@learncard/vpqr-plugin 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- var Gn=Object.create;var Rt=Object.defineProperty;var Zn=Object.getOwnPropertyDescriptor;var Xn=Object.getOwnPropertyNames;var Jn=Object.getPrototypeOf,Yn=Object.prototype.hasOwnProperty;var s=(e,t)=>Rt(e,"name",{value:t,configurable:!0});var qn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),to=(e,t)=>{for(var r in t)Rt(e,r,{get:t[r],enumerable:!0})},Qe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xn(t))!Yn.call(e,o)&&o!==r&&Rt(e,o,{get:()=>t[o],enumerable:!(n=Zn(t,o))||n.enumerable});return e};var eo=(e,t,r)=>(r=e!=null?Gn(Jn(e)):{},Qe(t||!e||!e.__esModule?Rt(r,"default",{value:e,enumerable:!0}):r,e)),ro=e=>Qe(Rt({},"__esModule",{value:!0}),e);var Cn=qn((zc,Tn)=>{var ii="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",si="0123456789ABCDEFGHIJKLMNOPQRSTUV",ai="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function ci(e,t){var r=e.indexOf(t);if(r===-1)throw new Error("Invalid character found: "+t);return r}s(ci,"readChar");Tn.exports=s(function(t,r){var n;switch(r){case"RFC3548":case"RFC4648":n=ii,t=t.replace(/=+$/,"");break;case"RFC4648-HEX":n=si,t=t.replace(/=+$/,"");break;case"Crockford":n=ai,t=t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1");break;default:throw new Error("Unknown base32 variant: "+r)}for(var o=t.length,i=0,a=0,f=0,u=new Uint8Array(o*5/8|0),p=0;p<o;p++)a=a<<5|ci(n,t[p]),i+=5,i>=8&&(u[f++]=a>>>i-8&255,i-=8);return u.buffer},"base32Decode")});var Ri={};to(Ri,{getVpqrPlugin:()=>Oi});module.exports=ro(Ri);var no=["string","number","bigint","symbol"],oo=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function He(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(no.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(io(e))return"Buffer";let r=so(e);return r||"Object"}s(He,"is");function io(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}s(io,"isBuffer");function so(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(oo.includes(t))return t}s(so,"getObjectType");var c=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};s(c,"Type");c.uint=new c(0,"uint",!0);c.negint=new c(1,"negint",!0);c.bytes=new c(2,"bytes",!0);c.string=new c(3,"string",!0);c.array=new c(4,"array",!1);c.map=new c(5,"map",!1);c.tag=new c(6,"tag",!1);c.float=new c(7,"float",!0);c.false=new c(7,"false",!0);c.true=new c(7,"true",!0);c.null=new c(7,"null",!0);c.undefined=new c(7,"undefined",!0);c.break=new c(7,"break",!0);var l=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};s(l,"Token");var xt=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",ao=new TextDecoder,co=new TextEncoder;function Kt(e){return xt&&globalThis.Buffer.isBuffer(e)}s(Kt,"isBuffer");function me(e){return e instanceof Uint8Array?Kt(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}s(me,"asU8A");var Ze=xt?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):We(e,t,r):(e,t,r)=>r-t>64?ao.decode(e.subarray(t,r)):We(e,t,r),Xe=xt?e=>e.length>64?globalThis.Buffer.from(e):Ke(e):e=>e.length>64?co.encode(e):Ke(e),z=s(e=>Uint8Array.from(e),"fromArray"),vt=xt?(e,t,r)=>Kt(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Je=xt?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),me(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let o of e)n+o.length>r.length&&(o=o.subarray(0,r.length-n)),r.set(o,n),n+=o.length;return r},Ye=xt?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function qe(e,t){if(Kt(e)&&Kt(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}s(qe,"compare");function Ke(e,t=1/0){let r,n=e.length,o=null,i=[];for(let a=0;a<n;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}else if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return i}s(Ke,"utf8ToBytes");function We(e,t,r){let n=[];for(;t<r;){let o=e[t],i=null,a=o>239?4:o>223?3:o>191?2:1;if(t+a<=r){let f,u,p,h;switch(a){case 1:o<128&&(i=o);break;case 2:f=e[t+1],(f&192)===128&&(h=(o&31)<<6|f&63,h>127&&(i=h));break;case 3:f=e[t+1],u=e[t+2],(f&192)===128&&(u&192)===128&&(h=(o&15)<<12|(f&63)<<6|u&63,h>2047&&(h<55296||h>57343)&&(i=h));break;case 4:f=e[t+1],u=e[t+2],p=e[t+3],(f&192)===128&&(u&192)===128&&(p&192)===128&&(h=(o&15)<<18|(f&63)<<12|(u&63)<<6|p&63,h>65535&&h<1114112&&(i=h))}}i===null?(i=65533,a=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),t+=a}return fo(n)}s(We,"utf8Slice");var Ge=4096;function fo(e){let t=e.length;if(t<=Ge)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Ge));return r}s(fo,"decodeCodePointsArray");var uo=256,bt=class{constructor(t=uo){this.chunkSize=t,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let o=r.length-(this.maxCursor-this.cursor)-1;r.set(t,o)}else{if(r){let o=r.length-(this.maxCursor-this.cursor)-1;o<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,o),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=Ye(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=vt(n,0,this.cursor)}else r=Je(this.chunks,this.cursor);return t&&this.reset(),r}};s(bt,"Bl");var y="CBOR decode error:",ye="CBOR encode error:",Dt=[];Dt[23]=1;Dt[24]=2;Dt[25]=3;Dt[26]=5;Dt[27]=9;function Q(e,t,r){if(e.length-t<r)throw new Error(`${y} not enough data for type`)}s(Q,"assertEnoughData");var A=[24,256,65536,4294967296,BigInt("18446744073709551616")];function U(e,t,r){Q(e,t,1);let n=e[t];if(r.strict===!0&&n<A[0])throw new Error(`${y} integer encoded in more bytes than necessary (strict decode)`);return n}s(U,"readUint8");function I(e,t,r){Q(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<A[1])throw new Error(`${y} integer encoded in more bytes than necessary (strict decode)`);return n}s(I,"readUint16");function k(e,t,r){Q(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<A[2])throw new Error(`${y} integer encoded in more bytes than necessary (strict decode)`);return n}s(k,"readUint32");function M(e,t,r){Q(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],i=(BigInt(n)<<BigInt(32))+BigInt(o);if(r.strict===!0&&i<A[3])throw new Error(`${y} integer encoded in more bytes than necessary (strict decode)`);if(i<=Number.MAX_SAFE_INTEGER)return Number(i);if(r.allowBigInt===!0)return i;throw new Error(`${y} integers outside of the safe integer range are not supported`)}s(M,"readUint64");function tr(e,t,r,n){return new l(c.uint,U(e,t+1,n),2)}s(tr,"decodeUint8");function er(e,t,r,n){return new l(c.uint,I(e,t+1,n),3)}s(er,"decodeUint16");function rr(e,t,r,n){return new l(c.uint,k(e,t+1,n),5)}s(rr,"decodeUint32");function nr(e,t,r,n){return new l(c.uint,M(e,t+1,n),9)}s(nr,"decodeUint64");function N(e,t){return B(e,0,t.value)}s(N,"encodeUint");function B(e,t,r){if(r<A[0]){let n=Number(r);e.push([t|n])}else if(r<A[1]){let n=Number(r);e.push([t|24,n])}else if(r<A[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<A[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<A[4]){let o=[t|27,0,0,0,0,0,0,0],i=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));o[8]=i&255,i=i>>8,o[7]=i&255,i=i>>8,o[6]=i&255,i=i>>8,o[5]=i&255,o[4]=a&255,a=a>>8,o[3]=a&255,a=a>>8,o[2]=a&255,a=a>>8,o[1]=a&255,e.push(o)}else throw new Error(`${y} encountered BigInt larger than allowable range`)}}s(B,"encodeUintValue");N.encodedSize=s(function(t){return B.encodedSize(t.value)},"encodedSize");B.encodedSize=s(function(t){return t<A[0]?1:t<A[1]?2:t<A[2]?3:t<A[3]?5:9},"encodedSize");N.compareTokens=s(function(t,r){return t.value<r.value?-1:t.value>r.value?1:0},"compareTokens");function or(e,t,r,n){return new l(c.negint,-1-U(e,t+1,n),2)}s(or,"decodeNegint8");function ir(e,t,r,n){return new l(c.negint,-1-I(e,t+1,n),3)}s(ir,"decodeNegint16");function sr(e,t,r,n){return new l(c.negint,-1-k(e,t+1,n),5)}s(sr,"decodeNegint32");var ge=BigInt(-1),ar=BigInt(1);function cr(e,t,r,n){let o=M(e,t+1,n);if(typeof o!="bigint"){let i=-1-o;if(i>=Number.MIN_SAFE_INTEGER)return new l(c.negint,i,9)}if(n.allowBigInt!==!0)throw new Error(`${y} integers outside of the safe integer range are not supported`);return new l(c.negint,ge-BigInt(o),9)}s(cr,"decodeNegint64");function Wt(e,t){let r=t.value,n=typeof r=="bigint"?r*ge-ar:r*-1-1;B(e,t.type.majorEncoded,n)}s(Wt,"encodeNegint");Wt.encodedSize=s(function(t){let r=t.value,n=typeof r=="bigint"?r*ge-ar:r*-1-1;return n<A[0]?1:n<A[1]?2:n<A[2]?3:n<A[3]?5:9},"encodedSize");Wt.compareTokens=s(function(t,r){return t.value<r.value?1:t.value>r.value?-1:0},"compareTokens");function Ut(e,t,r,n){Q(e,t,r+n);let o=vt(e,t+r,t+r+n);return new l(c.bytes,o,r+n)}s(Ut,"toToken");function fr(e,t,r,n){return Ut(e,t,1,r)}s(fr,"decodeBytesCompact");function ur(e,t,r,n){return Ut(e,t,2,U(e,t+1,n))}s(ur,"decodeBytes8");function pr(e,t,r,n){return Ut(e,t,3,I(e,t+1,n))}s(pr,"decodeBytes16");function lr(e,t,r,n){return Ut(e,t,5,k(e,t+1,n))}s(lr,"decodeBytes32");function dr(e,t,r,n){let o=M(e,t+1,n);if(typeof o=="bigint")throw new Error(`${y} 64-bit integer bytes lengths not supported`);return Ut(e,t,9,o)}s(dr,"decodeBytes64");function Gt(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===c.string?Xe(e.value):e.value),e.encodedBytes}s(Gt,"tokenBytes");function _t(e,t){let r=Gt(t);B(e,t.type.majorEncoded,r.length),e.push(r)}s(_t,"encodeBytes");_t.encodedSize=s(function(t){let r=Gt(t);return B.encodedSize(r.length)+r.length},"encodedSize");_t.compareTokens=s(function(t,r){return lo(Gt(t),Gt(r))},"compareTokens");function lo(e,t){return e.length<t.length?-1:e.length>t.length?1:qe(e,t)}s(lo,"compareBytes");function It(e,t,r,n,o){let i=r+n;Q(e,t,i);let a=new l(c.string,Ze(e,t+r,t+i),i);return o.retainStringBytes===!0&&(a.byteValue=vt(e,t+r,t+i)),a}s(It,"toToken");function hr(e,t,r,n){return It(e,t,1,r,n)}s(hr,"decodeStringCompact");function mr(e,t,r,n){return It(e,t,2,U(e,t+1,n),n)}s(mr,"decodeString8");function yr(e,t,r,n){return It(e,t,3,I(e,t+1,n),n)}s(yr,"decodeString16");function gr(e,t,r,n){return It(e,t,5,k(e,t+1,n),n)}s(gr,"decodeString32");function wr(e,t,r,n){let o=M(e,t+1,n);if(typeof o=="bigint")throw new Error(`${y} 64-bit integer string lengths not supported`);return It(e,t,9,o,n)}s(wr,"decodeString64");var xr=_t;function Et(e,t,r,n){return new l(c.array,n,r)}s(Et,"toToken");function vr(e,t,r,n){return Et(e,t,1,r)}s(vr,"decodeArrayCompact");function br(e,t,r,n){return Et(e,t,2,U(e,t+1,n))}s(br,"decodeArray8");function _r(e,t,r,n){return Et(e,t,3,I(e,t+1,n))}s(_r,"decodeArray16");function Er(e,t,r,n){return Et(e,t,5,k(e,t+1,n))}s(Er,"decodeArray32");function Tr(e,t,r,n){let o=M(e,t+1,n);if(typeof o=="bigint")throw new Error(`${y} 64-bit integer array lengths not supported`);return Et(e,t,9,o)}s(Tr,"decodeArray64");function Cr(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${y} indefinite length items not allowed`);return Et(e,t,1,1/0)}s(Cr,"decodeArrayIndefinite");function Zt(e,t){B(e,c.array.majorEncoded,t.value)}s(Zt,"encodeArray");Zt.compareTokens=N.compareTokens;Zt.encodedSize=s(function(t){return B.encodedSize(t.value)},"encodedSize");function Tt(e,t,r,n){return new l(c.map,n,r)}s(Tt,"toToken");function Ar(e,t,r,n){return Tt(e,t,1,r)}s(Ar,"decodeMapCompact");function Br(e,t,r,n){return Tt(e,t,2,U(e,t+1,n))}s(Br,"decodeMap8");function Sr(e,t,r,n){return Tt(e,t,3,I(e,t+1,n))}s(Sr,"decodeMap16");function Or(e,t,r,n){return Tt(e,t,5,k(e,t+1,n))}s(Or,"decodeMap32");function Rr(e,t,r,n){let o=M(e,t+1,n);if(typeof o=="bigint")throw new Error(`${y} 64-bit integer map lengths not supported`);return Tt(e,t,9,o)}s(Rr,"decodeMap64");function Dr(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${y} indefinite length items not allowed`);return Tt(e,t,1,1/0)}s(Dr,"decodeMapIndefinite");function Xt(e,t){B(e,c.map.majorEncoded,t.value)}s(Xt,"encodeMap");Xt.compareTokens=N.compareTokens;Xt.encodedSize=s(function(t){return B.encodedSize(t.value)},"encodedSize");function Ur(e,t,r,n){return new l(c.tag,r,1)}s(Ur,"decodeTagCompact");function Ir(e,t,r,n){return new l(c.tag,U(e,t+1,n),2)}s(Ir,"decodeTag8");function kr(e,t,r,n){return new l(c.tag,I(e,t+1,n),3)}s(kr,"decodeTag16");function Mr(e,t,r,n){return new l(c.tag,k(e,t+1,n),5)}s(Mr,"decodeTag32");function Lr(e,t,r,n){return new l(c.tag,M(e,t+1,n),9)}s(Lr,"decodeTag64");function Jt(e,t){B(e,c.tag.majorEncoded,t.value)}s(Jt,"encodeTag");Jt.compareTokens=N.compareTokens;Jt.encodedSize=s(function(t){return B.encodedSize(t.value)},"encodedSize");var xo=20,vo=21,bo=22,_o=23;function Nr(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${y} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new l(c.null,null,1):new l(c.undefined,void 0,1)}s(Nr,"decodeUndefined");function Pr(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${y} indefinite length items not allowed`);return new l(c.break,void 0,1)}s(Pr,"decodeBreak");function we(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${y} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${y} Infinity values are not supported`)}return new l(c.float,e,t)}s(we,"createToken");function Fr(e,t,r,n){return we(xe(e,t+1),3,n)}s(Fr,"decodeFloat16");function $r(e,t,r,n){return we(ve(e,t+1),5,n)}s($r,"decodeFloat32");function jr(e,t,r,n){return we(Hr(e,t+1),9,n)}s(jr,"decodeFloat64");function Yt(e,t,r){let n=t.value;if(n===!1)e.push([c.float.majorEncoded|xo]);else if(n===!0)e.push([c.float.majorEncoded|vo]);else if(n===null)e.push([c.float.majorEncoded|bo]);else if(n===void 0)e.push([c.float.majorEncoded|_o]);else{let o,i=!1;(!r||r.float64!==!0)&&(Vr(n),o=xe(F,1),n===o||Number.isNaN(n)?(F[0]=249,e.push(F.slice(0,3)),i=!0):(Qr(n),o=ve(F,1),n===o&&(F[0]=250,e.push(F.slice(0,5)),i=!0))),i||(Eo(n),o=Hr(F,1),F[0]=251,e.push(F.slice(0,9)))}}s(Yt,"encodeFloat");Yt.encodedSize=s(function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){Vr(n);let o=xe(F,1);if(n===o||Number.isNaN(n))return 3;if(Qr(n),o=ve(F,1),n===o)return 5}return 9},"encodedSize");var zr=new ArrayBuffer(9),P=new DataView(zr,1),F=new Uint8Array(zr,0);function Vr(e){if(e===1/0)P.setUint16(0,31744,!1);else if(e===-1/0)P.setUint16(0,64512,!1);else if(Number.isNaN(e))P.setUint16(0,32256,!1);else{P.setFloat32(0,e);let t=P.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)P.setUint16(0,31744,!1);else if(r===0)P.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let o=r-127;o<-24?P.setUint16(0,0):o<-14?P.setUint16(0,(t&2147483648)>>16|1<<24+o,!1):P.setUint16(0,(t&2147483648)>>16|o+15<<10|n>>13,!1)}}}s(Vr,"encodeFloat16");function xe(e,t){if(e.length-t<2)throw new Error(`${y} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,o=r&1023,i;return n===0?i=o*2**-24:n!==31?i=(o+1024)*2**(n-25):i=o===0?1/0:NaN,r&32768?-i:i}s(xe,"readFloat16");function Qr(e){P.setFloat32(0,e,!1)}s(Qr,"encodeFloat32");function ve(e,t){if(e.length-t<4)throw new Error(`${y} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}s(ve,"readFloat32");function Eo(e){P.setFloat64(0,e,!1)}s(Eo,"encodeFloat64");function Hr(e,t){if(e.length-t<8)throw new Error(`${y} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}s(Hr,"readFloat64");Yt.compareTokens=N.compareTokens;function x(e,t,r){throw new Error(`${y} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}s(x,"invalidMinor");function qt(e){return()=>{throw new Error(`${y} ${e}`)}}s(qt,"errorer");var d=[];for(let e=0;e<=23;e++)d[e]=x;d[24]=tr;d[25]=er;d[26]=rr;d[27]=nr;d[28]=x;d[29]=x;d[30]=x;d[31]=x;for(let e=32;e<=55;e++)d[e]=x;d[56]=or;d[57]=ir;d[58]=sr;d[59]=cr;d[60]=x;d[61]=x;d[62]=x;d[63]=x;for(let e=64;e<=87;e++)d[e]=fr;d[88]=ur;d[89]=pr;d[90]=lr;d[91]=dr;d[92]=x;d[93]=x;d[94]=x;d[95]=qt("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)d[e]=hr;d[120]=mr;d[121]=yr;d[122]=gr;d[123]=wr;d[124]=x;d[125]=x;d[126]=x;d[127]=qt("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)d[e]=vr;d[152]=br;d[153]=_r;d[154]=Er;d[155]=Tr;d[156]=x;d[157]=x;d[158]=x;d[159]=Cr;for(let e=160;e<=183;e++)d[e]=Ar;d[184]=Br;d[185]=Sr;d[186]=Or;d[187]=Rr;d[188]=x;d[189]=x;d[190]=x;d[191]=Dr;for(let e=192;e<=215;e++)d[e]=Ur;d[216]=Ir;d[217]=kr;d[218]=Mr;d[219]=Lr;d[220]=x;d[221]=x;d[222]=x;d[223]=x;for(let e=224;e<=243;e++)d[e]=qt("simple values are not supported");d[244]=x;d[245]=x;d[246]=x;d[247]=Nr;d[248]=qt("simple values are not supported");d[249]=Fr;d[250]=$r;d[251]=jr;d[252]=x;d[253]=x;d[254]=x;d[255]=Pr;var $=[];for(let e=0;e<24;e++)$[e]=new l(c.uint,e,1);for(let e=-1;e>=-24;e--)$[31-e]=new l(c.negint,e,1);$[64]=new l(c.bytes,new Uint8Array(0),1);$[96]=new l(c.string,"",1);$[128]=new l(c.array,0,1);$[160]=new l(c.map,0,1);$[244]=new l(c.false,!1,1);$[245]=new l(c.true,!0,1);$[246]=new l(c.null,null,1);function Kr(e){switch(e.type){case c.false:return z([244]);case c.true:return z([245]);case c.null:return z([246]);case c.bytes:return e.value.length?void 0:z([64]);case c.string:return e.value===""?z([96]):void 0;case c.array:return e.value===0?z([128]):void 0;case c.map:return e.value===0?z([160]):void 0;case c.uint:return e.value<24?z([Number(e.value)]):void 0;case c.negint:if(e.value>=-24)return z([31-Number(e.value)])}}s(Kr,"quickEncodeToken");var Co={float64:!1,mapSorter:So,quickEncodeToken:Kr};function Ao(){let e=[];return e[c.uint.major]=N,e[c.negint.major]=Wt,e[c.bytes.major]=_t,e[c.string.major]=xr,e[c.array.major]=Zt,e[c.map.major]=Xt,e[c.tag.major]=Jt,e[c.float.major]=Yt,e}s(Ao,"makeCborEncoders");var Wr=Ao(),be=new bt,st=class{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${ye} object contains circular references`);return new st(r,t)}};s(st,"Ref");var K={null:new l(c.null,null),undefined:new l(c.undefined,void 0),true:new l(c.true,!0),false:new l(c.false,!1),emptyArray:new l(c.array,0),emptyMap:new l(c.map,0)},W={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new l(c.float,e):e>=0?new l(c.uint,e):new l(c.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new l(c.uint,e):new l(c.negint,e)},Uint8Array(e,t,r,n){return new l(c.bytes,e)},string(e,t,r,n){return new l(c.string,e)},boolean(e,t,r,n){return e?K.true:K.false},null(e,t,r,n){return K.null},undefined(e,t,r,n){return K.undefined},ArrayBuffer(e,t,r,n){return new l(c.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new l(c.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[K.emptyArray,new l(c.break)]:K.emptyArray;n=st.createCheck(n,e);let o=[],i=0;for(let a of e)o[i++]=te(a,r,n);return r.addBreakTokens?[new l(c.array,e.length),o,new l(c.break)]:[new l(c.array,e.length),o]},Object(e,t,r,n){let o=t!=="Object",i=o?e.keys():Object.keys(e),a=o?e.size:i.length;if(!a)return r.addBreakTokens===!0?[K.emptyMap,new l(c.break)]:K.emptyMap;n=st.createCheck(n,e);let f=[],u=0;for(let p of i)f[u++]=[te(p,r,n),te(o?e.get(p):e[p],r,n)];return Bo(f,r),r.addBreakTokens?[new l(c.map,a),f,new l(c.break)]:[new l(c.map,a),f]}};W.Map=W.Object;W.Buffer=W.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))W[`${e}Array`]=W.DataView;function te(e,t={},r){let n=He(e),o=t&&t.typeEncoders&&t.typeEncoders[n]||W[n];if(typeof o=="function"){let a=o(e,n,t,r);if(a!=null)return a}let i=W[n];if(!i)throw new Error(`${ye} unsupported type: ${n}`);return i(e,n,t,r)}s(te,"objectToTokens");function Bo(e,t){t.mapSorter&&e.sort(t.mapSorter)}s(Bo,"sortMapEntries");function So(e,t){let r=Array.isArray(e[0])?e[0][0]:e[0],n=Array.isArray(t[0])?t[0][0]:t[0];if(r.type!==n.type)return r.type.compare(n.type);let o=r.type.major,i=Wr[o].compareTokens(r,n);return i===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),i}s(So,"mapSorter");function Gr(e,t,r,n){if(Array.isArray(t))for(let o of t)Gr(e,o,r,n);else r[t.type.major](e,t,n)}s(Gr,"tokensToEncoded");function Oo(e,t,r){let n=te(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let o=r.quickEncodeToken(n);if(o)return o;let i=t[n.type.major];if(i.encodedSize){let a=i.encodedSize(n,r),f=new bt(a);if(i(f,n,r),f.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return me(f.chunks[0])}}return be.reset(),Gr(be,n,t,r),be.toBytes(!0)}s(Oo,"encodeCustom");function kt(e,t){return t=Object.assign({},Co,t),Oo(e,Wr,t)}s(kt,"encode");var Ro={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},ee=class{constructor(t,r={}){this.pos=0,this.data=t,this.options=r}done(){return this.pos>=this.data.length}next(){let t=this.data[this.pos],r=$[t];if(r===void 0){let n=d[t];if(!n)throw new Error(`${y} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let o=t&31;r=n(this.data,this.pos,o,this.options)}return this.pos+=r.encodedLength,r}};s(ee,"Tokeniser");var Mt=Symbol.for("DONE"),re=Symbol.for("BREAK");function Do(e,t,r){let n=[];for(let o=0;o<e.value;o++){let i=Lt(t,r);if(i===re){if(e.value===1/0)break;throw new Error(`${y} got unexpected break to lengthed array`)}if(i===Mt)throw new Error(`${y} found array but not enough entries (got ${o}, expected ${e.value})`);n[o]=i}return n}s(Do,"tokenToArray");function Uo(e,t,r){let n=r.useMaps===!0,o=n?void 0:{},i=n?new Map:void 0;for(let a=0;a<e.value;a++){let f=Lt(t,r);if(f===re){if(e.value===1/0)break;throw new Error(`${y} got unexpected break to lengthed map`)}if(f===Mt)throw new Error(`${y} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof f!="string")throw new Error(`${y} non-string keys not supported (got ${typeof f})`);if(r.rejectDuplicateMapKeys===!0&&(n&&i.has(f)||!n&&f in o))throw new Error(`${y} found repeat map key "${f}"`);let u=Lt(t,r);if(u===Mt)throw new Error(`${y} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?i.set(f,u):o[f]=u}return n?i:o}s(Uo,"tokenToMap");function Lt(e,t){if(e.done())return Mt;let r=e.next();if(r.type===c.break)return re;if(r.type.terminal)return r.value;if(r.type===c.array)return Do(r,e,t);if(r.type===c.map)return Uo(r,e,t);if(r.type===c.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Lt(e,t);return t.tags[r.value](n)}throw new Error(`${y} tag not supported (${r.value})`)}throw new Error("unsupported")}s(Lt,"tokensToObject");function Nt(e,t){if(!(e instanceof Uint8Array))throw new Error(`${y} data to decode must be a Uint8Array`);t=Object.assign({},Ro,t);let r=t.tokenizer||new ee(e,t),n=Lt(r,t);if(n===Mt)throw new Error(`${y} did not find any content to decode`);if(n===re)throw new Error(`${y} got unexpected break`);if(!r.done())throw new Error(`${y} too many terminals, data makes no sense`);return n}s(Nt,"decode");var _=class extends Error{constructor(t,r){super(),this.message=r,this.value=t,this.stack=new Error(`${t}: ${r}`).stack,this.name=this.constructor.name}};s(_,"CborldError");var T=class{decode({value:t}={}){throw new Error("Must be implemented by derived class.")}static createDecoder({value:t,transformer:r}={}){throw new Error("Must be implemented by derived class.")}};s(T,"CborldDecoder");var _e=new Map,Ee=new Map;S(16,"https://www.w3.org/ns/activitystreams");S(17,"https://www.w3.org/2018/credentials/v1");S(18,"https://www.w3.org/ns/did/v1");S(19,"https://w3id.org/security/suites/ed25519-2018/v1");S(20,"https://w3id.org/security/suites/ed25519-2020/v1");S(21,"https://w3id.org/cit/v1");S(22,"https://w3id.org/age/v1");S(23,"https://w3id.org/security/suites/x25519-2020/v1");S(24,"https://w3id.org/veres-one/v1");S(25,"https://w3id.org/webkms/v1");S(26,"https://w3id.org/zcap/v1");S(27,"https://w3id.org/security/suites/hmac-2019/v1");S(28,"https://w3id.org/security/suites/aes-2019/v1");S(29,"https://w3id.org/vaccination/v1");S(30,"https://w3id.org/vc-revocation-list-2020/v1");S(31,"https://w3id.org/dcc/v1c");S(32,"https://w3id.org/vc/status-list/v1");function S(e,t){Ee.set(t,e),_e.set(e,t)}s(S,"_addRegistration");var G=class extends T{constructor({reverseAppContextMap:t}={}){super(),this.reverseAppContextMap=t}decode({value:t}={}){if(typeof t!="number")return Te(t);let r=_e.get(t)||this.reverseAppContextMap.get(t);if(r===void 0)throw new _("ERR_UNDEFINED_COMPRESSED_CONTEXT",`Undefined compressed context "${t}".`);return r}static createDecoder({transformer:t}={}){let{reverseAppContextMap:r}=t;return new G({reverseAppContextMap:r})}};s(G,"ContextDecoder");function Te(e){if(Array.isArray(e))return e.map(Te);if(!(e instanceof Map))return e;let t={};for(let[r,n]of e)t[r]=Te(n);return t}s(Te,"_mapToObject");var tn="3.7.5",Io=tn,ko=typeof atob=="function",Mo=typeof btoa=="function",At=typeof Buffer=="function",Zr=typeof TextDecoder=="function"?new TextDecoder:void 0,Xr=typeof TextEncoder=="function"?new TextEncoder:void 0,Lo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Pt=Array.prototype.slice.call(Lo),oe=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(Pt),No=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,O=String.fromCharCode.bind(String),Jr=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),en=s(e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),"_mkUriSafe"),rn=s(e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),"_tidyB64"),nn=s(e=>{let t,r,n,o,i="",a=e.length%3;for(let f=0;f<e.length;){if((r=e.charCodeAt(f++))>255||(n=e.charCodeAt(f++))>255||(o=e.charCodeAt(f++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|o,i+=Pt[t>>18&63]+Pt[t>>12&63]+Pt[t>>6&63]+Pt[t&63]}return a?i.slice(0,a-3)+"===".substring(a):i},"btoaPolyfill"),Be=Mo?e=>btoa(e):At?e=>Buffer.from(e,"binary").toString("base64"):nn,Ce=At?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,o=e.length;n<o;n+=4096)r.push(O.apply(null,e.subarray(n,n+4096)));return Be(r.join(""))},ie=s((e,t=!1)=>t?en(Ce(e)):Ce(e),"fromUint8Array"),Po=s(e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?O(192|t>>>6)+O(128|t&63):O(224|t>>>12&15)+O(128|t>>>6&63)+O(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return O(240|t>>>18&7)+O(128|t>>>12&63)+O(128|t>>>6&63)+O(128|t&63)}},"cb_utob"),Fo=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,on=s(e=>e.replace(Fo,Po),"utob"),Yr=At?e=>Buffer.from(e,"utf8").toString("base64"):Xr?e=>Ce(Xr.encode(e)):e=>Be(on(e)),Ct=s((e,t=!1)=>t?en(Yr(e)):Yr(e),"encode"),qr=s(e=>Ct(e,!0),"encodeURI"),$o=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,jo=s(e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return O((r>>>10)+55296)+O((r&1023)+56320);case 3:return O((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return O((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},"cb_btou"),sn=s(e=>e.replace($o,jo),"btou"),an=s(e=>{if(e=e.replace(/\s+/g,""),!No.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,o;for(let i=0;i<e.length;)t=oe[e.charAt(i++)]<<18|oe[e.charAt(i++)]<<12|(n=oe[e.charAt(i++)])<<6|(o=oe[e.charAt(i++)]),r+=n===64?O(t>>16&255):o===64?O(t>>16&255,t>>8&255):O(t>>16&255,t>>8&255,t&255);return r},"atobPolyfill"),Se=ko?e=>atob(rn(e)):At?e=>Buffer.from(e,"base64").toString("binary"):an,cn=At?e=>Jr(Buffer.from(e,"base64")):e=>Jr(Se(e).split("").map(t=>t.charCodeAt(0))),fn=s(e=>cn(un(e)),"toUint8Array"),zo=At?e=>Buffer.from(e,"base64").toString("utf8"):Zr?e=>Zr.decode(cn(e)):e=>sn(Se(e)),un=s(e=>rn(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),"_unURI"),Ae=s(e=>zo(un(e)),"decode"),Vo=s(e=>{if(typeof e!="string")return!1;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},"isValid"),pn=s(e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),"_noEnum"),ln=s(function(){let e=s((t,r)=>Object.defineProperty(String.prototype,t,pn(r)),"_add");e("fromBase64",function(){return Ae(this)}),e("toBase64",function(t){return Ct(this,t)}),e("toBase64URI",function(){return Ct(this,!0)}),e("toBase64URL",function(){return Ct(this,!0)}),e("toUint8Array",function(){return fn(this)})},"extendString"),dn=s(function(){let e=s((t,r)=>Object.defineProperty(Uint8Array.prototype,t,pn(r)),"_add");e("toBase64",function(t){return ie(this,t)}),e("toBase64URI",function(){return ie(this,!0)}),e("toBase64URL",function(){return ie(this,!0)})},"extendUint8Array"),Qo=s(()=>{ln(),dn()},"extendBuiltins"),se={version:tn,VERSION:Io,atob:Se,atobPolyfill:an,btoa:Be,btoaPolyfill:nn,fromBase64:Ae,toBase64:Ct,encode:Ct,encodeURI:qr,encodeURL:qr,utob:on,btou:sn,decode:Ae,isValid:Vo,fromUint8Array:ie,toUint8Array:fn,extendString:ln,extendUint8Array:dn,extendBuiltins:Qo};var hn={};function mn(e,t,r){if(!(e instanceof Uint8Array))throw new TypeError('"input" must be a Uint8Array.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(r!==void 0&&typeof r!="number")throw new TypeError('"maxline" must be a number.');if(e.length===0)return"";let n="",o=0,i=t.length,a=t.charAt(0),f=[0];for(o=0;o<e.length;++o){let u=e[o];for(let p=0;p<f.length;++p)u+=f[p]<<8,f[p]=u%i,u=u/i|0;for(;u>0;)f.push(u%i),u=u/i|0}for(o=0;e[o]===0&&o<e.length-1;++o)n+=a;for(o=f.length-1;o>=0;--o)n+=t[f[o]];if(r){let u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join(`\r
2
- `)}return n}s(mn,"encode");function yn(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(e.length===0)return new Uint8Array;let r=hn[t];if(!r){r=hn[t]=[];for(let a=0;a<t.length;++a)r[t.charCodeAt(a)]=a}e=e.replace(/\s/g,"");let n=t.length,o=t.charAt(0),i=[0];for(let a=0;a<e.length;a++){let f=r[e.charCodeAt(a)];if(f===void 0)return;let u=f;for(let p=0;p<i.length;++p)u+=i[p]*n,i[p]=u&255,u>>=8;for(;u>0;)i.push(u&255),u>>=8}for(let a=0;e[a]===o&&a<e.length-1;++a)i.push(0);return new Uint8Array(i.reverse())}s(yn,"decode");var gn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";function Ft(e,t){return mn(e,gn,t)}s(Ft,"encode");function ae(e){return yn(e,gn)}s(ae,"decode");var at=class extends T{decode({value:t}={}){let{buffer:r,byteOffset:n,length:o}=t,i=new Uint8Array(r,n+1,o-1);return t[0]===122?`z${Ft(i)}`:t[0]===77?`M${se.fromUint8Array(i)}`:t}static createDecoder({value:t}={}){if(!(t instanceof Uint8Array))return!1;if(t[0]===122||t[0]===77)return new at}};s(at,"MultibaseDecoder");var j=new Map([["@context",0],["@type",2],["@id",4],["@value",6],["@direction",8],["@graph",10],["@included",12],["@index",14],["@json",16],["@language",18],["@list",20],["@nest",22],["@reverse",24],["@base",26],["@container",28],["@default",30],["@embed",32],["@explicit",34],["@none",36],["@omitDefault",38],["@prefix",40],["@preserve",42],["@protected",44],["@requireAll",46],["@set",48],["@version",50],["@vocab",52]]),ce=100;var ct=class{constructor({appContextMap:t,documentLoader:r}={}){this.appContextMap=t,this.documentLoader=r}_beforeObjectContexts(){}_afterObjectContexts(){}_beforeTypeScopedContexts(){}async _transform({obj:t,transformMap:r,contextStack:n=[]}){this._beforeObjectContexts({obj:t,transformMap:r});let o=await this._applyEmbeddedContexts({obj:t,contextStack:n});this._afterObjectContexts({obj:t,transformMap:r});let i=n.slice();this._beforeTypeScopedContexts({activeCtx:o,obj:t,transformMap:r}),o=await this._applyTypeScopedContexts({obj:t,contextStack:n});let{aliases:a,scopedContextMap:f,termMap:u}=o,p=this._getEntries({obj:t,transformMap:r,transformer:this,termMap:u});for(let[h,g]of p){let{term:w}=h;if(w==="@id"||a.id.has(w)){this._transformObjectId({obj:t,transformMap:r,termInfo:h,value:g});continue}if(w==="@type"||a.type.has(w)){this._transformObjectType({obj:t,transformMap:r,termInfo:h,value:g});continue}let m=i,v,C=f.get(w);C&&(v=await this._applyEmbeddedContexts({obj:{"@context":C},contextStack:n}),m=n.slice());let{plural:gt,def:Qt}=h,he=this._getTermType({activeCtx:v||o,def:Qt}),Ht=gt?g:[g],wt=[];for(let ot of Ht){if(ot===null){wt.push(null);continue}if(!this._transformTypedValue({entries:wt,termType:he,value:ot,termInfo:h})){if(typeof ot!="object"){wt.push(ot);continue}if(Array.isArray(ot)){await this._transformArray({entries:wt,contextStack:m,value:ot});continue}await this._transformObject({entries:wt,contextStack:m,value:ot})}}v&&v.revert(),this._assignEntries({entries:wt,obj:t,transformMap:r,termInfo:h})}o.revert()}async _applyEmbeddedContexts({obj:t,contextStack:r}){let n=r.length,o=t["@context"];await this._updateContextStack({contextStack:r,contexts:o});let i=r[r.length-1];return i||(i={aliases:{id:new Set,type:new Set},context:{},scopedContextMap:new Map,termMap:new Map}),{...i,revert(){r.length=n}}}async _applyTypeScopedContexts({obj:t,contextStack:r}){let n=r.length,o=r[r.length-1];o||(o={aliases:{id:new Set,type:new Set},context:{},scopedContextMap:new Map,termMap:new Map});let{aliases:i}=o,a=[],f=["@type",...i.type];for(let p of f){let h=t[p];Array.isArray(h)?a.push(...h):a.push(h)}a=[...new Set(a)].sort();let{scopedContextMap:u}=o;for(let p of a){let h=u.get(p);h&&(await this._updateContextStack({contextStack:r,contexts:h}),o=r[r.length-1],{scopedContextMap:u}=o)}return{...o,revert(){r.length=n}}}async _updateContextStack({contextStack:t,contexts:r,transformer:n}){if(!r)return;Array.isArray(r)||(r=[r]);let{contextMap:o}=this;for(let i of r){let a=o.get(i);if(!a){let w=i,m;typeof i=="string"&&(m=i,{"@context":w}=await this._getDocument({url:m})),a=await this._addContext({context:w,contextUrl:m,transformer:n})}let f={aliases:{id:new Set(a.aliases.id),type:new Set(a.aliases.type)},context:i,scopedContextMap:new Map(a.scopedContextMap),termMap:new Map(a.termMap)},u=t[t.length-1];if(t.push(f),!u)continue;let{aliases:p,termMap:h}=f;for(let w of["id","type"])for(let m of u.aliases[w])i[m]===null||f.termMap.has(m)||p[w].add(m);let{scopedContextMap:g}=f;for(let[w,m]of u.scopedContextMap)i[w]===null||g.has(w)||g.set(w,m);for(let[w,m]of u.termMap)i[w]===null||h.has(w)||h.set(w,m)}}async _addContext({context:t,contextUrl:r}){let{contextMap:n,termToId:o,idToTerm:i}=this,a=t["@import"];if(a){let g=n.get(a);if(!g){let{"@context":w}=await this._getDocument({url:a});g=await this._addContext({context:w,contextUrl:a})}t={...g.context,...t}}let f=new Map,u=new Map,p={aliases:{id:new Set,type:new Set},context:t,scopedContextMap:f,termMap:u},h=Object.keys(t).sort();for(let g of h){let w=t[g];if(!w||(w==="@id"||w.id==="@id"?p.aliases.id.add(g):(w==="@type"||w.id==="@type")&&p.aliases.type.add(g),j.has(g)))continue;if(!o.has(g)){let v=this.nextTermId;this.nextTermId+=2,o.set(g,v),i&&i.set(v,g)}u.set(g,w);let m=w["@context"];m&&f.set(g,m)}return n.set(r||t,p),p}async _getDocument({url:t}){let{document:r}=await this.documentLoader(t);return typeof r=="string"?JSON.parse(r):r}_getTermType({activeCtx:t,def:r}){let{"@type":n}=r;if(!n)return;let[o,...i]=n.split(":"),a=t.termMap.get(o);if(a===void 0)return n;if(typeof a=="string")return a+i.join(":");if(!(typeof a=="object"&&typeof a["@id"]=="string"))throw new _("ERR_INVALID_TERM_DEFINITION",'JSON-LD term definitions must be strings or objects with "@id".');return a["@id"]+i.join(":")}_getIdForTerm({term:t,plural:r}){let n=this.termToId.get(t);if(n===void 0)throw new _("ERR_UNDEFINED_TERM","CBOR-LD compression requires all terms to be defined in a JSON-LD context.");return r?n+1:n}_getTermForId({id:t}){let r=(t&1)===1;return{term:this.idToTerm.get(r?t-1:t),plural:r}}};s(ct,"Transformer");var wn=new Map([[1024,"did:v1:nym:"],[1025,"did:key:"]]),Z=class extends T{decode({value:t}={}){let r=wn.get(t[0]);return typeof t[1]=="string"?r+=t[1]:r+=`z${Ft(t[1])}`,t.length>2&&(typeof t[2]=="string"?r+=`#${t[2]}`:r+=`#z${Ft(t[2])}`),r}static createDecoder({value:t}={}){return!(Array.isArray(t)&&t.length>1&&t.length<=3)||!wn.has(t[0])?!1:new Z}};s(Z,"Base58DidUrlDecoder");var X=class extends T{constructor({secure:t}={}){super(),this.secure=t}decode({value:t}={}){return`${this.secure?"https://":"http://"}${t[1]}`}static createDecoder({value:t}={}){return t.length===2&&typeof t[1]=="string"?new X({secure:t[0]===2}):!1}};s(X,"HttpUrlDecoder");var xn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ho(e){return typeof e=="string"&&xn.test(e)}s(Ho,"validate");var fe=Ho;var R=[];for(ue=0;ue<256;++ue)R.push((ue+256).toString(16).substr(1));var ue;function Ko(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(R[e[t+0]]+R[e[t+1]]+R[e[t+2]]+R[e[t+3]]+"-"+R[e[t+4]]+R[e[t+5]]+"-"+R[e[t+6]]+R[e[t+7]]+"-"+R[e[t+8]]+R[e[t+9]]+"-"+R[e[t+10]]+R[e[t+11]]+R[e[t+12]]+R[e[t+13]]+R[e[t+14]]+R[e[t+15]]).toLowerCase();if(!fe(r))throw TypeError("Stringified UUID is invalid");return r}s(Ko,"stringify");var Oe=Ko;function Wo(e){if(!fe(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}s(Wo,"parse");var Re=Wo;var ft=class extends T{decode({value:t}={}){return`urn:uuid:${typeof t[1]=="string"?t[1]:Oe(t[1])}`}static createDecoder({value:t}={}){if(t.length===2&&(typeof t[1]=="string"||t[1]instanceof Uint8Array))return new ft}};s(ft,"UuidUrnDecoder");var Go=new Map([[1,X],[2,X],[3,ft],[1024,Z],[1025,Z]]),J=class extends T{static createDecoder({value:t}={}){if(!(Array.isArray(t)||t.length>1))return!1;let r=Go.get(t[0]);return r&&r.createDecoder({value:t})}};s(J,"UriDecoder");var V=class extends T{constructor({term:t}={}){super(),this.term=t}decode(){return this.term}static createDecoder({value:t,transformer:r}={}){if(Array.isArray(t))return J.createDecoder({value:t,transformer:r});let n=r.idToTerm.get(t);if(n!==void 0)return new V({term:n})}};s(V,"VocabTermDecoder");var ut=class extends T{decode({value:t}={}){let r=new Date(t*1e3).toISOString();return r.substring(0,r.indexOf("T"))}static createDecoder({value:t}={}){if(typeof t=="number")return new ut}};s(ut,"XsdDateDecoder");var Y=class extends T{constructor({value:t}={}){super(),this.value=t}decode({value:t}={}){return typeof t=="number"?new Date(t*1e3).toISOString().replace(".000Z","Z"):new Date(t[0]*1e3+t[1]).toISOString()}static createDecoder({value:t}={}){if(typeof t=="number")return new Y;if(Array.isArray(t)&&t.length===2&&(typeof t[0]=="number"||typeof t[1]=="number"))return new Y}};s(Y,"XsdDateTimeDecoder");function q(e,t){return JSON.stringify(e,null,2)}s(q,"inspect");var Zo=new Map([["@id",J],["@vocab",V],["https://w3id.org/security#multibase",at],["http://www.w3.org/2001/XMLSchema#date",ut],["http://www.w3.org/2001/XMLSchema#dateTime",Y]]),De=j.get("@context"),vn=De+1,$t=class extends ct{constructor({documentLoader:t,appContextMap:r}={}){if(super({documentLoader:t,appContextMap:r}),this.reverseAppContextMap=new Map,r)for(let[n,o]of r)this.reverseAppContextMap.set(o,n)}async decompress({compressedBytes:t,diagnose:r}={}){this.contextMap=new Map,this.termToId=new Map(j),this.nextTermId=ce,this.idToTerm=new Map;for(let[f,u]of this.termToId)this.idToTerm.set(u,f);let n=Nt(t,{useMaps:!0});r&&(r("Diagnostic CBOR-LD decompression transform map(s):"),r(q(n,{depth:null,colors:!0})));let o=[],i=Array.isArray(n),a=i?n:[n];for(let f of a){let u={};await this._transform({obj:u,transformMap:f}),o.push(u)}return i?o:o[0]}_beforeObjectContexts({obj:t,transformMap:r}){let n=r.get(De);if(n){let i=G.createDecoder({value:n,transformer:this});t["@context"]=i?i.decode({value:n}):n}let o=r.get(vn);if(o){if(n)throw new _("ERR_INVALID_ENCODED_CONTEXT","Both singular and plural context IDs were found in the CBOR-LD input.");if(!Array.isArray(o))throw new _("ERR_INVALID_ENCODED_CONTEXT","Encoded plural context value must be an array.");let i=[];for(let a of o){let f=G.createDecoder({value:a,transformer:this});i.push(f?f.decode({value:a}):a)}t["@context"]=i}}_beforeTypeScopedContexts({activeCtx:t,obj:r,transformMap:n}){let{termToId:o}=this,i=["@type",...t.aliases.type];for(let a of i){let f=o.get(a),u=n.get(f);if(u===void 0&&(u=n.get(f+1)),u!==void 0)if(Array.isArray(u))r[a]=u.map(p=>{let h=V.createDecoder({value:p,transformer:this});return h?h.decode({value:p}):p});else{let p=V.createDecoder({value:u,transformer:this});r[a]=p?p.decode({value:u}):u}}}_getEntries({transformMap:t,termMap:r}){let n=[];for(let[o,i]of t){if(o===De||o===vn)continue;let{term:a,plural:f}=this._getTermForId({id:o});if(a===void 0)throw new _("ERR_UNKNOWN_CBORLD_TERM_ID",`Unknown term ID '${o}' was detected in the CBOR-LD input.`);let u=r.get(a);if(u===void 0&&!(a.startsWith("@")&&j.has(a)))throw new _("ERR_UNKNOWN_CBORLD_TERM",`Unknown term "${a}" was detected in the CBOR-LD input.`);n.push([{term:a,termId:o,plural:f,def:u},i])}return n.sort(Xo)}_getTermInfo({termMap:t,key:r}){let{term:n,plural:o}=this._getTermForId({id:r});if(n===void 0)throw new _("ERR_UNKNOWN_CBORLD_TERM_ID",`Unknown term ID '${r}' was detected in the CBOR-LD input.`);let i=t.get(n);if(i===void 0&&!(n.startsWith("@")&&j.has(n)))throw new _("ERR_UNKNOWN_CBORLD_TERM",`Unknown term "${n}" was detected in the CBOR-LD input.`);return{term:n,termId:r,plural:o,def:i}}_transformObjectId({obj:t,termInfo:r,value:n}){let o=J.createDecoder({value:n});t[r.term]=o?o.decode({value:n}):n}_transformObjectType({obj:t,termInfo:r,value:n}){let{term:o,plural:i}=r,a=i?n:[n],f=[];for(let u of a){let p=V.createDecoder({value:u,transformer:this});f.push(p?p.decode({value:u}):u)}t[o]=i?f:f[0]}_transformTypedValue({entries:t,termType:r,value:n}){let o=Zo.get(r),i=o&&o.createDecoder({value:n,transformer:this});if(i)return t.push(i.decode({value:n})),!0}async _transformArray({entries:t,contextStack:r,value:n}){let o=[];for(let i of n){let a={};o.push(a),await this._transform({obj:a,transformMap:i,contextStack:r})}t.push(o)}async _transformObject({entries:t,contextStack:r,value:n}){let o={};return t.push(o),this._transform({obj:o,transformMap:n,contextStack:r})}_assignEntries({entries:t,obj:r,termInfo:n}){let{term:o,plural:i}=n;r[o]=i?t:t[0]}};s($t,"Decompressor");function Xo([{term:e}],[{term:t}]){return e<t?-1:e>t?1:0}s(Xo,"_sortEntriesByTerm");async function Ue({cborldBytes:e,documentLoader:t,appContextMap:r=new Map,diagnose:n}){if(!(e instanceof Uint8Array))throw new TypeError('"cborldBytes" must be a Uint8Array.');let o=0;if(e[o++]!==217)throw new _("ERR_NOT_CBORLD",'CBOR-LD must start with a CBOR major type "Tag" header of `0xd9`.');if(e[o++]!==5)throw new _("ERR_NOT_CBORLD","CBOR-LD 16-bit tag must start with `0x05`.");let i=e[o];if(i===void 0)throw new _("ERR_NOT_CBORLD","Truncated CBOR-LD 16-bit tag.");if(!(i===0||i===1))throw new _("ERR_NOT_CBORLD",`Unsupported CBOR-LD compression mode "${i}".`);o++;let{buffer:a,byteOffset:f,length:u}=e,p=new Uint8Array(a,f+o,u-o);if(i===0)return Nt(p,{useMaps:!1});let g=await new $t({documentLoader:t,appContextMap:r}).decompress({compressedBytes:p,diagnose:n});return n&&(n("Diagnostic JSON-LD result:"),n(q(g,{depth:null,colors:!0}))),g}s(Ue,"decode");var b=class{encode(){throw new Error("Must be implemented by derived class.")}static createEncoder({value:t}={}){throw new Error("Must be implemented by derived class.")}};s(b,"CborldEncoder");var pt=class extends b{constructor({context:t,appContextMap:r}={}){super(),this.context=t,this.appContextMap=r}encode(){let{context:t}=this,r=Ee.get(t)||this.appContextMap.get(t);return r===void 0?new l(c.string,t):new l(c.uint,r)}static createEncoder({value:t,transformer:r}={}){if(typeof t!="string")return!1;let{appContextMap:n}=r;return new pt({context:t,appContextMap:n})}};s(pt,"ContextEncoder");var lt=class extends b{constructor({value:t}={}){super(),this.value=t}encode(){let{value:t}=this,r,n;t[0]==="z"?(r=122,n=ae(t.substr(1))):t[0]==="M"&&(r=77,n=se.toUint8Array(t.substr(1)));let o=new Uint8Array(1+n.length);return o[0]=r,o.set(n,1),new l(c.bytes,o)}static createEncoder({value:t}={}){if(typeof t!="string")return!1;if(t[0]==="z"||t[0]==="M")return new lt({value:t})}};s(lt,"MultibaseEncoder");var bn=new Map([["did:v1:nym:",1024],["did:key:",1025]]),tt=class extends b{constructor({value:t,scheme:r}={}){super(),this.value=t,this.scheme=r}encode(){let{value:t,scheme:r}=this,n=t.substr(r.length),[o,i]=n.split("#"),a=[new l(c.uint,bn.get(r)),_n(o)];return i!==void 0&&a.push(_n(i)),[new l(c.array,a.length),a]}static createEncoder({value:t}={}){let r=[...bn.keys()];for(let n of r)if(t.startsWith(n))return new tt({value:t,scheme:n})}};s(tt,"Base58DidUrlEncoder");function _n(e){if(e.startsWith("z")){let t=ae(e.substr(1));if(t)return new l(c.bytes,t)}return new l(c.string,e)}s(_n,"_multibase58ToToken");var H=class extends b{constructor({value:t,secure:r}={}){super(),this.value=t,this.secure=r}encode(){let{value:t,secure:r}=this,n=r?8:7,o=[new l(c.uint,r?2:1),new l(c.string,t.substr(n))];return[new l(c.array,o.length),o]}static createEncoder({value:t}={}){if(t.startsWith("https://"))return new H({value:t,secure:!0});if(t.startsWith("http://"))return new H({value:t,secure:!1})}};s(H,"HttpUrlEncoder");var dt=class extends b{constructor({value:t}={}){super(),this.value=t}encode(){let{value:t}=this,r=t.substr(9),n=[new l(c.uint,3)];if(r.toLowerCase()===r){let o=Re(r);n.push(new l(c.bytes,o))}else n.push(new l(c.string,r));return[new l(c.array,n.length),n]}static createEncoder({value:t}={}){if(t.startsWith("urn:uuid:"))return new dt({value:t})}};s(dt,"UuidUrnEncoder");var Jo=new Map([["http",H],["https",H],["urn:uuid",dt],["did:v1:nym",tt],["did:key",tt]]),et=class extends b{static createEncoder({value:t}={}){if(typeof t!="string")return!1;let r;try{let{protocol:o,pathname:i}=new URL(t);r=o,i.includes(":")&&(r+=i);let a=t.split(":");a.pop(),r=a.join(":")}catch{return!1}let n=Jo.get(r);return n&&n.createEncoder({value:t})}};s(et,"UriEncoder");var rt=class extends b{constructor({termId:t}={}){super(),this.termId=t}encode(){return new l(c.uint,this.termId)}static createEncoder({value:t,transformer:r}={}){let{termToId:n}=r,o=n.get(t);return o!==void 0?new rt({termId:o}):et.createEncoder({value:t})}};s(rt,"VocabTermEncoder");var ht=class extends b{constructor({value:t,parsed:r}={}){super(),this.value=t,this.parsed=r}encode(){let{value:t,parsed:r}=this,n=Math.floor(r/1e3),o=new Date(n*1e3).toISOString(),i=o.substring(0,o.indexOf("T"));return t!==i?new l(c.string,t):new l(c.uint,n)}static createEncoder({value:t}={}){if(t.includes("T"))return!1;let r=Date.parse(t);return isNaN(r)?!1:new ht({value:t,parsed:r})}};s(ht,"XsdDateEncoder");var mt=class extends b{constructor({value:t,parsed:r}={}){super(),this.value=t,this.parsed=r}encode(){let{value:t,parsed:r}=this,n=Math.floor(r/1e3),o=new l(c.uint,n),i=t.indexOf(".");if(i===-1){let p=new Date(n*1e3).toISOString().replace(".000Z","Z");return t!==p?new l(c.string,t):o}let a=parseInt(t.substr(i+1),10),f=new Date(n*1e3+a).toISOString();if(t!==f)return new l(c.string,t);let u=[o,new l(c.uint,a)];return[new l(c.array,u.length),u]}static createEncoder({value:t}={}){if(!t.includes("T"))return!1;let r=Date.parse(t);return isNaN(r)?!1:new mt({value:t,parsed:r})}};s(mt,"XsdDateTimeEncoder");var Yo=new Map([["@id",et],["@vocab",rt],["https://w3id.org/security#multibase",lt],["http://www.w3.org/2001/XMLSchema#date",ht],["http://www.w3.org/2001/XMLSchema#dateTime",mt]]),En=j.get("@context"),qo=En+1,ti={Object(e){if(e instanceof b)return e.encode({obj:e})}},jt=class extends ct{constructor({documentLoader:t,appContextMap:r}={}){super({documentLoader:t,appContextMap:r})}async compress({jsonldDocument:t,diagnose:r}={}){let n=await this._createTransformMaps({jsonldDocument:t});return r&&(r("Diagnostic CBOR-LD compression transform map(s):"),r(q(n,{depth:null,colors:!0}))),kt(n,{typeEncoders:ti})}async _createTransformMaps({jsonldDocument:t}){this.contextMap=new Map,this.termToId=new Map(j),this.nextTermId=ce;let r=[],n=Array.isArray(t),o=n?t:[t];for(let i of o){let a=new Map;await this._transform({obj:i,transformMap:a}),r.push(a)}return n?r:r[0]}_afterObjectContexts({obj:t,transformMap:r}){let n=t["@context"];if(!n)return;let o=[],i=Array.isArray(n),a=i?n:[n];for(let u of a){let p=pt.createEncoder({value:u,transformer:this});o.push(p||u)}let f=i?qo:En;r.set(f,i?o:o[0])}_getEntries({obj:t,termMap:r}){let n=[],o=Object.keys(t).sort();for(let i of o){if(i==="@context")continue;let a=r.get(i);if(a===void 0&&!(i.startsWith("@")&&j.has(i)))throw new _("ERR_UNKNOWN_CBORLD_TERM",`Unknown term '${i}' was detected in the JSON-LD input.`);let f=t[i],u=Array.isArray(f),p=this._getIdForTerm({term:i,plural:u});n.push([{term:i,termId:p,plural:u,def:a},f])}return n}_transformObjectId({transformMap:t,termInfo:r,value:n}){let{termId:o}=r,i=et.createEncoder({value:n,transformer:this,termInfo:r});t.set(o,i||n)}_transformObjectType({transformMap:t,termInfo:r,value:n}){let{termId:o,plural:i}=r,a=i?n:[n],f=[];for(let u of a){let p=rt.createEncoder({value:u,transformer:this,termInfo:r});f.push(p||u)}t.set(o,i?f:f[0])}_transformTypedValue({entries:t,termType:r,value:n,termInfo:o}){let i=Yo.get(r),a=i&&i.createEncoder({value:n,transformer:this,termInfo:o});if(a)return t.push(a),!0}async _transformArray({entries:t,contextStack:r,value:n}){let o=[];for(let i of n){let a=new Map;o.push(a),await this._transform({obj:i,transformMap:a,contextStack:r})}t.push(o)}async _transformObject({entries:t,contextStack:r,value:n}){let o=new Map;t.push(o),await this._transform({obj:n,transformMap:o,contextStack:r})}_assignEntries({entries:t,transformMap:r,termInfo:n}){let{termId:o,plural:i}=n;r.set(o,i?t:t[0])}};s(jt,"Compressor");async function Ie({jsonldDocument:e,documentLoader:t,appContextMap:r=new Map,compressionMode:n=1,diagnose:o}={}){if(!(n===0||n===1))throw new TypeError('"compressionMode" must be "0" (no compression) or "1" for compression mode version 1.');let i=new Uint8Array([217,5,n]),a;n===0?a=kt(e):a=await new jt({documentLoader:t,appContextMap:r}).compress({jsonldDocument:e,diagnose:o});let f=i.length+a.length,u=new Uint8Array(f);return u.set(i),u.set(a,i.length),o&&(o("Diagnostic CBOR-LD result:"),o(q(u,{depth:null,colors:!0}))),u}s(Ie,"encode");function ke(e){if(e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray)return new DataView(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new DataView(e);throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray")}s(ke,"toDataView");var ri="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",ni="0123456789ABCDEFGHIJKLMNOPQRSTUV",oi="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function Me(e,t,r){r=r||{};let n,o;switch(t){case"RFC3548":case"RFC4648":n=ri,o=!0;break;case"RFC4648-HEX":n=ni,o=!0;break;case"Crockford":n=oi,o=!1;break;default:throw new Error("Unknown base32 variant: "+t)}let i=r.padding!==void 0?r.padding:o,a=ke(e),f=0,u=0,p="";for(let h=0;h<a.byteLength;h++)for(u=u<<8|a.getUint8(h),f+=8;f>=5;)p+=n[u>>>f-5&31],f-=5;if(f>0&&(p+=n[u<<5-f&31]),i)for(;p.length%8!==0;)p+="=";return p}s(Me,"base32Encode");var Hn=eo(Cn(),1);var E;(function(e){e[e.Terminator=0]="Terminator",e[e.Numeric=1]="Numeric",e[e.Alphanumeric=2]="Alphanumeric",e[e.StructuredAppend=3]="StructuredAppend",e[e.Byte=4]="Byte",e[e.Kanji=8]="Kanji",e[e.ECI=7]="ECI"})(E||(E={}));var Le=s(function(e,t){return Le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Le(e,t)},"extendStatics");function nt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Le(e,t);function r(){this.constructor=e}s(r,"__"),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}s(nt,"__extends");var Bt=function(){function e(t,r){this.bytes=[],this.mode=t,this.data=r}return s(e,"QRData"),e.prototype.getLength=function(){return this.bytes.length},e.prototype.getLengthInBits=function(t){var r=this.mode,n=new Error("illegal mode: ".concat(r));if(1<=t&&t<10)switch(r){case E.Numeric:return 10;case E.Alphanumeric:return 9;case E.Byte:return 8;case E.Kanji:return 8;default:throw n}else if(t<27)switch(r){case E.Numeric:return 12;case E.Alphanumeric:return 11;case E.Byte:return 16;case E.Kanji:return 10;default:throw n}else if(t<41)switch(r){case E.Numeric:return 14;case E.Alphanumeric:return 13;case E.Byte:return 16;case E.Kanji:return 12;default:throw n}else throw new Error("illegal version: ".concat(t))},e}();function An(e){for(var t=0,r=e.length,n=[],o=0;o<r;o++){var i=e.charCodeAt(o);i<128?n[t++]=i:i<2048?(n[t++]=i>>6|192,n[t++]=i&63|128):(i&64512)===55296&&o+1<r&&(e.charCodeAt(o+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++o)&1023),n[t++]=i>>18|240,n[t++]=i>>12&63|128,n[t++]=i>>6&63|128,n[t++]=i&63|128):(n[t++]=i>>12|224,n[t++]=i>>6&63|128,n[t++]=i&63|128)}return n}s(An,"encode");var Bn=function(e){nt(t,e);function t(r,n){var o=e.call(this,E.Byte,r)||this;if(o.encoding=-1,typeof n=="function"){var i=n(r),a=i.encoding,f=i.bytes;o.bytes=f,o.encoding=a}else o.bytes=An(r),o.encoding=26;return o}return s(t,"QRByte"),t.prototype.writeTo=function(r){for(var n=this.bytes,o=0,i=n;o<i.length;o++){var a=i[o];r.put(a,8)}},t}(Bt);var yt=[],Ne=[];for(D=0;D<256;D++)Ne[D]=0,yt[D]=D<8?1<<D:yt[D-4]^yt[D-5]^yt[D-6]^yt[D-8];var D;for(D=0;D<255;D++)Ne[yt[D]]=D;var D;function St(e){if(e<1)throw new Error("illegal log: ".concat(e));return Ne[e]}s(St,"glog");function zt(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return yt[e]}s(zt,"gexp");var Vt=function(){function e(t,r){r===void 0&&(r=0);for(var n=0,o=t.length;n<o&&t[n]===0;)n++;o-=n;for(var i=[],a=0;a<o;a++)i.push(t[n+a]);for(var a=0;a<r;a++)i.push(0);this.num=i}return s(e,"Polynomial"),e.prototype.getAt=function(t){return this.num[t]},e.prototype.getLength=function(){return this.num.length},e.prototype.multiply=function(t){for(var r=[],n=t.getLength(),o=this.getLength(),i=o+n-1,a=0;a<i;a++)r.push(0);for(var a=0;a<o;a++)for(var f=0;f<n;f++)r[a+f]^=zt(St(this.getAt(a))+St(t.getAt(f)));return new e(r)},e.prototype.mod=function(t){var r=t.getLength(),n=this.getLength();if(n-r<0)return this;for(var o=St(this.getAt(0))-St(t.getAt(0)),i=[],a=0;a<n;a++)i.push(this.getAt(a));for(var a=0;a<r;a++)i[a]^=zt(St(t.getAt(a))+o);return new e(i).mod(t)},e}();var fi=3,ui=3,Sn=40,pi=10,li=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],di=1<<14|1<<12|1<<10|1<<4|1<<1,Un=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,In=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0;function kn(e){return li[e-1]}s(kn,"getAlignmentPattern");function Mn(e){for(var t=new Vt([1]),r=0;r<e;r++)t=t.multiply(new Vt([1,zt(r)]));return t}s(Mn,"getErrorCorrectionPolynomial");function Ot(e){for(var t=0;e!==0;)t++,e>>>=1;return t}s(Ot,"getBCHDigit");var On=Ot(In);function Ln(e){for(var t=e<<12;Ot(t)-On>=0;)t^=In<<Ot(t)-On;return e<<12|t}s(Ln,"getBCHVersion");var Rn=Ot(Un);function Nn(e){for(var t=e<<10;Ot(t)-Rn>=0;)t^=Un<<Ot(t)-Rn;return(e<<10|t)^di}s(Nn,"getBCHVersionInfo");function Dn(e,t){for(var r=e.getMatrixSize(),n=0,o=0;o<r;o++)for(var i=!1,a=0,f=0;f<r;f++){var u=t?e.isDark(o,f):e.isDark(f,o);u===i?(a++,a===5?n+=fi:a>5&&n++):(i=u,a=1)}return n}s(Dn,"applyMaskPenaltyRule1Internal");function hi(e){return Dn(e,!0)+Dn(e,!1)}s(hi,"applyMaskPenaltyRule1");function mi(e){for(var t=e.getMatrixSize(),r=0,n=0;n<t-1;n++)for(var o=0;o<t-1;o++){var i=e.isDark(n,o);i===e.isDark(n,o+1)&&i===e.isDark(n+1,o)&&i===e.isDark(n+1,o+1)&&(r+=ui)}return r}s(mi,"applyMaskPenaltyRule2");function pe(e,t,r,n,o){r=Math.max(r,0),n=Math.min(n,e.getMatrixSize());for(var i=r;i<n;i++){var a=o?e.isDark(t,i):e.isDark(i,t);if(a)return!1}return!0}s(pe,"isFourWhite");function yi(e){for(var t=e.getMatrixSize(),r=0,n=0;n<t;n++)for(var o=0;o<t;o++)o+6<t&&e.isDark(n,o)&&!e.isDark(n,o+1)&&e.isDark(n,o+2)&&e.isDark(n,o+3)&&e.isDark(n,o+4)&&!e.isDark(n,o+5)&&e.isDark(n,o+6)&&(pe(e,n,o-4,o,!0)||pe(e,n,o+7,o+11,!0))&&(r+=Sn),n+6<t&&e.isDark(n,o)&&!e.isDark(n+1,o)&&e.isDark(n+2,o)&&e.isDark(n+3,o)&&e.isDark(n+4,o)&&!e.isDark(n+5,o)&&e.isDark(n+6,o)&&(pe(e,o,n-4,n,!1)||pe(e,o,n+7,n+11,!1))&&(r+=Sn);return r}s(yi,"applyMaskPenaltyRule3");function gi(e){for(var t=e.getMatrixSize(),r=0,n=0;n<t;n++)for(var o=0;o<t;o++)e.isDark(n,o)&&r++;var i=t*t,a=Math.floor(Math.abs(r*20-i*10)/i);return a*pi}s(gi,"applyMaskPenaltyRule4");function Pn(e){return hi(e)+mi(e)+yi(e)+gi(e)}s(Pn,"calculateMaskPenalty");var L;(function(e){e[e.L=1]="L",e[e.M=0]="M",e[e.Q=3]="Q",e[e.H=2]="H"})(L||(L={}));var Fn=function(){function e(t,r){this.dataCount=r,this.totalCount=t}return s(e,"RSBlock"),e.prototype.getDataCount=function(){return this.dataCount},e.prototype.getTotalCount=function(){return this.totalCount},e.getRSBlocks=function(t,r){for(var n=[],o=e.getRSBlockTable(t,r),i=o.length/3,a=0;a<i;a++)for(var f=o[a*3+0],u=o[a*3+1],p=o[a*3+2],h=0;h<f;h++)n.push(new e(u,p));return n},e.getRSBlockTable=function(t,r){switch(r){case L.L:return e.RS_BLOCK_TABLE[(t-1)*4+0];case L.M:return e.RS_BLOCK_TABLE[(t-1)*4+1];case L.Q:return e.RS_BLOCK_TABLE[(t-1)*4+2];case L.H:return e.RS_BLOCK_TABLE[(t-1)*4+3];default:throw new Error("illegal error correction level: ".concat(r))}},e.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],e}();var Pe=function(){function e(){this.length=0,this.buffer=[]}return s(e,"BitBuffer"),e.prototype.getBuffer=function(){return this.buffer},e.prototype.getLengthInBits=function(){return this.length},e.prototype.getBit=function(t){return(this.buffer[t/8>>0]>>>7-t%8&1)===1},e.prototype.put=function(t,r){for(var n=0;n<r;n++)this.putBit((t>>>r-n-1&1)===1)},e.prototype.putBit=function(t){var r=this.buffer;this.length===r.length*8&&r.push(0),t&&(r[this.length/8>>0]|=128>>>this.length%8),this.length++},e}();var le=function(){function e(){}return s(e,"OutputStream"),e.prototype.writeBytes=function(t,r,n){r===void 0&&(r=0),n===void 0&&(n=t.length);for(var o=0;o<n;o++)this.writeByte(t[o+r])},e.prototype.flush=function(){},e.prototype.close=function(){this.flush()},e}();var de=function(e){nt(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.bytes=[],r}return s(t,"ByteArrayOutputStream"),t.prototype.writeByte=function(r){this.bytes.push(r)},t.prototype.writeInt16=function(r){this.bytes.push(r,r>>>8)},t.prototype.toByteArray=function(){return this.bytes},t}(le);function wi(e){if(e>=0){if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e===62)return 43;if(e===63)return 47}throw new Error("illegal char: ".concat(String.fromCharCode(e)))}s(wi,"encode");var $n=function(e){nt(t,e);function t(r){var n=e.call(this)||this;return n.buffer=0,n.length=0,n.bufLength=0,n.stream=r,n}return s(t,"Base64EncodeOutputStream"),t.prototype.writeByte=function(r){for(this.buffer=this.buffer<<8|r&255,this.bufLength+=8,this.length++;this.bufLength>=6;)this.writeEncoded(this.buffer>>>this.bufLength-6),this.bufLength-=6},t.prototype.flush=function(){this.bufLength>0&&(this.writeEncoded(this.buffer<<6-this.bufLength),this.buffer=0,this.bufLength=0);var r=this.stream;if(this.length%3!=0)for(var n=3-this.length%3,o=0;o<n;o++)r.writeByte(61)},t.prototype.writeEncoded=function(r){this.stream.writeByte(wi(r&63))},t}(le);function xi(e){var t=new de,r=new $n(t);return r.writeBytes(e),r.close(),t.close(),t.toByteArray()}s(xi,"encodeToBase64");var vi=function(){function e(){this.size=0,this.map={}}return s(e,"LZWTable"),e.prototype.add=function(t){this.contains(t)||(this.map[t]=this.size++)},e.prototype.getSize=function(){return this.size},e.prototype.indexOf=function(t){return this.map[t]},e.prototype.contains=function(t){return this.map[t]>=0},e}(),bi=function(){function e(t){this.output=t,this.bitLength=0,this.bitBuffer=0}return s(e,"BitOutputStream"),e.prototype.write=function(t,r){if(t>>>r!==0)throw new Error("length overflow");for(var n=this.output;this.bitLength+r>=8;)n.writeByte(255&(t<<this.bitLength|this.bitBuffer)),r-=8-this.bitLength,t>>>=8-this.bitLength,this.bitBuffer=0,this.bitLength=0;this.bitBuffer=t<<this.bitLength|this.bitBuffer,this.bitLength=this.bitLength+r},e.prototype.flush=function(){var t=this.output;this.bitLength>0&&t.writeByte(this.bitBuffer),t.flush()},e.prototype.close=function(){this.flush(),this.output.close()},e}(),jn=function(){function e(t,r){this.data=[],this.width=t,this.height=r;for(var n=t*r,o=0;o<n;o++)this.data[o]=0}return s(e,"GIFImage"),e.prototype.getLZWRaster=function(t){for(var r=new vi,n=String.fromCharCode,o=1<<t,i=(1<<t)+1,a=0;a<o;a++)r.add(n(a));r.add(n(o)),r.add(n(i));var f=t+1,u=new de,p=new bi(u);try{var h=this.data,g=h.length,w=String.fromCharCode;p.write(o,f);for(var m=0,v=w(h[m++]);m<g;){var C=w(h[m++]);r.contains(v+C)?v+=C:(p.write(r.indexOf(v),f),r.getSize()<4095&&(r.getSize()===1<<f&&f++,r.add(v+C)),v=C)}p.write(r.indexOf(v),f),p.write(i,f)}finally{p.close()}return u.toByteArray()},e.prototype.setPixel=function(t,r,n){var o=this,i=o.width,a=o.height;if(t<0||i<=t)throw new Error("illegal x axis: ".concat(t));if(r<0||a<=r)throw new Error("illegal y axis: ".concat(r));this.data[r*i+t]=n},e.prototype.getPixel=function(t,r){var n=this,o=n.width,i=n.height;if(t<0||o<=t)throw new Error("illegal x axis: ".concat(t));if(r<0||i<=r)throw new Error("illegal y axis: ".concat(r));return this.data[r*o+t]},e.prototype.write=function(t){var r=this,n=r.width,o=r.height;t.writeByte(71),t.writeByte(73),t.writeByte(70),t.writeByte(56),t.writeByte(55),t.writeByte(97),t.writeInt16(n),t.writeInt16(o),t.writeByte(128),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(255),t.writeByte(255),t.writeByte(255),t.writeByte(44),t.writeInt16(0),t.writeInt16(0),t.writeInt16(n),t.writeInt16(o),t.writeByte(0);var i=2,a=this.getLZWRaster(i),f=a.length;t.writeByte(i);for(var u=0;f-u>255;)t.writeByte(255),t.writeBytes(a,u,255),u+=255;var p=f-u;t.writeByte(p),t.writeBytes(a,u,p),t.writeByte(0),t.writeByte(59)},e.prototype.toDataURL=function(){var t=new de;this.write(t);var r=xi(t.toByteArray());t.close();for(var n=r.length,o=String.fromCharCode,i="data:image/gif;base64,",a=0;a<n;a++)i+=o(r[a]);return i},e}();function zn(e){switch(e){case 0:return function(t,r){return(t+r&1)===0};case 1:return function(t,r){return(r&1)===0};case 2:return function(t,r){return t%3===0};case 3:return function(t,r){return(t+r)%3===0};case 4:return function(t,r){return((t/3>>0)+(r/2>>0)&1)===0};case 5:return function(t,r){return(t*r&1)+t*r%3===0};case 6:return function(t,r){return((t*r&1)+t*r%3&1)===0};case 7:return function(t,r){return(t*r%3+(t+r&1)&1)===0};default:throw new Error("illegal mask: ".concat(e))}}s(zn,"getMaskFunc");var _i=236,Ei=17,Ti=Object.prototype.toString;function Ci(e,t){if(e<0||e>=1e6)throw new Error("byte mode encoding hint out of range");t.put(E.ECI,4),e<1<<7?t.put(e,8):e<1<<14?(t.put(2,2),t.put(e,14)):(t.put(6,3),t.put(e,21))}s(Ci,"appendECI");function Vn(e,t,r,n){for(var o=new Pe,i=Fn.getRSBlocks(e,t),a=0,f=n;a<f.length;a++){var u=f[a],p=u.mode;r&&p===E.Byte&&Ci(u.encoding,o),o.put(p,4),o.put(u.getLength(),u.getLengthInBits(e)),u.writeTo(o)}for(var h=0,g=0,w=i;g<w.length;g++){var m=w[g];h+=m.getDataCount()}return h*=8,[o,i,h]}s(Vn,"prepareData");function Ai(e,t){for(var r=0,n=0,o=0,i=[],a=[],f=t.length,u=e.getBuffer(),p=0;p<f;p++){var h=t[p],g=h.getDataCount(),w=h.getTotalCount()-g;n=Math.max(n,g),o=Math.max(o,w),i[p]=[];for(var m=0;m<g;m++)i[p][m]=255&u[m+r];r+=g;var v=Mn(w),C=v.getLength()-1,gt=new Vt(i[p],C),Qt=gt.mod(v),he=Qt.getLength();a[p]=[];for(var m=0;m<C;m++){var Ht=m+he-C;a[p][m]=Ht>=0?Qt.getAt(Ht):0}}e=new Pe;for(var m=0;m<n;m++)for(var p=0;p<f;p++)m<i[p].length&&e.put(i[p][m],8);for(var m=0;m<o;m++)for(var p=0;p<f;p++)m<a[p].length&&e.put(a[p][m],8);return e}s(Ai,"createBytes");function Bi(e,t,r){for(e.getLengthInBits()+4<=r&&e.put(0,4);e.getLengthInBits()%8!==0;)e.putBit(!1);for(;!(e.getLengthInBits()>=r||(e.put(_i,8),e.getLengthInBits()>=r));)e.put(Ei,8);return Ai(e,t)}s(Bi,"createData");var Fe=function(){function e(t){t===void 0&&(t={}),this.matrixSize=0,this.chunks=[],this.matrix=[];var r=t.version,n=r===void 0?0:r,o=t.encodingHint,i=o===void 0?!1:o,a=t.errorCorrectionLevel,f=a===void 0?L.L:a;this.setVersion(n),this.setEncodingHint(i),this.setErrorCorrectionLevel(f)}return s(e,"Encoder"),e.prototype.getMatrix=function(){return this.matrix},e.prototype.getMatrixSize=function(){return this.matrixSize},e.prototype.getVersion=function(){return this.version},e.prototype.setVersion=function(t){return this.version=Math.min(40,Math.max(0,t>>0)),this.auto=this.version===0,this},e.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},e.prototype.setErrorCorrectionLevel=function(t){switch(t){case L.L:case L.M:case L.Q:case L.H:this.errorCorrectionLevel=t}return this},e.prototype.getEncodingHint=function(){return this.encodingHint},e.prototype.setEncodingHint=function(t){return this.encodingHint=t,this},e.prototype.write=function(t){var r=this.chunks;if(t instanceof Bt)r.push(t);else{var n=Ti.call(t);if(n==="[object String]")r.push(new Bn(t));else throw new Error("illegal data: ".concat(t))}return this},e.prototype.isDark=function(t,r){return this.matrix[t][r]===!0},e.prototype.setupFinderPattern=function(t,r){for(var n=this.matrix,o=this.matrixSize,i=-1;i<=7;i++)for(var a=-1;a<=7;a++)t+i<=-1||o<=t+i||r+a<=-1||o<=r+a||(0<=i&&i<=6&&(a===0||a===6)||0<=a&&a<=6&&(i===0||i===6)||2<=i&&i<=4&&2<=a&&a<=4?n[t+i][r+a]=!0:n[t+i][r+a]=!1)},e.prototype.setupAlignmentPattern=function(){for(var t=this.matrix,r=kn(this.version),n=r.length,o=0;o<n;o++)for(var i=0;i<n;i++){var a=r[o],f=r[i];if(t[a][f]===null)for(var u=-2;u<=2;u++)for(var p=-2;p<=2;p++)u===-2||u===2||p===-2||p===2||u===0&&p===0?t[a+u][f+p]=!0:t[a+u][f+p]=!1}},e.prototype.setupTimingPattern=function(){for(var t=this.matrix,r=this.matrixSize-8,n=8;n<r;n++){var o=n%2===0;t[n][6]===null&&(t[n][6]=o),t[6][n]===null&&(t[6][n]=o)}},e.prototype.setupFormatInfo=function(t){for(var r=this.matrix,n=this.errorCorrectionLevel<<3|t,o=Nn(n),i=this.matrixSize,a=0;a<15;a++){var f=(o>>a&1)===1;a<6?r[a][8]=f:a<8?r[a+1][8]=f:r[i-15+a][8]=f,a<8?r[8][i-a-1]=f:a<9?r[8][15-a-1+1]=f:r[8][15-a-1]=f}r[i-8][8]=!0},e.prototype.setupVersionInfo=function(){if(this.version>=7)for(var t=this.matrix,r=this.matrixSize,n=Ln(this.version),o=0;o<18;o++){var i=(n>>o&1)===1;t[o/3>>0][o%3+r-8-3]=i,t[o%3+r-8-3][o/3>>0]=i}},e.prototype.setupCodewords=function(t,r){for(var n=this.matrix,o=this.matrixSize,i=t.getLengthInBits(),a=zn(r),f=0,u=o-1;u>=1;u-=2){u===6&&(u=5);for(var p=0;p<o;p++)for(var h=0;h<2;h++){var g=u-h,w=(u+1&2)===0,m=w?o-1-p:p;if(n[m][g]===null){var v=!1;f<i&&(v=t.getBit(f++));var C=a(g,m);C&&(v=!v),n[m][g]=v}}}},e.prototype.buildMatrix=function(t,r){for(var n=[],o=this.matrixSize,i=0;i<o;i++){n[i]=[];for(var a=0;a<o;a++)n[i][a]=null}this.matrix=n,this.setupFinderPattern(0,0),this.setupFinderPattern(o-7,0),this.setupFinderPattern(0,o-7),this.setupAlignmentPattern(),this.setupTimingPattern(),this.setupFormatInfo(r),this.setupVersionInfo(),this.setupCodewords(t,r)},e.prototype.make=function(){var t,r,n,o,i,a=this,f=a.chunks,u=a.errorCorrectionLevel;if(this.auto){for(var p=1;p<=40&&(t=Vn(p,u,this.encodingHint,f),n=t[0],o=t[1],i=t[2],!(n.getLengthInBits()<=i));p++);var h=n.getLengthInBits();if(h>i)throw new Error("data overflow: ".concat(h," > ").concat(i));this.version=p}else r=Vn(this.version,u,this.encodingHint,f),n=r[0],o=r[1],i=r[2];this.matrixSize=this.version*4+17;for(var g=[],w=Bi(n,o,i),m=-1,v=Number.MAX_VALUE,C=0;C<8;C++){this.buildMatrix(w,C),g.push(this.matrix);var gt=Pn(this);gt<v&&(v=gt,m=C)}return this.matrix=g[m],this},e.prototype.toDataURL=function(t,r){t===void 0&&(t=2),r===void 0&&(r=t*4),t=Math.max(1,t>>0),r=Math.max(0,r>>0);for(var n=this.matrixSize,o=t*n+r*2,i=r,a=o-r,f=new jn(o,o),u=0;u<o;u++)for(var p=0;p<o;p++)if(i<=p&&p<a&&i<=u&&u<a){var h=(u-i)/t>>0,g=(p-i)/t>>0;f.setPixel(p,u,this.isDark(h,g)?0:1)}else f.setPixel(p,u,1);return f.toDataURL()},e.prototype.clear=function(){this.chunks=[]},e}();function Qn(e){for(var t=e.length,r=[],n=0;n<t;n++)r.push(e.charCodeAt(n));return r}s(Qn,"encode");function $e(e){if(48<=e&&e<=57)return e-48;if(65<=e&&e<=90)return e-65+10;switch(e){case 32:return 36;case 36:return 37;case 37:return 38;case 42:return 39;case 43:return 40;case 45:return 41;case 46:return 42;case 47:return 43;case 58:return 44;default:throw new Error("illegal char: ".concat(String.fromCharCode(e)))}}s($e,"getByte");var je=function(e){nt(t,e);function t(r){var n=e.call(this,E.Alphanumeric,r)||this;return n.bytes=Qn(r),n}return s(t,"QRAlphanumeric"),t.prototype.writeTo=function(r){for(var n=0,o=this.bytes,i=o.length;n+1<i;)r.put($e(o[n])*45+$e(o[n+1]),11),n+=2;n<i&&r.put($e(o[n]),6)},t}(Bt);var Kn="VP1",Wn="B";function Si({bytes:e,size:t}){let r=new Fe;r.setEncodingHint(!0);let n=Me(e,"RFC4648",{padding:!1}),o=`${Kn}-${Wn}${n}`;return r.write(new je(o)),r.make(),{payload:o,encodedCborld:n,version:r.getVersion(),imageDataUrl:r.toDataURL(t)}}s(Si,"_bytesToQrCodeDataUrl");async function ze({vp:e,documentLoader:t,size:r,diagnose:n}={}){let o=await Ie({jsonldDocument:e,documentLoader:t,diagnose:n}),{payload:i,imageDataUrl:a,encodedCborld:f,version:u}=Si({bytes:o,size:r});return{payload:i,imageDataUrl:a,encodedCborld:f,rawCborldBytes:o,version:u}}s(ze,"toQrCode");async function Ve({text:e,documentLoader:t,diagnose:r}={}){let n=Kn+"-";if(!(e&&e.startsWith(n)))throw TypeError("Unsupported VP QR format.");let o=e.slice(n.length);if(!o.startsWith(Wn))throw TypeError("Payload must be multibase base32 (RFC4648) encoded.");let i=(0,Hn.default)(o.slice(1),"RFC4648"),a=new Uint8Array(i);return{vp:await Ue({cborldBytes:a,documentLoader:t,diagnose:r})}}s(Ve,"fromQrCode");var Oi=s(e=>({name:"Vpqr",displayName:"VP QR",description:"Allows reading and creating QR codes with Verifiable Presentations in them",methods:{vpFromQrCode:async(t,r)=>(await Ve({text:r,documentLoader:async n=>({document:await e.invoke.contextLoader(n)})}))?.vp,vpToQrCode:async(t,r)=>(await ze({vp:r,documentLoader:async n=>({document:await e.invoke.contextLoader(n)})}))?.imageDataUrl}}),"getVpqrPlugin");
1
+ "use strict";var Xn=Object.create;var Ot=Object.defineProperty;var Zn=Object.getOwnPropertyDescriptor;var Jn=Object.getOwnPropertyNames;var Yn=Object.getPrototypeOf,qn=Object.prototype.hasOwnProperty;var s=(e,t)=>Ot(e,"name",{value:t,configurable:!0});var to=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),eo=(e,t)=>{for(var r in t)Ot(e,r,{get:t[r],enumerable:!0})},We=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Jn(t))!qn.call(e,o)&&o!==r&&Ot(e,o,{get:()=>t[o],enumerable:!(n=Zn(t,o))||n.enumerable});return e};var ro=(e,t,r)=>(r=e!=null?Xn(Yn(e)):{},We(t||!e||!e.__esModule?Ot(r,"default",{value:e,enumerable:!0}):r,e)),no=e=>We(Ot({},"__esModule",{value:!0}),e);var Un=to((Fa,kn)=>{var ii="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",si="0123456789ABCDEFGHIJKLMNOPQRSTUV",ci="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function ai(e,t){var r=e.indexOf(t);if(r===-1)throw new Error("Invalid character found: "+t);return r}s(ai,"readChar");kn.exports=s(function(t,r){var n;switch(r){case"RFC3548":case"RFC4648":n=ii,t=t.replace(/=+$/,"");break;case"RFC4648-HEX":n=si,t=t.replace(/=+$/,"");break;case"Crockford":n=ci,t=t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1");break;default:throw new Error("Unknown base32 variant: "+r)}for(var o=t.length,i=0,c=0,f=0,u=new Uint8Array(o*5/8|0),d=0;d<o;d++)c=c<<5|ai(n,t[d]),i+=5,i>=8&&(u[f++]=c>>>i-8&255,i-=8);return u.buffer},"base32Decode")});var Bi={};eo(Bi,{getVpqrPlugin:()=>Ai});module.exports=no(Bi);var oo=["string","number","bigint","symbol"],io=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Qe(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(oo.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(so(e))return"Buffer";let r=co(e);return r||"Object"}s(Qe,"is");function so(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}s(so,"isBuffer");function co(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(io.includes(t))return t}s(co,"getObjectType");var a=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};s(a,"Type");a.uint=new a(0,"uint",!0);a.negint=new a(1,"negint",!0);a.bytes=new a(2,"bytes",!0);a.string=new a(3,"string",!0);a.array=new a(4,"array",!1);a.map=new a(5,"map",!1);a.tag=new a(6,"tag",!1);a.float=new a(7,"float",!0);a.false=new a(7,"false",!0);a.true=new a(7,"true",!0);a.null=new a(7,"null",!0);a.undefined=new a(7,"undefined",!0);a.break=new a(7,"break",!0);var l=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};s(l,"Token");var bt=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",ao=new TextDecoder,fo=new TextEncoder;function ee(e){return bt&&globalThis.Buffer.isBuffer(e)}s(ee,"isBuffer");function be(e){return e instanceof Uint8Array?ee(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}s(be,"asU8A");var Je=bt?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Xe(e,t,r):(e,t,r)=>r-t>64?ao.decode(e.subarray(t,r)):Xe(e,t,r),Ye=bt?e=>e.length>64?globalThis.Buffer.from(e):Ge(e):e=>e.length>64?fo.encode(e):Ge(e),V=s(e=>Uint8Array.from(e),"fromArray"),Et=bt?(e,t,r)=>ee(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),qe=bt?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),be(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let o of e)n+o.length>r.length&&(o=o.subarray(0,r.length-n)),r.set(o,n),n+=o.length;return r},tr=bt?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function er(e,t){if(ee(e)&&ee(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}s(er,"compare");function Ge(e){let t=[],r=0;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=o&63|128):(o&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(o=65536+((o&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t}s(Ge,"utf8ToBytes");function Xe(e,t,r){let n=[];for(;t<r;){let o=e[t],i=null,c=o>239?4:o>223?3:o>191?2:1;if(t+c<=r){let f,u,d,h;switch(c){case 1:o<128&&(i=o);break;case 2:f=e[t+1],(f&192)===128&&(h=(o&31)<<6|f&63,h>127&&(i=h));break;case 3:f=e[t+1],u=e[t+2],(f&192)===128&&(u&192)===128&&(h=(o&15)<<12|(f&63)<<6|u&63,h>2047&&(h<55296||h>57343)&&(i=h));break;case 4:f=e[t+1],u=e[t+2],d=e[t+3],(f&192)===128&&(u&192)===128&&(d&192)===128&&(h=(o&15)<<18|(f&63)<<12|(u&63)<<6|d&63,h>65535&&h<1114112&&(i=h))}}i===null?(i=65533,c=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),t+=c}return uo(n)}s(Xe,"utf8Slice");var Ze=4096;function uo(e){let t=e.length;if(t<=Ze)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Ze));return r}s(uo,"decodeCodePointsArray");var lo=256,Ct=class{constructor(t=lo){this.chunkSize=t,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let o=r.length-(this.maxCursor-this.cursor)-1;r.set(t,o)}else{if(r){let o=r.length-(this.maxCursor-this.cursor)-1;o<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,o),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=tr(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=Et(n,0,this.cursor)}else r=qe(this.chunks,this.cursor);return t&&this.reset(),r}};s(Ct,"Bl");var m="CBOR decode error:",Ee="CBOR encode error:",vt=[];vt[23]=1;vt[24]=2;vt[25]=3;vt[26]=5;vt[27]=9;function K(e,t,r){if(e.length-t<r)throw new Error(`${m} not enough data for type`)}s(K,"assertEnoughData");var A=[24,256,65536,4294967296,BigInt("18446744073709551616")];function D(e,t,r){K(e,t,1);let n=e[t];if(r.strict===!0&&n<A[0])throw new Error(`${m} integer encoded in more bytes than necessary (strict decode)`);return n}s(D,"readUint8");function S(e,t,r){K(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<A[1])throw new Error(`${m} integer encoded in more bytes than necessary (strict decode)`);return n}s(S,"readUint16");function M(e,t,r){K(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<A[2])throw new Error(`${m} integer encoded in more bytes than necessary (strict decode)`);return n}s(M,"readUint32");function R(e,t,r){K(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],i=(BigInt(n)<<BigInt(32))+BigInt(o);if(r.strict===!0&&i<A[3])throw new Error(`${m} integer encoded in more bytes than necessary (strict decode)`);if(i<=Number.MAX_SAFE_INTEGER)return Number(i);if(r.allowBigInt===!0)return i;throw new Error(`${m} integers outside of the safe integer range are not supported`)}s(R,"readUint64");function rr(e,t,r,n){return new l(a.uint,D(e,t+1,n),2)}s(rr,"decodeUint8");function nr(e,t,r,n){return new l(a.uint,S(e,t+1,n),3)}s(nr,"decodeUint16");function or(e,t,r,n){return new l(a.uint,M(e,t+1,n),5)}s(or,"decodeUint32");function ir(e,t,r,n){return new l(a.uint,R(e,t+1,n),9)}s(ir,"decodeUint64");function N(e,t){return B(e,0,t.value)}s(N,"encodeUint");function B(e,t,r){if(r<A[0]){let n=Number(r);e.push([t|n])}else if(r<A[1]){let n=Number(r);e.push([t|24,n])}else if(r<A[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<A[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<A[4]){let o=[t|27,0,0,0,0,0,0,0],i=Number(n&BigInt(4294967295)),c=Number(n>>BigInt(32)&BigInt(4294967295));o[8]=i&255,i=i>>8,o[7]=i&255,i=i>>8,o[6]=i&255,i=i>>8,o[5]=i&255,o[4]=c&255,c=c>>8,o[3]=c&255,c=c>>8,o[2]=c&255,c=c>>8,o[1]=c&255,e.push(o)}else throw new Error(`${m} encountered BigInt larger than allowable range`)}}s(B,"encodeUintValue");N.encodedSize=s(function(t){return B.encodedSize(t.value)},"encodedSize");B.encodedSize=s(function(t){return t<A[0]?1:t<A[1]?2:t<A[2]?3:t<A[3]?5:9},"encodedSize");N.compareTokens=s(function(t,r){return t.value<r.value?-1:t.value>r.value?1:0},"compareTokens");function sr(e,t,r,n){return new l(a.negint,-1-D(e,t+1,n),2)}s(sr,"decodeNegint8");function cr(e,t,r,n){return new l(a.negint,-1-S(e,t+1,n),3)}s(cr,"decodeNegint16");function ar(e,t,r,n){return new l(a.negint,-1-M(e,t+1,n),5)}s(ar,"decodeNegint32");var Ce=BigInt(-1),fr=BigInt(1);function ur(e,t,r,n){let o=R(e,t+1,n);if(typeof o!="bigint"){let i=-1-o;if(i>=Number.MIN_SAFE_INTEGER)return new l(a.negint,i,9)}if(n.allowBigInt!==!0)throw new Error(`${m} integers outside of the safe integer range are not supported`);return new l(a.negint,Ce-BigInt(o),9)}s(ur,"decodeNegint64");function re(e,t){let r=t.value,n=typeof r=="bigint"?r*Ce-fr:r*-1-1;B(e,t.type.majorEncoded,n)}s(re,"encodeNegint");re.encodedSize=s(function(t){let r=t.value,n=typeof r=="bigint"?r*Ce-fr:r*-1-1;return n<A[0]?1:n<A[1]?2:n<A[2]?3:n<A[3]?5:9},"encodedSize");re.compareTokens=s(function(t,r){return t.value<r.value?1:t.value>r.value?-1:0},"compareTokens");function Nt(e,t,r,n){K(e,t,r+n);let o=Et(e,t+r,t+r+n);return new l(a.bytes,o,r+n)}s(Nt,"toToken");function dr(e,t,r,n){return Nt(e,t,1,r)}s(dr,"decodeBytesCompact");function lr(e,t,r,n){return Nt(e,t,2,D(e,t+1,n))}s(lr,"decodeBytes8");function pr(e,t,r,n){return Nt(e,t,3,S(e,t+1,n))}s(pr,"decodeBytes16");function hr(e,t,r,n){return Nt(e,t,5,M(e,t+1,n))}s(hr,"decodeBytes32");function mr(e,t,r,n){let o=R(e,t+1,n);if(typeof o=="bigint")throw new Error(`${m} 64-bit integer bytes lengths not supported`);return Nt(e,t,9,o)}s(mr,"decodeBytes64");function ne(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===a.string?Ye(e.value):e.value),e.encodedBytes}s(ne,"tokenBytes");function _t(e,t){let r=ne(t);B(e,t.type.majorEncoded,r.length),e.push(r)}s(_t,"encodeBytes");_t.encodedSize=s(function(t){let r=ne(t);return B.encodedSize(r.length)+r.length},"encodedSize");_t.compareTokens=s(function(t,r){return ho(ne(t),ne(r))},"compareTokens");function ho(e,t){return e.length<t.length?-1:e.length>t.length?1:er(e,t)}s(ho,"compareBytes");function Lt(e,t,r,n,o){let i=r+n;K(e,t,i);let c=new l(a.string,Je(e,t+r,t+i),i);return o.retainStringBytes===!0&&(c.byteValue=Et(e,t+r,t+i)),c}s(Lt,"toToken");function xr(e,t,r,n){return Lt(e,t,1,r,n)}s(xr,"decodeStringCompact");function gr(e,t,r,n){return Lt(e,t,2,D(e,t+1,n),n)}s(gr,"decodeString8");function yr(e,t,r,n){return Lt(e,t,3,S(e,t+1,n),n)}s(yr,"decodeString16");function wr(e,t,r,n){return Lt(e,t,5,M(e,t+1,n),n)}s(wr,"decodeString32");function br(e,t,r,n){let o=R(e,t+1,n);if(typeof o=="bigint")throw new Error(`${m} 64-bit integer string lengths not supported`);return Lt(e,t,9,o,n)}s(br,"decodeString64");var Er=_t;function Tt(e,t,r,n){return new l(a.array,n,r)}s(Tt,"toToken");function Cr(e,t,r,n){return Tt(e,t,1,r)}s(Cr,"decodeArrayCompact");function _r(e,t,r,n){return Tt(e,t,2,D(e,t+1,n))}s(_r,"decodeArray8");function Tr(e,t,r,n){return Tt(e,t,3,S(e,t+1,n))}s(Tr,"decodeArray16");function Ar(e,t,r,n){return Tt(e,t,5,M(e,t+1,n))}s(Ar,"decodeArray32");function Br(e,t,r,n){let o=R(e,t+1,n);if(typeof o=="bigint")throw new Error(`${m} 64-bit integer array lengths not supported`);return Tt(e,t,9,o)}s(Br,"decodeArray64");function kr(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${m} indefinite length items not allowed`);return Tt(e,t,1,1/0)}s(kr,"decodeArrayIndefinite");function oe(e,t){B(e,a.array.majorEncoded,t.value)}s(oe,"encodeArray");oe.compareTokens=N.compareTokens;oe.encodedSize=s(function(t){return B.encodedSize(t.value)},"encodedSize");function At(e,t,r,n){return new l(a.map,n,r)}s(At,"toToken");function Ur(e,t,r,n){return At(e,t,1,r)}s(Ur,"decodeMapCompact");function Ir(e,t,r,n){return At(e,t,2,D(e,t+1,n))}s(Ir,"decodeMap8");function Dr(e,t,r,n){return At(e,t,3,S(e,t+1,n))}s(Dr,"decodeMap16");function Sr(e,t,r,n){return At(e,t,5,M(e,t+1,n))}s(Sr,"decodeMap32");function Mr(e,t,r,n){let o=R(e,t+1,n);if(typeof o=="bigint")throw new Error(`${m} 64-bit integer map lengths not supported`);return At(e,t,9,o)}s(Mr,"decodeMap64");function Rr(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${m} indefinite length items not allowed`);return At(e,t,1,1/0)}s(Rr,"decodeMapIndefinite");function ie(e,t){B(e,a.map.majorEncoded,t.value)}s(ie,"encodeMap");ie.compareTokens=N.compareTokens;ie.encodedSize=s(function(t){return B.encodedSize(t.value)},"encodedSize");function Or(e,t,r,n){return new l(a.tag,r,1)}s(Or,"decodeTagCompact");function vr(e,t,r,n){return new l(a.tag,D(e,t+1,n),2)}s(vr,"decodeTag8");function Nr(e,t,r,n){return new l(a.tag,S(e,t+1,n),3)}s(Nr,"decodeTag16");function Lr(e,t,r,n){return new l(a.tag,M(e,t+1,n),5)}s(Lr,"decodeTag32");function Fr(e,t,r,n){return new l(a.tag,R(e,t+1,n),9)}s(Fr,"decodeTag64");function se(e,t){B(e,a.tag.majorEncoded,t.value)}s(se,"encodeTag");se.compareTokens=N.compareTokens;se.encodedSize=s(function(t){return B.encodedSize(t.value)},"encodedSize");var bo=20,Eo=21,Co=22,_o=23;function $r(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${m} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new l(a.null,null,1):new l(a.undefined,void 0,1)}s($r,"decodeUndefined");function Pr(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${m} indefinite length items not allowed`);return new l(a.break,void 0,1)}s(Pr,"decodeBreak");function _e(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${m} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${m} Infinity values are not supported`)}return new l(a.float,e,t)}s(_e,"createToken");function zr(e,t,r,n){return _e(Te(e,t+1),3,n)}s(zr,"decodeFloat16");function jr(e,t,r,n){return _e(Ae(e,t+1),5,n)}s(jr,"decodeFloat32");function Vr(e,t,r,n){return _e(Qr(e,t+1),9,n)}s(Vr,"decodeFloat64");function ce(e,t,r){let n=t.value;if(n===!1)e.push([a.float.majorEncoded|bo]);else if(n===!0)e.push([a.float.majorEncoded|Eo]);else if(n===null)e.push([a.float.majorEncoded|Co]);else if(n===void 0)e.push([a.float.majorEncoded|_o]);else{let o,i=!1;(!r||r.float64!==!0)&&(Kr(n),o=Te($,1),n===o||Number.isNaN(n)?($[0]=249,e.push($.slice(0,3)),i=!0):(Wr(n),o=Ae($,1),n===o&&($[0]=250,e.push($.slice(0,5)),i=!0))),i||(To(n),o=Qr($,1),$[0]=251,e.push($.slice(0,9)))}}s(ce,"encodeFloat");ce.encodedSize=s(function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){Kr(n);let o=Te($,1);if(n===o||Number.isNaN(n))return 3;if(Wr(n),o=Ae($,1),n===o)return 5}return 9},"encodedSize");var Hr=new ArrayBuffer(9),L=new DataView(Hr,1),$=new Uint8Array(Hr,0);function Kr(e){if(e===1/0)L.setUint16(0,31744,!1);else if(e===-1/0)L.setUint16(0,64512,!1);else if(Number.isNaN(e))L.setUint16(0,32256,!1);else{L.setFloat32(0,e);let t=L.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)L.setUint16(0,31744,!1);else if(r===0)L.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let o=r-127;o<-24?L.setUint16(0,0):o<-14?L.setUint16(0,(t&2147483648)>>16|1<<24+o,!1):L.setUint16(0,(t&2147483648)>>16|o+15<<10|n>>13,!1)}}}s(Kr,"encodeFloat16");function Te(e,t){if(e.length-t<2)throw new Error(`${m} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,o=r&1023,i;return n===0?i=o*2**-24:n!==31?i=(o+1024)*2**(n-25):i=o===0?1/0:NaN,r&32768?-i:i}s(Te,"readFloat16");function Wr(e){L.setFloat32(0,e,!1)}s(Wr,"encodeFloat32");function Ae(e,t){if(e.length-t<4)throw new Error(`${m} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}s(Ae,"readFloat32");function To(e){L.setFloat64(0,e,!1)}s(To,"encodeFloat64");function Qr(e,t){if(e.length-t<8)throw new Error(`${m} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}s(Qr,"readFloat64");ce.compareTokens=N.compareTokens;function y(e,t,r){throw new Error(`${m} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}s(y,"invalidMinor");function ae(e){return()=>{throw new Error(`${m} ${e}`)}}s(ae,"errorer");var p=[];for(let e=0;e<=23;e++)p[e]=y;p[24]=rr;p[25]=nr;p[26]=or;p[27]=ir;p[28]=y;p[29]=y;p[30]=y;p[31]=y;for(let e=32;e<=55;e++)p[e]=y;p[56]=sr;p[57]=cr;p[58]=ar;p[59]=ur;p[60]=y;p[61]=y;p[62]=y;p[63]=y;for(let e=64;e<=87;e++)p[e]=dr;p[88]=lr;p[89]=pr;p[90]=hr;p[91]=mr;p[92]=y;p[93]=y;p[94]=y;p[95]=ae("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)p[e]=xr;p[120]=gr;p[121]=yr;p[122]=wr;p[123]=br;p[124]=y;p[125]=y;p[126]=y;p[127]=ae("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)p[e]=Cr;p[152]=_r;p[153]=Tr;p[154]=Ar;p[155]=Br;p[156]=y;p[157]=y;p[158]=y;p[159]=kr;for(let e=160;e<=183;e++)p[e]=Ur;p[184]=Ir;p[185]=Dr;p[186]=Sr;p[187]=Mr;p[188]=y;p[189]=y;p[190]=y;p[191]=Rr;for(let e=192;e<=215;e++)p[e]=Or;p[216]=vr;p[217]=Nr;p[218]=Lr;p[219]=Fr;p[220]=y;p[221]=y;p[222]=y;p[223]=y;for(let e=224;e<=243;e++)p[e]=ae("simple values are not supported");p[244]=y;p[245]=y;p[246]=y;p[247]=$r;p[248]=ae("simple values are not supported");p[249]=zr;p[250]=jr;p[251]=Vr;p[252]=y;p[253]=y;p[254]=y;p[255]=Pr;var P=[];for(let e=0;e<24;e++)P[e]=new l(a.uint,e,1);for(let e=-1;e>=-24;e--)P[31-e]=new l(a.negint,e,1);P[64]=new l(a.bytes,new Uint8Array(0),1);P[96]=new l(a.string,"",1);P[128]=new l(a.array,0,1);P[160]=new l(a.map,0,1);P[244]=new l(a.false,!1,1);P[245]=new l(a.true,!0,1);P[246]=new l(a.null,null,1);function Gr(e){switch(e.type){case a.false:return V([244]);case a.true:return V([245]);case a.null:return V([246]);case a.bytes:return e.value.length?void 0:V([64]);case a.string:return e.value===""?V([96]):void 0;case a.array:return e.value===0?V([128]):void 0;case a.map:return e.value===0?V([160]):void 0;case a.uint:return e.value<24?V([Number(e.value)]):void 0;case a.negint:if(e.value>=-24)return V([31-Number(e.value)])}}s(Gr,"quickEncodeToken");var Bo={float64:!1,mapSorter:Io,quickEncodeToken:Gr};function ko(){let e=[];return e[a.uint.major]=N,e[a.negint.major]=re,e[a.bytes.major]=_t,e[a.string.major]=Er,e[a.array.major]=oe,e[a.map.major]=ie,e[a.tag.major]=se,e[a.float.major]=ce,e}s(ko,"makeCborEncoders");var Xr=ko(),Be=new Ct,ct=class{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${Ee} object contains circular references`);return new ct(r,t)}};s(ct,"Ref");var G={null:new l(a.null,null),undefined:new l(a.undefined,void 0),true:new l(a.true,!0),false:new l(a.false,!1),emptyArray:new l(a.array,0),emptyMap:new l(a.map,0)},X={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new l(a.float,e):e>=0?new l(a.uint,e):new l(a.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new l(a.uint,e):new l(a.negint,e)},Uint8Array(e,t,r,n){return new l(a.bytes,e)},string(e,t,r,n){return new l(a.string,e)},boolean(e,t,r,n){return e?G.true:G.false},null(e,t,r,n){return G.null},undefined(e,t,r,n){return G.undefined},ArrayBuffer(e,t,r,n){return new l(a.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new l(a.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[G.emptyArray,new l(a.break)]:G.emptyArray;n=ct.createCheck(n,e);let o=[],i=0;for(let c of e)o[i++]=fe(c,r,n);return r.addBreakTokens?[new l(a.array,e.length),o,new l(a.break)]:[new l(a.array,e.length),o]},Object(e,t,r,n){let o=t!=="Object",i=o?e.keys():Object.keys(e),c=o?e.size:i.length;if(!c)return r.addBreakTokens===!0?[G.emptyMap,new l(a.break)]:G.emptyMap;n=ct.createCheck(n,e);let f=[],u=0;for(let d of i)f[u++]=[fe(d,r,n),fe(o?e.get(d):e[d],r,n)];return Uo(f,r),r.addBreakTokens?[new l(a.map,c),f,new l(a.break)]:[new l(a.map,c),f]}};X.Map=X.Object;X.Buffer=X.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))X[`${e}Array`]=X.DataView;function fe(e,t={},r){let n=Qe(e),o=t&&t.typeEncoders&&t.typeEncoders[n]||X[n];if(typeof o=="function"){let c=o(e,n,t,r);if(c!=null)return c}let i=X[n];if(!i)throw new Error(`${Ee} unsupported type: ${n}`);return i(e,n,t,r)}s(fe,"objectToTokens");function Uo(e,t){t.mapSorter&&e.sort(t.mapSorter)}s(Uo,"sortMapEntries");function Io(e,t){let r=Array.isArray(e[0])?e[0][0]:e[0],n=Array.isArray(t[0])?t[0][0]:t[0];if(r.type!==n.type)return r.type.compare(n.type);let o=r.type.major,i=Xr[o].compareTokens(r,n);return i===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),i}s(Io,"mapSorter");function Zr(e,t,r,n){if(Array.isArray(t))for(let o of t)Zr(e,o,r,n);else r[t.type.major](e,t,n)}s(Zr,"tokensToEncoded");function Do(e,t,r){let n=fe(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let o=r.quickEncodeToken(n);if(o)return o;let i=t[n.type.major];if(i.encodedSize){let c=i.encodedSize(n,r),f=new Ct(c);if(i(f,n,r),f.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return be(f.chunks[0])}}return Be.reset(),Zr(Be,n,t,r),Be.toBytes(!0)}s(Do,"encodeCustom");function Ft(e,t){return t=Object.assign({},Bo,t),Do(e,Xr,t)}s(Ft,"encode");var So={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},$t=class{constructor(t,r={}){this._pos=0,this.data=t,this.options=r}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let t=this.data[this._pos],r=P[t];if(r===void 0){let n=p[t];if(!n)throw new Error(`${m} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let o=t&31;r=n(this.data,this._pos,o,this.options)}return this._pos+=r.encodedLength,r}};s($t,"Tokeniser");var Pt=Symbol.for("DONE"),ue=Symbol.for("BREAK");function Mo(e,t,r){let n=[];for(let o=0;o<e.value;o++){let i=Bt(t,r);if(i===ue){if(e.value===1/0)break;throw new Error(`${m} got unexpected break to lengthed array`)}if(i===Pt)throw new Error(`${m} found array but not enough entries (got ${o}, expected ${e.value})`);n[o]=i}return n}s(Mo,"tokenToArray");function Ro(e,t,r){let n=r.useMaps===!0,o=n?void 0:{},i=n?new Map:void 0;for(let c=0;c<e.value;c++){let f=Bt(t,r);if(f===ue){if(e.value===1/0)break;throw new Error(`${m} got unexpected break to lengthed map`)}if(f===Pt)throw new Error(`${m} found map but not enough entries (got ${c} [no key], expected ${e.value})`);if(n!==!0&&typeof f!="string")throw new Error(`${m} non-string keys not supported (got ${typeof f})`);if(r.rejectDuplicateMapKeys===!0&&(n&&i.has(f)||!n&&f in o))throw new Error(`${m} found repeat map key "${f}"`);let u=Bt(t,r);if(u===Pt)throw new Error(`${m} found map but not enough entries (got ${c} [no value], expected ${e.value})`);n?i.set(f,u):o[f]=u}return n?i:o}s(Ro,"tokenToMap");function Bt(e,t){if(e.done())return Pt;let r=e.next();if(r.type===a.break)return ue;if(r.type.terminal)return r.value;if(r.type===a.array)return Mo(r,e,t);if(r.type===a.map)return Ro(r,e,t);if(r.type===a.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Bt(e,t);return t.tags[r.value](n)}throw new Error(`${m} tag not supported (${r.value})`)}throw new Error("unsupported")}s(Bt,"tokensToObject");function Jr(e,t){if(!(e instanceof Uint8Array))throw new Error(`${m} data to decode must be a Uint8Array`);t=Object.assign({},So,t);let r=t.tokenizer||new $t(e,t),n=Bt(r,t);if(n===Pt)throw new Error(`${m} did not find any content to decode`);if(n===ue)throw new Error(`${m} got unexpected break`);return[n,e.subarray(r.pos())]}s(Jr,"decodeFirst");function zt(e,t){let[r,n]=Jr(e,t);if(n.length>0)throw new Error(`${m} too many terminals, data makes no sense`);return r}s(zt,"decode");var E=class extends Error{constructor(t,r){super(),this.message=r,this.value=t,this.stack=new Error(`${t}: ${r}`).stack,this.name=this.constructor.name}};s(E,"CborldError");var z=new Map([["@context",0],["@type",2],["@id",4],["@value",6],["@direction",8],["@graph",10],["@included",12],["@index",14],["@json",16],["@language",18],["@list",20],["@nest",22],["@reverse",24],["@base",26],["@container",28],["@default",30],["@embed",32],["@explicit",34],["@none",36],["@omitDefault",38],["@prefix",40],["@preserve",42],["@protected",44],["@requireAll",46],["@set",48],["@version",50],["@vocab",52]]),le=100;var _=class{decode({value:t}={}){throw new Error("Must be implemented by derived class.")}static createDecoder({value:t,transformer:r}={}){throw new Error("Must be implemented by derived class.")}};s(_,"CborldDecoder");var ke=new Map,Ue=new Map;T(16,"https://www.w3.org/ns/activitystreams");T(17,"https://www.w3.org/2018/credentials/v1");T(18,"https://www.w3.org/ns/did/v1");T(19,"https://w3id.org/security/suites/ed25519-2018/v1");T(20,"https://w3id.org/security/suites/ed25519-2020/v1");T(21,"https://w3id.org/cit/v1");T(22,"https://w3id.org/age/v1");T(23,"https://w3id.org/security/suites/x25519-2020/v1");T(24,"https://w3id.org/veres-one/v1");T(25,"https://w3id.org/webkms/v1");T(26,"https://w3id.org/zcap/v1");T(27,"https://w3id.org/security/suites/hmac-2019/v1");T(28,"https://w3id.org/security/suites/aes-2019/v1");T(29,"https://w3id.org/vaccination/v1");T(30,"https://w3id.org/vc-revocation-list-2020/v1");T(31,"https://w3id.org/dcc/v1");T(32,"https://w3id.org/vc/status-list/v1");T(48,"https://w3id.org/security/data-integrity/v1");T(49,"https://w3id.org/security/multikey/v1");T(50,"https://purl.imsglobal.org/spec/ob/v3p0/context.json");T(51,"https://w3id.org/security/data-integrity/v2");function T(e,t){Ue.set(t,e),ke.set(e,t)}s(T,"_addRegistration");var Z=class extends _{constructor({reverseAppContextMap:t}={}){super(),this.reverseAppContextMap=t}decode({value:t}={}){if(typeof t!="number")return Ie(t);let r=ke.get(t)||this.reverseAppContextMap.get(t);if(r===void 0)throw new E("ERR_UNDEFINED_COMPRESSED_CONTEXT",`Undefined compressed context "${t}".`);return r}static createDecoder({transformer:t}={}){let{reverseAppContextMap:r}=t;return new Z({reverseAppContextMap:r})}};s(Z,"ContextDecoder");function Ie(e){if(Array.isArray(e))return e.map(Ie);if(!(e instanceof Map))return e;let t={};for(let[r,n]of e)t[r]=Ie(n);return t}s(Ie,"_mapToObject");function J(e,t){return JSON.stringify(e,null,2)}s(J,"inspect");var nn="3.7.7",Oo=nn,Ut=typeof Buffer=="function",Yr=typeof TextDecoder=="function"?new TextDecoder:void 0,qr=typeof TextEncoder=="function"?new TextEncoder:void 0,vo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",jt=Array.prototype.slice.call(vo),pe=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(jt),No=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,k=String.fromCharCode.bind(String),tn=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),on=s(e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),"_mkUriSafe"),sn=s(e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),"_tidyB64"),cn=s(e=>{let t,r,n,o,i="",c=e.length%3;for(let f=0;f<e.length;){if((r=e.charCodeAt(f++))>255||(n=e.charCodeAt(f++))>255||(o=e.charCodeAt(f++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|o,i+=jt[t>>18&63]+jt[t>>12&63]+jt[t>>6&63]+jt[t&63]}return c?i.slice(0,c-3)+"===".substring(c):i},"btoaPolyfill"),Me=typeof btoa=="function"?e=>btoa(e):Ut?e=>Buffer.from(e,"binary").toString("base64"):cn,De=Ut?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,o=e.length;n<o;n+=4096)r.push(k.apply(null,e.subarray(n,n+4096)));return Me(r.join(""))},he=s((e,t=!1)=>t?on(De(e)):De(e),"fromUint8Array"),Lo=s(e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?k(192|t>>>6)+k(128|t&63):k(224|t>>>12&15)+k(128|t>>>6&63)+k(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return k(240|t>>>18&7)+k(128|t>>>12&63)+k(128|t>>>6&63)+k(128|t&63)}},"cb_utob"),Fo=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,an=s(e=>e.replace(Fo,Lo),"utob"),en=Ut?e=>Buffer.from(e,"utf8").toString("base64"):qr?e=>De(qr.encode(e)):e=>Me(an(e)),kt=s((e,t=!1)=>t?on(en(e)):en(e),"encode"),rn=s(e=>kt(e,!0),"encodeURI"),$o=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Po=s(e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return k((r>>>10)+55296)+k((r&1023)+56320);case 3:return k((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return k((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},"cb_btou"),fn=s(e=>e.replace($o,Po),"btou"),un=s(e=>{if(e=e.replace(/\s+/g,""),!No.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,o;for(let i=0;i<e.length;)t=pe[e.charAt(i++)]<<18|pe[e.charAt(i++)]<<12|(n=pe[e.charAt(i++)])<<6|(o=pe[e.charAt(i++)]),r+=n===64?k(t>>16&255):o===64?k(t>>16&255,t>>8&255):k(t>>16&255,t>>8&255,t&255);return r},"atobPolyfill"),Re=typeof atob=="function"?e=>atob(sn(e)):Ut?e=>Buffer.from(e,"base64").toString("binary"):un,dn=Ut?e=>tn(Buffer.from(e,"base64")):e=>tn(Re(e).split("").map(t=>t.charCodeAt(0))),ln=s(e=>dn(pn(e)),"toUint8Array"),zo=Ut?e=>Buffer.from(e,"base64").toString("utf8"):Yr?e=>Yr.decode(dn(e)):e=>fn(Re(e)),pn=s(e=>sn(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),"_unURI"),Se=s(e=>zo(pn(e)),"decode"),jo=s(e=>{if(typeof e!="string")return!1;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},"isValid"),hn=s(e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),"_noEnum"),mn=s(function(){let e=s((t,r)=>Object.defineProperty(String.prototype,t,hn(r)),"_add");e("fromBase64",function(){return Se(this)}),e("toBase64",function(t){return kt(this,t)}),e("toBase64URI",function(){return kt(this,!0)}),e("toBase64URL",function(){return kt(this,!0)}),e("toUint8Array",function(){return ln(this)})},"extendString"),xn=s(function(){let e=s((t,r)=>Object.defineProperty(Uint8Array.prototype,t,hn(r)),"_add");e("toBase64",function(t){return he(this,t)}),e("toBase64URI",function(){return he(this,!0)}),e("toBase64URL",function(){return he(this,!0)})},"extendUint8Array"),Vo=s(()=>{mn(),xn()},"extendBuiltins"),me={version:nn,VERSION:Oo,atob:Re,atobPolyfill:un,btoa:Me,btoaPolyfill:cn,fromBase64:Se,toBase64:kt,encode:kt,encodeURI:rn,encodeURL:rn,utob:an,btou:fn,decode:Se,isValid:jo,fromUint8Array:he,toUint8Array:ln,extendString:mn,extendUint8Array:xn,extendBuiltins:Vo};var gn={};function yn(e,t,r){if(!(e instanceof Uint8Array))throw new TypeError('"input" must be a Uint8Array.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(r!==void 0&&typeof r!="number")throw new TypeError('"maxline" must be a number.');if(e.length===0)return"";let n="",o=0,i=t.length,c=t.charAt(0),f=[0];for(o=0;o<e.length;++o){let u=e[o];for(let d=0;d<f.length;++d)u+=f[d]<<8,f[d]=u%i,u=u/i|0;for(;u>0;)f.push(u%i),u=u/i|0}for(o=0;e[o]===0&&o<e.length-1;++o)n+=c;for(o=f.length-1;o>=0;--o)n+=t[f[o]];if(r){let u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join(`\r
2
+ `)}return n}s(yn,"encode");function wn(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(e.length===0)return new Uint8Array;let r=gn[t];if(!r){r=gn[t]=[];for(let c=0;c<t.length;++c)r[t.charCodeAt(c)]=c}e=e.replace(/\s/g,"");let n=t.length,o=t.charAt(0),i=[0];for(let c=0;c<e.length;c++){let f=r[e.charCodeAt(c)];if(f===void 0)return;let u=f;for(let d=0;d<i.length;++d)u+=i[d]*n,i[d]=u&255,u>>=8;for(;u>0;)i.push(u&255),u>>=8}for(let c=0;e[c]===o&&c<e.length-1;++c)i.push(0);return new Uint8Array(i.reverse())}s(wn,"decode");var bn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";function Vt(e,t){return yn(e,bn,t)}s(Vt,"encode");function xe(e){return wn(e,bn)}s(xe,"decode");var at=class extends _{decode({value:t}={}){let{buffer:r,byteOffset:n,length:o}=t,i=new Uint8Array(r,n+1,o-1);return t[0]===122?`z${Vt(i)}`:t[0]===77?`M${me.fromUint8Array(i)}`:t}static createDecoder({value:t}={}){if(!(t instanceof Uint8Array))return!1;if(t[0]===122||t[0]===77)return new at}};s(at,"MultibaseDecoder");var ft=class{constructor({appContextMap:t,documentLoader:r}={}){this.appContextMap=t,this.documentLoader=r}_beforeObjectContexts(){}_afterObjectContexts(){}_beforeTypeScopedContexts(){}async _transform({obj:t,transformMap:r,contextStack:n=[]}){this._beforeObjectContexts({obj:t,transformMap:r});let o=await this._applyEmbeddedContexts({obj:t,contextStack:n});this._afterObjectContexts({obj:t,transformMap:r});let i=n.slice();this._beforeTypeScopedContexts({activeCtx:o,obj:t,transformMap:r}),o=await this._applyTypeScopedContexts({obj:t,contextStack:n});let{aliases:c,scopedContextMap:f,termMap:u}=o,d=this._getEntries({obj:t,transformMap:r,transformer:this,termMap:u});for(let[h,x]of d){let{term:g}=h;if(g==="@id"||c.id.has(g)){this._transformObjectId({obj:t,transformMap:r,termInfo:h,value:x});continue}if(g==="@type"||c.type.has(g)){this._transformObjectType({obj:t,transformMap:r,termInfo:h,value:x});continue}let w=i,I,Yt=f.get(g);Yt&&(I=await this._applyEmbeddedContexts({obj:{"@context":Yt},contextStack:n}),w=n.slice());let{plural:qt,def:we}=h,F=this._getTermType({activeCtx:I||o,def:we}),te=qt?x:[x],wt=[];for(let it of te){if(it===null){wt.push(null);continue}if(!this._transformTypedValue({entries:wt,termType:F,value:it,termInfo:h})){if(typeof it!="object"){wt.push(it);continue}if(Array.isArray(it)){await this._transformArray({entries:wt,contextStack:w,value:it});continue}await this._transformObject({entries:wt,contextStack:w,value:it})}}I&&I.revert(),this._assignEntries({entries:wt,obj:t,transformMap:r,termInfo:h})}o.revert()}async _applyEmbeddedContexts({obj:t,contextStack:r}){let n=r.length,o=t["@context"];await this._updateContextStack({contextStack:r,contexts:o});let i=r[r.length-1];return i||(i={aliases:{id:new Set,type:new Set},context:{},scopedContextMap:new Map,termMap:new Map}),{...i,revert(){r.length=n}}}async _applyTypeScopedContexts({obj:t,contextStack:r}){let n=r.length,o=r[r.length-1];o||(o={aliases:{id:new Set,type:new Set},context:{},scopedContextMap:new Map,termMap:new Map});let{aliases:i}=o,c=[],f=["@type",...i.type];for(let d of f){let h=t[d];Array.isArray(h)?c.push(...h):c.push(h)}c=[...new Set(c)].sort();let{scopedContextMap:u}=o;for(let d of c){let h=u.get(d);h&&(await this._updateContextStack({contextStack:r,contexts:h}),o=r[r.length-1],{scopedContextMap:u}=o)}return{...o,revert(){r.length=n}}}async _updateContextStack({contextStack:t,contexts:r,transformer:n}){if(!r)return;Array.isArray(r)||(r=[r]);let{contextMap:o}=this;for(let i of r){let c=o.get(i);if(!c){let g=i,w;typeof i=="string"&&(w=i,{"@context":g}=await this._getDocument({url:w})),c=await this._addContext({context:g,contextUrl:w,transformer:n})}let f={aliases:{id:new Set(c.aliases.id),type:new Set(c.aliases.type)},context:i,scopedContextMap:new Map(c.scopedContextMap),termMap:new Map(c.termMap)},u=t[t.length-1];if(t.push(f),!u)continue;let{aliases:d,termMap:h}=f;for(let g of["id","type"])for(let w of u.aliases[g])i[w]===null||f.termMap.has(w)||d[g].add(w);let{scopedContextMap:x}=f;for(let[g,w]of u.scopedContextMap)i[g]===null||x.has(g)||x.set(g,w);for(let[g,w]of u.termMap)i[g]===null||h.has(g)||h.set(g,w)}}async _addContext({context:t,contextUrl:r}){let{contextMap:n,termToId:o,idToTerm:i}=this,c=t["@import"];if(c){let x=n.get(c);if(!x){let{"@context":g}=await this._getDocument({url:c});x=await this._addContext({context:g,contextUrl:c})}t={...x.context,...t}}let f=new Map,u=new Map,d={aliases:{id:new Set,type:new Set},context:t,scopedContextMap:f,termMap:u},h=Object.keys(t).sort();for(let x of h){let g=t[x];if(!g||(g==="@id"||g.id==="@id"?d.aliases.id.add(x):(g==="@type"||g.id==="@type")&&d.aliases.type.add(x),z.has(x)))continue;if(!o.has(x)){let I=this.nextTermId;this.nextTermId+=2,o.set(x,I),i&&i.set(I,x)}u.set(x,g);let w=g["@context"];w&&f.set(x,w)}return n.set(r||t,d),d}async _getDocument({url:t}){let{document:r}=await this.documentLoader(t);return typeof r=="string"?JSON.parse(r):r}_getTermType({activeCtx:t,def:r}){let{"@type":n}=r;if(!n)return;let[o,...i]=n.split(":"),c=t.termMap.get(o);if(c===void 0)return n;if(typeof c=="string")return c+i.join(":");if(!(typeof c=="object"&&typeof c["@id"]=="string"))throw new E("ERR_INVALID_TERM_DEFINITION",'JSON-LD term definitions must be strings or objects with "@id".');return c["@id"]+i.join(":")}_getIdForTerm({term:t,plural:r}){let n=this.termToId.get(t);if(n===void 0)throw new E("ERR_UNDEFINED_TERM","CBOR-LD compression requires all terms to be defined in a JSON-LD context.");return r?n+1:n}_getTermForId({id:t}){let r=(t&1)===1;return{term:this.idToTerm.get(r?t-1:t),plural:r}}};s(ft,"Transformer");var En=new Map([[1024,"did:v1:nym:"],[1025,"did:key:"]]),Y=class extends _{decode({value:t}={}){let r=En.get(t[0]);return typeof t[1]=="string"?r+=t[1]:r+=`z${Vt(t[1])}`,t.length>2&&(typeof t[2]=="string"?r+=`#${t[2]}`:r+=`#z${Vt(t[2])}`),r}static createDecoder({value:t}={}){return!(Array.isArray(t)&&t.length>1&&t.length<=3)||!En.has(t[0])?!1:new Y}};s(Y,"Base58DidUrlDecoder");var q=class extends _{constructor({secure:t}={}){super(),this.secure=t}decode({value:t}={}){return`${this.secure?"https://":"http://"}${t[1]}`}static createDecoder({value:t}={}){return t.length===2&&typeof t[1]=="string"?new q({secure:t[0]===2}):!1}};s(q,"HttpUrlDecoder");var Cn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ho(e){return typeof e=="string"&&Cn.test(e)}s(Ho,"validate");var ge=Ho;var U=[];for(let e=0;e<256;++e)U.push((e+256).toString(16).slice(1));function Ko(e,t=0){return U[e[t+0]]+U[e[t+1]]+U[e[t+2]]+U[e[t+3]]+"-"+U[e[t+4]]+U[e[t+5]]+"-"+U[e[t+6]]+U[e[t+7]]+"-"+U[e[t+8]]+U[e[t+9]]+"-"+U[e[t+10]]+U[e[t+11]]+U[e[t+12]]+U[e[t+13]]+U[e[t+14]]+U[e[t+15]]}s(Ko,"unsafeStringify");function Wo(e,t=0){let r=Ko(e,t);if(!ge(r))throw TypeError("Stringified UUID is invalid");return r}s(Wo,"stringify");var Oe=Wo;function Qo(e){if(!ge(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}s(Qo,"parse");var ve=Qo;var ut=class extends _{decode({value:t}={}){return`urn:uuid:${typeof t[1]=="string"?t[1]:Oe(t[1])}`}static createDecoder({value:t}={}){if(t.length===2&&(typeof t[1]=="string"||t[1]instanceof Uint8Array))return new ut}};s(ut,"UuidUrnDecoder");var Go=new Map([[1,q],[2,q],[3,ut],[1024,Y],[1025,Y]]),tt=class extends _{static createDecoder({value:t}={}){if(!(Array.isArray(t)||t.length>1))return!1;let r=Go.get(t[0]);return r&&r.createDecoder({value:t})}};s(tt,"UriDecoder");var H=class extends _{constructor({term:t}={}){super(),this.term=t}decode(){return this.term}static createDecoder({value:t,transformer:r}={}){if(Array.isArray(t))return tt.createDecoder({value:t,transformer:r});let n=r.idToTerm.get(t);if(n!==void 0)return new H({term:n})}};s(H,"VocabTermDecoder");var dt=class extends _{decode({value:t}={}){let r=new Date(t*1e3).toISOString();return r.substring(0,r.indexOf("T"))}static createDecoder({value:t}={}){if(typeof t=="number")return new dt}};s(dt,"XsdDateDecoder");var et=class extends _{constructor({value:t}={}){super(),this.value=t}decode({value:t}={}){return typeof t=="number"?new Date(t*1e3).toISOString().replace(".000Z","Z"):new Date(t[0]*1e3+t[1]).toISOString()}static createDecoder({value:t}={}){if(typeof t=="number")return new et;if(Array.isArray(t)&&t.length===2&&(typeof t[0]=="number"||typeof t[1]=="number"))return new et}};s(et,"XsdDateTimeDecoder");var Xo=new Map([["@id",tt],["@vocab",H],["https://w3id.org/security#multibase",at],["http://www.w3.org/2001/XMLSchema#date",dt],["http://www.w3.org/2001/XMLSchema#dateTime",et]]),Ne=z.get("@context"),_n=Ne+1,Ht=class extends ft{constructor({documentLoader:t,appContextMap:r}={}){if(super({documentLoader:t,appContextMap:r}),this.reverseAppContextMap=new Map,r)for(let[n,o]of r)this.reverseAppContextMap.set(o,n)}async decompress({compressedBytes:t,diagnose:r}={}){this.contextMap=new Map,this.termToId=new Map(z),this.nextTermId=le,this.idToTerm=new Map;for(let[f,u]of this.termToId)this.idToTerm.set(u,f);let n=zt(t,{useMaps:!0});r&&(r("Diagnostic CBOR-LD decompression transform map(s):"),r(J(n,{depth:null,colors:!0})));let o=[],i=Array.isArray(n),c=i?n:[n];for(let f of c){let u={};await this._transform({obj:u,transformMap:f}),o.push(u)}return i?o:o[0]}_beforeObjectContexts({obj:t,transformMap:r}){let n=r.get(Ne);if(n){let i=Z.createDecoder({value:n,transformer:this});t["@context"]=i?i.decode({value:n}):n}let o=r.get(_n);if(o){if(n)throw new E("ERR_INVALID_ENCODED_CONTEXT","Both singular and plural context IDs were found in the CBOR-LD input.");if(!Array.isArray(o))throw new E("ERR_INVALID_ENCODED_CONTEXT","Encoded plural context value must be an array.");let i=[];for(let c of o){let f=Z.createDecoder({value:c,transformer:this});i.push(f?f.decode({value:c}):c)}t["@context"]=i}}_beforeTypeScopedContexts({activeCtx:t,obj:r,transformMap:n}){let{termToId:o}=this,i=["@type",...t.aliases.type];for(let c of i){let f=o.get(c),u=n.get(f);if(u===void 0&&(u=n.get(f+1)),u!==void 0)if(Array.isArray(u))r[c]=u.map(d=>{let h=H.createDecoder({value:d,transformer:this});return h?h.decode({value:d}):d});else{let d=H.createDecoder({value:u,transformer:this});r[c]=d?d.decode({value:u}):u}}}_getEntries({transformMap:t,termMap:r}){let n=[];for(let[o,i]of t){if(o===Ne||o===_n)continue;let{term:c,plural:f}=this._getTermForId({id:o});if(c===void 0)throw new E("ERR_UNKNOWN_CBORLD_TERM_ID",`Unknown term ID '${o}' was detected in the CBOR-LD input.`);let u=r.get(c);if(u===void 0&&!(c.startsWith("@")&&z.has(c)))throw new E("ERR_UNKNOWN_CBORLD_TERM",`Unknown term "${c}" was detected in the CBOR-LD input.`);n.push([{term:c,termId:o,plural:f,def:u},i])}return n.sort(Zo)}_getTermInfo({termMap:t,key:r}){let{term:n,plural:o}=this._getTermForId({id:r});if(n===void 0)throw new E("ERR_UNKNOWN_CBORLD_TERM_ID",`Unknown term ID '${r}' was detected in the CBOR-LD input.`);let i=t.get(n);if(i===void 0&&!(n.startsWith("@")&&z.has(n)))throw new E("ERR_UNKNOWN_CBORLD_TERM",`Unknown term "${n}" was detected in the CBOR-LD input.`);return{term:n,termId:r,plural:o,def:i}}_transformObjectId({obj:t,termInfo:r,value:n}){let o=tt.createDecoder({value:n});t[r.term]=o?o.decode({value:n}):n}_transformObjectType({obj:t,termInfo:r,value:n}){let{term:o,plural:i}=r,c=i?n:[n],f=[];for(let u of c){let d=H.createDecoder({value:u,transformer:this});f.push(d?d.decode({value:u}):u)}t[o]=i?f:f[0]}_transformTypedValue({entries:t,termType:r,value:n}){let o=Xo.get(r),i=o&&o.createDecoder({value:n,transformer:this});if(i)return t.push(i.decode({value:n})),!0}async _transformArray({entries:t,contextStack:r,value:n}){let o=[];for(let i of n){let c={};o.push(c),await this._transform({obj:c,transformMap:i,contextStack:r})}t.push(o)}async _transformObject({entries:t,contextStack:r,value:n}){let o={};return t.push(o),this._transform({obj:o,transformMap:n,contextStack:r})}_assignEntries({entries:t,obj:r,termInfo:n}){let{term:o,plural:i}=n;r[o]=i?t:t[0]}};s(Ht,"Decompressor");function Zo([{term:e}],[{term:t}]){return e<t?-1:e>t?1:0}s(Zo,"_sortEntriesByTerm");async function Le({cborldBytes:e,documentLoader:t,appContextMap:r=new Map,diagnose:n}){if(!(e instanceof Uint8Array))throw new TypeError('"cborldBytes" must be a Uint8Array.');let o=0;if(e[o++]!==217)throw new E("ERR_NOT_CBORLD",'CBOR-LD must start with a CBOR major type "Tag" header of `0xd9`.');if(e[o++]!==5)throw new E("ERR_NOT_CBORLD","CBOR-LD 16-bit tag must start with `0x05`.");let i=e[o];if(i===void 0)throw new E("ERR_NOT_CBORLD","Truncated CBOR-LD 16-bit tag.");if(!(i===0||i===1))throw new E("ERR_NOT_CBORLD",`Unsupported CBOR-LD compression mode "${i}".`);o++;let{buffer:c,byteOffset:f,length:u}=e,d=new Uint8Array(c,f+o,u-o);if(i===0)return zt(d,{useMaps:!1});let x=await new Ht({documentLoader:t,appContextMap:r}).decompress({compressedBytes:d,diagnose:n});return n&&(n("Diagnostic JSON-LD result:"),n(J(x,{depth:null,colors:!0}))),x}s(Le,"decode");var b=class{encode(){throw new Error("Must be implemented by derived class.")}static createEncoder({value:t}={}){throw new Error("Must be implemented by derived class.")}};s(b,"CborldEncoder");var lt=class extends b{constructor({context:t,appContextMap:r}={}){super(),this.context=t,this.appContextMap=r}encode(){let{context:t}=this,r=Ue.get(t)||this.appContextMap.get(t);return r===void 0?new l(a.string,t):new l(a.uint,r)}static createEncoder({value:t,transformer:r}={}){if(typeof t!="string")return!1;let{appContextMap:n}=r;return new lt({context:t,appContextMap:n})}};s(lt,"ContextEncoder");var pt=class extends b{constructor({value:t}={}){super(),this.value=t}encode(){let{value:t}=this,r,n;t[0]==="z"?(r=122,n=xe(t.substr(1))):t[0]==="M"&&(r=77,n=me.toUint8Array(t.substr(1)));let o=new Uint8Array(1+n.length);return o[0]=r,o.set(n,1),new l(a.bytes,o)}static createEncoder({value:t}={}){if(typeof t!="string")return!1;if(t[0]==="z"||t[0]==="M")return new pt({value:t})}};s(pt,"MultibaseEncoder");var Tn=new Map([["did:v1:nym:",1024],["did:key:",1025]]),rt=class extends b{constructor({value:t,scheme:r}={}){super(),this.value=t,this.scheme=r}encode(){let{value:t,scheme:r}=this,n=t.substr(r.length),[o,i]=n.split("#"),c=[new l(a.uint,Tn.get(r)),An(o)];return i!==void 0&&c.push(An(i)),[new l(a.array,c.length),c]}static createEncoder({value:t}={}){let r=[...Tn.keys()];for(let n of r)if(t.startsWith(n))return new rt({value:t,scheme:n})}};s(rt,"Base58DidUrlEncoder");function An(e){if(e.startsWith("z")){let t=xe(e.substr(1));if(t)return new l(a.bytes,t)}return new l(a.string,e)}s(An,"_multibase58ToToken");var W=class extends b{constructor({value:t,secure:r}={}){super(),this.value=t,this.secure=r}encode(){let{value:t,secure:r}=this,n=r?8:7,o=[new l(a.uint,r?2:1),new l(a.string,t.substr(n))];return[new l(a.array,o.length),o]}static createEncoder({value:t}={}){if(t.startsWith("https://"))return new W({value:t,secure:!0});if(t.startsWith("http://"))return new W({value:t,secure:!1})}};s(W,"HttpUrlEncoder");var ht=class extends b{constructor({value:t}={}){super(),this.value=t}encode(){let{value:t}=this,r=t.substr(9),n=[new l(a.uint,3)];if(r.toLowerCase()===r){let o=ve(r);n.push(new l(a.bytes,o))}else n.push(new l(a.string,r));return[new l(a.array,n.length),n]}static createEncoder({value:t}={}){if(t.startsWith("urn:uuid:"))return new ht({value:t})}};s(ht,"UuidUrnEncoder");var Jo=new Map([["http",W],["https",W],["urn:uuid",ht],["did:v1:nym",rt],["did:key",rt]]),nt=class extends b{static createEncoder({value:t}={}){if(typeof t!="string")return!1;let r;try{let{protocol:o,pathname:i}=new URL(t);r=o,i.includes(":")&&(r+=i);let c=t.split(":");c.pop(),r=c.join(":")}catch{return!1}let n=Jo.get(r);return n&&n.createEncoder({value:t})}};s(nt,"UriEncoder");var ot=class extends b{constructor({termId:t}={}){super(),this.termId=t}encode(){return new l(a.uint,this.termId)}static createEncoder({value:t,transformer:r}={}){let{termToId:n}=r,o=n.get(t);return o!==void 0?new ot({termId:o}):nt.createEncoder({value:t})}};s(ot,"VocabTermEncoder");var mt=class extends b{constructor({value:t,parsed:r}={}){super(),this.value=t,this.parsed=r}encode(){let{value:t,parsed:r}=this,n=Math.floor(r/1e3),o=new Date(n*1e3).toISOString(),i=o.substring(0,o.indexOf("T"));return t!==i?new l(a.string,t):new l(a.uint,n)}static createEncoder({value:t}={}){if(t.includes("T"))return!1;let r=Date.parse(t);return isNaN(r)?!1:new mt({value:t,parsed:r})}};s(mt,"XsdDateEncoder");var xt=class extends b{constructor({value:t,parsed:r}={}){super(),this.value=t,this.parsed=r}encode(){let{value:t,parsed:r}=this,n=Math.floor(r/1e3),o=new l(a.uint,n),i=t.indexOf(".");if(i===-1){let d=new Date(n*1e3).toISOString().replace(".000Z","Z");return t!==d?new l(a.string,t):o}let c=parseInt(t.substr(i+1),10),f=new Date(n*1e3+c).toISOString();if(t!==f)return new l(a.string,t);let u=[o,new l(a.uint,c)];return[new l(a.array,u.length),u]}static createEncoder({value:t}={}){if(!t.includes("T"))return!1;let r=Date.parse(t);return isNaN(r)?!1:new xt({value:t,parsed:r})}};s(xt,"XsdDateTimeEncoder");var Yo=new Map([["@id",nt],["@vocab",ot],["https://w3id.org/security#multibase",pt],["http://www.w3.org/2001/XMLSchema#date",mt],["http://www.w3.org/2001/XMLSchema#dateTime",xt]]),Bn=z.get("@context"),qo=Bn+1,ti={Object(e){if(e instanceof b)return e.encode({obj:e})}},Kt=class extends ft{constructor({documentLoader:t,appContextMap:r}={}){super({documentLoader:t,appContextMap:r})}async compress({jsonldDocument:t,diagnose:r}={}){let n=await this._createTransformMaps({jsonldDocument:t});return r&&(r("Diagnostic CBOR-LD compression transform map(s):"),r(J(n,{depth:null,colors:!0}))),Ft(n,{typeEncoders:ti})}async _createTransformMaps({jsonldDocument:t}){this.contextMap=new Map,this.termToId=new Map(z),this.nextTermId=le;let r=[],n=Array.isArray(t),o=n?t:[t];for(let i of o){let c=new Map;await this._transform({obj:i,transformMap:c}),r.push(c)}return n?r:r[0]}_afterObjectContexts({obj:t,transformMap:r}){let n=t["@context"];if(!n)return;let o=[],i=Array.isArray(n),c=i?n:[n];for(let u of c){let d=lt.createEncoder({value:u,transformer:this});o.push(d||u)}let f=i?qo:Bn;r.set(f,i?o:o[0])}_getEntries({obj:t,termMap:r}){let n=[],o=Object.keys(t).sort();for(let i of o){if(i==="@context")continue;let c=r.get(i);if(c===void 0&&!(i.startsWith("@")&&z.has(i)))throw new E("ERR_UNKNOWN_CBORLD_TERM",`Unknown term '${i}' was detected in the JSON-LD input.`);let f=t[i],u=Array.isArray(f),d=this._getIdForTerm({term:i,plural:u});n.push([{term:i,termId:d,plural:u,def:c},f])}return n}_transformObjectId({transformMap:t,termInfo:r,value:n}){let{termId:o}=r,i=nt.createEncoder({value:n,transformer:this,termInfo:r});t.set(o,i||n)}_transformObjectType({transformMap:t,termInfo:r,value:n}){let{termId:o,plural:i}=r,c=i?n:[n],f=[];for(let u of c){let d=ot.createEncoder({value:u,transformer:this,termInfo:r});f.push(d||u)}t.set(o,i?f:f[0])}_transformTypedValue({entries:t,termType:r,value:n,termInfo:o}){let i=Yo.get(r),c=i&&i.createEncoder({value:n,transformer:this,termInfo:o});if(c)return t.push(c),!0}async _transformArray({entries:t,contextStack:r,value:n}){let o=[];for(let i of n){let c=new Map;o.push(c),await this._transform({obj:i,transformMap:c,contextStack:r})}t.push(o)}async _transformObject({entries:t,contextStack:r,value:n}){let o=new Map;t.push(o),await this._transform({obj:n,transformMap:o,contextStack:r})}_assignEntries({entries:t,transformMap:r,termInfo:n}){let{termId:o,plural:i}=n;r.set(o,i?t:t[0])}};s(Kt,"Compressor");async function Fe({jsonldDocument:e,documentLoader:t,appContextMap:r=new Map,compressionMode:n=1,diagnose:o}={}){if(!(n===0||n===1))throw new TypeError('"compressionMode" must be "0" (no compression) or "1" for compression mode version 1.');let i=new Uint8Array([217,5,n]),c;n===0?c=Ft(e):c=await new Kt({documentLoader:t,appContextMap:r}).compress({jsonldDocument:e,diagnose:o});let f=i.length+c.length,u=new Uint8Array(f);return u.set(i),u.set(c,i.length),o&&(o("Diagnostic CBOR-LD result:"),o(J(u,{depth:null,colors:!0}))),u}s(Fe,"encode");function $e(e){if(e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray)return new DataView(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new DataView(e);throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray")}s($e,"toDataView");var ri="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",ni="0123456789ABCDEFGHIJKLMNOPQRSTUV",oi="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function Pe(e,t,r){r=r||{};let n,o;switch(t){case"RFC3548":case"RFC4648":n=ri,o=!0;break;case"RFC4648-HEX":n=ni,o=!0;break;case"Crockford":n=oi,o=!1;break;default:throw new Error("Unknown base32 variant: "+t)}let i=r.padding!==void 0?r.padding:o,c=$e(e),f=0,u=0,d="";for(let h=0;h<c.byteLength;h++)for(u=u<<8|c.getUint8(h),f+=8;f>=5;)d+=n[u>>>f-5&31],f-=5;if(f>0&&(d+=n[u<<5-f&31]),i)for(;d.length%8!==0;)d+="=";return d}s(Pe,"base32Encode");var Wn=ro(Un(),1);var C;(function(e){e[e.Terminator=0]="Terminator",e[e.Numeric=1]="Numeric",e[e.Alphanumeric=2]="Alphanumeric",e[e.StructuredAppend=3]="StructuredAppend",e[e.Byte=4]="Byte",e[e.Kanji=8]="Kanji",e[e.ECI=7]="ECI"})(C||(C={}));var Q=class{constructor(t,r){this.bytes=[],this.mode=t,this.data=r}getLength(){return this.bytes.length}getLengthInBits(t){let r=this.mode,n=new Error(`illegal mode: ${r}`);if(1<=t&&t<10)switch(r){case C.Numeric:return 10;case C.Alphanumeric:return 9;case C.Byte:return 8;case C.Kanji:return 8;default:throw n}else if(t<27)switch(r){case C.Numeric:return 12;case C.Alphanumeric:return 11;case C.Byte:return 16;case C.Kanji:return 10;default:throw n}else if(t<41)switch(r){case C.Numeric:return 14;case C.Alphanumeric:return 13;case C.Byte:return 16;case C.Kanji:return 12;default:throw n}else throw new Error(`illegal version: ${t}`)}};s(Q,"QRData");function In(e){let t=0,{length:r}=e,n=[];for(let o=0;o<r;o++){let i=e.charCodeAt(o);i<128?n[t++]=i:i<2048?(n[t++]=i>>6|192,n[t++]=i&63|128):(i&64512)===55296&&o+1<r&&(e.charCodeAt(o+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++o)&1023),n[t++]=i>>18|240,n[t++]=i>>12&63|128,n[t++]=i>>6&63|128,n[t++]=i&63|128):(n[t++]=i>>12|224,n[t++]=i>>6&63|128,n[t++]=i&63|128)}return n}s(In,"encode");var Wt=class extends Q{constructor(t,r){if(super(C.Byte,t),this.encoding=-1,typeof r=="function"){let{encoding:n,bytes:o}=r(t);this.bytes=o,this.encoding=n}else this.bytes=In(t),this.encoding=26}writeTo(t){let{bytes:r}=this;for(let n of r)t.put(n,8)}};s(Wt,"QRByte");var gt=[],ze=[];for(let e=0;e<256;e++)ze[e]=0,gt[e]=e<8?1<<e:gt[e-4]^gt[e-5]^gt[e-6]^gt[e-8];for(let e=0;e<255;e++)ze[gt[e]]=e;function It(e){if(e<1)throw new Error(`illegal log: ${e}`);return ze[e]}s(It,"glog");function Qt(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return gt[e]}s(Qt,"gexp");var j=class{constructor(t,r=0){let n=0,{length:o}=t;for(;n<o&&t[n]===0;)n++;o-=n;let i=[];for(let c=0;c<o;c++)i.push(t[n+c]);for(let c=0;c<r;c++)i.push(0);this.num=i}getAt(t){return this.num[t]}getLength(){return this.num.length}multiply(t){let r=[],n=t.getLength(),o=this.getLength(),i=o+n-1;for(let c=0;c<i;c++)r.push(0);for(let c=0;c<o;c++)for(let f=0;f<n;f++)r[c+f]^=Qt(It(this.getAt(c))+It(t.getAt(f)));return new j(r)}mod(t){let r=t.getLength(),n=this.getLength();if(n-r<0)return this;let o=It(this.getAt(0))-It(t.getAt(0)),i=[];for(let c=0;c<n;c++)i.push(this.getAt(c));for(let c=0;c<r;c++)i[c]^=Qt(It(t.getAt(c))+o);return new j(i).mod(t)}};s(j,"Polynomial");var fi=3,ui=3,Dn=40,di=10,li=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],pi=1<<14|1<<12|1<<10|1<<4|1<<1,On=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,vn=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0;function Nn(e){return li[e-1]}s(Nn,"getAlignmentPattern");function Ln(e){let t=new j([1]);for(let r=0;r<e;r++)t=t.multiply(new j([1,Qt(r)]));return t}s(Ln,"getErrorCorrectionPolynomial");function Dt(e){let t=0;for(;e!==0;)t++,e>>>=1;return t}s(Dt,"getBCHDigit");var Sn=Dt(vn);function Fn(e){let t=e<<12;for(;Dt(t)-Sn>=0;)t^=vn<<Dt(t)-Sn;return e<<12|t}s(Fn,"getBCHVersion");var Mn=Dt(On);function $n(e){let t=e<<10;for(;Dt(t)-Mn>=0;)t^=On<<Dt(t)-Mn;return(e<<10|t)^pi}s($n,"getBCHVersionInfo");function Rn(e,t){let r=e.getMatrixSize(),n=0;for(let o=0;o<r;o++){let i=!1,c=0;for(let f=0;f<r;f++){let u=t?e.isDark(o,f):e.isDark(f,o);u===i?(c++,c===5?n+=fi:c>5&&n++):(i=u,c=1)}}return n}s(Rn,"applyMaskPenaltyRule1Internal");function hi(e){return Rn(e,!0)+Rn(e,!1)}s(hi,"applyMaskPenaltyRule1");function mi(e){let t=e.getMatrixSize(),r=0;for(let n=0;n<t-1;n++)for(let o=0;o<t-1;o++){let i=e.isDark(n,o);i===e.isDark(n,o+1)&&i===e.isDark(n+1,o)&&i===e.isDark(n+1,o+1)&&(r+=ui)}return r}s(mi,"applyMaskPenaltyRule2");function ye(e,t,r,n,o){r=Math.max(r,0),n=Math.min(n,e.getMatrixSize());for(let i=r;i<n;i++)if(o?e.isDark(t,i):e.isDark(i,t))return!1;return!0}s(ye,"isFourWhite");function xi(e){let t=e.getMatrixSize(),r=0;for(let n=0;n<t;n++)for(let o=0;o<t;o++)o+6<t&&e.isDark(n,o)&&!e.isDark(n,o+1)&&e.isDark(n,o+2)&&e.isDark(n,o+3)&&e.isDark(n,o+4)&&!e.isDark(n,o+5)&&e.isDark(n,o+6)&&(ye(e,n,o-4,o,!0)||ye(e,n,o+7,o+11,!0))&&(r+=Dn),n+6<t&&e.isDark(n,o)&&!e.isDark(n+1,o)&&e.isDark(n+2,o)&&e.isDark(n+3,o)&&e.isDark(n+4,o)&&!e.isDark(n+5,o)&&e.isDark(n+6,o)&&(ye(e,o,n-4,n,!1)||ye(e,o,n+7,n+11,!1))&&(r+=Dn);return r}s(xi,"applyMaskPenaltyRule3");function gi(e){let t=e.getMatrixSize(),r=0;for(let i=0;i<t;i++)for(let c=0;c<t;c++)e.isDark(i,c)&&r++;let n=t*t;return Math.floor(Math.abs(r*20-n*10)/n)*di}s(gi,"applyMaskPenaltyRule4");function Pn(e){return hi(e)+mi(e)+xi(e)+gi(e)}s(Pn,"calculateMaskPenalty");var O;(function(e){e[e.L=1]="L",e[e.M=0]="M",e[e.Q=3]="Q",e[e.H=2]="H"})(O||(O={}));var v=class{constructor(t,r){this.dataCount=r,this.totalCount=t}getDataCount(){return this.dataCount}getTotalCount(){return this.totalCount}static getRSBlocks(t,r){let n=[],o=v.getRSBlockTable(t,r),i=o.length/3;for(let c=0;c<i;c++){let f=o[c*3+0],u=o[c*3+1],d=o[c*3+2];for(let h=0;h<f;h++)n.push(new v(u,d))}return n}static getRSBlockTable(t,r){switch(r){case O.L:return v.RS_BLOCK_TABLE[(t-1)*4+0];case O.M:return v.RS_BLOCK_TABLE[(t-1)*4+1];case O.Q:return v.RS_BLOCK_TABLE[(t-1)*4+2];case O.H:return v.RS_BLOCK_TABLE[(t-1)*4+3];default:throw new Error(`illegal error correction level: ${r}`)}}};s(v,"RSBlock");v.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];var St=class{constructor(){this.length=0,this.buffer=[]}getBuffer(){return this.buffer}getLengthInBits(){return this.length}getBit(t){return(this.buffer[t/8>>0]>>>7-t%8&1)===1}put(t,r){for(let n=0;n<r;n++)this.putBit((t>>>r-n-1&1)===1)}putBit(t){let{buffer:r}=this;this.length===r.length*8&&r.push(0),t&&(r[this.length/8>>0]|=128>>>this.length%8),this.length++}};s(St,"BitBuffer");var Gt=class{constructor(t){let r=1<<t,n=r+1;this.bof=r,this.eof=n,this.depth=t,this.reset()}reset(){let t=this.depth+1;this.bits=t,this.size=1<<t,this.codes=new Map,this.unused=this.eof+1}add(t,r){let{unused:n}=this;if(n>4095)return!1;this.codes.set(t<<8|r,n++);let{bits:o,size:i}=this;return n>i&&(i=1<<++o),this.bits=o,this.size=i,this.unused=n,!0}get(t,r){return this.codes.get(t<<8|r)}};s(Gt,"Dict");var Xt=class{constructor(t){this.bits=0,this.buffer=0,this.bytes=[],this.dict=t}write(t){let{bits:r}=this,n=this.buffer|t<<r;r+=this.dict.bits;let{bytes:o}=this;for(;r>=8;)o.push(n&255),n>>=8,r-=8;this.bits=r,this.buffer=n}pipe(t){let{bytes:r}=this;this.bits>0&&r.push(this.buffer),t.writeByte(this.dict.depth);let{length:n}=r;for(let o=0;o<n;){let i=n-o;i>=255?(t.writeByte(255),t.writeBytes(r,o,255),o+=255):(t.writeByte(i),t.writeBytes(r,o,i),o=n)}t.writeByte(0)}};s(Xt,"DictStream");function zn(e,t,r){let n=new Gt(t),o=new Xt(n);if(o.write(n.bof),e.length>0){let i=e[0],{length:c}=e;for(let f=1;f<c;f++){let u=e[f],d=n.get(i,u);d!=null?i=d:(o.write(i),n.add(i,u)||(o.write(n.bof),n.reset()),i=u)}o.write(i)}o.write(n.eof),o.pipe(r)}s(zn,"compress");var yt=class{constructor(){this.bytes=[]}writeByte(t){this.bytes.push(t&255)}writeInt16(t){this.bytes.push(t&255,t>>8&255)}writeBytes(t,r=0,n=t.length){let o=this.bytes;for(let i=0;i<n;i++)o.push(t[r+i]&255)}};s(yt,"ByteStream");var{fromCharCode:je}=String;function jn(e){if(e&=63,e>=0){if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e===62)return 43;if(e===63)return 47}throw new Error(`illegal char: ${je(e)}`)}s(jn,"encode");var Zt=class{constructor(){this.bits=0,this.buffer=0,this.length=0,this.stream=new yt}get bytes(){return this.stream.bytes}write(t){let r=this.bits+8,{stream:n}=this,o=this.buffer<<8|t&255;for(;r>=6;)n.writeByte(jn(o>>>r-6)),r-=6;this.length++,this.bits=r,this.buffer=o}close(){let{bits:t,stream:r,length:n}=this;if(t>0&&(r.writeByte(jn(this.buffer<<6-t)),this.bits=0,this.buffer=0),n%3!=0){let o=3-n%3;for(let i=0;i<o;i++)r.writeByte(61)}}};s(Zt,"Base64Stream");var Jt=class{constructor(t,r,{foreground:n=[0,0,0],background:o=[255,255,255]}={}){this.pixels=[],this.width=t,this.height=r,this.foreground=n,this.background=o}encodeImpl(){let t=new yt,{width:r,height:n,background:o,foreground:i}=this;return t.writeBytes([71,73,70,56,57,97]),t.writeInt16(r),t.writeInt16(n),t.writeBytes([128,0,0]),t.writeBytes([o[0],o[1],o[2]]),t.writeBytes([i[0],i[1],i[2]]),t.writeByte(44),t.writeInt16(0),t.writeInt16(0),t.writeInt16(r),t.writeInt16(n),t.writeByte(0),zn(this.pixels,2,t),t.writeByte(59),t.bytes}set(t,r,n){this.pixels[r*this.width+t]=n}toDataURL(){let t=this.encodeImpl(),r=new Zt;for(let i of t)r.write(i);r.close();let n=r.bytes,o="data:image/gif;base64,";for(let i of n)o+=je(i);return o}};s(Jt,"GIFImage");function Vn(e){switch(e){case 0:return(t,r)=>(t+r&1)===0;case 1:return(t,r)=>(r&1)===0;case 2:return(t,r)=>t%3===0;case 3:return(t,r)=>(t+r)%3===0;case 4:return(t,r)=>((t/3>>0)+(r/2>>0)&1)===0;case 5:return(t,r)=>(t*r&1)+t*r%3===0;case 6:return(t,r)=>((t*r&1)+t*r%3&1)===0;case 7:return(t,r)=>(t*r%3+(t+r&1)&1)===0;default:throw new Error(`illegal mask: ${e}`)}}s(Vn,"getMaskFunc");var yi=236,wi=17,{toString:bi}=Object.prototype;function Ei(e,t){if(e<0||e>=1e6)throw new Error("byte mode encoding hint out of range");t.put(C.ECI,4),e<1<<7?t.put(e,8):e<1<<14?(t.put(2,2),t.put(e,14)):(t.put(6,3),t.put(e,21))}s(Ei,"appendECI");function Hn(e,t,r,n){let o=new St,i=v.getRSBlocks(e,t);for(let f of n){let u=f.mode;r&&u===C.Byte&&Ei(f.encoding,o),o.put(u,4),o.put(f.getLength(),f.getLengthInBits(e)),f.writeTo(o)}let c=0;for(let f of i)c+=f.getDataCount();return c*=8,[o,i,c]}s(Hn,"prepareData");function Ci(e,t){let r=0,n=0,o=0,i=[],c=[],f=t.length,u=e.getBuffer();for(let d=0;d<f;d++){let h=t[d],x=h.getDataCount(),g=h.getTotalCount()-x;n=Math.max(n,x),o=Math.max(o,g),i[d]=[];for(let F=0;F<x;F++)i[d][F]=255&u[F+r];r+=x;let w=Ln(g),I=w.getLength()-1,qt=new j(i[d],I).mod(w),we=qt.getLength();c[d]=[];for(let F=0;F<I;F++){let te=F+we-I;c[d][F]=te>=0?qt.getAt(te):0}}e=new St;for(let d=0;d<n;d++)for(let h=0;h<f;h++)d<i[h].length&&e.put(i[h][d],8);for(let d=0;d<o;d++)for(let h=0;h<f;h++)d<c[h].length&&e.put(c[h][d],8);return e}s(Ci,"createBytes");function _i(e,t,r){for(e.getLengthInBits()+4<=r&&e.put(0,4);e.getLengthInBits()%8!==0;)e.putBit(!1);for(;!(e.getLengthInBits()>=r||(e.put(yi,8),e.getLengthInBits()>=r));)e.put(wi,8);return Ci(e,t)}s(_i,"createData");var Mt=class{constructor(t={}){this.matrixSize=0,this.chunks=[],this.matrix=[];let{version:r=0,encodingHint:n=!1,errorCorrectionLevel:o=O.L}=t;this.setVersion(r),this.setEncodingHint(n),this.setErrorCorrectionLevel(o)}getMatrix(){return this.matrix}getMatrixSize(){return this.matrixSize}getVersion(){return this.version}setVersion(t){return this.version=Math.min(40,Math.max(0,t>>0)),this.auto=this.version===0,this}getErrorCorrectionLevel(){return this.errorCorrectionLevel}setErrorCorrectionLevel(t){switch(t){case O.L:case O.M:case O.Q:case O.H:this.errorCorrectionLevel=t}return this}getEncodingHint(){return this.encodingHint}setEncodingHint(t){return this.encodingHint=t,this}write(t){let{chunks:r}=this;if(t instanceof Q)r.push(t);else if(bi.call(t)==="[object String]")r.push(new Wt(t));else throw new Error(`illegal data: ${t}`);return this}isDark(t,r){return this.matrix[t][r]===!0}setupFinderPattern(t,r){let{matrix:n}=this,o=this.matrixSize;for(let i=-1;i<=7;i++)for(let c=-1;c<=7;c++)t+i<=-1||o<=t+i||r+c<=-1||o<=r+c||(0<=i&&i<=6&&(c===0||c===6)||0<=c&&c<=6&&(i===0||i===6)||2<=i&&i<=4&&2<=c&&c<=4?n[t+i][r+c]=!0:n[t+i][r+c]=!1)}setupAlignmentPattern(){let{matrix:t}=this,r=Nn(this.version),{length:n}=r;for(let o=0;o<n;o++)for(let i=0;i<n;i++){let c=r[o],f=r[i];if(t[c][f]===null)for(let u=-2;u<=2;u++)for(let d=-2;d<=2;d++)u===-2||u===2||d===-2||d===2||u===0&&d===0?t[c+u][f+d]=!0:t[c+u][f+d]=!1}}setupTimingPattern(){let{matrix:t}=this,r=this.matrixSize-8;for(let n=8;n<r;n++){let o=n%2===0;t[n][6]===null&&(t[n][6]=o),t[6][n]===null&&(t[6][n]=o)}}setupFormatInfo(t){let{matrix:r}=this,n=this.errorCorrectionLevel<<3|t,o=$n(n),i=this.matrixSize;for(let c=0;c<15;c++){let f=(o>>c&1)===1;c<6?r[c][8]=f:c<8?r[c+1][8]=f:r[i-15+c][8]=f,c<8?r[8][i-c-1]=f:c<9?r[8][15-c-1+1]=f:r[8][15-c-1]=f}r[i-8][8]=!0}setupVersionInfo(){if(this.version>=7){let{matrix:t}=this,r=this.matrixSize,n=Fn(this.version);for(let o=0;o<18;o++){let i=(n>>o&1)===1;t[o/3>>0][o%3+r-8-3]=i,t[o%3+r-8-3][o/3>>0]=i}}}setupCodewords(t,r){let{matrix:n}=this,o=this.matrixSize,i=t.getLengthInBits(),c=Vn(r),f=0;for(let u=o-1;u>=1;u-=2){u===6&&(u=5);for(let d=0;d<o;d++)for(let h=0;h<2;h++){let x=u-h,w=(u+1&2)===0?o-1-d:d;if(n[w][x]!==null)continue;let I=!1;f<i&&(I=t.getBit(f++)),c(x,w)&&(I=!I),n[w][x]=I}}}buildMatrix(t,r){let n=[],o=this.matrixSize;for(let i=0;i<o;i++){n[i]=[];for(let c=0;c<o;c++)n[i][c]=null}this.matrix=n,this.setupFinderPattern(0,0),this.setupFinderPattern(o-7,0),this.setupFinderPattern(0,o-7),this.setupAlignmentPattern(),this.setupTimingPattern(),this.setupFormatInfo(r),this.setupVersionInfo(),this.setupCodewords(t,r)}make(){let t,r,n,{chunks:o,errorCorrectionLevel:i}=this;if(this.auto){let h=1;for(;h<=40&&([t,r,n]=Hn(h,i,this.encodingHint,o),!(t.getLengthInBits()<=n));h++);let x=t.getLengthInBits();if(x>n)throw new Error(`data overflow: ${x} > ${n}`);this.version=h}else[t,r,n]=Hn(this.version,i,this.encodingHint,o);this.matrixSize=this.version*4+17;let c=[],f=_i(t,r,n),u=-1,d=Number.MAX_VALUE;for(let h=0;h<8;h++){this.buildMatrix(f,h),c.push(this.matrix);let x=Pn(this);x<d&&(d=x,u=h)}return this.matrix=c[u],this}toDataURL(t=2,r=t*4,n){t=Math.max(1,t>>0),r=Math.max(0,r>>0);let o=this.matrixSize,i=t*o+r*2,c=r,f=i-r,u=new Jt(i,i,n);for(let d=0;d<i;d++)for(let h=0;h<i;h++)if(c<=h&&h<f&&c<=d&&d<f){let x=(d-c)/t>>0,g=(h-c)/t>>0;u.set(h,d,this.isDark(x,g)?1:0)}else u.set(h,d,0);return u.toDataURL()}clear(){this.chunks=[]}};s(Mt,"Encoder");function Kn(e){let{length:t}=e,r=[];for(let n=0;n<t;n++)r.push(e.charCodeAt(n));return r}s(Kn,"encode");function Ve(e){if(48<=e&&e<=57)return e-48;if(65<=e&&e<=90)return e-65+10;switch(e){case 32:return 36;case 36:return 37;case 37:return 38;case 42:return 39;case 43:return 40;case 45:return 41;case 46:return 42;case 47:return 43;case 58:return 44;default:throw new Error(`illegal char: ${String.fromCharCode(e)}`)}}s(Ve,"getByte");var Rt=class extends Q{constructor(t){super(C.Alphanumeric,t),this.bytes=Kn(t)}writeTo(t){let r=0,{bytes:n}=this,{length:o}=n;for(;r+1<o;)t.put(Ve(n[r])*45+Ve(n[r+1]),11),r+=2;r<o&&t.put(Ve(n[r]),6)}};s(Rt,"QRAlphanumeric");var Qn="VP1",Gn="B";function Ti({bytes:e,size:t}){let r=new Mt;r.setEncodingHint(!0);let n=Pe(e,"RFC4648",{padding:!1}),o=`${Qn}-${Gn}${n}`;return r.write(new Rt(o)),r.make(),{payload:o,encodedCborld:n,version:r.getVersion(),imageDataUrl:r.toDataURL(t)}}s(Ti,"_bytesToQrCodeDataUrl");async function He({vp:e,documentLoader:t,size:r,diagnose:n}={}){let o=await Fe({jsonldDocument:e,documentLoader:t,diagnose:n}),{payload:i,imageDataUrl:c,encodedCborld:f,version:u}=Ti({bytes:o,size:r});return{payload:i,imageDataUrl:c,encodedCborld:f,rawCborldBytes:o,version:u}}s(He,"toQrCode");async function Ke({text:e,documentLoader:t,diagnose:r}={}){let n=Qn+"-";if(!(e&&e.startsWith(n)))throw TypeError("Unsupported VP QR format.");let o=e.slice(n.length);if(!o.startsWith(Gn))throw TypeError("Payload must be multibase base32 (RFC4648) encoded.");let i=(0,Wn.default)(o.slice(1),"RFC4648"),c=new Uint8Array(i);return{vp:await Le({cborldBytes:c,documentLoader:t,diagnose:r})}}s(Ke,"fromQrCode");var Ai=s(e=>({name:"Vpqr",displayName:"VP QR",description:"Allows reading and creating QR codes with Verifiable Presentations in them",methods:{vpFromQrCode:async(t,r)=>(await Ke({text:r,documentLoader:async n=>({document:await e.invoke.contextLoader(n)})}))?.vp,vpToQrCode:async(t,r)=>(await He({vp:r,documentLoader:async n=>({document:await e.invoke.contextLoader(n)})}))?.imageDataUrl}}),"getVpqrPlugin");
3
3
  /*!
4
4
  * Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
5
5
  */
@@ -9,14 +9,20 @@ var Gn=Object.create;var Rt=Object.defineProperty;var Zn=Object.getOwnPropertyDe
9
9
  /*!
10
10
  * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved.
11
11
  */
12
+ /*!
13
+ * Copyright (c) 2020-2023 Digital Bazaar, Inc. All rights reserved.
14
+ */
12
15
  /*!
13
16
  * Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
14
17
  */
18
+ /*!
19
+ * Copyright (c) 2021-2023 Digital Bazaar, Inc. All rights reserved.
20
+ */
15
21
  /**
16
22
  * @module QRCode
17
23
  * @package @nuintun/qrcode
18
24
  * @license MIT
19
- * @version 3.3.5
25
+ * @version 3.4.0
20
26
  * @author nuintun <nuintun@qq.com>
21
27
  * @description A pure JavaScript QRCode encode and decode library.
22
28
  * @see https://github.com/nuintun/qrcode#readme