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