backpack-viewer 0.7.13 → 0.7.14
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/app/assets/index-BbX2AsyK.css +1 -0
- package/dist/app/assets/index-CSbPTbYZ.js +6 -0
- package/dist/app/assets/index-Dz__sU13.js +12 -0
- package/dist/app/assets/layout-worker-4xak23M6.js +1 -0
- package/dist/app/index.html +18 -0
- package/dist/extensions/share/index-B8_hkT8R.js +6277 -0
- package/dist/extensions/share/src/index.js +295 -520
- package/package.json +3 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var Ui=Object.defineProperty;var Ti=(e,t,n)=>t in e?Ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var B=(e,t,n)=>Ti(e,typeof t!="symbol"?t+"":t,n);function Xo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function rt(e,t=""){if(typeof e!="number"){const n=t&&`"${t}" `;throw new TypeError(`${n}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){const n=t&&`"${t}" `;throw new RangeError(`${n}expected integer >= 0, got ${e}`)}}function At(e,t,n=""){const r=Xo(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",f=r?`length=${o}`:`type=${typeof e}`,a=i+"expected Uint8Array"+c+", got "+f;throw r?new RangeError(a):new TypeError(a)}return e}function We(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(rt(e.outputLen),rt(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}function wn(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Po(e,t){At(e,void 0,"digestInto() output");const n=t.outputLen;if(e.length<n)throw new RangeError('"digestInto() output" expected to be of length >='+n)}function Dn(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ce(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function dn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function vt(e,t){return e<<32-t|e>>>t}function P(e,t){return e<<t|e>>>32-t>>>0}const ki=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ki(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Hi(e){for(let t=0;t<e.length;t++)e[t]=Ki(e[t]);return e}const eo=ki?e=>e:Hi,Go=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ci=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Sr(e){if(At(e),Go)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Ci[e[n]];return t}const Ot={_0:48,_9:57,A:65,F:70,a:97,f:102};function no(e){if(e>=Ot._0&&e<=Ot._9)return e-Ot._0;if(e>=Ot.A&&e<=Ot.F)return e-(Ot.A-10);if(e>=Ot.a&&e<=Ot.f)return e-(Ot.a-10)}function Rr(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if(Go)try{return Uint8Array.fromHex(e)}catch(o){throw o instanceof SyntaxError?new RangeError(o.message):o}const t=e.length,n=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,s=0;o<n;o++,s+=2){const i=no(e.charCodeAt(s)),c=no(e.charCodeAt(s+1));if(i===void 0||c===void 0){const f=e[s]+e[s+1];throw new RangeError('hex string expected, got non-hex character "'+f+'" at index '+s)}r[o]=i*16+c}return r}function Ni(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function ro(e,t=""){return typeof e=="string"?Ni(e):At(e,void 0,t)}function Fi(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];At(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}function Wo(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new TypeError("options must be object or undefined");return Object.assign(e,t)}function qi(e,t={}){const n=(o,s)=>e(s).update(o).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=o=>e(o),Object.assign(n,t),Object.freeze(n)}function It(e=32){rt(e,"bytesLength");const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof(t==null?void 0:t.getRandomValues)!="function")throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}const Zi=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});let oo=class{constructor(t,n){B(this,"oHash");B(this,"iHash");B(this,"blockLen");B(this,"outputLen");B(this,"canXOF",!1);B(this,"finished",!1);B(this,"destroyed",!1);if(We(t),At(n,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,o=new Uint8Array(r);o.set(n.length>r?t.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=t.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),ce(o)}update(t){return wn(this),this.iHash.update(t),this}digestInto(t){wn(this),Po(t,this),this.finished=!0;const n=t.subarray(0,this.outputLen);this.iHash.digestInto(n),this.oHash.update(n),this.oHash.digestInto(n),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const Le=(()=>{const e=((t,n,r)=>new oo(t,n).update(r).digest());return e.create=(t,n)=>new oo(t,n),e})();function Qe(e,t,n){return We(e),n===void 0&&(n=new Uint8Array(e.outputLen)),Le(e,n,t)}const jn=Uint8Array.of(0),so=Uint8Array.of();function Qo(e,t,n,r=32){We(e),rt(r,"length"),At(t,void 0,"prk");const o=e.outputLen;if(t.length<o)throw new Error('"prk" must be at least HashLen octets');if(r>255*o)throw new Error("Length must be <= 255*HashLen");const s=Math.ceil(r/o);n===void 0?n=so:At(n,void 0,"info");const i=new Uint8Array(s*o),c=Le.create(e,t),f=c._cloneInto(),a=new Uint8Array(c.outputLen);for(let u=0;u<s;u++)jn[0]=u+1,f.update(u===0?so:a).update(n).update(jn).digestInto(a),i.set(a,o*u),c._cloneInto(f);return c.destroy(),f.destroy(),ce(a,jn),i.slice(0,r)}const xe=(e,t,n,r,o)=>Qo(e,Qe(e,t,n),r,o);function Mi(e,t,n){return e&t^~e&n}function Di(e,t,n){return e&t^e&n^t&n}let ji=class{constructor(t,n,r,o){B(this,"blockLen");B(this,"outputLen");B(this,"canXOF",!1);B(this,"padOffset");B(this,"isLE");B(this,"buffer");B(this,"view");B(this,"finished",!1);B(this,"length",0);B(this,"pos",0);B(this,"destroyed",!1);this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=dn(this.buffer)}update(t){wn(this),At(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const f=dn(t);for(;o<=s-i;i+=o)this.process(f,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){wn(this),Po(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,ce(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let l=i;l<o;l++)n[l]=0;r.setBigUint64(o-8,BigInt(this.length*8),s),this.process(r,0);const c=dn(t),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const a=f/4,u=this.get();if(a>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<a;l++)c.setUint32(4*l,u[l],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const Ht=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Yi=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ct=new Uint32Array(64);let zi=class extends ji{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:f}=this;return[t,n,r,o,s,i,c,f]}set(t,n,r,o,s,i,c,f){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=f|0}process(t,n){for(let l=0;l<16;l++,n+=4)Ct[l]=t.getUint32(n,!1);for(let l=16;l<64;l++){const w=Ct[l-15],g=Ct[l-2],E=vt(w,7)^vt(w,18)^w>>>3,m=vt(g,17)^vt(g,19)^g>>>10;Ct[l]=m+Ct[l-7]+E+Ct[l-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:f,G:a,H:u}=this;for(let l=0;l<64;l++){const w=vt(c,6)^vt(c,11)^vt(c,25),g=u+w+Mi(c,f,a)+Yi[l]+Ct[l]|0,m=(vt(r,2)^vt(r,13)^vt(r,22))+Di(r,o,s)|0;u=a,a=f,f=c,c=i+g|0,i=s,s=o,o=r,r=g+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,f=f+this.F|0,a=a+this.G|0,u=u+this.H|0,this.set(r,o,s,i,c,f,a,u)}roundClean(){ce(Ct)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),ce(this.buffer)}},Vi=class extends zi{constructor(){super(32);B(this,"A",Ht[0]|0);B(this,"B",Ht[1]|0);B(this,"C",Ht[2]|0);B(this,"D",Ht[3]|0);B(this,"E",Ht[4]|0);B(this,"F",Ht[5]|0);B(this,"G",Ht[6]|0);B(this,"H",Ht[7]|0)}};const et=qi(()=>new Vi,Zi(1));/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ir(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Xi(e){if(!Ir(e))throw new Error("Uint8Array expected")}function Jo(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function Pi(e){if(typeof e!="function")throw new Error("function expected");return!0}function fe(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function Lr(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function sr(e){if(!Array.isArray(e))throw new Error("array expected")}function bn(e,t){if(!Jo(!0,t))throw new Error(`${e}: array of strings expected`)}function ts(e,t){if(!Jo(!1,t))throw new Error(`${e}: array of numbers expected`)}function Or(...e){const t=s=>s,n=(s,i)=>c=>s(i(c)),r=e.map(s=>s.encode).reduceRight(n,t),o=e.map(s=>s.decode).reduce(n,t);return{encode:r,decode:o}}function $r(e){const t=typeof e=="string"?e.split(""):e,n=t.length;bn("alphabet",t);const r=new Map(t.map((o,s)=>[o,s]));return{encode:o=>(sr(o),o.map(s=>{if(!Number.isSafeInteger(s)||s<0||s>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${s}". Allowed: ${e}`);return t[s]})),decode:o=>(sr(o),o.map(s=>{fe("alphabet.decode",s);const i=r.get(s);if(i===void 0)throw new Error(`Unknown letter: "${s}". Allowed: ${e}`);return i}))}}function _r(e=""){return fe("join",e),{encode:t=>(bn("join.decode",t),t.join(e)),decode:t=>(fe("join.decode",t),t.split(e))}}function Gi(e,t="="){return Lr(e),fe("padding",t),{encode(n){for(bn("padding.encode",n);n.length*e%8;)n.push(t);return n},decode(n){bn("padding.decode",n);let r=n.length;if(r*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if((r-1)*e%8===0)throw new Error("padding: invalid, string has too much padding");return n.slice(0,r)}}}const es=(e,t)=>t===0?e:es(t,e%t),xn=(e,t)=>e+(t-es(e,t)),hn=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function ir(e,t,n,r){if(sr(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(xn(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${xn(t,n)}`);let o=0,s=0;const i=hn[t],c=hn[n]-1,f=[];for(const a of e){if(Lr(a),a>=i)throw new Error(`convertRadix2: invalid data word=${a} from=${t}`);if(o=o<<t|a,s+t>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);for(s+=t;s>=n;s-=n)f.push((o>>s-n&c)>>>0);const u=hn[s];if(u===void 0)throw new Error("invalid carry");o&=u-1}if(o=o<<n-s&c,!r&&s>=t)throw new Error("Excess padding");if(!r&&o>0)throw new Error(`Non-zero padding: ${o}`);return r&&s>0&&f.push(o>>>0),f}function Ur(e,t=!1){if(Lr(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(xn(8,e)>32||xn(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!Ir(n))throw new Error("radix2.encode input should be Uint8Array");return ir(Array.from(n),8,e,!t)},decode:n=>(ts("radix2.decode",n),Uint8Array.from(ir(n,e,8,t)))}}function io(e){return Pi(e),function(...t){try{return e.apply(null,t)}catch{}}}const Wi=typeof Uint8Array.from([]).toBase64=="function"&&typeof Uint8Array.fromBase64=="function",Qi=(e,t)=>{fe("base64",e);const n=/^[A-Za-z0-9=+/]+$/,r="base64";if(e.length>0&&!n.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},ns=Wi?{encode(e){return Xi(e),e.toBase64()},decode(e){return Qi(e)}}:Or(Ur(6),$r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Gi(6),_r("")),at=Or(Ur(6),$r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),_r("")),cr=Or($r("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),_r("")),co=[996825010,642813549,513874426,1027748829,705979059];function Te(e){const t=e>>25;let n=(e&33554431)<<5;for(let r=0;r<co.length;r++)(t>>r&1)===1&&(n^=co[r]);return n}function fo(e,t,n=1){const r=e.length;let o=1;for(let s=0;s<r;s++){const i=e.charCodeAt(s);if(i<33||i>126)throw new Error(`Invalid prefix (${e})`);o=Te(o)^i>>5}o=Te(o);for(let s=0;s<r;s++)o=Te(o)^e.charCodeAt(s)&31;for(let s of t)o=Te(o)^s;for(let s=0;s<6;s++)o=Te(o);return o^=n,cr.encode(ir([o%hn[30]],30,5,!1))}function Ji(e){const t=e==="bech32"?1:734539939,n=Ur(5),r=n.decode,o=n.encode,s=io(r);function i(l,w,g=90){fe("bech32.encode prefix",l),Ir(w)&&(w=Array.from(w)),ts("bech32.encode",w);const E=l.length;if(E===0)throw new TypeError(`Invalid prefix length ${E}`);const m=E+7+w.length;if(g!==!1&&m>g)throw new TypeError(`Length ${m} exceeds limit ${g}`);const b=l.toLowerCase(),p=fo(b,w,t);return`${b}1${cr.encode(w)}${p}`}function c(l,w=90){fe("bech32.decode input",l);const g=l.length;if(g<8||w!==!1&&g>w)throw new TypeError(`invalid string length: ${g} (${l}). Expected (8..${w})`);const E=l.toLowerCase();if(l!==E&&l!==l.toUpperCase())throw new Error("String must be lowercase or uppercase");const m=E.lastIndexOf("1");if(m===0||m===-1)throw new Error('Letter "1" must be present between prefix and data only');const b=E.slice(0,m),p=E.slice(m+1);if(p.length<6)throw new Error("Data must be at least 6 characters long");const L=cr.decode(p).slice(0,-6),$=fo(b,L,t);if(!p.endsWith($))throw new Error(`Invalid checksum in ${l}: expected "${$}"`);return{prefix:b,words:L}}const f=io(c);function a(l){const{prefix:w,words:g}=c(l,!1);return{prefix:w,words:g,bytes:r(g)}}function u(l,w){return i(l,o(w))}return{encode:i,decode:c,encodeFromBytes:u,decodeToBytes:a,decodeUnsafe:f,fromWords:r,fromWordsUnsafe:s,toWords:o}}const it=Ji("bech32");function tc(e,t,n,r){We(e);const o=Wo({dkLen:32,asyncTick:10},r),{c:s,dkLen:i,asyncTick:c}=o;if(rt(s,"c"),rt(i,"dkLen"),rt(c,"asyncTick"),s<1)throw new Error("iterations (c) must be >= 1");if(i<1)throw new Error('"dkLen" must be >= 1');if(i>(2**32-1)*e.outputLen)throw new Error("derived key too long");const f=ro(t,"password"),a=ro(n,"salt"),u=new Uint8Array(i),l=Le.create(e,f),w=l._cloneInto().update(a);return{c:s,dkLen:i,asyncTick:c,DK:u,PRF:l,PRFSalt:w}}function ec(e,t,n,r,o){return e.destroy(),t.destroy(),r&&r.destroy(),ce(o),n}function rs(e,t,n,r){const{c:o,dkLen:s,DK:i,PRF:c,PRFSalt:f}=tc(e,t,n,r);let a;const u=new Uint8Array(4),l=dn(u),w=new Uint8Array(c.outputLen);for(let g=1,E=0;E<s;g++,E+=c.outputLen){const m=i.subarray(E,E+c.outputLen);l.setInt32(0,g,!1),(a=f._cloneInto(a)).update(u).digestInto(w),m.set(w.subarray(0,m.length));for(let b=1;b<o;b++){c._cloneInto(a).update(w).digestInto(w);for(let p=0;p<m.length;p++)m[p]^=w[p]}}return ec(c,f,i,a,w)}function ao(e,t,n,r,o,s){let i=e[t++]^n[r++],c=e[t++]^n[r++],f=e[t++]^n[r++],a=e[t++]^n[r++],u=e[t++]^n[r++],l=e[t++]^n[r++],w=e[t++]^n[r++],g=e[t++]^n[r++],E=e[t++]^n[r++],m=e[t++]^n[r++],b=e[t++]^n[r++],p=e[t++]^n[r++],L=e[t++]^n[r++],$=e[t++]^n[r++],H=e[t++]^n[r++],k=e[t++]^n[r++],C=i,F=c,K=f,_=a,N=u,T=l,U=w,v=g,d=E,h=m,y=b,A=p,S=L,x=$,R=H,I=k;for(let O=0;O<8;O+=2)N^=P(C+S|0,7),d^=P(N+C|0,9),S^=P(d+N|0,13),C^=P(S+d|0,18),h^=P(T+F|0,7),x^=P(h+T|0,9),F^=P(x+h|0,13),T^=P(F+x|0,18),R^=P(y+U|0,7),K^=P(R+y|0,9),U^=P(K+R|0,13),y^=P(U+K|0,18),_^=P(I+A|0,7),v^=P(_+I|0,9),A^=P(v+_|0,13),I^=P(A+v|0,18),F^=P(C+_|0,7),K^=P(F+C|0,9),_^=P(K+F|0,13),C^=P(_+K|0,18),U^=P(T+N|0,7),v^=P(U+T|0,9),N^=P(v+U|0,13),T^=P(N+v|0,18),A^=P(y+h|0,7),d^=P(A+y|0,9),h^=P(d+A|0,13),y^=P(h+d|0,18),S^=P(I+R|0,7),x^=P(S+I|0,9),R^=P(x+S|0,13),I^=P(R+x|0,18);o[s++]=i+C|0,o[s++]=c+F|0,o[s++]=f+K|0,o[s++]=a+_|0,o[s++]=u+N|0,o[s++]=l+T|0,o[s++]=w+U|0,o[s++]=g+v|0,o[s++]=E+d|0,o[s++]=m+h|0,o[s++]=b+y|0,o[s++]=p+A|0,o[s++]=L+S|0,o[s++]=$+x|0,o[s++]=H+R|0,o[s++]=k+I|0}function Yn(e,t,n,r,o){let s=r+0,i=r+16*o;for(let c=0;c<16;c++)n[i+c]=e[t+(2*o-1)*16+c];for(let c=0;c<o;c++,s+=16,t+=16)ao(n,i,e,t,n,s),c>0&&(i+=16),ao(n,s,e,t+=16,n,i)}function nc(e,t,n){const r=Wo({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:o,r:s,p:i,dkLen:c,asyncTick:f,maxmem:a,onProgress:u}=r;if(rt(o,"N"),rt(s,"r"),rt(i,"p"),rt(c,"dkLen"),rt(f,"asyncTick"),rt(a,"maxmem"),u!==void 0&&typeof u!="function")throw new Error("progressCb must be a function");const l=128*s,w=l/4,g=Math.pow(2,32);if(o<=1||(o&o-1)!==0||o>g)throw new Error('"N" expected a power of 2, and 2^1 <= N <= 2^32');if(i<1||i>(g-1)*32/l)throw new Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)');if(c<1||c>(g-1)*32)throw new Error('"dkLen" expected integer 1..(2^32 - 1) * 32');const E=l*(o+i+1);if(E>a)throw new Error('"maxmem" limit was hit: memUsed(128*r*(N+p+1))='+E+", maxmem="+a);const m=rs(et,e,t,{c:1,dkLen:l*i}),b=Dn(m),p=Dn(new Uint8Array(l*o)),L=Dn(new Uint8Array(l));let $=()=>{};if(u){const H=2*o*i,k=Math.max(Math.floor(H/1e4),1);let C=0;$=()=>{C++,u&&(!(C%k)||C===H)&&u(C/H)}}return{N:o,r:s,p:i,dkLen:c,blockSize32:w,V:p,B32:b,B:m,tmp:L,blockMixCb:$,asyncTick:f}}function rc(e,t,n,r,o){const s=rs(et,e,n,{c:1,dkLen:t});return ce(n,r,o),s}function os(e,t,n){const{N:r,r:o,p:s,dkLen:i,blockSize32:c,V:f,B32:a,B:u,tmp:l,blockMixCb:w}=nc(e,t,n);eo(a);for(let g=0;g<s;g++){const E=c*g;for(let m=0;m<c;m++)f[m]=a[E+m];for(let m=0,b=0;m<r-1;m++)Yn(f,b,f,b+=c,o),w();Yn(f,(r-1)*c,a,E,o),w();for(let m=0;m<r;m++){const b=(a[E+c-16]&r-1)>>>0;for(let p=0;p<c;p++)l[p]=a[E+p]^f[b*c+p];Yn(l,0,a,E,o),w()}}return eo(a),rc(e,i,u,f,l)}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function oc(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function fr(e){if(typeof e!="boolean")throw new TypeError(`boolean expected, not ${e}`)}function Me(e){if(typeof e!="number")throw new TypeError("number expected, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError("positive integer expected, got "+e)}function st(e,t,n=""){const r=oc(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",f=r?`length=${o}`:`type=${typeof e}`,a=i+"expected Uint8Array"+c+", got "+f;throw r?new RangeError(a):new TypeError(a)}return e}function uo(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function sc(e,t,n=!1){st(e,void 0,"output");const r=t.outputLen;if(e.length<r)throw new RangeError("digestInto() expects output buffer of length at least "+r);if(n&&!Ve(e))throw new Error("invalid output, must be aligned")}function Ut(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function zt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ic(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const pe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,cc=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,fc=e=>{for(let t=0;t<e.length;t++)e[t]=cc(e[t]);return e},ee=pe?e=>e:fc;function ac(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function uc(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function lc(e,t,n){const r=t,o=(()=>[]),s=(c,f)=>r(f,...o(c)).update(c).digest(),i=r(new Uint8Array(e),...o(new Uint8Array(0)));return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.create=(c,...f)=>r(c,...f),s}const dc=(e,t)=>{function n(r,...o){if(st(r,void 0,"key"),e.nonceLength!==void 0){const u=o[0];st(u,e.varSizeNonce?void 0:e.nonceLength,"nonce")}const s=e.tagLength;s&&o[1]!==void 0&&st(o[1],void 0,"AAD");const i=t(r,...o),c=(u,l)=>{if(l!==void 0){if(u!==2)throw new Error("cipher output not supported");st(l,void 0,"output")}};let f=!1;return{encrypt(u,l){if(f)throw new Error("cannot encrypt() twice with same key + nonce");return f=!0,st(u),c(i.encrypt.length,l),i.encrypt(u,l)},decrypt(u,l){if(st(u),s&&u.length<s)throw new Error('"ciphertext" expected length bigger than tagLength='+s);return c(i.decrypt.length,l),i.decrypt(u,l)}}}return Object.assign(n,e),n};function ar(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(st(t,void 0,"output"),t.length!==e)throw new Error('"output" expected Uint8Array of length '+e+", got: "+t.length);if(n&&!Ve(t))throw new Error("invalid output, must be aligned");return t}function hc(e,t,n){Me(e),Me(t),fr(n);const r=new Uint8Array(16),o=ic(r);return o.setBigUint64(0,BigInt(t),n),o.setBigUint64(8,BigInt(e),n),r}function Ve(e){return e.byteOffset%4===0}function En(e){return Uint8Array.from(st(e))}const ss=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),yc=ee(Ut(ss("expand 16-byte k"))),gc=ee(Ut(ss("expand 32-byte k")));function G(e,t){return e<<t|e>>>32-t}const ke=64,pc=16,ur=2**32-1,lo=Uint32Array.of();function wc(e,t,n,r,o,s,i,c){const f=o.length,a=new Uint8Array(ke),u=Ut(a),l=pe&&Ve(o)&&Ve(s),w=l?Ut(o):lo,g=l?Ut(s):lo;if(!pe){for(let E=0;E<f;i++){if(e(t,n,r,u,i,c),ee(u),i>=ur)throw new Error("arx: counter overflow");const m=Math.min(ke,f-E);for(let b=0,p;b<m;b++)p=E+b,s[p]=o[p]^a[b];E+=m}return}for(let E=0;E<f;i++){if(e(t,n,r,u,i,c),i>=ur)throw new Error("arx: counter overflow");const m=Math.min(ke,f-E);if(l&&m===ke){const b=E/4;if(E%4!==0)throw new Error("arx: invalid block position");for(let p=0,L;p<pc;p++)L=b+p,g[L]=w[L]^u[p];E+=ke;continue}for(let b=0,p;b<m;b++)p=E+b,s[p]=o[p]^a[b];E+=m}}function bc(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:o,counterRight:s,rounds:i}=ac({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return Me(o),Me(i),fr(s),fr(n),(c,f,a,u,l=0)=>{st(c,void 0,"key"),st(f,void 0,"nonce"),st(a,void 0,"data");const w=a.length;if(u=ar(w,u,!1),Me(l),l<0||l>=ur)throw new Error("arx: counter overflow");const g=[];let E=c.length,m,b;if(E===32)g.push(m=En(c)),b=gc;else if(E===16&&n)m=new Uint8Array(32),m.set(c),m.set(c,16),b=yc,g.push(m);else throw st(c,32,"arx key"),new Error("invalid key size");(!pe||!Ve(f))&&g.push(f=En(f));let p=Ut(m);if(r){if(f.length!==24)throw new Error("arx: extended nonce must be 24 bytes");const H=f.subarray(0,16);if(pe)r(b,p,Ut(H),p);else{const k=ee(Uint32Array.from(b));r(k,p,Ut(H),p),zt(k),ee(p)}f=f.subarray(16)}else pe||ee(p);const L=16-o;if(L!==f.length)throw new Error(`arx: nonce must be ${L} or 16 bytes`);if(L!==12){const H=new Uint8Array(12);H.set(f,s?0:12-f.length),f=H,g.push(f)}const $=ee(Ut(f));try{return wc(e,b,p,$,a,u,l,i),u}finally{zt(...g)}}}function nt(e,t){return e[t++]&255|(e[t++]&255)<<8}class xc{constructor(t){B(this,"blockLen",16);B(this,"outputLen",16);B(this,"buffer",new Uint8Array(16));B(this,"r",new Uint16Array(10));B(this,"h",new Uint16Array(10));B(this,"pad",new Uint16Array(8));B(this,"pos",0);B(this,"finished",!1);B(this,"destroyed",!1);t=En(st(t,32,"key"));const n=nt(t,0),r=nt(t,2),o=nt(t,4),s=nt(t,6),i=nt(t,8),c=nt(t,10),f=nt(t,12),a=nt(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|o<<6)&7939,this.r[3]=(o>>>7|s<<9)&8191,this.r[4]=(s>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|c<<2)&8191,this.r[7]=(c>>>11|f<<5)&8065,this.r[8]=(f>>>8|a<<8)&8191,this.r[9]=a>>>5&127;for(let u=0;u<8;u++)this.pad[u]=nt(t,16+2*u)}process(t,n,r=!1){const o=r?0:2048,{h:s,r:i}=this,c=i[0],f=i[1],a=i[2],u=i[3],l=i[4],w=i[5],g=i[6],E=i[7],m=i[8],b=i[9],p=nt(t,n+0),L=nt(t,n+2),$=nt(t,n+4),H=nt(t,n+6),k=nt(t,n+8),C=nt(t,n+10),F=nt(t,n+12),K=nt(t,n+14);let _=s[0]+(p&8191),N=s[1]+((p>>>13|L<<3)&8191),T=s[2]+((L>>>10|$<<6)&8191),U=s[3]+(($>>>7|H<<9)&8191),v=s[4]+((H>>>4|k<<12)&8191),d=s[5]+(k>>>1&8191),h=s[6]+((k>>>14|C<<2)&8191),y=s[7]+((C>>>11|F<<5)&8191),A=s[8]+((F>>>8|K<<8)&8191),S=s[9]+(K>>>5|o),x=0,R=x+_*c+N*(5*b)+T*(5*m)+U*(5*E)+v*(5*g);x=R>>>13,R&=8191,R+=d*(5*w)+h*(5*l)+y*(5*u)+A*(5*a)+S*(5*f),x+=R>>>13,R&=8191;let I=x+_*f+N*c+T*(5*b)+U*(5*m)+v*(5*E);x=I>>>13,I&=8191,I+=d*(5*g)+h*(5*w)+y*(5*l)+A*(5*u)+S*(5*a),x+=I>>>13,I&=8191;let O=x+_*a+N*f+T*c+U*(5*b)+v*(5*m);x=O>>>13,O&=8191,O+=d*(5*E)+h*(5*g)+y*(5*w)+A*(5*l)+S*(5*u),x+=O>>>13,O&=8191;let q=x+_*u+N*a+T*f+U*c+v*(5*b);x=q>>>13,q&=8191,q+=d*(5*m)+h*(5*E)+y*(5*g)+A*(5*w)+S*(5*l),x+=q>>>13,q&=8191;let D=x+_*l+N*u+T*a+U*f+v*c;x=D>>>13,D&=8191,D+=d*(5*b)+h*(5*m)+y*(5*E)+A*(5*g)+S*(5*w),x+=D>>>13,D&=8191;let Z=x+_*w+N*l+T*u+U*a+v*f;x=Z>>>13,Z&=8191,Z+=d*c+h*(5*b)+y*(5*m)+A*(5*E)+S*(5*g),x+=Z>>>13,Z&=8191;let M=x+_*g+N*w+T*l+U*u+v*a;x=M>>>13,M&=8191,M+=d*f+h*c+y*(5*b)+A*(5*m)+S*(5*E),x+=M>>>13,M&=8191;let j=x+_*E+N*g+T*w+U*l+v*u;x=j>>>13,j&=8191,j+=d*a+h*f+y*c+A*(5*b)+S*(5*m),x+=j>>>13,j&=8191;let V=x+_*m+N*E+T*g+U*w+v*l;x=V>>>13,V&=8191,V+=d*u+h*a+y*f+A*c+S*(5*b),x+=V>>>13,V&=8191;let Y=x+_*b+N*m+T*E+U*g+v*w;x=Y>>>13,Y&=8191,Y+=d*l+h*u+y*a+A*f+S*c,x+=Y>>>13,Y&=8191,x=(x<<2)+x|0,x=x+R|0,R=x&8191,x=x>>>13,I+=x,s[0]=R,s[1]=I,s[2]=O,s[3]=q,s[4]=D,s[5]=Z,s[6]=M,s[7]=j,s[8]=V,s[9]=Y}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let o=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=o,o=t[c]>>>13,t[c]&=8191;t[0]+=o*5,o=t[0]>>>13,t[0]&=8191,t[1]+=o,o=t[1]>>>13,t[1]&=8191,t[2]+=o,r[0]=t[0]+5,o=r[0]>>>13,r[0]&=8191;for(let c=1;c<10;c++)r[c]=t[c]+o,o=r[c]>>>13,r[c]&=8191;r[9]-=8192;let s=(o^1)-1;for(let c=0;c<10;c++)r[c]&=s;s=~s;for(let c=0;c<10;c++)t[c]=t[c]&s|r[c];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let i=t[0]+n[0];t[0]=i&65535;for(let c=1;c<8;c++)i=(t[c]+n[c]|0)+(i>>>16)|0,t[c]=i&65535;zt(r)}update(t){uo(this),st(t),t=En(t);const{buffer:n,blockLen:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(r-this.pos,o-s);if(i===r){for(;r<=o-s;s+=r)this.process(t,s);continue}n.set(t.subarray(s,s+i),this.pos),this.pos+=i,s+=i,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){this.destroyed=!0,zt(this.h,this.r,this.buffer,this.pad)}digestInto(t){uo(this),sc(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:o}=this;if(o){for(n[o++]=1;o<16;o++)n[o]=0;this.process(n,0,!0)}this.finalize();let s=0;for(let i=0;i<8;i++)t[s++]=r[i]>>>0,t[s++]=r[i]>>>8}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}}const Ec=lc(32,e=>new xc(e));function mc(e,t,n,r,o,s=20){let i=e[0],c=e[1],f=e[2],a=e[3],u=t[0],l=t[1],w=t[2],g=t[3],E=t[4],m=t[5],b=t[6],p=t[7],L=o,$=n[0],H=n[1],k=n[2],C=i,F=c,K=f,_=a,N=u,T=l,U=w,v=g,d=E,h=m,y=b,A=p,S=L,x=$,R=H,I=k;for(let q=0;q<s;q+=2)C=C+N|0,S=G(S^C,16),d=d+S|0,N=G(N^d,12),C=C+N|0,S=G(S^C,8),d=d+S|0,N=G(N^d,7),F=F+T|0,x=G(x^F,16),h=h+x|0,T=G(T^h,12),F=F+T|0,x=G(x^F,8),h=h+x|0,T=G(T^h,7),K=K+U|0,R=G(R^K,16),y=y+R|0,U=G(U^y,12),K=K+U|0,R=G(R^K,8),y=y+R|0,U=G(U^y,7),_=_+v|0,I=G(I^_,16),A=A+I|0,v=G(v^A,12),_=_+v|0,I=G(I^_,8),A=A+I|0,v=G(v^A,7),C=C+T|0,I=G(I^C,16),y=y+I|0,T=G(T^y,12),C=C+T|0,I=G(I^C,8),y=y+I|0,T=G(T^y,7),F=F+U|0,S=G(S^F,16),A=A+S|0,U=G(U^A,12),F=F+U|0,S=G(S^F,8),A=A+S|0,U=G(U^A,7),K=K+v|0,x=G(x^K,16),d=d+x|0,v=G(v^d,12),K=K+v|0,x=G(x^K,8),d=d+x|0,v=G(v^d,7),_=_+N|0,R=G(R^_,16),h=h+R|0,N=G(N^h,12),_=_+N|0,R=G(R^_,8),h=h+R|0,N=G(N^h,7);let O=0;r[O++]=i+C|0,r[O++]=c+F|0,r[O++]=f+K|0,r[O++]=a+_|0,r[O++]=u+N|0,r[O++]=l+T|0,r[O++]=w+U|0,r[O++]=g+v|0,r[O++]=E+d|0,r[O++]=m+h|0,r[O++]=b+y|0,r[O++]=p+A|0,r[O++]=L+S|0,r[O++]=$+x|0,r[O++]=H+R|0,r[O++]=k+I|0}const Bc=bc(mc,{counterRight:!1,counterLength:4,allowShortKeys:!1}),Ac=new Uint8Array(16),ho=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(Ac.subarray(n))},vc=new Uint8Array(32);function yo(e,t,n,r,o){o!==void 0&&st(o,void 0,"AAD");const s=e(t,n,vc),i=hc(r.length,o?o.length:0,!0),c=Ec.create(s);o&&ho(c,o),ho(c,r),c.update(i);const f=c.digest();return zt(s,i),f}const Sc=e=>(t,n,r)=>({encrypt(s,i){const c=s.length;i=ar(c+16,i,!1),i.set(s);const f=i.subarray(0,-16);e(t,n,f,f,1);const a=yo(e,t,n,f,r);return i.set(a,c),zt(a),i},decrypt(s,i){i=ar(s.length-16,i,!1);const c=s.subarray(0,-16),f=s.subarray(-16),a=yo(e,t,n,c,r);if(!uc(f,a))throw zt(a),new Error("invalid tag");return i.set(s.subarray(0,-16)),e(t,n,i,i,1),zt(a),i}}),Lt=dc({blockSize:64,nonceLength:12,tagLength:16},Sc(Bc));/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Tr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function wt(e,t=""){if(!Number.isSafeInteger(e)||e<0){const n=t&&`"${t}" `;throw new Error(`${n}expected integer >= 0, got ${e}`)}}function X(e,t,n=""){const r=Tr(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",f=r?`length=${o}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+c+", got "+f)}return e}function Xt(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash must wrapped by utils.createHasher");wt(e.outputLen),wt(e.blockLen)}function Ee(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function is(e,t){X(e,void 0,"digestInto() output");const n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function cs(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function kt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function zn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function St(e,t){return e<<32-t|e>>>t}const Rc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ic(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Lc(e){for(let t=0;t<e.length;t++)e[t]=Ic(e[t]);return e}const go=Rc?e=>e:Lc,fs=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Oc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function On(e){if(X(e),fs)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Oc[e[n]];return t}const $t={_0:48,_9:57,A:65,F:70,a:97,f:102};function po(e){if(e>=$t._0&&e<=$t._9)return e-$t._0;if(e>=$t.A&&e<=$t.F)return e-($t.A-10);if(e>=$t.a&&e<=$t.f)return e-($t.a-10)}function mn(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(fs)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,s=0;o<n;o++,s+=2){const i=po(e.charCodeAt(s)),c=po(e.charCodeAt(s+1));if(i===void 0||c===void 0){const f=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+s)}r[o]=i*16+c}return r}function ut(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];X(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}function $n(e,t={}){const n=(o,s)=>e(s).update(o).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=o=>e(o),Object.assign(n,t),Object.freeze(n)}function _n(e=32){const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof(t==null?void 0:t.getRandomValues)!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(e))}const Oe=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const kr=BigInt(0),lr=BigInt(1);function Bn(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}" `;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function as(e){if(typeof e=="bigint"){if(!yn(e))throw new Error("positive bigint expected, got "+e)}else wt(e);return e}function en(e){const t=as(e).toString(16);return t.length&1?"0"+t:t}function us(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?kr:BigInt("0x"+e)}function Je(e){return us(On(e))}function Xe(e){return us(On(dr(X(e)).reverse()))}function Un(e,t){wt(t),e=as(e);const n=mn(e.toString(16).padStart(t*2,"0"));if(n.length!==t)throw new Error("number too large");return n}function Kr(e,t){return Un(e,t).reverse()}function dr(e){return Uint8Array.from(e)}function ne(e){return Uint8Array.from(e,(t,n)=>{const r=t.charCodeAt(0);if(t.length!==1||r>127)throw new Error(`string contains non-ASCII character "${e[n]}" with code ${r} at position ${n}`);return r})}const yn=e=>typeof e=="bigint"&&kr<=e;function $c(e,t,n){return yn(e)&&yn(t)&&yn(n)&&t<=e&&e<n}function hr(e,t,n,r){if(!$c(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function _c(e){let t;for(t=0;e>kr;e>>=lr,t+=1);return t}const Hr=e=>(lr<<BigInt(e))-lr;function Uc(e,t,n){if(wt(e,"hashLen"),wt(t,"qByteLen"),typeof n!="function")throw new Error("hmacFn must be a function");const r=b=>new Uint8Array(b),o=Uint8Array.of(),s=Uint8Array.of(0),i=Uint8Array.of(1),c=1e3;let f=r(e),a=r(e),u=0;const l=()=>{f.fill(1),a.fill(0),u=0},w=(...b)=>n(a,ut(f,...b)),g=(b=o)=>{a=w(s,b),f=w(),b.length!==0&&(a=w(i,b),f=w())},E=()=>{if(u++>=c)throw new Error("drbg: tried max amount of iterations");let b=0;const p=[];for(;b<t;){f=w();const L=f.slice();p.push(L),b+=f.length}return ut(...p)};return(b,p)=>{l(),g(b);let L;for(;!(L=p(E()));)g();return l(),L}}function Tn(e,t={},n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(s,i,c){const f=e[s];if(c&&f===void 0)return;const a=typeof f;if(a!==i||f===null)throw new Error(`param "${s}" is invalid: expected ${i}, got ${a}`)}const o=(s,i)=>Object.entries(s).forEach(([c,f])=>r(c,f,i));o(t,!1),o(n,!0)}function wo(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gt=BigInt(0),dt=BigInt(1),re=BigInt(2),ls=BigInt(3),ds=BigInt(4),hs=BigInt(5),Tc=BigInt(7),ys=BigInt(8),kc=BigInt(9),gs=BigInt(16);function pt(e,t){const n=e%t;return n>=gt?n:t+n}function Et(e,t,n){let r=e;for(;t-- >gt;)r*=r,r%=n;return r}function bo(e,t){if(e===gt)throw new Error("invert: expected non-zero number");if(t<=gt)throw new Error("invert: expected positive modulus, got "+t);let n=pt(e,t),r=t,o=gt,s=dt;for(;n!==gt;){const c=r/n,f=r%n,a=o-s*c;r=n,n=f,o=s,s=a}if(r!==dt)throw new Error("invert: does not exist");return pt(o,t)}function Cr(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function ps(e,t){const n=(e.ORDER+dt)/ds,r=e.pow(t,n);return Cr(e,r,t),r}function Kc(e,t){const n=(e.ORDER-hs)/ys,r=e.mul(t,re),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,re),o),c=e.mul(s,e.sub(i,e.ONE));return Cr(e,c,t),c}function Hc(e){const t=Nr(e),n=ws(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+Tc)/gs;return(c,f)=>{let a=c.pow(f,i),u=c.mul(a,r);const l=c.mul(a,o),w=c.mul(a,s),g=c.eql(c.sqr(u),f),E=c.eql(c.sqr(l),f);a=c.cmov(a,u,g),u=c.cmov(w,l,E);const m=c.eql(c.sqr(u),f),b=c.cmov(a,u,m);return Cr(c,b,f),b}}function ws(e){if(e<ls)throw new Error("sqrt is not defined for small field");let t=e-dt,n=0;for(;t%re===gt;)t/=re,n++;let r=re;const o=Nr(e);for(;xo(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return ps;let s=o.pow(r,t);const i=(t+dt)/re;return function(f,a){if(f.is0(a))return a;if(xo(f,a)!==1)throw new Error("Cannot find square root");let u=n,l=f.mul(f.ONE,s),w=f.pow(a,t),g=f.pow(a,i);for(;!f.eql(w,f.ONE);){if(f.is0(w))return f.ZERO;let E=1,m=f.sqr(w);for(;!f.eql(m,f.ONE);)if(E++,m=f.sqr(m),E===u)throw new Error("Cannot find square root");const b=dt<<BigInt(u-E-1),p=f.pow(l,b);u=E,l=f.sqr(p),w=f.mul(w,l),g=f.mul(g,p)}return g}}function Cc(e){return e%ds===ls?ps:e%ys===hs?Kc:e%gs===kc?Hc(e):ws(e)}const Nc=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Fc(e){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},n=Nc.reduce((r,o)=>(r[o]="function",r),t);return Tn(e,n),e}function qc(e,t,n){if(n<gt)throw new Error("invalid exponent, negatives unsupported");if(n===gt)return e.ONE;if(n===dt)return t;let r=e.ONE,o=t;for(;n>gt;)n&dt&&(r=e.mul(r,o)),o=e.sqr(o),n>>=dt;return r}function bs(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,c,f)=>e.is0(c)?i:(r[f]=i,e.mul(i,c)),e.ONE),s=e.inv(o);return t.reduceRight((i,c,f)=>e.is0(c)?i:(r[f]=e.mul(i,r[f]),e.mul(i,c)),s),r}function xo(e,t){const n=(e.ORDER-dt)/re,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),i=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function Zc(e,t){t!==void 0&&wt(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}let Mc=class{constructor(t,n={}){B(this,"ORDER");B(this,"BITS");B(this,"BYTES");B(this,"isLE");B(this,"ZERO",gt);B(this,"ONE",dt);B(this,"_lengths");B(this,"_sqrt");B(this,"_mod");var i;if(t<=gt)throw new Error("invalid field: expected ORDER > 0, got "+t);let r;this.isLE=!1,n!=null&&typeof n=="object"&&(typeof n.BITS=="number"&&(r=n.BITS),typeof n.sqrt=="function"&&(this.sqrt=n.sqrt),typeof n.isLE=="boolean"&&(this.isLE=n.isLE),n.allowedLengths&&(this._lengths=(i=n.allowedLengths)==null?void 0:i.slice()),typeof n.modFromBytes=="boolean"&&(this._mod=n.modFromBytes));const{nBitLength:o,nByteLength:s}=Zc(t,r);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=o,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return pt(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return gt<=t&&t<this.ORDER}is0(t){return t===gt}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&dt)===dt}neg(t){return pt(-t,this.ORDER)}eql(t,n){return t===n}sqr(t){return pt(t*t,this.ORDER)}add(t,n){return pt(t+n,this.ORDER)}sub(t,n){return pt(t-n,this.ORDER)}mul(t,n){return pt(t*n,this.ORDER)}pow(t,n){return qc(this,t,n)}div(t,n){return pt(t*bo(n,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,n){return t+n}subN(t,n){return t-n}mulN(t,n){return t*n}inv(t){return bo(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=Cc(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Kr(t,this.BYTES):Un(t,this.BYTES)}fromBytes(t,n=!1){X(t);const{_lengths:r,BYTES:o,isLE:s,ORDER:i,_mod:c}=this;if(r){if(!r.includes(t.length)||t.length>o)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);const a=new Uint8Array(o);a.set(t,s?0:a.length-t.length),t=a}if(t.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+t.length);let f=s?Xe(t):Je(t);if(c&&(f=pt(f,i)),!n&&!this.isValid(f))throw new Error("invalid field element: outside of range 0..ORDER");return f}invertBatch(t){return bs(this,t)}cmov(t,n,r){return r?n:t}};function Nr(e,t={}){return new Mc(e,t)}function xs(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Es(e){const t=xs(e);return t+Math.ceil(t/2)}function Dc(e,t,n=!1){X(e);const r=e.length,o=xs(t),s=Es(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Xe(e):Je(e),c=pt(i,t-dt)+dt;return n?Kr(c,o):Un(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const me=BigInt(0),oe=BigInt(1);function An(e,t){const n=t.negate();return e?n:t}function Eo(e,t){const n=bs(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function ms(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Vn(e,t){ms(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Hr(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function mo(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),f=e>>i;c>r&&(c-=s,f+=oe);const a=t*r,u=a+Math.abs(c)-1,l=c===0,w=c<0,g=t%2!==0;return{nextN:f,offset:u,isZero:l,isNeg:w,isNegF:g,offsetF:a}}const Xn=new WeakMap,Bs=new WeakMap;function Pn(e){return Bs.get(e)||1}function Bo(e){if(e!==me)throw new Error("invalid wNAF")}let jc=class{constructor(t,n){B(this,"BASE");B(this,"ZERO");B(this,"Fn");B(this,"bits");this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let o=t;for(;n>me;)n&oe&&(r=r.add(o)),o=o.double(),n>>=oe;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Vn(n,this.bits),s=[];let i=t,c=i;for(let f=0;f<r;f++){c=i,s.push(c);for(let a=1;a<o;a++)c=c.add(i),s.push(c);i=c.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE;const i=Vn(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:f,offset:a,isZero:u,isNeg:l,isNegF:w,offsetF:g}=mo(r,c,i);r=f,u?s=s.add(An(w,n[g])):o=o.add(An(l,n[a]))}return Bo(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Vn(t,this.bits);for(let i=0;i<s.windows&&r!==me;i++){const{nextN:c,offset:f,isZero:a,isNeg:u}=mo(r,i,s);if(r=c,!a){const l=n[f];o=o.add(u?l.negate():l)}}return Bo(r),o}getPrecomputes(t,n,r){let o=Xn.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),Xn.set(n,o))),o}cached(t,n,r){const o=Pn(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Pn(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){ms(n,this.bits),Bs.set(t,n),Xn.delete(t)}hasCache(t){return Pn(t)!==1}};function Yc(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>me||r>me;)n&oe&&(s=s.add(o)),r&oe&&(i=i.add(o)),o=o.double(),n>>=oe,r>>=oe;return{p1:s,p2:i}}function Ao(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Fc(t),t}else return Nr(e,{isLE:n})}function zc(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const f of["p","n","h"]){const a=t[f];if(!(typeof a=="bigint"&&a>me))throw new Error(`CURVE.${f} must be positive bigint`)}const o=Ao(t.p,n.Fp,r),s=Ao(t.n,n.Fn,r),c=["Gx","Gy","a","b"];for(const f of c)if(!o.isValid(t[f]))throw new Error(`CURVE.${f} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:s}}function As(e,t){return function(r){const o=e(r);return{secretKey:o,publicKey:t(o)}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ke=BigInt(0),le=BigInt(1),nn=BigInt(2);function Vc(e){return Tn(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function Xc(e){const t=Vc(e),{P:n,type:r,adjustScalarBytes:o,powPminus2:s,randomBytes:i}=t,c=r==="x25519";if(!c&&r!=="x448")throw new Error("invalid type");const f=i||_n,a=c?255:448,u=c?32:56,l=BigInt(c?9:5),w=BigInt(c?121665:39081),g=c?nn**BigInt(254):nn**BigInt(447),E=c?BigInt(8)*nn**BigInt(251)-le:BigInt(4)*nn**BigInt(445)-le,m=g+E+le,b=d=>pt(d,n),p=L(l);function L(d){return Kr(b(d),u)}function $(d){const h=dr(X(d,u,"uCoordinate"));return c&&(h[31]&=127),b(Xe(h))}function H(d){return Xe(o(dr(X(d,u,"scalar"))))}function k(d,h){const y=N($(h),H(d));if(y===Ke)throw new Error("invalid private or public key received");return L(y)}function C(d){return k(d,p)}const F=C,K=k;function _(d,h,y){const A=b(d*(h-y));return h=b(h-A),y=b(y+A),{x_2:h,x_3:y}}function N(d,h){hr("u",d,Ke,n),hr("scalar",h,g,m);const y=h,A=d;let S=le,x=Ke,R=d,I=le,O=Ke;for(let D=BigInt(a-1);D>=Ke;D--){const Z=y>>D≤O^=Z,{x_2:S,x_3:R}=_(O,S,R),{x_2:x,x_3:I}=_(O,x,I),O=Z;const M=S+x,j=b(M*M),V=S-x,Y=b(V*V),z=j-Y,W=R+I,bt=R-I,xt=b(bt*M),Kt=b(W*V),_e=xt+Kt,Ue=xt-Kt;R=b(_e*_e),I=b(A*b(Ue*Ue)),S=b(j*Y),x=b(z*(j+b(w*z)))}({x_2:S,x_3:R}=_(O,S,R)),{x_2:x,x_3:I}=_(O,x,I);const q=s(x);return b(S*q)}const T={secretKey:u,publicKey:u,seed:u},U=(d=f(u))=>(X(d,T.seed,"seed"),d),v={randomSecretKey:U};return Object.freeze({keygen:As(U,F),getSharedSecret:K,getPublicKey:F,scalarMult:k,scalarMultBase:C,utils:v,GuBytes:p.slice(),lengths:T})}class vs{constructor(t,n){B(this,"oHash");B(this,"iHash");B(this,"blockLen");B(this,"outputLen");B(this,"finished",!1);B(this,"destroyed",!1);if(Xt(t),X(n,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,o=new Uint8Array(r);o.set(n.length>r?t.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=t.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),kt(o)}update(t){return Ee(this),this.iHash.update(t),this}digestInto(t){Ee(this),X(t,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const kn=(e,t,n)=>new vs(e,t).update(n).digest();kn.create=(e,t)=>new vs(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vo=(e,t)=>(e+(e>=0?t:-t)/Ss)/t;function Pc(e,t,n){const[[r,o],[s,i]]=t,c=vo(i*e,n),f=vo(-o*e,n);let a=e-c*r-f*s,u=-c*o-f*i;const l=a<Tt,w=u<Tt;l&&(a=-a),w&&(u=-u);const g=Hr(Math.ceil(_c(n)/2))+we;if(a<Tt||a>=g||u<Tt||u>=g)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:l,k1:a,k2neg:w,k2:u}}function yr(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Gn(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Bn(n.lowS,"lowS"),Bn(n.prehash,"prehash"),n.format!==void 0&&yr(n.format),n}let Gc=class extends Error{constructor(t=""){super(t)}};const Dt={Err:Gc,_tlv:{encode:(e,t)=>{const{Err:n}=Dt;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=en(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?en(o.length/2|128):"";return en(e)+s+o+t},decode(e,t){const{Err:n}=Dt;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const f=o&127;if(!f)throw new n("tlv.decode(long): indefinite length not supported");if(f>4)throw new n("tlv.decode(long): byte length is too big");const a=t.subarray(r,r+f);if(a.length!==f)throw new n("tlv.decode: length bytes not complete");if(a[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of a)i=i<<8|u;if(r+=f,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=Dt;if(e<Tt)throw new t("integer: negative integers are not allowed");let n=en(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Dt;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Je(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Dt,o=X(e,void 0,"signature"),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:f}=r.decode(2,s),{v:a,l:u}=r.decode(2,f);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(a)}},hexFromSig(e){const{_tlv:t,_int:n}=Dt,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},Tt=BigInt(0),we=BigInt(1),Ss=BigInt(2),rn=BigInt(3),Wc=BigInt(4);function Rs(e,t={}){const n=zc("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;Tn(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:f}=t;if(f&&(!r.is0(s.a)||typeof f.beta!="bigint"||!Array.isArray(f.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const a=Ls(r,o);function u(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(v,d,h){const{x:y,y:A}=d.toAffine(),S=r.toBytes(y);if(Bn(h,"isCompressed"),h){u();const x=!r.isOdd(A);return ut(Is(x),S)}else return ut(Uint8Array.of(4),S,r.toBytes(A))}function w(v){X(v,void 0,"Point");const{publicKey:d,publicKeyUncompressed:h}=a,y=v.length,A=v[0],S=v.subarray(1);if(y===d&&(A===2||A===3)){const x=r.fromBytes(S);if(!r.isValid(x))throw new Error("bad point: is not on curve, wrong x");const R=m(x);let I;try{I=r.sqrt(R)}catch(D){const Z=D instanceof Error?": "+D.message:"";throw new Error("bad point: is not on curve, sqrt error"+Z)}u();const O=r.isOdd(I);return(A&1)===1!==O&&(I=r.neg(I)),{x,y:I}}else if(y===h&&A===4){const x=r.BYTES,R=r.fromBytes(S.subarray(0,x)),I=r.fromBytes(S.subarray(x,x*2));if(!b(R,I))throw new Error("bad point: is not on curve");return{x:R,y:I}}else throw new Error(`bad point: got length ${y}, expected compressed=${d} or uncompressed=${h}`)}const g=t.toBytes||l,E=t.fromBytes||w;function m(v){const d=r.sqr(v),h=r.mul(d,v);return r.add(r.add(h,r.mul(v,s.a)),s.b)}function b(v,d){const h=r.sqr(d),y=m(v);return r.eql(h,y)}if(!b(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const p=r.mul(r.pow(s.a,rn),Wc),L=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(p,L)))throw new Error("bad curve params: a or b");function $(v,d,h=!1){if(!r.isValid(d)||h&&r.is0(d))throw new Error(`bad point coordinate ${v}`);return d}function H(v){if(!(v instanceof _))throw new Error("Weierstrass Point expected")}function k(v){if(!f||!f.basises)throw new Error("no endo");return Pc(v,f.basises,o.ORDER)}const C=wo((v,d)=>{const{X:h,Y:y,Z:A}=v;if(r.eql(A,r.ONE))return{x:h,y};const S=v.is0();d==null&&(d=S?r.ONE:r.inv(A));const x=r.mul(h,d),R=r.mul(y,d),I=r.mul(A,d);if(S)return{x:r.ZERO,y:r.ZERO};if(!r.eql(I,r.ONE))throw new Error("invZ was invalid");return{x,y:R}}),F=wo(v=>{if(v.is0()){if(t.allowInfinityPoint&&!r.is0(v.Y))return;throw new Error("bad point: ZERO")}const{x:d,y:h}=v.toAffine();if(!r.isValid(d)||!r.isValid(h))throw new Error("bad point: x or y not field elements");if(!b(d,h))throw new Error("bad point: equation left != right");if(!v.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function K(v,d,h,y,A){return h=new _(r.mul(h.X,v),h.Y,h.Z),d=An(y,d),h=An(A,h),d.add(h)}const U=class U{constructor(d,h,y){B(this,"X");B(this,"Y");B(this,"Z");this.X=$("x",d),this.Y=$("y",h,!0),this.Z=$("z",y),Object.freeze(this)}static CURVE(){return s}static fromAffine(d){const{x:h,y}=d||{};if(!d||!r.isValid(h)||!r.isValid(y))throw new Error("invalid affine point");if(d instanceof U)throw new Error("projective point not allowed");return r.is0(h)&&r.is0(y)?U.ZERO:new U(h,y,r.ONE)}static fromBytes(d){const h=U.fromAffine(E(X(d,void 0,"point")));return h.assertValidity(),h}static fromHex(d){return U.fromBytes(mn(d))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(d=8,h=!0){return T.createCache(this,d),h||this.multiply(rn),this}assertValidity(){F(this)}hasEvenY(){const{y:d}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(d)}equals(d){H(d);const{X:h,Y:y,Z:A}=this,{X:S,Y:x,Z:R}=d,I=r.eql(r.mul(h,R),r.mul(S,A)),O=r.eql(r.mul(y,R),r.mul(x,A));return I&&O}negate(){return new U(this.X,r.neg(this.Y),this.Z)}double(){const{a:d,b:h}=s,y=r.mul(h,rn),{X:A,Y:S,Z:x}=this;let R=r.ZERO,I=r.ZERO,O=r.ZERO,q=r.mul(A,A),D=r.mul(S,S),Z=r.mul(x,x),M=r.mul(A,S);return M=r.add(M,M),O=r.mul(A,x),O=r.add(O,O),R=r.mul(d,O),I=r.mul(y,Z),I=r.add(R,I),R=r.sub(D,I),I=r.add(D,I),I=r.mul(R,I),R=r.mul(M,R),O=r.mul(y,O),Z=r.mul(d,Z),M=r.sub(q,Z),M=r.mul(d,M),M=r.add(M,O),O=r.add(q,q),q=r.add(O,q),q=r.add(q,Z),q=r.mul(q,M),I=r.add(I,q),Z=r.mul(S,x),Z=r.add(Z,Z),q=r.mul(Z,M),R=r.sub(R,q),O=r.mul(Z,D),O=r.add(O,O),O=r.add(O,O),new U(R,I,O)}add(d){H(d);const{X:h,Y:y,Z:A}=this,{X:S,Y:x,Z:R}=d;let I=r.ZERO,O=r.ZERO,q=r.ZERO;const D=s.a,Z=r.mul(s.b,rn);let M=r.mul(h,S),j=r.mul(y,x),V=r.mul(A,R),Y=r.add(h,y),z=r.add(S,x);Y=r.mul(Y,z),z=r.add(M,j),Y=r.sub(Y,z),z=r.add(h,A);let W=r.add(S,R);return z=r.mul(z,W),W=r.add(M,V),z=r.sub(z,W),W=r.add(y,A),I=r.add(x,R),W=r.mul(W,I),I=r.add(j,V),W=r.sub(W,I),q=r.mul(D,z),I=r.mul(Z,V),q=r.add(I,q),I=r.sub(j,q),q=r.add(j,q),O=r.mul(I,q),j=r.add(M,M),j=r.add(j,M),V=r.mul(D,V),z=r.mul(Z,z),j=r.add(j,V),V=r.sub(M,V),V=r.mul(D,V),z=r.add(z,V),M=r.mul(j,z),O=r.add(O,M),M=r.mul(W,z),I=r.mul(Y,I),I=r.sub(I,M),M=r.mul(Y,j),q=r.mul(W,q),q=r.add(q,M),new U(I,O,q)}subtract(d){return this.add(d.negate())}is0(){return this.equals(U.ZERO)}multiply(d){const{endo:h}=t;if(!o.isValidNot0(d))throw new Error("invalid scalar: out of range");let y,A;const S=x=>T.cached(this,x,R=>Eo(U,R));if(h){const{k1neg:x,k1:R,k2neg:I,k2:O}=k(d),{p:q,f:D}=S(R),{p:Z,f:M}=S(O);A=D.add(M),y=K(h.beta,q,Z,x,I)}else{const{p:x,f:R}=S(d);y=x,A=R}return Eo(U,[y,A])[0]}multiplyUnsafe(d){const{endo:h}=t,y=this;if(!o.isValid(d))throw new Error("invalid scalar: out of range");if(d===Tt||y.is0())return U.ZERO;if(d===we)return y;if(T.hasCache(this))return this.multiply(d);if(h){const{k1neg:A,k1:S,k2neg:x,k2:R}=k(d),{p1:I,p2:O}=Yc(U,y,S,R);return K(h.beta,I,O,A,x)}else return T.unsafe(y,d)}toAffine(d){return C(this,d)}isTorsionFree(){const{isTorsionFree:d}=t;return i===we?!0:d?d(U,this):T.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:d}=t;return i===we?this:d?d(U,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(d=!0){return Bn(d,"isCompressed"),this.assertValidity(),g(U,this,d)}toHex(d=!0){return On(this.toBytes(d))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};B(U,"BASE",new U(s.Gx,s.Gy,r.ONE)),B(U,"ZERO",new U(r.ZERO,r.ONE,r.ZERO)),B(U,"Fp",r),B(U,"Fn",o);let _=U;const N=o.BITS,T=new jc(_,t.endo?Math.ceil(N/2):N);return _.BASE.precompute(8),_}function Is(e){return Uint8Array.of(e?2:3)}function Ls(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Qc(e,t={}){const{Fn:n}=e,r=t.randomBytes||_n,o=Object.assign(Ls(e.Fp,n),{seed:Es(n.ORDER)});function s(g){try{const E=n.fromBytes(g);return n.isValidNot0(E)}catch{return!1}}function i(g,E){const{publicKey:m,publicKeyUncompressed:b}=o;try{const p=g.length;return E===!0&&p!==m||E===!1&&p!==b?!1:!!e.fromBytes(g)}catch{return!1}}function c(g=r(o.seed)){return Dc(X(g,o.seed,"seed"),n.ORDER)}function f(g,E=!0){return e.BASE.multiply(n.fromBytes(g)).toBytes(E)}function a(g){const{secretKey:E,publicKey:m,publicKeyUncompressed:b}=o;if(!Tr(g)||"_lengths"in n&&n._lengths||E===m)return;const p=X(g,void 0,"key").length;return p===m||p===b}function u(g,E,m=!0){if(a(g)===!0)throw new Error("first arg must be private key");if(a(E)===!1)throw new Error("second arg must be public key");const b=n.fromBytes(g);return e.fromBytes(E).multiply(b).toBytes(m)}const l={isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c},w=As(c,f);return Object.freeze({getPublicKey:f,getSharedSecret:u,keygen:w,Point:e,utils:l,lengths:o})}function Os(e,t,n={}){Xt(t),Tn(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),n=Object.assign({},n);const r=n.randomBytes||_n,o=n.hmac||((d,h)=>kn(t,d,h)),{Fp:s,Fn:i}=e,{ORDER:c,BITS:f}=i,{keygen:a,getPublicKey:u,getSharedSecret:l,utils:w,lengths:g}=Qc(e,n),E={prehash:!0,lowS:typeof n.lowS=="boolean"?n.lowS:!0,format:"compact",extraEntropy:!1},m=c*Ss<s.ORDER;function b(d){const h=c>>we;return d>h}function p(d,h){if(!i.isValidNot0(h))throw new Error(`invalid signature ${d}: out of range 1..Point.Fn.ORDER`);return h}function L(){if(m)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function $(d,h){yr(h);const y=g.signature,A=h==="compact"?y:h==="recovered"?y+1:void 0;return X(d,A)}class H{constructor(h,y,A){B(this,"r");B(this,"s");B(this,"recovery");if(this.r=p("r",h),this.s=p("s",y),A!=null){if(L(),![0,1,2,3].includes(A))throw new Error("invalid recovery id");this.recovery=A}Object.freeze(this)}static fromBytes(h,y=E.format){$(h,y);let A;if(y==="der"){const{r:I,s:O}=Dt.toSig(X(h));return new H(I,O)}y==="recovered"&&(A=h[0],y="compact",h=h.subarray(1));const S=g.signature/2,x=h.subarray(0,S),R=h.subarray(S,S*2);return new H(i.fromBytes(x),i.fromBytes(R),A)}static fromHex(h,y){return this.fromBytes(mn(h),y)}assertRecovery(){const{recovery:h}=this;if(h==null)throw new Error("invalid recovery id: must be present");return h}addRecoveryBit(h){return new H(this.r,this.s,h)}recoverPublicKey(h){const{r:y,s:A}=this,S=this.assertRecovery(),x=S===2||S===3?y+c:y;if(!s.isValid(x))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const R=s.toBytes(x),I=e.fromBytes(ut(Is((S&1)===0),R)),O=i.inv(x),q=C(X(h,void 0,"msgHash")),D=i.create(-q*O),Z=i.create(A*O),M=e.BASE.multiplyUnsafe(D).add(I.multiplyUnsafe(Z));if(M.is0())throw new Error("invalid recovery: point at infinify");return M.assertValidity(),M}hasHighS(){return b(this.s)}toBytes(h=E.format){if(yr(h),h==="der")return mn(Dt.hexFromSig(this));const{r:y,s:A}=this,S=i.toBytes(y),x=i.toBytes(A);return h==="recovered"?(L(),ut(Uint8Array.of(this.assertRecovery()),S,x)):ut(S,x)}toHex(h){return On(this.toBytes(h))}}const k=n.bits2int||function(h){if(h.length>8192)throw new Error("input is too large");const y=Je(h),A=h.length*8-f;return A>0?y>>BigInt(A):y},C=n.bits2int_modN||function(h){return i.create(k(h))},F=Hr(f);function K(d){return hr("num < 2^"+f,d,Tt,F),i.toBytes(d)}function _(d,h){return X(d,void 0,"message"),h?X(t(d),void 0,"prehashed message"):d}function N(d,h,y){const{lowS:A,prehash:S,extraEntropy:x}=Gn(y,E);d=_(d,S);const R=C(d),I=i.fromBytes(h);if(!i.isValidNot0(I))throw new Error("invalid private key");const O=[K(I),K(R)];if(x!=null&&x!==!1){const M=x===!0?r(g.secretKey):x;O.push(X(M,void 0,"extraEntropy"))}const q=ut(...O),D=R;function Z(M){const j=k(M);if(!i.isValidNot0(j))return;const V=i.inv(j),Y=e.BASE.multiply(j).toAffine(),z=i.create(Y.x);if(z===Tt)return;const W=i.create(V*i.create(D+z*I));if(W===Tt)return;let bt=(Y.x===z?0:2)|Number(Y.y&we),xt=W;return A&&b(W)&&(xt=i.neg(W),bt^=1),new H(z,xt,m?void 0:bt)}return{seed:q,k2sig:Z}}function T(d,h,y={}){const{seed:A,k2sig:S}=N(d,h,y);return Uc(t.outputLen,i.BYTES,o)(A,S).toBytes(y.format)}function U(d,h,y,A={}){const{lowS:S,prehash:x,format:R}=Gn(A,E);if(y=X(y,void 0,"publicKey"),h=_(h,x),!Tr(d)){const I=d instanceof H?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+I)}$(d,R);try{const I=H.fromBytes(d,R),O=e.fromBytes(y);if(S&&I.hasHighS())return!1;const{r:q,s:D}=I,Z=C(h),M=i.inv(D),j=i.create(Z*M),V=i.create(q*M),Y=e.BASE.multiplyUnsafe(j).add(O.multiplyUnsafe(V));return Y.is0()?!1:i.create(Y.x)===q}catch{return!1}}function v(d,h,y={}){const{prehash:A}=Gn(y,E);return h=_(h,A),H.fromBytes(d,"recovered").recoverPublicKey(h).toBytes()}return Object.freeze({keygen:a,getPublicKey:u,getSharedSecret:l,utils:w,lengths:g,Point:e,sign:T,verify:U,recoverPublicKey:v,Signature:H,hash:t})}function Jc(e,t,n){return e&t^~e&n}function tf(e,t,n){return e&t^e&n^t&n}class $s{constructor(t,n,r,o){B(this,"blockLen");B(this,"outputLen");B(this,"padOffset");B(this,"isLE");B(this,"buffer");B(this,"view");B(this,"finished",!1);B(this,"length",0);B(this,"pos",0);B(this,"destroyed",!1);this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=zn(this.buffer)}update(t){Ee(this),X(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const f=zn(t);for(;o<=s-i;i+=o)this.process(f,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ee(this),is(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,kt(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let l=i;l<o;l++)n[l]=0;r.setBigUint64(o-8,BigInt(this.length*8),s),this.process(r,0);const c=zn(t),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const a=f/4,u=this.get();if(a>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<a;l++)c.setUint32(4*l,u[l],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Nt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ot=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),on=BigInt(2**32-1),So=BigInt(32);function ef(e,t=!1){return t?{h:Number(e&on),l:Number(e>>So&on)}:{h:Number(e>>So&on)|0,l:Number(e&on)|0}}function _s(e,t=!1){const n=e.length;let r=new Uint32Array(n),o=new Uint32Array(n);for(let s=0;s<n;s++){const{h:i,l:c}=ef(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Ro=(e,t,n)=>e>>>n,Io=(e,t,n)=>e<<32-n|t>>>n,de=(e,t,n)=>e>>>n|t<<32-n,he=(e,t,n)=>e<<32-n|t>>>n,sn=(e,t,n)=>e<<64-n|t>>>n-32,cn=(e,t,n)=>e>>>n-32|t<<64-n,nf=(e,t,n)=>e<<n|t>>>32-n,rf=(e,t,n)=>t<<n|e>>>32-n,of=(e,t,n)=>t<<n-32|e>>>64-n,sf=(e,t,n)=>e<<n-32|t>>>64-n;function _t(e,t,n,r){const o=(t>>>0)+(r>>>0);return{h:e+n+(o/2**32|0)|0,l:o|0}}const cf=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),ff=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,af=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),uf=(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,lf=(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0),df=(e,t,n,r,o,s)=>t+n+r+o+s+(e/2**32|0)|0,hf=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ft=new Uint32Array(64);class yf extends $s{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:f}=this;return[t,n,r,o,s,i,c,f]}set(t,n,r,o,s,i,c,f){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=f|0}process(t,n){for(let l=0;l<16;l++,n+=4)Ft[l]=t.getUint32(n,!1);for(let l=16;l<64;l++){const w=Ft[l-15],g=Ft[l-2],E=St(w,7)^St(w,18)^w>>>3,m=St(g,17)^St(g,19)^g>>>10;Ft[l]=m+Ft[l-7]+E+Ft[l-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:f,G:a,H:u}=this;for(let l=0;l<64;l++){const w=St(c,6)^St(c,11)^St(c,25),g=u+w+Jc(c,f,a)+hf[l]+Ft[l]|0,m=(St(r,2)^St(r,13)^St(r,22))+tf(r,o,s)|0;u=a,a=f,f=c,c=i+g|0,i=s,s=o,o=r,r=g+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,f=f+this.F|0,a=a+this.G|0,u=u+this.H|0,this.set(r,o,s,i,c,f,a,u)}roundClean(){kt(Ft)}destroy(){this.set(0,0,0,0,0,0,0,0),kt(this.buffer)}}class gf extends yf{constructor(){super(32);B(this,"A",Nt[0]|0);B(this,"B",Nt[1]|0);B(this,"C",Nt[2]|0);B(this,"D",Nt[3]|0);B(this,"E",Nt[4]|0);B(this,"F",Nt[5]|0);B(this,"G",Nt[6]|0);B(this,"H",Nt[7]|0)}}const Us=_s(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),pf=Us[0],wf=Us[1],qt=new Uint32Array(80),Zt=new Uint32Array(80);class bf extends $s{constructor(t){super(128,t,16,!1)}get(){const{Ah:t,Al:n,Bh:r,Bl:o,Ch:s,Cl:i,Dh:c,Dl:f,Eh:a,El:u,Fh:l,Fl:w,Gh:g,Gl:E,Hh:m,Hl:b}=this;return[t,n,r,o,s,i,c,f,a,u,l,w,g,E,m,b]}set(t,n,r,o,s,i,c,f,a,u,l,w,g,E,m,b){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=f|0,this.Eh=a|0,this.El=u|0,this.Fh=l|0,this.Fl=w|0,this.Gh=g|0,this.Gl=E|0,this.Hh=m|0,this.Hl=b|0}process(t,n){for(let $=0;$<16;$++,n+=4)qt[$]=t.getUint32(n),Zt[$]=t.getUint32(n+=4);for(let $=16;$<80;$++){const H=qt[$-15]|0,k=Zt[$-15]|0,C=de(H,k,1)^de(H,k,8)^Ro(H,k,7),F=he(H,k,1)^he(H,k,8)^Io(H,k,7),K=qt[$-2]|0,_=Zt[$-2]|0,N=de(K,_,19)^sn(K,_,61)^Ro(K,_,6),T=he(K,_,19)^cn(K,_,61)^Io(K,_,6),U=af(F,T,Zt[$-7],Zt[$-16]),v=uf(U,C,N,qt[$-7],qt[$-16]);qt[$]=v|0,Zt[$]=U|0}let{Ah:r,Al:o,Bh:s,Bl:i,Ch:c,Cl:f,Dh:a,Dl:u,Eh:l,El:w,Fh:g,Fl:E,Gh:m,Gl:b,Hh:p,Hl:L}=this;for(let $=0;$<80;$++){const H=de(l,w,14)^de(l,w,18)^sn(l,w,41),k=he(l,w,14)^he(l,w,18)^cn(l,w,41),C=l&g^~l&m,F=w&E^~w&b,K=lf(L,k,F,wf[$],Zt[$]),_=df(K,p,H,C,pf[$],qt[$]),N=K|0,T=de(r,o,28)^sn(r,o,34)^sn(r,o,39),U=he(r,o,28)^cn(r,o,34)^cn(r,o,39),v=r&s^r&c^s&c,d=o&i^o&f^i&f;p=m|0,L=b|0,m=g|0,b=E|0,g=l|0,E=w|0,{h:l,l:w}=_t(a|0,u|0,_|0,N|0),a=c|0,u=f|0,c=s|0,f=i|0,s=r|0,i=o|0;const h=cf(N,U,d);r=ff(h,_,T,v),o=h|0}({h:r,l:o}=_t(this.Ah|0,this.Al|0,r|0,o|0)),{h:s,l:i}=_t(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:f}=_t(this.Ch|0,this.Cl|0,c|0,f|0),{h:a,l:u}=_t(this.Dh|0,this.Dl|0,a|0,u|0),{h:l,l:w}=_t(this.Eh|0,this.El|0,l|0,w|0),{h:g,l:E}=_t(this.Fh|0,this.Fl|0,g|0,E|0),{h:m,l:b}=_t(this.Gh|0,this.Gl|0,m|0,b|0),{h:p,l:L}=_t(this.Hh|0,this.Hl|0,p|0,L|0),this.set(r,o,s,i,c,f,a,u,l,w,g,E,m,b,p,L)}roundClean(){kt(qt,Zt)}destroy(){kt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class xf extends bf{constructor(){super(48);B(this,"Ah",ot[0]|0);B(this,"Al",ot[1]|0);B(this,"Bh",ot[2]|0);B(this,"Bl",ot[3]|0);B(this,"Ch",ot[4]|0);B(this,"Cl",ot[5]|0);B(this,"Dh",ot[6]|0);B(this,"Dl",ot[7]|0);B(this,"Eh",ot[8]|0);B(this,"El",ot[9]|0);B(this,"Fh",ot[10]|0);B(this,"Fl",ot[11]|0);B(this,"Gh",ot[12]|0);B(this,"Gl",ot[13]|0);B(this,"Hh",ot[14]|0);B(this,"Hl",ot[15]|0)}}const Ts=$n(()=>new gf,Oe(1)),Ef=$n(()=>new xf,Oe(2));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const mf=BigInt(1),Lo=BigInt(2),Bf=BigInt(3),Af=BigInt(5);BigInt(8);const ks=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed");function vf(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),o=BigInt(80),s=ks,c=e*e%s*e%s,f=Et(c,Lo,s)*c%s,a=Et(f,mf,s)*e%s,u=Et(a,Af,s)*a%s,l=Et(u,t,s)*u%s,w=Et(l,n,s)*l%s,g=Et(w,r,s)*w%s,E=Et(g,o,s)*g%s,m=Et(E,o,s)*g%s,b=Et(m,t,s)*u%s;return{pow_p_5_8:Et(b,Lo,s)*e%s,b2:c}}function Sf(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const Rf=(()=>{const e=ks;return Xc({P:e,type:"x25519",powPminus2:t=>{const{pow_p_5_8:n,b2:r}=vf(t);return pt(Et(n,Bf,e)*r,e)},adjustScalarBytes:Sf})})();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const If={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Lf={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},Of=Rs(If),Ks=Os(Of,Ts),$f=Rs(Lf),_f=Os($f,Ef);function Uf(e,t,n){return Xt(e),n===void 0&&(n=new Uint8Array(e.outputLen)),kn(e,n,t)}const Wn=Uint8Array.of(0),Oo=Uint8Array.of();function Tf(e,t,n,r=32){Xt(e),wt(r,"length");const o=e.outputLen;if(r>255*o)throw new Error("Length must be <= 255*HashLen");const s=Math.ceil(r/o);n===void 0?n=Oo:X(n,void 0,"info");const i=new Uint8Array(s*o),c=kn.create(e,t),f=c._cloneInto(),a=new Uint8Array(c.outputLen);for(let u=0;u<s;u++)Wn[0]=u+1,f.update(u===0?Oo:a).update(n).update(Wn).digestInto(a),i.set(a,o*u),c._cloneInto(f);return c.destroy(),f.destroy(),kt(a,Wn),i.slice(0,r)}const kf=BigInt(0),He=BigInt(1),Kf=BigInt(2),Hf=BigInt(7),Cf=BigInt(256),Nf=BigInt(113),Hs=[],Cs=[],Ns=[];for(let e=0,t=He,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Hs.push(2*(5*r+n)),Cs.push((e+1)*(e+2)/2%64);let o=kf;for(let s=0;s<7;s++)t=(t<<He^(t>>Hf)*Nf)%Cf,t&Kf&&(o^=He<<(He<<BigInt(s))-He);Ns.push(o)}const Fs=_s(Ns,!0),Ff=Fs[0],qf=Fs[1],$o=(e,t,n)=>n>32?of(e,t,n):nf(e,t,n),_o=(e,t,n)=>n>32?sf(e,t,n):rf(e,t,n);function Zf(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,f=(i+2)%10,a=n[f],u=n[f+1],l=$o(a,u,1)^n[c],w=_o(a,u,1)^n[c+1];for(let g=0;g<50;g+=10)e[i+g]^=l,e[i+g+1]^=w}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=Cs[i],f=$o(o,s,c),a=_o(o,s,c),u=Hs[i];o=e[u],s=e[u+1],e[u]=f,e[u+1]=a}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=Ff[r],e[1]^=qf[r]}kt(n)}class Kn{constructor(t,n,r,o=!1,s=24){B(this,"state");B(this,"pos",0);B(this,"posOut",0);B(this,"finished",!1);B(this,"state32");B(this,"destroyed",!1);B(this,"blockLen");B(this,"suffix");B(this,"outputLen");B(this,"enableXOF",!1);B(this,"rounds");if(this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,wt(r,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=cs(this.state)}clone(){return this._cloneInto()}keccak(){go(this.state32),Zf(this.state32,this.rounds),go(this.state32),this.posOut=0,this.pos=0}update(t){Ee(this),X(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,(n&128)!==0&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){Ee(this,!1),X(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return wt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(is(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,kt(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Kn(n,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const qs=(e,t,n,r={})=>$n(()=>new Kn(t,e,n),r),tn=qs(6,136,32,Oe(8)),Mf=qs(6,72,64,Oe(10)),Zs=(e,t,n,r={})=>$n((o={})=>new Kn(t,e,o.dkLen===void 0?n:o.dkLen,!0),r),Df=Zs(31,168,16,Oe(11)),ae=Zs(31,136,32,Oe(12));function Fr(e){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw new Error("wrong u32 integer:"+e);return e}function Ms(e){return Fr(e),(e&e-1)===0&&e!==0}function Ds(e,t){Fr(e);let n=0;for(let r=0;r<t;r++,e>>>=1)n=n<<1|e&1;return n}function js(e){return Fr(e),31-Math.clz32(e)}function Uo(e){const t=e.length;if(t<2||!Ms(t))throw new Error("n must be a power of 2 and greater than 1. Got "+t);const n=js(t);for(let r=0;r<t;r++){const o=Ds(r,n);if(r<o){const s=e[r];e[r]=e[o],e[o]=s}}return e}const To=(e,t)=>{const{N:n,roots:r,dit:o,invertButterflies:s=!1,skipStages:i=0,brp:c=!0}=t,f=js(n);if(!Ms(n))throw new Error("FFT: Polynomial size should be power of two");const a=o!==s;return u=>{if(u.length!==n)throw new Error("FFT: wrong Polynomial length");o&&c&&Uo(u);for(let l=0,w=1;l<f-i;l++){const g=o?l+1+i:f-l,E=1<<g,m=E>>1,b=n>>g;for(let p=0;p<n;p+=E)for(let L=0,$=w++;L<m;L++){const H=s?o?n-$:$:L*b,k=p+L,C=p+L+m,F=r[H],K=u[C],_=u[k];if(a){const N=e.mul(K,F);u[k]=e.add(_,N),u[C]=e.sub(_,N)}else s?(u[k]=e.add(K,_),u[C]=e.mul(e.sub(K,_),F)):(u[k]=e.add(_,K),u[C]=e.mul(e.sub(_,K),F))}}return!o&&c&&Uo(u),u}};/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */const Pt=_n;function Qn(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function jf(e){return Uint8Array.from(e)}function De(e,...t){const n=o=>typeof o=="number"?o:o.bytesLen,r=t.reduce((o,s)=>o+n(s),0);return{bytesLen:r,encode:o=>{const s=new Uint8Array(r);for(let i=0,c=0;i<t.length;i++){const f=t[i],a=n(f),u=typeof f=="number"?o[i]:f.encode(o[i]);X(u,a,e),s.set(u,c),typeof f!="number"&&u.fill(0),c+=a}return s},decode:o=>{X(o,r,e);const s=[];for(const i of t){const c=n(i),f=o.subarray(0,c);s.push(typeof i=="number"?f:i.decode(f)),o=o.subarray(c)}return s}}}function Jn(e,t){const n=t*e.bytesLen;return{bytesLen:n,encode:r=>{if(r.length!==t)throw new Error(`vecCoder.encode: wrong length=${r.length}. Expected: ${t}`);const o=new Uint8Array(n);for(let s=0,i=0;s<r.length;s++){const c=e.encode(r[s]);o.set(c,i),c.fill(0),i+=c.length}return o},decode:r=>{X(r,n);const o=[];for(let s=0;s<r.length;s+=e.bytesLen)o.push(e.decode(r.subarray(s,s+e.bytesLen)));return o}}}function ct(...e){for(const t of e)if(Array.isArray(t))for(const n of t)n.fill(0);else t.fill(0)}function ko(e){return(1<<e)-1}/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */const Yf=e=>{const{newPoly:t,N:n,Q:r,F:o,ROOT_OF_UNITY:s,brvBits:i}=e,c=(p,L=r)=>{const $=p%L|0;return($>=0?$|0:L+$|0)|0},f=(p,L=r)=>{const $=c(p,L)|0;return($>L>>1?$-L|0:$)|0};function a(){const p=t(n);for(let L=0;L<n;L++){const $=Ds(L,i),H=BigInt(s)**BigInt($)%BigInt(r);p[L]=Number(H)|0}return p}const u=a(),l={add:(p,L)=>c((p|0)+(L|0))|0,sub:(p,L)=>c((p|0)-(L|0))|0,mul:(p,L)=>c((p|0)*(L|0))|0,inv:p=>{throw new Error("not implemented")}},w={N:n,roots:u,invertButterflies:!0,skipStages:1,brp:!1},g=To(l,{dit:!1,...w}),E=To(l,{dit:!0,...w});return{mod:c,smod:f,nttZetas:u,NTT:{encode:p=>g(p),decode:p=>{E(p);for(let L=0;L<p.length;L++)p[L]=c(o*p[L]);return p}},bitsCoder:(p,L)=>{const $=ko(p),H=p*(n/8);return{bytesLen:H,encode:k=>{const C=new Uint8Array(H);for(let F=0,K=0,_=0,N=0;F<k.length;F++)for(K|=(L.encode(k[F])&$)<<_,_+=p;_>=8;_-=8,K>>=8)C[N++]=K&ko(_);return C},decode:k=>{const C=t(n);for(let F=0,K=0,_=0,N=0;F<k.length;F++)for(K|=k[F]<<_,_+=8;_>=p;_-=p,K>>=p)C[N++]=L.decode(K&$);return C}}}}},zf=e=>(t,n)=>{n||(n=e.blockLen);const r=new Uint8Array(t.length+2);r.set(t);const o=t.length,s=new Uint8Array(n);let i=e.create({}),c=0,f=0;return{stats:()=>({calls:c,xofs:f}),get:(a,u)=>(r[o+0]=a,r[o+1]=u,i.destroy(),i=e.create({}).update(r),c++,()=>(f++,i.xofInto(s))),clean:()=>{i.destroy(),ct(s,r)}}},Vf=zf(Df);/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */const lt=256,Vt=3329,Xf=3303,Pf=17,{mod:Pe,nttZetas:Gf,NTT:Gt,bitsCoder:Wf}=Yf({N:lt,Q:Vt,F:Xf,ROOT_OF_UNITY:Pf,newPoly:e=>new Uint16Array(e),brvBits:7}),Ys={768:{N:lt,Q:Vt,K:3,ETA1:2,ETA2:2,du:10,dv:4,RBGstrength:192},1024:{N:lt,Q:Vt,K:4,ETA1:2,ETA2:2,du:11,dv:5,RBGstrength:256}},Qf=e=>{if(e>=12)return{encode:n=>n,decode:n=>n};const t=2**(e-1);return{encode:n=>((n<<e)+Vt/2)/Vt,decode:n=>n*Vt+t>>>e}},Ce=e=>Wf(e,Qf(e));function Wt(e,t){for(let n=0;n<lt;n++)e[n]=Pe(e[n]+t[n])}function Jf(e,t){for(let n=0;n<lt;n++)e[n]=Pe(e[n]-t[n])}function ta(e,t,n,r,o){const s=Pe(t*r*o+e*n),i=Pe(e*r+t*n);return{c0:s,c1:i}}function fn(e,t){for(let n=0;n<lt/2;n++){let r=Gf[64+(n>>1)];n&1&&(r=-r);const{c0:o,c1:s}=ta(e[2*n+0],e[2*n+1],t[2*n+0],t[2*n+1],r);e[2*n+0]=o,e[2*n+1]=s}return e}function Ko(e){const t=new Uint16Array(lt);for(let n=0;n<lt;){const r=e();if(r.length%3)throw new Error("SampleNTT: unaligned block");for(let o=0;n<lt&&o+3<=r.length;o+=3){const s=(r[o+0]>>0|r[o+1]<<8)&4095,i=(r[o+1]>>4|r[o+2]<<4)&4095;s<Vt&&(t[n++]=s),n<lt&&i<Vt&&(t[n++]=i)}}return t}function Ne(e,t,n,r){const o=e(r*lt/4,t,n),s=new Uint16Array(lt),i=cs(o);let c=0;for(let f=0,a=0,u=0,l=0;f<i.length;f++){let w=i[f];for(let g=0;g<32;g++)u+=w&1,w>>=1,c+=1,c===r?(l=u,u=0):c===2*r&&(s[a++]=Pe(l-u),u=0,c=0)}if(c)throw new Error(`sampleCBD: leftover bits: ${c}`);return s}const ea=e=>{const{K:t,PRF:n,XOF:r,HASH512:o,ETA1:s,ETA2:i,du:c,dv:f}=e,a=Ce(1),u=Ce(f),l=Ce(c),w=De("publicKey",Jn(Ce(12),t),32),g=Jn(Ce(12),t),E=De("ciphertext",Jn(l,t),u),m=De("seed",32,32);return{secretCoder:g,lengths:{secretKey:g.bytesLen,publicKey:w.bytesLen,cipherText:E.bytesLen},keygen:b=>{X(b,32,"seed");const p=new Uint8Array(33);p.set(b),p[32]=t;const L=o(p),[$,H]=m.decode(L),k=[],C=[];for(let _=0;_<t;_++)k.push(Gt.encode(Ne(n,H,_,s)));const F=r($);for(let _=0;_<t;_++){const N=Gt.encode(Ne(n,H,t+_,s));for(let T=0;T<t;T++){const U=Ko(F.get(T,_));Wt(N,fn(U,k[T]))}C.push(N)}F.clean();const K={publicKey:w.encode([C,$]),secretKey:g.encode(k)};return ct($,H,k,C,p,L),K},encrypt:(b,p,L)=>{const[$,H]=w.decode(b),k=[];for(let T=0;T<t;T++)k.push(Gt.encode(Ne(n,L,T,s)));const C=r(H),F=new Uint16Array(lt),K=[];for(let T=0;T<t;T++){const U=Ne(n,L,t+T,i),v=new Uint16Array(lt);for(let d=0;d<t;d++){const h=Ko(C.get(T,d));Wt(v,fn(h,k[d]))}Wt(U,Gt.decode(v)),K.push(U),Wt(F,fn($[T],k[T])),ct(v)}C.clean();const _=Ne(n,L,2*t,i);Wt(_,Gt.decode(F));const N=a.decode(p);return Wt(N,_),ct($,k,F,_),E.encode([K,N])},decrypt:(b,p)=>{const[L,$]=E.decode(b),H=g.decode(p),k=new Uint16Array(lt);for(let C=0;C<t;C++)Wt(k,fn(H[C],Gt.encode(L[C])));return Jf($,Gt.decode(k)),ct(k,H,L),a.encode($)}}};function zs(e){const t=ea(e),{HASH256:n,HASH512:r,KDF:o}=e,{secretCoder:s,lengths:i}=t,c=De("secretKey",i.secretKey,i.publicKey,32,32),f=32,a=64;return{info:{type:"ml-kem"},lengths:{...i,seed:64,msg:f,msgRand:f,secretKey:c.bytesLen},keygen:(u=Pt(a))=>{X(u,a,"seed");const{publicKey:l,secretKey:w}=t.keygen(u.subarray(0,32)),g=n(l),E=c.encode([w,l,g,u.subarray(32)]);return ct(w,g),{publicKey:l,secretKey:E}},getPublicKey:u=>{const[l,w,g,E]=c.decode(u);return Uint8Array.from(w)},encapsulate:(u,l=Pt(f))=>{X(u,i.publicKey,"publicKey"),X(l,f,"message");const w=u.subarray(0,384*e.K),g=s.encode(s.decode(jf(w)));if(!Qn(g,w))throw ct(g),new Error("ML-KEM.encapsulate: wrong publicKey modulus");ct(g);const E=r.create().update(l).update(n(u)).digest(),m=t.encrypt(u,l,E.subarray(32,64));return ct(E.subarray(32)),{cipherText:m,sharedSecret:E.subarray(0,32)}},decapsulate:(u,l)=>{X(l,c.bytesLen,"secretKey"),X(u,i.cipherText,"cipherText");const w=c.bytesLen-96,g=w+32,E=n(l.subarray(w/2,g));if(!Qn(E,l.subarray(g,g+32)))throw new Error("invalid secretKey: hash check failed");const[m,b,p,L]=c.decode(l),$=t.decrypt(u,m),H=r.create().update($).update(p).digest(),k=H.subarray(0,32),C=t.encrypt(b,$,H.subarray(32,64)),F=Qn(u,C),K=o.create({dkLen:32}).update(L).update(u).digest();return ct($,C,F?K:k),F?k:K}}}function na(e,t,n){return ae.create({dkLen:e}).update(t).update(new Uint8Array([n])).digest()}const Vs={HASH256:tn,HASH512:Mf,KDF:ae,XOF:Vf,PRF:na},Hn=zs({...Vs,...Ys[768]}),ra=zs({...Vs,...Ys[1024]});/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */function oa(e,t=!1){const n=e.lengths;let r=e.keygen;if(t){const s=e.Point.Fn;if(!s)throw new Error("No Point.Fn");r=(i=Pt(n.seed))=>{X(i,n.seed,"seed");const c=s.isLE?Xe(i):Je(i),f=s.toBytes(s.create(c));return{secretKey:f,publicKey:e.getPublicKey(f)}}}return{lengths:{secretKey:n.secretKey,publicKey:n.publicKey,seed:n.seed},keygen:r,getPublicKey:o=>e.getPublicKey(o)}}function qr(e,t=!1){const n=oa(e,t);if(!e.getSharedSecret)throw new Error("wrong curve");return{lengths:{...n.lengths,msg:n.lengths.seed,cipherText:n.lengths.publicKey},keygen:n.keygen,getPublicKey:n.getPublicKey,encapsulate(r,o=Pt(e.lengths.seed)){const s=this.keygen(o).secretKey,i=this.decapsulate(r,s),c=e.getPublicKey(s);return ct(s),{sharedSecret:i,cipherText:c}},decapsulate(r,o){const s=e.getSharedSecret(o,r);return e.lengths.publicKeyHasPrefix?s.subarray(1):s}}}function je(e,t){return De(t,...e.map(n=>{if(typeof n.lengths[t]!="number")throw new Error("wrong length: "+t);return n.lengths[t]}))}function Zr(e){return(t,n)=>e(t,{dkLen:n})}function sa(e,t,...n){const r=je(n,"seed"),o=je(n,"publicKey");wt(e);function s(i){X(i,e);const c=r.decode(t(i,r.bytesLen)),f=n.map((l,w)=>l.keygen(c[w])),a=f.map(l=>l.secretKey),u=f.map(l=>l.publicKey);return{secretKey:a,publicKey:u}}return{info:{lengths:{seed:e,publicKey:o.bytesLen,secretKey:e}},getPublicKey(i){return this.keygen(i).publicKey},keygen(i=Pt(e)){const{publicKey:c,secretKey:f}=s(i),a=o.encode(c);return ct(c),ct(f),{secretKey:i,publicKey:a}},expandDecapsulationKey:s,realSeedLen:e}}function Cn(e,t,n,r,...o){const s=sa(e,n,...o),i=je(o,"cipherText"),c=je(o,"publicKey"),f=je(o,"msg");return wt(t),{lengths:{...s.info.lengths,msg:t,msgRand:f.bytesLen,cipherText:i.bytesLen},getPublicKey:s.getPublicKey,keygen:s.keygen,encapsulate(a,u=Pt(f.bytesLen)){const l=c.decode(a),w=f.decode(u),g=o.map((p,L)=>p.encapsulate(l[L],w[L])),E=g.map(p=>p.sharedSecret),m=g.map(p=>p.cipherText),b={sharedSecret:r(l,m,E),cipherText:i.encode(m)};return ct(E,m),b},decapsulate(a,u){const l=i.decode(a),{publicKey:w,secretKey:g}=s.expandDecapsulationKey(u),E=o.map((m,b)=>m.decapsulate(l[b],g[b]));return r(w,l,E)}}}function Xs(e,t,n,r,o){return Xt(r),Xt(o),Cn(32,32,Zr(r),(s,i,c)=>o(ut(c[0],c[1],i[1],s[1],ne(e))),t,n)}Xs("QSF-KEM(ML-KEM-768,P-256)-XOF(SHAKE256)-KDF(SHA3-256)",Hn,qr(Ks,!0),ae,tn);Xs("QSF-KEM(ML-KEM-1024,P-384)-XOF(SHAKE256)-KDF(SHA3-256)",ra,qr(_f,!0),ae,tn);function ia(e,t,n,r,o){return Xt(r),Xt(o),Cn(32,32,Zr(r),(s,i,c)=>{const f=ut(c[0],c[1],i[0],s[0],i[1],s[1],ne(e)),a=32,u=ut(ne("hybrid_prk"),f),l=Uf(o,u),w=ut(Un(a,2),ne("shared_secret"),ne("")),g=Tf(o,l,w,a);return ct(l,w,u,f),g},t,n)}const Ps=qr(Rf);ia("KitchenSink-KEM(ML-KEM-768,X25519)-XOF(SHAKE256)-KDF(HKDF-SHA-256)",Hn,Ps,ae,Ts);const ca=Cn(32,32,Zr(ae),(e,t,n)=>tn(ut(n[0],n[1],t[1],e[1],ne("\\.//^\\"))),Hn,Ps);function fa(e,t,n,r){const o=e.Point.Fn;if(!o)throw new Error("no Point.Fn");function s(i){let c;for(let u=0,l=t;;u=l,l+=t){if(l>i.length)throw new Error("rejection sampling failed");if(c=o.fromBytes(i.subarray(u,l),!0),o.isValidNot0(c))break}const f=o.toBytes(o.create(c)),a=e.getPublicKey(f,!1);return{secretKey:f,publicKey:a}}return{lengths:{secretKey:t,publicKey:n,seed:r,msg:r,cipherText:n},keygen(i=Pt(r)){return X(i,r,"seed"),s(i)},getPublicKey(i){return e.getPublicKey(i,!1)},encapsulate(i,c=Pt(r)){X(c,r,"rand");const{secretKey:f}=s(c),a=this.decapsulate(i,f),u=e.getPublicKey(f,!1);return ct(f),{sharedSecret:a,cipherText:u}},decapsulate(i,c){return e.getSharedSecret(c,i).subarray(1)}}}function aa(e,t,n,r){const{secretKey:o,publicKeyUncompressed:s}=n.lengths;if(!o||!s)throw new Error("wrong curve");const i=fa(n,o,s,r),c=64,f=c+r;return Cn(32,32,a=>{X(a,32);const u=ae(a,{dkLen:f}),l=u.subarray(0,c),w=u.subarray(c,f);return ut(l,w)},(a,u,l)=>tn(ut(l[0],l[1],u[1],a[1],ne(e))),t,i)}const ua=aa("MLKEM768-P256",Hn,Ks,128),Mr=ca,la=ua;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const J=(e,t,n)=>At(e,t,n),Gs=rt,Nn=Sr,jt=(...e)=>Fi(...e),vn=e=>Rr(e),Ws=Xo,Dr=e=>It(e),Sn=BigInt(0),gr=BigInt(1);function Be(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}" `;throw new TypeError(n+"expected boolean, got type="+typeof e)}return e}function jr(e){if(typeof e=="bigint"){if(!gn(e))throw new RangeError("positive bigint expected, got "+e)}else Gs(e);return e}function pr(e,t=""){if(typeof e!="number"){const n=t&&`"${t}" `;throw new TypeError(n+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){const n=t&&`"${t}" `;throw new RangeError(n+"expected safe integer, got "+e)}}function an(e){const t=jr(e).toString(16);return t.length&1?"0"+t:t}function Qs(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?Sn:BigInt("0x"+e)}function Fn(e){return Qs(Sr(e))}function Ae(e){return Qs(Sr(Ge(At(e)).reverse()))}function Yr(e,t){if(rt(t),t===0)throw new RangeError("zero length");e=jr(e);const n=e.toString(16);if(n.length>t*2)throw new RangeError("number too large");return Rr(n.padStart(t*2,"0"))}function zr(e,t){return Yr(e,t).reverse()}function da(e,t){if(e=J(e),t=J(t),e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function Ge(e){return Uint8Array.from(J(e))}const gn=e=>typeof e=="bigint"&&Sn<=e;function ha(e,t,n){return gn(e)&&gn(t)&&gn(n)&&t<=e&&e<n}function ve(e,t,n,r){if(!ha(t,n,r))throw new RangeError("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Vr(e){if(e<Sn)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>Sn;e>>=gr,t+=1);return t}const Xr=e=>(gr<<BigInt(e))-gr;function ya(e,t,n){if(rt(e,"hashLen"),rt(t,"qByteLen"),typeof n!="function")throw new TypeError("hmacFn must be a function");const r=b=>new Uint8Array(b),o=Uint8Array.of(),s=Uint8Array.of(0),i=Uint8Array.of(1),c=1e3;let f=r(e),a=r(e),u=0;const l=()=>{f.fill(1),a.fill(0),u=0},w=(...b)=>n(a,jt(f,...b)),g=(b=o)=>{a=w(s,b),f=w(),b.length!==0&&(a=w(i,b),f=w())},E=()=>{if(u++>=c)throw new Error("drbg: tried max amount of iterations");let b=0;const p=[];for(;b<t;){f=w();const L=f.slice();p.push(L),b+=f.length}return jt(...p)};return(b,p)=>{l(),g(b);let L;for(;(L=p(E()))===void 0;)g();return l(),L}}function $e(e,t={},n={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw new TypeError("expected valid options object");function r(s,i,c){if(!c&&i!=="function"&&!Object.hasOwn(e,s))throw new TypeError(`param "${s}" is invalid: expected own property`);const f=e[s];if(c&&f===void 0)return;const a=typeof f;if(a!==i||f===null)throw new TypeError(`param "${s}" is invalid: expected ${i}, got ${a}`)}const o=(s,i)=>Object.entries(s).forEach(([c,f])=>r(c,f,i));o(t,!1),o(n,!0)}const Ho=()=>{throw new Error("not implemented")};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ft=BigInt(0),tt=BigInt(1),se=BigInt(2),Js=BigInt(3),ti=BigInt(4),ei=BigInt(5),ga=BigInt(7),ni=BigInt(8),pa=BigInt(9),ri=BigInt(16);function Q(e,t){if(t<=ft)throw new Error("mod: expected positive modulus, got "+t);const n=e%t;return n>=ft?n:t+n}function mt(e,t,n){if(t<ft)throw new Error("pow2: expected non-negative exponent, got "+t);let r=e;for(;t-- >ft;)r*=r,r%=n;return r}function Co(e,t){if(e===ft)throw new Error("invert: expected non-zero number");if(t<=ft)throw new Error("invert: expected positive modulus, got "+t);let n=Q(e,t),r=t,o=ft,s=tt;for(;n!==ft;){const c=r/n,f=r-n*c,a=o-s*c;r=n,n=f,o=s,s=a}if(r!==tt)throw new Error("invert: does not exist");return Q(o,t)}function Pr(e,t,n){const r=e;if(!r.eql(r.sqr(t),n))throw new Error("Cannot find square root")}function oi(e,t){const n=e,r=(n.ORDER+tt)/ti,o=n.pow(t,r);return Pr(n,o,t),o}function wa(e,t){const n=e,r=(n.ORDER-ei)/ni,o=n.mul(t,se),s=n.pow(o,r),i=n.mul(t,s),c=n.mul(n.mul(i,se),s),f=n.mul(i,n.sub(c,n.ONE));return Pr(n,f,t),f}function ba(e){const t=Gr(e),n=si(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+ga)/ri;return((c,f)=>{const a=c;let u=a.pow(f,i),l=a.mul(u,r);const w=a.mul(u,o),g=a.mul(u,s),E=a.eql(a.sqr(l),f),m=a.eql(a.sqr(w),f);u=a.cmov(u,l,E),l=a.cmov(g,w,m);const b=a.eql(a.sqr(l),f),p=a.cmov(u,l,b);return Pr(a,p,f),p})}function si(e){if(e<Js)throw new Error("sqrt is not defined for small field");let t=e-tt,n=0;for(;t%se===ft;)t/=se,n++;let r=se;const o=Gr(e);for(;No(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return oi;let s=o.pow(r,t);const i=(t+tt)/se;return function(f,a){const u=f;if(u.is0(a))return a;if(No(u,a)!==1)throw new Error("Cannot find square root");let l=n,w=u.mul(u.ONE,s),g=u.pow(a,t),E=u.pow(a,i);for(;!u.eql(g,u.ONE);){if(u.is0(g))return u.ZERO;let m=1,b=u.sqr(g);for(;!u.eql(b,u.ONE);)if(m++,b=u.sqr(b),m===l)throw new Error("Cannot find square root");const p=tt<<BigInt(l-m-1),L=u.pow(w,p);l=m,w=u.sqr(L),g=u.mul(g,w),E=u.mul(E,L)}return E}}function xa(e){return e%ti===Js?oi:e%ni===ei?wa:e%ri===pa?ba(e):si(e)}const Qt=(e,t)=>(Q(e,t)&tt)===tt,Ea=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ma(e){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},n=Ea.reduce((r,o)=>(r[o]="function",r),t);if($e(e,n),pr(e.BYTES,"BYTES"),pr(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=tt)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function Ba(e,t,n){const r=e;if(n<ft)throw new Error("invalid exponent, negatives unsupported");if(n===ft)return r.ONE;if(n===tt)return t;let o=r.ONE,s=t;for(;n>ft;)n&tt&&(o=r.mul(o,s)),s=r.sqr(s),n>>=tt;return o}function ii(e,t,n=!1){const r=e,o=new Array(t.length).fill(n?r.ZERO:void 0),s=t.reduce((c,f,a)=>r.is0(f)?c:(o[a]=c,r.mul(c,f)),r.ONE),i=r.inv(s);return t.reduceRight((c,f,a)=>r.is0(f)?c:(o[a]=r.mul(c,o[a]),r.mul(c,f)),i),o}function No(e,t){const n=e,r=(n.ORDER-tt)/se,o=n.pow(t,r),s=n.eql(o,n.ONE),i=n.eql(o,n.ZERO),c=n.eql(o,n.neg(n.ONE));if(!s&&!i&&!c)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function Aa(e,t){if(t!==void 0&&Gs(t),e<=ft)throw new Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);const n=Vr(e);if(t!==void 0&&t<n)throw new Error(`invalid n length: expected bit length (${n}) >= n.length (${t})`);const r=t!==void 0?t:n,o=Math.ceil(r/8);return{nBitLength:r,nByteLength:o}}const Fo=new WeakMap;class ci{constructor(t,n={}){B(this,"ORDER");B(this,"BITS");B(this,"BYTES");B(this,"isLE");B(this,"ZERO",ft);B(this,"ONE",tt);B(this,"_lengths");B(this,"_mod");if(t<=tt)throw new Error("invalid field: expected ORDER > 1, got "+t);let r;this.isLE=!1,n!=null&&typeof n=="object"&&(typeof n.BITS=="number"&&(r=n.BITS),typeof n.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:n.sqrt,enumerable:!0}),typeof n.isLE=="boolean"&&(this.isLE=n.isLE),n.allowedLengths&&(this._lengths=Object.freeze(n.allowedLengths.slice())),typeof n.modFromBytes=="boolean"&&(this._mod=n.modFromBytes));const{nBitLength:o,nByteLength:s}=Aa(t,r);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=o,this.BYTES=s,Object.freeze(this)}create(t){return Q(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return ft<=t&&t<this.ORDER}is0(t){return t===ft}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&tt)===tt}neg(t){return Q(-t,this.ORDER)}eql(t,n){return t===n}sqr(t){return Q(t*t,this.ORDER)}add(t,n){return Q(t+n,this.ORDER)}sub(t,n){return Q(t-n,this.ORDER)}mul(t,n){return Q(t*n,this.ORDER)}pow(t,n){return Ba(this,t,n)}div(t,n){return Q(t*Co(n,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,n){return t+n}subN(t,n){return t-n}mulN(t,n){return t*n}inv(t){return Co(t,this.ORDER)}sqrt(t){let n=Fo.get(this);return n||Fo.set(this,n=xa(this.ORDER)),n(this,t)}toBytes(t){return this.isLE?zr(t,this.BYTES):Yr(t,this.BYTES)}fromBytes(t,n=!1){J(t);const{_lengths:r,BYTES:o,isLE:s,ORDER:i,_mod:c}=this;if(r){if(t.length<1||!r.includes(t.length)||t.length>o)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);const a=new Uint8Array(o);a.set(t,s?0:a.length-t.length),t=a}if(t.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+t.length);let f=s?Ae(t):Fn(t);if(c&&(f=Q(f,i)),!n&&!this.isValid(f))throw new Error("invalid field element: outside of range 0..ORDER");return f}invertBatch(t){return ii(this,t)}cmov(t,n,r){return Be(r,"condition"),r?n:t}}Object.freeze(ci.prototype);function Gr(e,t={}){return new ci(e,t)}function fi(e){if(typeof e!="bigint")throw new Error("field order must be bigint");if(e<=tt)throw new Error("field order must be greater than 1");const t=Vr(e-tt);return Math.ceil(t/8)}function ai(e){const t=fi(e);return t+Math.ceil(t/2)}function va(e,t,n=!1){J(e);const r=e.length,o=fi(t),s=Math.max(ai(t),16);if(r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Ae(e):Fn(e),c=Q(i,t-tt)+tt;return n?zr(c,o):Yr(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Se=BigInt(0),ie=BigInt(1);function Rn(e,t){const n=t.negate();return e?n:t}function Ye(e,t){const n=ii(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function ui(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function tr(e,t){ui(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Xr(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function qo(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),f=e>>i;c>r&&(c-=s,f+=ie);const a=t*r,u=a+Math.abs(c)-1,l=c===0,w=c<0,g=t%2!==0;return{nextN:f,offset:u,isZero:l,isNeg:w,isNegF:g,offsetF:a}}const er=new WeakMap,li=new WeakMap;function nr(e){return li.get(e)||1}function Zo(e){if(e!==Se)throw new Error("invalid wNAF")}class di{constructor(t,n){B(this,"BASE");B(this,"ZERO");B(this,"Fn");B(this,"bits");this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let o=t;for(;n>Se;)n&ie&&(r=r.add(o)),o=o.double(),n>>=ie;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=tr(n,this.bits),s=[];let i=t,c=i;for(let f=0;f<r;f++){c=i,s.push(c);for(let a=1;a<o;a++)c=c.add(i),s.push(c);i=c.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE;const i=tr(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:f,offset:a,isZero:u,isNeg:l,isNegF:w,offsetF:g}=qo(r,c,i);r=f,u?s=s.add(Rn(w,n[g])):o=o.add(Rn(l,n[a]))}return Zo(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=tr(t,this.bits);for(let i=0;i<s.windows&&r!==Se;i++){const{nextN:c,offset:f,isZero:a,isNeg:u}=qo(r,i,s);if(r=c,!a){const l=n[f];o=o.add(u?l.negate():l)}}return Zo(r),o}getPrecomputes(t,n,r){let o=er.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),er.set(n,o))),o}cached(t,n,r){const o=nr(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=nr(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){ui(n,this.bits),li.set(t,n),er.delete(t)}hasCache(t){return nr(t)!==1}}function Sa(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>Se||r>Se;)n&ie&&(s=s.add(o)),r&ie&&(i=i.add(o)),o=o.double(),n>>=ie,r>>=ie;return{p1:s,p2:i}}function Mo(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return ma(t),t}else return Gr(e,{isLE:n})}function hi(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const f of["p","n","h"]){const a=t[f];if(!(typeof a=="bigint"&&a>Se))throw new Error(`CURVE.${f} must be positive bigint`)}const o=Mo(t.p,n.Fp,r),s=Mo(t.n,n.Fn,r),c=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(const f of c)if(!o.isValid(t[f]))throw new Error(`CURVE.${f} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:s}}function yi(e,t){return function(r){const o=e(r);return{secretKey:o,publicKey:t(o)}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Do=(e,t)=>(e+(e>=0?t:-t)/gi)/t;function Ra(e,t,n){ve("scalar",e,Rt,n);const[[r,o],[s,i]]=t,c=Do(i*e,n),f=Do(-o*e,n);let a=e-c*r-f*s,u=-c*o-f*i;const l=a<Rt,w=u<Rt;l&&(a=-a),w&&(u=-u);const g=Xr(Math.ceil(Vr(n)/2))+Yt;if(a<Rt||a>=g||u<Rt||u>=g)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:l,k1:a,k2neg:w,k2:u}}function wr(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function rr(e,t){$e(e);const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Be(n.lowS,"lowS"),Be(n.prehash,"prehash"),n.format!==void 0&&wr(n.format),n}class Ia extends Error{constructor(t=""){super(t)}}const Bt={Err:Ia,_tlv:{encode:(e,t)=>{const{Err:n}=Bt;if(pr(e,"tag"),e<0||e>255)throw new n("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=an(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?an(o.length/2|128):"";return an(e)+s+o+t},decode(e,t){const{Err:n}=Bt;t=J(t,void 0,"DER data");let r=0;if(e<0||e>255)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const f=o&127;if(!f)throw new n("tlv.decode(long): indefinite length not supported");if(f>4)throw new n("tlv.decode(long): byte length is too big");const a=t.subarray(r,r+f);if(a.length!==f)throw new n("tlv.decode: length bytes not complete");if(a[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of a)i=i<<8|u;if(r+=f,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=Bt;if(jr(e),e<Rt)throw new t("integer: negative integers are not allowed");let n=an(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Bt;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Fn(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Bt,o=J(e,void 0,"signature"),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:f}=r.decode(2,s),{v:a,l:u}=r.decode(2,f);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(a)}},hexFromSig(e){const{_tlv:t,_int:n}=Bt,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}};Object.freeze(Bt._tlv);Object.freeze(Bt._int);Object.freeze(Bt);const Rt=BigInt(0),Yt=BigInt(1),gi=BigInt(2),un=BigInt(3),La=BigInt(4);function Oa(e,t={}){const n=hi("weierstrass",e,t),r=n.Fp,o=n.Fn;let s=n.CURVE;const{h:i,n:c}=s;$e(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:f,allowInfinityPoint:a}=t;if(f&&(!r.is0(s.a)||typeof f.beta!="bigint"||!Array.isArray(f.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=wi(r,o);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function w(U,v,d){if(a&&v.is0())return Uint8Array.of(0);const{x:h,y}=v.toAffine(),A=r.toBytes(h);if(Be(d,"isCompressed"),d){l();const S=!r.isOdd(y);return jt(pi(S),A)}else return jt(Uint8Array.of(4),A,r.toBytes(y))}function g(U){J(U,void 0,"Point");const{publicKey:v,publicKeyUncompressed:d}=u,h=U.length,y=U[0],A=U.subarray(1);if(a&&h===1&&y===0)return{x:r.ZERO,y:r.ZERO};if(h===v&&(y===2||y===3)){const S=r.fromBytes(A);if(!r.isValid(S))throw new Error("bad point: is not on curve, wrong x");const x=b(S);let R;try{R=r.sqrt(x)}catch(q){const D=q instanceof Error?": "+q.message:"";throw new Error("bad point: is not on curve, sqrt error"+D)}l();const I=r.isOdd(R);return(y&1)===1!==I&&(R=r.neg(R)),{x:S,y:R}}else if(h===d&&y===4){const S=r.BYTES,x=r.fromBytes(A.subarray(0,S)),R=r.fromBytes(A.subarray(S,S*2));if(!p(x,R))throw new Error("bad point: is not on curve");return{x,y:R}}else throw new Error(`bad point: got length ${h}, expected compressed=${v} or uncompressed=${d}`)}const E=t.toBytes===void 0?w:t.toBytes,m=t.fromBytes===void 0?g:t.fromBytes;function b(U){const v=r.sqr(U),d=r.mul(v,U);return r.add(r.add(d,r.mul(U,s.a)),s.b)}function p(U,v){const d=r.sqr(v),h=b(U);return r.eql(d,h)}if(!p(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const L=r.mul(r.pow(s.a,un),La),$=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(L,$)))throw new Error("bad curve params: a or b");function H(U,v,d=!1){if(!r.isValid(v)||d&&r.is0(v))throw new Error(`bad point coordinate ${U}`);return v}function k(U){if(!(U instanceof K))throw new Error("Weierstrass Point expected")}function C(U){if(!f||!f.basises)throw new Error("no endo");return Ra(U,f.basises,o.ORDER)}function F(U,v,d,h,y){return d=new K(r.mul(d.X,U),d.Y,d.Z),v=Rn(h,v),d=Rn(y,d),v.add(d)}const T=class T{constructor(v,d,h){B(this,"X");B(this,"Y");B(this,"Z");this.X=H("x",v),this.Y=H("y",d,!0),this.Z=H("z",h),Object.freeze(this)}static CURVE(){return s}static fromAffine(v){const{x:d,y:h}=v||{};if(!v||!r.isValid(d)||!r.isValid(h))throw new Error("invalid affine point");if(v instanceof T)throw new Error("projective point not allowed");return r.is0(d)&&r.is0(h)?T.ZERO:new T(d,h,r.ONE)}static fromBytes(v){const d=T.fromAffine(m(J(v,void 0,"point")));return d.assertValidity(),d}static fromHex(v){return T.fromBytes(vn(v))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(v=8,d=!0){return N.createCache(this,v),d||this.multiply(un),this}assertValidity(){const v=this;if(v.is0()){if(t.allowInfinityPoint&&r.is0(v.X)&&r.eql(v.Y,r.ONE)&&r.is0(v.Z))return;throw new Error("bad point: ZERO")}const{x:d,y:h}=v.toAffine();if(!r.isValid(d)||!r.isValid(h))throw new Error("bad point: x or y not field elements");if(!p(d,h))throw new Error("bad point: equation left != right");if(!v.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:v}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(v)}equals(v){k(v);const{X:d,Y:h,Z:y}=this,{X:A,Y:S,Z:x}=v,R=r.eql(r.mul(d,x),r.mul(A,y)),I=r.eql(r.mul(h,x),r.mul(S,y));return R&&I}negate(){return new T(this.X,r.neg(this.Y),this.Z)}double(){const{a:v,b:d}=s,h=r.mul(d,un),{X:y,Y:A,Z:S}=this;let x=r.ZERO,R=r.ZERO,I=r.ZERO,O=r.mul(y,y),q=r.mul(A,A),D=r.mul(S,S),Z=r.mul(y,A);return Z=r.add(Z,Z),I=r.mul(y,S),I=r.add(I,I),x=r.mul(v,I),R=r.mul(h,D),R=r.add(x,R),x=r.sub(q,R),R=r.add(q,R),R=r.mul(x,R),x=r.mul(Z,x),I=r.mul(h,I),D=r.mul(v,D),Z=r.sub(O,D),Z=r.mul(v,Z),Z=r.add(Z,I),I=r.add(O,O),O=r.add(I,O),O=r.add(O,D),O=r.mul(O,Z),R=r.add(R,O),D=r.mul(A,S),D=r.add(D,D),O=r.mul(D,Z),x=r.sub(x,O),I=r.mul(D,q),I=r.add(I,I),I=r.add(I,I),new T(x,R,I)}add(v){k(v);const{X:d,Y:h,Z:y}=this,{X:A,Y:S,Z:x}=v;let R=r.ZERO,I=r.ZERO,O=r.ZERO;const q=s.a,D=r.mul(s.b,un);let Z=r.mul(d,A),M=r.mul(h,S),j=r.mul(y,x),V=r.add(d,h),Y=r.add(A,S);V=r.mul(V,Y),Y=r.add(Z,M),V=r.sub(V,Y),Y=r.add(d,y);let z=r.add(A,x);return Y=r.mul(Y,z),z=r.add(Z,j),Y=r.sub(Y,z),z=r.add(h,y),R=r.add(S,x),z=r.mul(z,R),R=r.add(M,j),z=r.sub(z,R),O=r.mul(q,Y),R=r.mul(D,j),O=r.add(R,O),R=r.sub(M,O),O=r.add(M,O),I=r.mul(R,O),M=r.add(Z,Z),M=r.add(M,Z),j=r.mul(q,j),Y=r.mul(D,Y),M=r.add(M,j),j=r.sub(Z,j),j=r.mul(q,j),Y=r.add(Y,j),Z=r.mul(M,Y),I=r.add(I,Z),Z=r.mul(z,Y),R=r.mul(V,R),R=r.sub(R,Z),Z=r.mul(V,M),O=r.mul(z,O),O=r.add(O,Z),new T(R,I,O)}subtract(v){return k(v),this.add(v.negate())}is0(){return this.equals(T.ZERO)}multiply(v){const{endo:d}=t;if(!o.isValidNot0(v))throw new RangeError("invalid scalar: out of range");let h,y;const A=S=>N.cached(this,S,x=>Ye(T,x));if(d){const{k1neg:S,k1:x,k2neg:R,k2:I}=C(v),{p:O,f:q}=A(x),{p:D,f:Z}=A(I);y=q.add(Z),h=F(d.beta,O,D,S,R)}else{const{p:S,f:x}=A(v);h=S,y=x}return Ye(T,[h,y])[0]}multiplyUnsafe(v){const{endo:d}=t,h=this,y=v;if(!o.isValid(y))throw new RangeError("invalid scalar: out of range");if(y===Rt||h.is0())return T.ZERO;if(y===Yt)return h;if(N.hasCache(this))return this.multiply(y);if(d){const{k1neg:A,k1:S,k2neg:x,k2:R}=C(y),{p1:I,p2:O}=Sa(T,h,S,R);return F(d.beta,I,O,A,x)}else return N.unsafe(h,y)}toAffine(v){const d=this;let h=v;const{X:y,Y:A,Z:S}=d;if(r.eql(S,r.ONE))return{x:y,y:A};const x=d.is0();h==null&&(h=x?r.ONE:r.inv(S));const R=r.mul(y,h),I=r.mul(A,h),O=r.mul(S,h);if(x)return{x:r.ZERO,y:r.ZERO};if(!r.eql(O,r.ONE))throw new Error("invZ was invalid");return{x:R,y:I}}isTorsionFree(){const{isTorsionFree:v}=t;return i===Yt?!0:v?v(T,this):N.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:v}=t;return i===Yt?this:v?v(T,this):this.multiplyUnsafe(i)}isSmallOrder(){return i===Yt?this.is0():this.clearCofactor().is0()}toBytes(v=!0){return Be(v,"isCompressed"),this.assertValidity(),E(T,this,v)}toHex(v=!0){return Nn(this.toBytes(v))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};B(T,"BASE",new T(s.Gx,s.Gy,r.ONE)),B(T,"ZERO",new T(r.ZERO,r.ONE,r.ZERO)),B(T,"Fp",r),B(T,"Fn",o);let K=T;const _=o.BITS,N=new di(K,t.endo?Math.ceil(_/2):_);return _>=8&&K.BASE.precompute(8),Object.freeze(K.prototype),Object.freeze(K),K}function pi(e){return Uint8Array.of(e?2:3)}function wi(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function $a(e,t={}){const{Fn:n}=e,r=t.randomBytes===void 0?Dr:t.randomBytes,o=Object.assign(wi(e.Fp,n),{seed:Math.max(ai(n.ORDER),16)});function s(g){try{const E=n.fromBytes(g);return n.isValidNot0(E)}catch{return!1}}function i(g,E){const{publicKey:m,publicKeyUncompressed:b}=o;try{const p=g.length;return E===!0&&p!==m||E===!1&&p!==b?!1:!!e.fromBytes(g)}catch{return!1}}function c(g){return g=g===void 0?r(o.seed):g,va(J(g,o.seed,"seed"),n.ORDER)}function f(g,E=!0){return e.BASE.multiply(n.fromBytes(g)).toBytes(E)}function a(g){const{secretKey:E,publicKey:m,publicKeyUncompressed:b}=o,p=n._lengths;if(!Ws(g))return;const L=J(g,void 0,"key").length,$=L===m||L===b,H=L===E||!!(p!=null&&p.includes(L));if(!($&&H))return $}function u(g,E,m=!0){if(a(g)===!0)throw new Error("first arg must be private key");if(a(E)===!1)throw new Error("second arg must be public key");const b=n.fromBytes(g);return e.fromBytes(E).multiply(b).toBytes(m)}const l={isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c},w=yi(c,f);return Object.freeze(l),Object.freeze(o),Object.freeze({getPublicKey:f,getSharedSecret:u,keygen:w,Point:e,utils:l,lengths:o})}function _a(e,t,n={}){const r=t;We(r),$e(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),n=Object.assign({},n);const o=n.randomBytes===void 0?Dr:n.randomBytes,s=n.hmac===void 0?(h,y)=>Le(r,h,y):n.hmac,{Fp:i,Fn:c}=e,{ORDER:f,BITS:a}=c,{keygen:u,getPublicKey:l,getSharedSecret:w,utils:g,lengths:E}=$a(e,n),m={prehash:!0,lowS:typeof n.lowS=="boolean"?n.lowS:!0,format:"compact",extraEntropy:!1},b=f*gi+Yt<i.ORDER;function p(h){const y=f>>Yt;return h>y}function L(h,y){if(!c.isValidNot0(y))throw new Error(`invalid signature ${h}: out of range 1..Point.Fn.ORDER`);return y}function $(){if(b)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function H(h,y){wr(y);const A=E.signature,S=y==="compact"?A:y==="recovered"?A+1:void 0;return J(h,S)}class k{constructor(y,A,S){B(this,"r");B(this,"s");B(this,"recovery");if(this.r=L("r",y),this.s=L("s",A),S!=null){if($(),![0,1,2,3].includes(S))throw new Error("invalid recovery id");this.recovery=S}Object.freeze(this)}static fromBytes(y,A=m.format){H(y,A);let S;if(A==="der"){const{r:O,s:q}=Bt.toSig(J(y));return new k(O,q)}A==="recovered"&&(S=y[0],A="compact",y=y.subarray(1));const x=E.signature/2,R=y.subarray(0,x),I=y.subarray(x,x*2);return new k(c.fromBytes(R),c.fromBytes(I),S)}static fromHex(y,A){return this.fromBytes(vn(y),A)}assertRecovery(){const{recovery:y}=this;if(y==null)throw new Error("invalid recovery id: must be present");return y}addRecoveryBit(y){return new k(this.r,this.s,y)}recoverPublicKey(y){const{r:A,s:S}=this,x=this.assertRecovery(),R=x===2||x===3?A+f:A;if(!i.isValid(R))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const I=i.toBytes(R),O=e.fromBytes(jt(pi((x&1)===0),I)),q=c.inv(R),D=F(J(y,void 0,"msgHash")),Z=c.create(-D*q),M=c.create(S*q),j=e.BASE.multiplyUnsafe(Z).add(O.multiplyUnsafe(M));if(j.is0())throw new Error("invalid recovery: point at infinify");return j.assertValidity(),j}hasHighS(){return p(this.s)}toBytes(y=m.format){if(wr(y),y==="der")return vn(Bt.hexFromSig(this));const{r:A,s:S}=this,x=c.toBytes(A),R=c.toBytes(S);return y==="recovered"?($(),jt(Uint8Array.of(this.assertRecovery()),x,R)):jt(x,R)}toHex(y){return Nn(this.toBytes(y))}}Object.freeze(k.prototype),Object.freeze(k);const C=n.bits2int===void 0?function(y){if(y.length>8192)throw new Error("input is too large");const A=Fn(y),S=y.length*8-a;return S>0?A>>BigInt(S):A}:n.bits2int,F=n.bits2int_modN===void 0?function(y){return c.create(C(y))}:n.bits2int_modN,K=Xr(a);function _(h){return ve("num < 2^"+a,h,Rt,K),c.toBytes(h)}function N(h,y){return J(h,void 0,"message"),y?J(r(h),void 0,"prehashed message"):h}function T(h,y,A){const{lowS:S,prehash:x,extraEntropy:R}=rr(A,m);h=N(h,x);const I=F(h),O=c.fromBytes(y);if(!c.isValidNot0(O))throw new Error("invalid private key");const q=[_(O),_(I)];if(R!=null&&R!==!1){const j=R===!0?o(E.secretKey):R;q.push(J(j,void 0,"extraEntropy"))}const D=jt(...q),Z=I;function M(j){const V=C(j);if(!c.isValidNot0(V))return;const Y=c.inv(V),z=e.BASE.multiply(V).toAffine(),W=c.create(z.x);if(W===Rt)return;const bt=c.create(Y*c.create(Z+W*O));if(bt===Rt)return;let xt=(z.x===W?0:2)|Number(z.y&Yt),Kt=bt;return S&&p(bt)&&(Kt=c.neg(bt),xt^=1),new k(W,Kt,b?void 0:xt)}return{seed:D,k2sig:M}}function U(h,y,A={}){const{seed:S,k2sig:x}=T(h,y,A);return ya(r.outputLen,c.BYTES,s)(S,x).toBytes(A.format)}function v(h,y,A,S={}){const{lowS:x,prehash:R,format:I}=rr(S,m);if(A=J(A,void 0,"publicKey"),y=N(y,R),!Ws(h)){const O=h instanceof k?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+O)}H(h,I);try{const O=k.fromBytes(h,I),q=e.fromBytes(A);if(x&&O.hasHighS())return!1;const{r:D,s:Z}=O,M=F(y),j=c.inv(Z),V=c.create(M*j),Y=c.create(D*j),z=e.BASE.multiplyUnsafe(V).add(q.multiplyUnsafe(Y));return z.is0()?!1:c.create(z.x)===D}catch{return!1}}function d(h,y,A={}){const{prehash:S}=rr(A,m);return y=N(y,S),k.fromBytes(h,"recovered").recoverPublicKey(y).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:w,utils:g,lengths:E,Point:e,sign:U,verify:v,recoverPublicKey:d,Signature:k,hash:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ua={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Ta=Oa(Ua),Fe=_a(Ta,et);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mt=BigInt(0),ht=BigInt(1),or=BigInt(2),ka=BigInt(8);function Ka(e,t,n,r){const o=e.sqr(n),s=e.sqr(r),i=e.add(e.mul(t.a,o),s),c=e.add(e.ONE,e.mul(t.d,e.mul(o,s)));return e.eql(i,c)}function Ha(e,t={}){const n=t,r=hi("edwards",e,n,n.FpFnLE),{Fp:o,Fn:s}=r;let i=r.CURVE;const{h:c}=i;$e(n,{},{uvRatio:"function"});const f=or<<BigInt(s.BYTES*8)-ht,a=b=>o.create(b),u=n.uvRatio===void 0?(b,p)=>{try{return{isValid:!0,value:o.sqrt(o.div(b,p))}}catch{return{isValid:!1,value:Mt}}}:n.uvRatio;if(!Ka(o,i,i.Gx,i.Gy))throw new Error("bad curve params: generator point");function l(b,p,L=!1){const $=L?ht:Mt;return ve("coordinate "+b,p,$,f),p}function w(b){if(!(b instanceof g))throw new Error("EdwardsPoint expected")}const m=class m{constructor(p,L,$,H){B(this,"X");B(this,"Y");B(this,"Z");B(this,"T");this.X=l("x",p),this.Y=l("y",L),this.Z=l("z",$,!0),this.T=l("t",H),Object.freeze(this)}static CURVE(){return i}static fromAffine(p){if(p instanceof m)throw new Error("extended point not allowed");const{x:L,y:$}=p||{};return l("x",L),l("y",$),new m(L,$,ht,a(L*$))}static fromBytes(p,L=!1){const $=o.BYTES,{a:H,d:k}=i;p=Ge(J(p,$,"point")),Be(L,"zip215");const C=Ge(p),F=p[$-1];C[$-1]=F&-129;const K=Ae(C),_=L?f:o.ORDER;ve("point.y",K,Mt,_);const N=a(K*K),T=a(N-ht),U=a(k*N-H);let{isValid:v,value:d}=u(T,U);if(!v)throw new Error("bad point: invalid y coordinate");const h=(d&ht)===ht,y=(F&128)!==0;if(!L&&d===Mt&&y)throw new Error("bad point: x=0 and x_0=1");return y!==h&&(d=a(-d)),m.fromAffine({x:d,y:K})}static fromHex(p,L=!1){return m.fromBytes(vn(p),L)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(p=8,L=!0){return E.createCache(this,p),L||this.multiply(or),this}assertValidity(){const p=this,{a:L,d:$}=i;if(p.is0())throw new Error("bad point: ZERO");const{X:H,Y:k,Z:C,T:F}=p,K=a(H*H),_=a(k*k),N=a(C*C),T=a(N*N),U=a(K*L),v=a(N*a(U+_)),d=a(T+a($*a(K*_)));if(v!==d)throw new Error("bad point: equation left != right (1)");const h=a(H*k),y=a(C*F);if(h!==y)throw new Error("bad point: equation left != right (2)")}equals(p){w(p);const{X:L,Y:$,Z:H}=this,{X:k,Y:C,Z:F}=p,K=a(L*F),_=a(k*H),N=a($*F),T=a(C*H);return K===_&&N===T}is0(){return this.equals(m.ZERO)}negate(){return new m(a(-this.X),this.Y,this.Z,a(-this.T))}double(){const{a:p}=i,{X:L,Y:$,Z:H}=this,k=a(L*L),C=a($*$),F=a(or*a(H*H)),K=a(p*k),_=L+$,N=a(a(_*_)-k-C),T=K+C,U=T-F,v=K-C,d=a(N*U),h=a(T*v),y=a(N*v),A=a(U*T);return new m(d,h,A,y)}add(p){w(p);const{a:L,d:$}=i,{X:H,Y:k,Z:C,T:F}=this,{X:K,Y:_,Z:N,T}=p,U=a(H*K),v=a(k*_),d=a(F*$*T),h=a(C*N),y=a((H+k)*(K+_)-U-v),A=h-d,S=h+d,x=a(v-L*U),R=a(y*A),I=a(S*x),O=a(y*x),q=a(A*S);return new m(R,I,q,O)}subtract(p){return w(p),this.add(p.negate())}multiply(p){if(!s.isValidNot0(p))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");const{p:L,f:$}=E.cached(this,p,H=>Ye(m,H));return Ye(m,[L,$])[0]}multiplyUnsafe(p){if(!s.isValid(p))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return p===Mt?m.ZERO:this.is0()||p===ht?this:E.unsafe(this,p,L=>Ye(m,L))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return E.unsafe(this,i.n).is0()}toAffine(p){const L=this;let $=p;const{X:H,Y:k,Z:C}=L,F=L.is0();$==null&&($=F?ka:o.inv(C));const K=a(H*$),_=a(k*$),N=o.mul(C,$);if(F)return{x:Mt,y:ht};if(N!==ht)throw new Error("invZ was invalid");return{x:K,y:_}}clearCofactor(){return c===ht?this:this.multiplyUnsafe(c)}toBytes(){const{x:p,y:L}=this.toAffine(),$=o.toBytes(L);return $[$.length-1]|=p&ht?128:0,$}toHex(){return Nn(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};B(m,"BASE",new m(i.Gx,i.Gy,ht,a(i.Gx*i.Gy))),B(m,"ZERO",new m(Mt,ht,ht,Mt)),B(m,"Fp",o),B(m,"Fn",s);let g=m;const E=new di(g,s.BITS);return s.BITS>=8&&g.BASE.precompute(8),Object.freeze(g.prototype),Object.freeze(g),g}class Ze{constructor(t){B(this,"ep");this.ep=t}static fromBytes(t){Ho()}static fromHex(t){Ho()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(t){return this.ep.toAffine(t)}toHex(){return Nn(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(t){return this.assertSame(t),this.init(this.ep.add(t.ep))}subtract(t){return this.assertSame(t),this.init(this.ep.subtract(t.ep))}multiply(t){return this.init(this.ep.multiply(t))}multiplyUnsafe(t){return this.init(this.ep.multiplyUnsafe(t))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(t,n){return this.ep.precompute(t,n),this}}B(Ze,"BASE"),B(Ze,"ZERO"),B(Ze,"Fp"),B(Ze,"Fn");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const qe=BigInt(0),ye=BigInt(1),ln=BigInt(2);function Ca(e){return $e(e,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...e})}function Na(e){const t=Ca(e),{P:n,type:r,adjustScalarBytes:o,powPminus2:s,randomBytes:i}=t,c=r==="x25519";if(!c&&r!=="x448")throw new Error("invalid type");const f=i===void 0?Dr:i,a=c?255:448,u=c?32:56,l=BigInt(c?9:5),w=BigInt(c?121665:39081),g=c?ln**BigInt(254):ln**BigInt(447),E=c?BigInt(8)*ln**BigInt(251)-ye:BigInt(4)*ln**BigInt(445)-ye,m=g+E+ye,b=d=>Q(d,n),p=L(l);function L(d){return zr(b(d),u)}function $(d){const h=Ge(J(d,u,"uCoordinate"));return c&&(h[31]&=127),b(Ae(h))}function H(d){return Ae(o(Ge(J(d,u,"scalar"))))}function k(d,h){const y=N($(h),H(d));if(y===qe)throw new Error("invalid private or public key received");return L(y)}function C(d){return k(d,p)}const F=C,K=k;function _(d,h,y){const A=b(d*(h-y));return h=b(h-A),y=b(y+A),{x_2:h,x_3:y}}function N(d,h){ve("u",d,qe,n),ve("scalar",h,g,m);const y=h,A=d;let S=ye,x=qe,R=d,I=ye,O=qe;for(let D=BigInt(a-1);D>=qe;D--){const Z=y>>D&ye;O^=Z,{x_2:S,x_3:R}=_(O,S,R),{x_2:x,x_3:I}=_(O,x,I),O=Z;const M=S+x,j=b(M*M),V=S-x,Y=b(V*V),z=j-Y,W=R+I,bt=R-I,xt=b(bt*M),Kt=b(W*V),_e=xt+Kt,Ue=xt-Kt;R=b(_e*_e),I=b(A*b(Ue*Ue)),S=b(j*Y),x=b(z*(j+b(w*z)))}({x_2:S,x_3:R}=_(O,S,R)),{x_2:x,x_3:I}=_(O,x,I);const q=s(x);return b(S*q)}const T={secretKey:u,publicKey:u,seed:u},U=d=>(d=d===void 0?f(u):d,J(d,T.seed,"seed"),d),v={randomSecretKey:U};return Object.freeze(T),Object.freeze(v),Object.freeze({keygen:yi(U,F),getSharedSecret:K,getPublicKey:F,scalarMult:k,scalarMultBase:C,utils:v,GuBytes:p.slice(),lengths:T})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fa=BigInt(0),ze=BigInt(1),jo=BigInt(2),qa=BigInt(3),Za=BigInt(5),Ma=BigInt(8),Re=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),bi={p:Re,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Ma,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function xi(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),o=BigInt(80),s=Re,c=e*e%s*e%s,f=mt(c,jo,s)*c%s,a=mt(f,ze,s)*e%s,u=mt(a,Za,s)*a%s,l=mt(u,t,s)*u%s,w=mt(l,n,s)*l%s,g=mt(w,r,s)*w%s,E=mt(g,o,s)*g%s,m=mt(E,o,s)*g%s,b=mt(m,t,s)*u%s;return{pow_p_5_8:mt(b,jo,s)*e%s,b2:c}}function Da(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const br=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Ei(e,t){const n=Re,r=Q(t*t*t,n),o=Q(r*r*t,n),s=xi(e*o).pow_p_5_8;let i=Q(e*r*s,n);const c=Q(t*i*i,n),f=i,a=Q(i*br,n),u=c===e,l=c===Q(-e,n),w=c===Q(-e*br,n);return u&&(i=f),(l||w)&&(i=a),Qt(i,n)&&(i=Q(-i,n)),{isValid:u||l,value:i}}const ge=Ha(bi,{uvRatio:Ei}),Jt=ge.Fp,ja=ge.Fn,xr=(()=>{const e=Re;return Na({P:e,type:"x25519",powPminus2:t=>{const{pow_p_5_8:n,b2:r}=xi(t);return Q(mt(n,qa,e)*r,e)},adjustScalarBytes:Da})})(),Yo=br,Ya=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),zo=e=>Ei(ze,e),za=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Va=e=>Jt.create(Ae(e)&za),yt=class yt extends Ze{constructor(t){super(t)}static fromAffine(t){return new yt(ge.fromAffine(t))}assertSame(t){if(!(t instanceof yt))throw new Error("RistrettoPoint expected")}init(t){return new yt(t)}static fromBytes(t){At(t,32);const{a:n,d:r}=bi,o=Re,s=H=>Jt.create(H),i=Va(t);if(!da(Jt.toBytes(i),t)||Qt(i,o))throw new Error("invalid ristretto255 encoding 1");const c=s(i*i),f=s(ze+n*c),a=s(ze-n*c),u=s(f*f),l=s(a*a),w=s(n*r*u-l),{isValid:g,value:E}=zo(s(w*l)),m=s(E*a),b=s(E*m*w);let p=s((i+i)*m);Qt(p,o)&&(p=s(-p));const L=s(f*b),$=s(p*L);if(!g||Qt($,o)||L===Fa)throw new Error("invalid ristretto255 encoding 2");return new yt(new ge(p,L,ze,$))}static fromHex(t){return yt.fromBytes(Rr(t))}toBytes(){let{X:t,Y:n,Z:r,T:o}=this.ep;const s=Re,i=b=>Jt.create(b),c=i(i(r+n)*i(r-n)),f=i(t*n),a=i(f*f),{value:u}=zo(i(c*a)),l=i(u*c),w=i(u*f),g=i(l*w*o);let E;if(Qt(o*g,s)){let b=i(n*Yo),p=i(t*Yo);t=b,n=p,E=i(l*Ya)}else E=w;Qt(t*g,s)&&(n=i(-n));let m=i((r-n)*E);return Qt(m,s)&&(m=i(-m)),Jt.toBytes(m)}equals(t){this.assertSame(t);const{X:n,Y:r}=this.ep,{X:o,Y:s}=t.ep,i=a=>Jt.create(a),c=i(n*s)===i(r*o),f=i(r*s)===i(n*o);return c||f}is0(){return this.equals(yt.ZERO)}};B(yt,"BASE",new yt(ge.BASE)),B(yt,"ZERO",new yt(ge.ZERO)),B(yt,"Fp",Jt),B(yt,"Fn",ja);let Ie=yt;Object.freeze(Ie.BASE);Object.freeze(Ie.ZERO);Object.freeze(Ie.prototype);Object.freeze(Ie);const mi=!1;async function Bi(e,t){try{return await e()}catch(n){if(n instanceof ReferenceError||n instanceof DOMException&&n.name==="NotSupportedError")return await t();throw n}}async function Wr(e,t){return await Bi(async()=>{const n=Er(e)?e:await Pa(e),r=await crypto.subtle.importKey("raw",t,{name:"X25519"},mi,[]);return new Uint8Array(await crypto.subtle.deriveBits({name:"X25519",public:r},n,256))},()=>{if(Er(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return xr.scalarMult(e,t)})}async function In(e){return await Bi(async()=>Wr(e,xr.GuBytes),()=>{if(Er(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return xr.scalarMultBase(e)})}const Xa=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]);async function Pa(e){if(e.length!==32)throw new Error("X25519 private key must be 32 bytes");const t=new Uint8Array([...Xa,...e]);return crypto.subtle.importKey("pkcs8",t,{name:"X25519"},mi,["deriveBits"])}function Er(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}class Ga{constructor(t){B(this,"s");B(this,"transcript",[]);B(this,"buf",new Uint8Array(0));this.s=t.getReader()}async readLine(){const t=[];for(;;){const n=this.buf.indexOf(10);if(n>=0)return t.push(this.buf.subarray(0,n)),this.transcript.push(this.buf.subarray(0,n+1)),this.buf=this.buf.subarray(n+1),Wa(be(t));this.buf.length>0&&(t.push(this.buf),this.transcript.push(this.buf));const r=await this.s.read();if(r.done)return this.buf=be(t),null;this.buf=r.value}}close(){return this.s.releaseLock(),{rest:this.buf,transcript:be(this.transcript)}}}function Wa(e){return e.forEach(t=>{if(t<32||t>126)throw Error("invalid non-ASCII byte in header")}),new TextDecoder().decode(e)}function be(e){const t=e.reduce(((o,s)=>o+s.length),0),n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function Ln(e,...t){return e.pipeThrough(new TransformStream({start(n){for(const r of t)n.enqueue(r)}}))}function mr(e){return new ReadableStream({start(t){t.enqueue(e),t.close()}})}async function Ai(e){if(!(e instanceof ReadableStream))throw new Error("readAll expects a ReadableStream<Uint8Array>");return new Uint8Array(await new Response(e).arrayBuffer())}async function Qa(e){if(!(e instanceof ReadableStream))throw new Error("readAllString expects a ReadableStream<Uint8Array>");return await new Response(e).text()}async function Ja(e,t){const n=e.getReader(),r=[];let o=0;for(;o<t;){const{done:f,value:a}=await n.read();if(f)throw Error("stream ended before reading "+t.toString()+" bytes");r.push(a),o+=a.length}n.releaseLock();const s=be(r),i=s.subarray(0,t),c=Ln(e,s.subarray(t));return{data:i,rest:c}}class ue{constructor(t,n){B(this,"args");B(this,"body");this.args=t,this.body=n}}async function tu(e){const t=await e.readLine();if(t===null)throw Error("invalid stanza");const n=t.split(" ");if(n.length<2||n.shift()!=="->")return{next:t};for(const s of n)if(s.length===0)throw Error("invalid stanza");const r=[];for(;;){const s=await e.readLine();if(s===null)throw Error("invalid stanza");const i=at.decode(s);if(i.length>48)throw Error("invalid stanza");if(r.push(i),i.length<48)break}const o=be(r);return{s:new ue(n,o)}}async function eu(e){const t=new Ga(e),n=await t.readLine();if(n!=="age-encryption.org/v1")throw Error("invalid version "+(n??"line"));const r=[];for(;;){const{s:o,next:s}=await tu(t);if(o!==void 0){r.push(o);continue}if(!s.startsWith("--- "))throw Error("invalid header");const i=at.decode(s.slice(4)),{rest:c,transcript:f}=t.close(),a=f.slice(0,f.length-1-s.length+3);return{stanzas:r,headerNoMAC:a,MAC:i,headerSize:f.length,rest:Ln(e,c)}}}function vi(e){const t=[];t.push(`age-encryption.org/v1
|
|
2
|
+
`);for(const n of e){t.push("-> "+n.args.join(" ")+`
|
|
3
|
+
`);for(let r=0;r<n.body.length;r+=48){let o=r+48;o>n.body.length&&(o=n.body.length),t.push(at.encode(n.body.subarray(r,o))+`
|
|
4
|
+
`)}n.body.length%48===0&&t.push(`
|
|
5
|
+
`)}return t.push("---"),new TextEncoder().encode(t.join(""))}function nu(e,t){return be([vi(e),new TextEncoder().encode(" "+at.encode(t)+`
|
|
6
|
+
`)])}function Du(){return ru()}function ru(){const e=It(32),t=it.encodeFromBytes("AGE-SECRET-KEY-",e).toUpperCase();return Promise.resolve(t)}function ju(){const e=It(32),t=it.encodeFromBytes("AGE-SECRET-KEY-PQ-",e).toUpperCase();return Promise.resolve(t)}async function Yu(e){let t;if(Ri(e))t=e;else if(e.startsWith("AGE-SECRET-KEY-PQ-1")){const r=it.decodeToBytes(e);if(r.prefix.toUpperCase()!=="AGE-SECRET-KEY-PQ-"||r.bytes.length!==32)throw Error("invalid identity");const o=Mr.getPublicKey(r.bytes);return it.encode("age1pq",it.toWords(o),!1)}else{const r=it.decodeToBytes(e);if(!e.startsWith("AGE-SECRET-KEY-1")||r.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||r.bytes.length!==32)throw Error("invalid identity");t=r.bytes}const n=await In(t);return it.encodeFromBytes("age",n)}class ou{constructor(t){B(this,"recipient");const n=it.decodeToBytes(t);if(!t.startsWith("age1pq1")||n.prefix.toLowerCase()!=="age1pq"||n.bytes.length!==1216)throw Error("invalid recipient");this.recipient=n.bytes}wrapFileKey(t){const{cipherText:n,sharedSecret:r}=Mr.encapsulate(this.recipient),o=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:s,nonce:i}=qn(Si,r,o),c=Lt(s,i).encrypt(t);return[new ue(["mlkem768x25519",at.encode(n)],c)]}}class su{constructor(t){B(this,"identity");const n=it.decodeToBytes(t);if(!t.startsWith("AGE-SECRET-KEY-PQ-1")||n.prefix.toUpperCase()!=="AGE-SECRET-KEY-PQ-"||n.bytes.length!==32)throw Error("invalid identity");this.identity=n.bytes}unwrapFileKey(t){for(const n of t){if(n.args.length<1||n.args[0]!=="mlkem768x25519")continue;if(n.args.length!==2)throw Error("invalid mlkem768x25519 stanza");const r=at.decode(n.args[1]);if(r.length!==1120||n.body.length!==32)throw Error("invalid mlkem768x25519 stanza");const o=Mr.decapsulate(r,this.identity),s=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:i,nonce:c}=qn(Si,o,s);try{return Lt(i,c).decrypt(n.body)}catch{continue}}return null}}const Si=25722,iu=80,Br=16;function qn(e,t,n){const r=cu(e),o=pn(r,void 0,"psk_id_hash",new Uint8Array(0)),s=pn(r,void 0,"info_hash",n),i=new Uint8Array(1+o.length+s.length);i[0]=0,i.set(o,1),i.set(s,1+o.length);const c=pn(r,t,"secret",new Uint8Array(0)),f=Ar(r,c,"key",i,32),a=Ar(r,c,"base_nonce",i,12);return{key:f,nonce:a}}function cu(e){const t=new Uint8Array(10);return t.set(new TextEncoder().encode("HPKE"),0),t[4]=e>>8&255,t[5]=e&255,t[6]=0,t[7]=1,t[8]=0,t[9]=3,t}function pn(e,t,n,r){const o=new Uint8Array(7+e.length+n.length+r.length);let s=0;return o.set(new TextEncoder().encode("HPKE-v1"),s),s+=7,o.set(e,s),s+=e.length,o.set(new TextEncoder().encode(n),s),s+=n.length,o.set(r,s),Qe(et,o,t)}function Ar(e,t,n,r,o){const s=new Uint8Array(9+e.length+n.length+r.length);let i=0;return s[i]=o>>8&255,s[i+1]=o&255,i+=2,s.set(new TextEncoder().encode("HPKE-v1"),i),i+=7,s.set(e,i),i+=e.length,s.set(new TextEncoder().encode(n),i),i+=n.length,s.set(r,i),Qo(et,t,s,o)}function fu(e){e.length!==Fe.lengths.publicKeyUncompressed&&(e=Fe.Point.fromBytes(e).toBytes(!1));const t=Fe.utils.randomSecretKey(),n=Fe.getPublicKey(t,!1),r=Fe.getSharedSecret(t,e,!0).subarray(1),o=new Uint8Array(n.length+e.length);o.set(n,0),o.set(e,n.length);const s=new Uint8Array(5);s.set(new TextEncoder().encode("KEM"),0),s[3]=Br>>8,s[4]=Br&255;const i=pn(s,void 0,"eae_prk",r),c=Ar(s,i,"shared_secret",o,32);return{encapsulatedKey:n,sharedSecret:c}}class au{constructor(t){B(this,"recipient");const n=it.decodeToBytes(t);if(!t.startsWith("age1tag1")||n.prefix.toLowerCase()!=="age1tag"||n.bytes.length!==33)throw Error("invalid recipient");this.recipient=n.bytes}wrapFileKey(t){const{encapsulatedKey:n,sharedSecret:r}=fu(this.recipient),o=new TextEncoder().encode("age-encryption.org/p256tag"),s=(()=>{const a=et(this.recipient).subarray(0,4),u=new Uint8Array(n.length+a.length);return u.set(n,0),u.set(a,n.length),Qe(et,u,o).subarray(0,4)})(),{key:i,nonce:c}=qn(Br,r,o),f=Lt(i,c).encrypt(t);return[new ue(["p256tag",at.encode(s),at.encode(n)],f)]}}class uu{constructor(t){B(this,"recipient");const n=it.decodeToBytes(t);if(!t.startsWith("age1tagpq1")||n.prefix.toLowerCase()!=="age1tagpq"||n.bytes.length!==1249)throw Error("invalid recipient");this.recipient=n.bytes}wrapFileKey(t){const{cipherText:n,sharedSecret:r}=la.encapsulate(this.recipient),o=new TextEncoder().encode("age-encryption.org/mlkem768p256tag"),s=(()=>{const a=et(this.recipient.subarray(1184)).subarray(0,4),u=new Uint8Array(n.length+a.length);return u.set(n,0),u.set(a,n.length),Qe(et,u,o).subarray(0,4)})(),{key:i,nonce:c}=qn(iu,r,o),f=Lt(i,c).encrypt(t);return[new ue(["mlkem768p256tag",at.encode(s),at.encode(n)],f)]}}class lu{constructor(t){B(this,"recipient");const n=it.decodeToBytes(t);if(!t.startsWith("age1")||n.prefix.toLowerCase()!=="age"||n.bytes.length!==32)throw Error("invalid recipient");this.recipient=n.bytes}async wrapFileKey(t){const n=It(32),r=await In(n),o=await Wr(n,this.recipient),s=new Uint8Array(r.length+this.recipient.length);s.set(r),s.set(this.recipient,r.length);const i=new TextEncoder().encode("age-encryption.org/v1/X25519"),c=xe(et,o,s,i,32);return[new ue(["X25519",at.encode(r)],Qr(t,c))]}}class Vo{constructor(t){B(this,"identity");B(this,"recipient");if(Ri(t)){this.identity=t,this.recipient=In(t);return}const n=it.decodeToBytes(t);if(!t.startsWith("AGE-SECRET-KEY-1")||n.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||n.bytes.length!==32)throw Error("invalid identity");this.identity=n.bytes,this.recipient=In(n.bytes)}async unwrapFileKey(t){for(const n of t){if(n.args.length<1||n.args[0]!=="X25519")continue;if(n.args.length!==2)throw Error("invalid X25519 stanza");const r=at.decode(n.args[1]);if(r.length!==32)throw Error("invalid X25519 stanza");const o=await Wr(this.identity,r),s=await this.recipient,i=new Uint8Array(r.length+s.length);i.set(r),i.set(s,r.length);const c=new TextEncoder().encode("age-encryption.org/v1/X25519"),f=xe(et,o,i,c,32),a=Jr(n.body,f);if(a!==null)return a}return null}}class du{constructor(t,n){B(this,"passphrase");B(this,"logN");this.passphrase=t,this.logN=n}wrapFileKey(t){const n=It(16),r="age-encryption.org/v1/scrypt",o=new Uint8Array(r.length+16);o.set(new TextEncoder().encode(r)),o.set(n,r.length);const s=os(this.passphrase,o,{N:2**this.logN,r:8,p:1,dkLen:32});return[new ue(["scrypt",at.encode(n),this.logN.toString()],Qr(t,s))]}}class hu{constructor(t){B(this,"passphrase");this.passphrase=t}unwrapFileKey(t){for(const n of t){if(n.args.length<1||n.args[0]!=="scrypt")continue;if(t.length!==1)throw Error("scrypt recipient is not the only one in the header");if(n.args.length!==3||!/^[1-9][0-9]*$/.test(n.args[2]))throw Error("invalid scrypt stanza");const r=at.decode(n.args[1]);if(r.length!==16)throw Error("invalid scrypt stanza");const o=Number(n.args[2]);if(o>20)throw Error("scrypt work factor is too high");const s="age-encryption.org/v1/scrypt",i=new Uint8Array(s.length+16);i.set(new TextEncoder().encode(s)),i.set(r,s.length);const c=os(this.passphrase,i,{N:2**o,r:8,p:1,dkLen:32}),f=Jr(n.body,c);if(f!==null)return f}return null}}function Qr(e,t){const n=new Uint8Array(12);return Lt(t,n).encrypt(e)}function Jr(e,t){if(e.length!==32)throw Error("invalid stanza");const n=new Uint8Array(12);try{return Lt(t,n).decrypt(e)}catch{return null}}function Ri(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}const te=16,to=64*1024,vr=to+te;function yu(e){const t=new Uint8Array(12),n=()=>{for(let i=t.length-2;i>=0&&(t[i]++,t[i]===0);i--);};let r=!0;const o=new Uint8Array(vr);let s=0;return new TransformStream({transform(i,c){for(;i.length>0;){if(s===o.length){const a=Lt(e,t).decrypt(o);c.enqueue(a),n(),s=0,r=!1}const f=Math.min(o.length-s,i.length);o.set(i.subarray(0,f),s),s+=f,i=i.subarray(f)}},flush(i){t[11]=1;const c=Lt(e,t).decrypt(o.subarray(0,s));if(!r&&c.length===0)throw new Error("final chunk is empty");i.enqueue(c)}})}function gu(e){if(e<te)throw Error("ciphertext is too small");if(e===te)return 0;const t=Math.floor(e/vr),n=e%vr;if(0<n&&n<=te)throw Error("ciphertext size is invalid");let r=e;return r-=t*te,r-=n>0?te:0,r}function pu(e){const t=new Uint8Array(12),n=()=>{for(let s=t.length-2;s>=0&&(t[s]++,t[s]===0);s--);},r=new Uint8Array(to);let o=0;return new TransformStream({transform(s,i){for(;s.length>0;){if(o===r.length){const f=Lt(e,t).encrypt(r);i.enqueue(f),n(),o=0}const c=Math.min(r.length-o,s.length);r.set(s.subarray(0,c),o),o+=c,s=s.subarray(c)}},flush(s){t[11]=1;const i=Lt(e,t).encrypt(r.subarray(0,o));s.enqueue(i)}})}function wu(e){const t=Math.max(1,Math.ceil(e/to));return e+te*t}function bu(e){const t=[];t.push(`-----BEGIN AGE ENCRYPTED FILE-----
|
|
7
|
+
`);for(let n=0;n<e.length;n+=48){let r=n+48;r>e.length&&(r=e.length),t.push(ns.encode(e.subarray(n,r))+`
|
|
8
|
+
`)}return t.push(`-----END AGE ENCRYPTED FILE-----
|
|
9
|
+
`),t.join("")}function xu(e){const t=e.trim().replaceAll(`\r
|
|
10
|
+
`,`
|
|
11
|
+
`).split(`
|
|
12
|
+
`);if(t.shift()!=="-----BEGIN AGE ENCRYPTED FILE-----")throw Error("invalid header");if(t.pop()!=="-----END AGE ENCRYPTED FILE-----")throw Error("invalid footer");function n(r,o){return r===t.length-1?o.length>0&&o.length<=64&&o.length%4===0:o.length===64}if(!t.every((r,o)=>n(o,r)))throw Error("invalid line length");if(!t.every(r=>/^[A-Za-z0-9+/=]+$/.test(r)))throw Error("invalid base64");return ns.decode(t.join(""))}const zu=Object.freeze(Object.defineProperty({__proto__:null,decode:xu,encode:bu},Symbol.toStringTag,{value:"Module"}));function Zn(e){if(e.length===0)throw Error("cbor: unexpected EOF");const t=e[0]>>5,n=e[0]&31;if(n<=23)return[t,n,e.subarray(1)];if(n===24){if(e.length<2)throw Error("cbor: unexpected EOF");return[t,e[1],e.subarray(2)]}if(n===25){if(e.length<3)throw Error("cbor: unexpected EOF");return[t,e[1]<<8|e[2],e.subarray(3)]}throw Error("cbor: unsupported argument encoding")}function Eu(e){const[t,n,r]=Zn(e);if(t!==0)throw Error("cbor: expected unsigned integer");return[n,r]}function mu(e){const[t,n,r]=Zn(e);if(t!==2)throw Error("cbor: expected byte string");if(n>r.length)throw Error("cbor: unexpected EOF");return[r.subarray(0,n),r.subarray(n)]}function Ii(e){const[t,n,r]=Zn(e);if(t!==3)throw Error("cbor: expected text string");if(n>r.length)throw Error("cbor: unexpected EOF");return[new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(r.subarray(0,n)),r.subarray(n)]}function Bu(e){const[t,n,r]=Zn(e);if(t!==4)throw Error("cbor: expected array");let o=r;const s=[];for(let i=0;i<n;i++){let c;[c,o]=Ii(o),s.push(c)}return[s,o]}function Au(e){return new Uint8Array([e])}function vu(e){if(e.length<=23)return new Uint8Array([64|e.length,...e]);if(e.length<=255)return new Uint8Array([88,e.length,...e]);if(e.length<=65535)return new Uint8Array([89,e.length>>8,e.length&255,...e]);throw Error("cbor: byte string too long")}function Li(e){const t=new TextEncoder().encode(e);if(t.length<=23)return new Uint8Array([96|t.length,...t]);if(t.length<=255)return new Uint8Array([120,t.length,...t]);if(t.length<=65535)return new Uint8Array([121,t.length>>8,t.length&255,...t]);throw Error("cbor: text string too long")}function Su(e){const t=e.flatMap(n=>[...Li(n)]);if(e.length<=23)return new Uint8Array([128|e.length,...t]);if(e.length<=255)return new Uint8Array([152,e.length,...t]);if(e.length<=65535)return new Uint8Array([153,e.length>>8,e.length&255,...t]);throw Error("cbor: array too long")}const Ru=[{type:"public-key",alg:-8},{type:"public-key",alg:-7},{type:"public-key",alg:-257}];async function Iu(e){var r;const t=await navigator.credentials.create({publicKey:{rp:{name:"",id:e.rpId},user:{name:e.keyName,id:It(8),displayName:""},pubKeyCredParams:Ru,authenticatorSelection:{requireResidentKey:e.type!=="security-key",residentKey:e.type!=="security-key"?"required":"discouraged",userVerification:"required"},hints:e.type==="security-key"?["security-key"]:[],extensions:{prf:{}},challenge:new Uint8Array([0]).buffer}});if(!((r=t.getClientExtensionResults().prf)!=null&&r.enabled))throw Error("PRF extension not available (need macOS 15+, Chrome 132+)");const n=e.rpId??new URL(window.origin).hostname;return Lu(t,n)}const Oi="AGE-PLUGIN-FIDO2PRF-";function Lu(e,t){const n=e.response,r=Au(1),o=vu(new Uint8Array(e.rawId)),s=Li(t),i=Su(n.getTransports()),c=new Uint8Array([...r,...o,...s,...i]);return it.encode(Oi,it.toWords(c),!1).toUpperCase()}function Ou(e){const t=it.decodeToBytes(e);if(!e.startsWith(Oi+"1"))throw Error("invalid identity");const[n,r]=Eu(t.bytes);if(n!==1)throw Error("unsupported identity version");const[o,s]=mu(r),[i,c]=Ii(s),[f]=Bu(c);return[o,i,f]}const Mn="age-encryption.org/fido2prf";class $i{constructor(t){B(this,"credId");B(this,"transports");B(this,"rpId");if(t!=null&&t.identity){const[n,r,o]=Ou(t.identity);this.credId=n,this.transports=o,this.rpId=r}else this.rpId=t==null?void 0:t.rpId}async getCredential(t){var o;const r=(o=(await navigator.credentials.get({publicKey:{allowCredentials:this.credId?[{id:this.credId,transports:this.transports,type:"public-key"}]:[],challenge:It(16),extensions:{prf:{eval:Uu(t)}},userVerification:"required",rpId:this.rpId}})).getClientExtensionResults().prf)==null?void 0:o.results;if(r===void 0)throw Error("PRF extension not available (need macOS 15+, Chrome 132+)");return r}}class $u extends $i{async wrapFileKey(t){const n=It(16),r=await this.getCredential(n),o=_i(r);return[new ue([Mn,at.encode(n)],Qr(t,o))]}}class _u extends $i{async unwrapFileKey(t){for(const n of t){if(n.args.length<1||n.args[0]!==Mn)continue;if(n.args.length!==2)throw Error("invalid prf stanza");const r=at.decode(n.args[1]);if(r.length!==16)throw Error("invalid prf stanza");const o=await this.getCredential(r),s=_i(o),i=Jr(n.body,s);if(i!==null)return i}return null}}function Uu(e){const t=new TextEncoder().encode(Mn),n=new Uint8Array(t.length+e.length+1);n.set(t,0),n[t.length]=1,n.set(e,t.length+1);const r=new Uint8Array(t.length+e.length+1);return r.set(t,0),r[t.length]=2,r.set(e,t.length+1),{first:n,second:r}}function _i(e){if(e.second===void 0)throw Error("Missing second PRF result");const t=new Uint8Array(e.first.byteLength+e.second.byteLength);return t.set(new Uint8Array(e.first),0),t.set(new Uint8Array(e.second),e.first.byteLength),Qe(et,t,new TextEncoder().encode(Mn))}const Vu=Object.freeze(Object.defineProperty({__proto__:null,WebAuthnIdentity:_u,WebAuthnRecipient:$u,createCredential:Iu},Symbol.toStringTag,{value:"Module"}));class Xu{constructor(){B(this,"passphrase",null);B(this,"scryptWorkFactor",18);B(this,"recipients",[])}setPassphrase(t){if(this.passphrase!==null)throw new Error("can encrypt to at most one passphrase");if(this.recipients.length!==0)throw new Error("can't encrypt to both recipients and passphrases");this.passphrase=t}setScryptWorkFactor(t){this.scryptWorkFactor=t}addRecipient(t){if(this.passphrase!==null)throw new Error("can't encrypt to both recipients and passphrases");if(typeof t=="string")if(t.startsWith("age1pq1"))this.recipients.push(new ou(t));else if(t.startsWith("age1tag1"))this.recipients.push(new au(t));else if(t.startsWith("age1tagpq1"))this.recipients.push(new uu(t));else if(t.startsWith("age1"))this.recipients.push(new lu(t));else throw new Error("unrecognized recipient type");else this.recipients.push(t)}async encrypt(t){const n=It(16),r=[];let o=this.recipients;this.passphrase!==null&&(o=[new du(this.passphrase,this.scryptWorkFactor)]);for(const g of o)r.push(...await g.wrapFileKey(n));const s=new TextEncoder().encode("header"),i=xe(et,n,void 0,s,32),c=Le(et,i,vi(r)),f=nu(r,c),a=It(16),u=new TextEncoder().encode("payload"),l=xe(et,n,a,u,32),w=pu(l);return t instanceof ReadableStream?Object.assign(Ln(t.pipeThrough(w),f,a),{size:g=>wu(g)+f.length+a.length}):(typeof t=="string"&&(t=new TextEncoder().encode(t)),await Ai(Ln(mr(t).pipeThrough(w),f,a)))}}class Pu{constructor(){B(this,"identities",[])}addPassphrase(t){this.identities.push(new hu(t))}addIdentity(t){if(ku(t))this.identities.push(new Vo(t));else if(typeof t=="string")if(t.startsWith("AGE-SECRET-KEY-1"))this.identities.push(new Vo(t));else if(t.startsWith("AGE-SECRET-KEY-PQ-1"))this.identities.push(new su(t));else throw new Error("unrecognized identity type");else this.identities.push(t)}async decrypt(t,n){const r=t instanceof ReadableStream?t:mr(t),{fileKey:o,headerSize:s,rest:i}=await this.decryptHeaderInternal(r),{data:c,rest:f}=await Ja(i,16),a=new TextEncoder().encode("payload"),u=xe(et,o,c,a,32),l=yu(u),w=f.pipeThrough(l),g=Object.assign(w,{size:E=>gu(E-s-c.length)});return t instanceof ReadableStream?g:n==="text"?await Qa(w):await Ai(w)}async decryptHeader(t){return(await this.decryptHeaderInternal(mr(t))).fileKey}async decryptHeaderInternal(t){const n=await eu(t),r=await this.unwrapFileKey(n.stanzas);if(r===null)throw Error("no identity matched any of the file's recipients");const o=new TextEncoder().encode("header"),s=xe(et,r,void 0,o,32),i=Le(et,s,n.headerNoMAC);if(!Tu(n.MAC,i))throw Error("invalid header HMAC");return{fileKey:r,headerSize:n.headerSize,rest:n.rest}}async unwrapFileKey(t){for(const n of this.identities){const r=await n.unwrapFileKey(t);if(r!==null)return r}return null}}function Tu(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function ku(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}export{Pu as Decrypter,Xu as Encrypter,ue as Stanza,zu as armor,ju as generateHybridIdentity,Du as generateIdentity,ru as generateX25519Identity,Yu as identityToRecipient,Vu as webauthn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){"use strict";function T(t,s,n,r){return{x0:t,y0:s,x1:n,y1:r,cx:0,cy:0,mass:0,children:[null,null,null,null],body:null}}function L(t,s,n){const r=(t.x0+t.x1)/2,i=(t.y0+t.y1)/2;return(s<r?0:1)+(n<i?0:2)}function R(t,s){const n=(t.x0+t.x1)/2,r=(t.y0+t.y1)/2;switch(s){case 0:return[t.x0,t.y0,n,r];case 1:return[n,t.y0,t.x1,r];case 2:return[t.x0,r,n,t.y1];default:return[n,r,t.x1,t.y1]}}function _(t,s){if(t.mass===0&&t.body===null){t.body=s,t.cx=s.x,t.cy=s.y,t.mass=1;return}if(t.body!==null){const i=t.body;t.body=null,i.x===s.x&&i.y===s.y&&(s.x+=(Math.random()-.5)*.1,s.y+=(Math.random()-.5)*.1);const y=L(t,i.x,i.y);if(t.children[y]===null){const[l,e,c,f]=R(t,y);t.children[y]=T(l,e,c,f)}_(t.children[y],i)}const n=L(t,s.x,s.y);if(t.children[n]===null){const[i,y,l,e]=R(t,n);t.children[n]=T(i,y,l,e)}_(t.children[n],s);const r=t.mass+1;t.cx=(t.cx*t.mass+s.x)/r,t.cy=(t.cy*t.mass+s.y)/r,t.mass=r}function j(t){if(t.length===0)return null;let s=1/0,n=1/0,r=-1/0,i=-1/0;for(const o of t)o.x<s&&(s=o.x),o.y<n&&(n=o.y),o.x>r&&(r=o.x),o.y>i&&(i=o.y);const y=Math.max(r-s,i-n)*.1+50,l=(s+r)/2,e=(n+i)/2,c=Math.max(r-s,i-n)/2+y,f=T(l-c,e-c,l+c,e+c);for(const o of t)_(f,o);return f}function z(t,s,n,r,i,y){q(t,s,n,r,i,y)}function q(t,s,n,r,i,y){if(t.mass===0)return;const l=t.cx-s.x,e=t.cy-s.y,c=l*l+e*e;if(t.body!==null){if(t.body!==s){let o=Math.sqrt(c);o<y&&(o=y);const a=r*i/(o*o),x=l/o*a,u=e/o*a;s.vx-=x,s.vy-=u}return}const f=t.x1-t.x0;if(f*f/c<n*n){let o=Math.sqrt(c);o<y&&(o=y);const a=r*t.mass*i/(o*o),x=l/o*a,u=e/o*a;s.vx-=x,s.vy-=u;return}for(let o=0;o<4;o++)t.children[o]!==null&&q(t.children[o],s,n,r,i,y)}const N={clusterStrength:.08,spacing:1.5},P=6e3,X=12e3,F=.004,O=140,w=350,H=.9,C=.01,I=30,E=50;let S={...N};function B(t){t.clusterStrength!==void 0&&(S.clusterStrength=t.clusterStrength),t.spacing!==void 0&&(S.spacing=t.spacing)}function V(t){if(t<=30)return{...N};const s=Math.log2(t/30);return{clusterStrength:Math.min(.5,.08+.06*s),spacing:Math.min(15,1.5+1.2*s)}}function D(t,s){for(const n of Object.values(t))if(typeof n=="string")return n;return s}function K(t){const s=new Map,n=[...new Set(t.nodes.map(c=>c.type))],r=Math.sqrt(n.length)*w*.6*Math.max(1,S.spacing),i=new Map,y=new Map;for(const c of t.nodes)y.set(c.type,(y.get(c.type)??0)+1);const l=t.nodes.map(c=>{const f=n.indexOf(c.type),o=2*Math.PI*f/Math.max(n.length,1),a=Math.cos(o)*r,x=Math.sin(o)*r,u=i.get(c.type)??0;i.set(c.type,u+1);const d=y.get(c.type)??1,v=2*Math.PI*u/d,M=O*.6,m={id:c.id,x:a+Math.cos(v)*M,y:x+Math.sin(v)*M,vx:0,vy:0,label:D(c.properties,c.id),type:c.type};return s.set(c.id,m),m}),e=t.edges.map(c=>({sourceId:c.sourceId,targetId:c.targetId,type:c.type}));return{nodes:l,edges:e,nodeMap:s}}const Q=.7,b=80;function J(t,s){const{nodes:n,edges:r,nodeMap:i}=t,y=X*S.spacing;if(n.length>=b){const e=j(n);if(e)for(const f of n)z(e,f,Q,y,s,I);const c=y-P;if(c>0){const f=new Map;for(const o of n){let a=f.get(o.type);a||(a=[],f.set(o.type,a)),a.push(o)}for(const o of f.values())for(let a=0;a<o.length;a++)for(let x=a+1;x<o.length;x++){const u=o[a],d=o[x];let v=d.x-u.x,M=d.y-u.y,m=Math.sqrt(v*v+M*M);m<I&&(m=I);const k=c*s/(m*m),G=v/m*k,U=M/m*k;u.vx+=G,u.vy+=U,d.vx-=G,d.vy-=U}}}else for(let e=0;e<n.length;e++)for(let c=e+1;c<n.length;c++){const f=n[e],o=n[c];let a=o.x-f.x,x=o.y-f.y,u=Math.sqrt(a*a+x*x);u<I&&(u=I);const v=(f.type===o.type?P:y)*s/(u*u),M=a/u*v,m=x/u*v;f.vx-=M,f.vy-=m,o.vx+=M,o.vy+=m}for(const e of r){const c=i.get(e.sourceId),f=i.get(e.targetId);if(!c||!f)continue;const o=f.x-c.x,a=f.y-c.y,x=Math.sqrt(o*o+a*a);if(x===0)continue;const u=c.type===f.type?O*S.spacing:w*S.spacing,d=F*(x-u)*s,v=o/x*d,M=a/x*d;c.vx+=v,c.vy+=M,f.vx-=v,f.vy-=M}for(const e of n)e.vx-=e.x*C*s,e.vy-=e.y*C*s;const l=new Map;for(const e of n){const c=l.get(e.type)??{x:0,y:0,count:0};c.x+=e.x,c.y+=e.y,c.count++,l.set(e.type,c)}for(const e of l.values())e.x/=e.count,e.y/=e.count;for(const e of n){const c=l.get(e.type);e.vx+=(c.x-e.x)*S.clusterStrength*s,e.vy+=(c.y-e.y)*S.clusterStrength*s}for(const e of n){if(e.pinned){e.vx=0,e.vy=0;continue}e.vx*=H,e.vy*=H;const c=Math.sqrt(e.vx*e.vx+e.vy*e.vy);c>E&&(e.vx=e.vx/c*E,e.vy=e.vy/c*E),e.x+=e.vx,e.y+=e.vy}return s*.995}const W=.001,Z=3;let g=!1,h=null,p=1;function Y(t){const s=new Float64Array(t.length*4);for(let n=0;n<t.length;n++){const r=t[n];s[n*4]=r.x,s[n*4+1]=r.y,s[n*4+2]=r.vx,s[n*4+3]=r.vy}return s}function A(){if(!g||!h)return;for(let s=0;s<Z;s++){if(p<W){g=!1;const n=Y(h.nodes);self.postMessage({type:"tick",positions:n,alpha:p},{transfer:[n.buffer]}),self.postMessage({type:"settled"});return}p=J(h,p)}const t=Y(h.nodes);self.postMessage({type:"tick",positions:t,alpha:p},{transfer:[t.buffer]}),setTimeout(A,0)}self.onmessage=t=>{const s=t.data;if(s.type==="start"){g=!1;const n=s.data,r=s.params,i=V(n.nodes.length);B({...i,...r}),h=K(n),p=1,g=!0,A()}if(s.type==="stop"&&(g=!1),s.type==="resume"&&!g&&h&&(p=Math.max(p,typeof s.alpha=="number"?s.alpha:.5),g=!0,A()),s.type==="pin"&&h){const n=s.updates;for(const r of n){const i=h.nodeMap.get(r.id);i&&(i.x=r.x,i.y=r.y,i.vx=0,i.vy=0,i.pinned=!0)}p=Math.max(p,.3),g||(g=!0,A())}if(s.type==="unpin"&&h){const n=s.ids;if(n==="all")for(const r of h.nodes)r.pinned=!1;else if(Array.isArray(n))for(const r of n){const i=h.nodeMap.get(r);i&&(i.pinned=!1)}p=Math.max(p,.5),g||(g=!0,A())}s.type==="params"&&(B(s.params),p=Math.max(p,.3),!g&&h&&(g=!0,A()))}})();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Backpack Viewer</title>
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-CSbPTbYZ.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BbX2AsyK.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="app">
|
|
12
|
+
<aside id="sidebar"></aside>
|
|
13
|
+
<div id="canvas-container">
|
|
14
|
+
<canvas id="graph-canvas"></canvas>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|