@serfab/quereus-plugin-sereus 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin-browser.js +1 -1
- package/package.json +1 -1
package/dist/plugin-browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @serfab/quereus-plugin-sereus 1.
|
|
1
|
+
/* @serfab/quereus-plugin-sereus 1.7.0 — browser bundle */
|
|
2
2
|
var _ke=Object.create;var v3=Object.defineProperty;var Pke=Object.getOwnPropertyDescriptor;var Rke=Object.getOwnPropertyNames;var Lke=Object.getPrototypeOf,Mke=Object.prototype.hasOwnProperty;var _=(r,e)=>()=>(r&&(e=r(r=0)),e);var Nr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),W=(r,e)=>{for(var t in e)v3(r,t,{get:e[t],enumerable:!0})},Bke=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Rke(e))!Mke.call(r,o)&&o!==t&&v3(r,o,{get:()=>e[o],enumerable:!(n=Pke(e,o))||n.enumerable});return r};var Ri=(r,e,t)=>(t=r!=null?_ke(Lke(r)):{},Bke(e||!r||!r.__esModule?v3(t,"default",{value:r,enumerable:!0}):t,r));var $te=Nr((Lvt,zte)=>{var xg=1e3,vg=xg*60,Eg=vg*60,xh=Eg*24,V5e=xh*7,q5e=xh*365.25;zte.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return j5e(r);if(t==="number"&&isFinite(r))return e.long?W5e(r):G5e(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function j5e(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*q5e;case"weeks":case"week":case"w":return t*V5e;case"days":case"day":case"d":return t*xh;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Eg;case"minutes":case"minute":case"mins":case"min":case"m":return t*vg;case"seconds":case"second":case"secs":case"sec":case"s":return t*xg;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function G5e(r){var e=Math.abs(r);return e>=xh?Math.round(r/xh)+"d":e>=Eg?Math.round(r/Eg)+"h":e>=vg?Math.round(r/vg)+"m":e>=xg?Math.round(r/xg)+"s":r+"ms"}function W5e(r){var e=Math.abs(r);return e>=xh?TI(r,e,xh,"day"):e>=Eg?TI(r,e,Eg,"hour"):e>=vg?TI(r,e,vg,"minute"):e>=xg?TI(r,e,xg,"second"):r+" ms"}function TI(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var Vte=Nr((Mvt,Hte)=>{function Y5e(r){t.debug=t,t.default=t,t.coerce=c,t.disable=i,t.enable=o,t.enabled=a,t.humanize=$te(),t.destroy=l,Object.keys(r).forEach(u=>{t[u]=r[u]}),t.names=[],t.skips=[],t.formatters={};function e(u){let d=0;for(let h=0;h<u.length;h++)d=(d<<5)-d+u.charCodeAt(h),d|=0;return t.colors[Math.abs(d)%t.colors.length]}t.selectColor=e;function t(u){let d,h=null,p,f;function g(...y){if(!g.enabled)return;let m=g,w=Number(new Date),b=w-(d||w);m.diff=b,m.prev=d,m.curr=w,d=w,y[0]=t.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let x=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(T,A)=>{if(T==="%%")return"%";x++;let v=t.formatters[A];if(typeof v=="function"){let C=y[x];T=v.call(m,C),y.splice(x,1),x--}return T}),t.formatArgs.call(m,y),(m.log||t.log).apply(m,y)}return g.namespace=u,g.useColors=t.useColors(),g.color=t.selectColor(u),g.extend=n,g.destroy=t.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(p!==t.namespaces&&(p=t.namespaces,f=t.enabled(u)),f),set:y=>{h=y}}),typeof t.init=="function"&&t.init(g),g}function n(u,d){let h=t(this.namespace+(typeof d>"u"?":":d)+u);return h.log=this.log,h}function o(u){t.save(u),t.namespaces=u,t.names=[],t.skips=[];let d=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let h of d)h[0]==="-"?t.skips.push(h.slice(1)):t.names.push(h)}function s(u,d){let h=0,p=0,f=-1,g=0;for(;h<u.length;)if(p<d.length&&(d[p]===u[h]||d[p]==="*"))d[p]==="*"?(f=p,g=h,p++):(h++,p++);else if(f!==-1)p=f+1,g++,h=g;else return!1;for(;p<d.length&&d[p]==="*";)p++;return p===d.length}function i(){let u=[...t.names,...t.skips.map(d=>"-"+d)].join(",");return t.enable(""),u}function a(u){for(let d of t.skips)if(s(u,d))return!1;for(let d of t.names)if(s(u,d))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Hte.exports=Y5e});var qte=Nr((Xo,kI)=>{Xo.formatArgs=Z5e;Xo.save=J5e;Xo.load=Q5e;Xo.useColors=X5e;Xo.storage=e8e();Xo.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Xo.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function X5e(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Z5e(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+kI.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}Xo.log=console.debug||console.log||(()=>{});function J5e(r){try{r?Xo.storage.setItem("debug",r):Xo.storage.removeItem("debug")}catch{}}function Q5e(){let r;try{r=Xo.storage.getItem("debug")||Xo.storage.getItem("DEBUG")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function e8e(){try{return localStorage}catch{}}kI.exports=Vte()(Xo);var{formatters:t8e}=kI.exports;t8e.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});function Oe(r=0){return new Uint8Array(r)}function ar(r=0){return new Uint8Array(r)}var Xt=_(()=>{});function mt(r){if(r<y3e)return 1;if(r<b3e)return 2;if(r<w3e)return 3;if(r<XB)return 4;if(r<ZB)return 5;if(r<JB)return 6;if(r<QB)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function ul(r,e,t=0){switch(mt(r)){case 8:e[t++]=r&255|at,r/=128;case 7:e[t++]=r&255|at,r/=128;case 6:e[t++]=r&255|at,r/=128;case 5:e[t++]=r&255|at,r/=128;case 4:e[t++]=r&255|at,r>>>=7;case 3:e[t++]=r&255|at,r>>>=7;case 2:e[t++]=r&255|at,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function x3e(r,e,t=0){switch(mt(r)){case 8:e.set(t++,r&255|at),r/=128;case 7:e.set(t++,r&255|at),r/=128;case 6:e.set(t++,r&255|at),r/=128;case 5:e.set(t++,r&255|at),r/=128;case 4:e.set(t++,r&255|at),r>>>=7;case 3:e.set(t++,r&255|at),r>>>=7;case 2:e.set(t++,r&255|at),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function eO(r,e){let t=r[e],n=0;if(n+=t&oo,t<at||(t=r[e+1],n+=(t&oo)<<7,t<at)||(t=r[e+2],n+=(t&oo)<<14,t<at)||(t=r[e+3],n+=(t&oo)<<21,t<at)||(t=r[e+4],n+=(t&oo)*XB,t<at)||(t=r[e+5],n+=(t&oo)*ZB,t<at)||(t=r[e+6],n+=(t&oo)*JB,t<at)||(t=r[e+7],n+=(t&oo)*QB,t<at))return n;throw new RangeError("Could not decode varint")}function v3e(r,e){let t=r.get(e),n=0;if(n+=t&oo,t<at||(t=r.get(e+1),n+=(t&oo)<<7,t<at)||(t=r.get(e+2),n+=(t&oo)<<14,t<at)||(t=r.get(e+3),n+=(t&oo)<<21,t<at)||(t=r.get(e+4),n+=(t&oo)*XB,t<at)||(t=r.get(e+5),n+=(t&oo)*ZB,t<at)||(t=r.get(e+6),n+=(t&oo)*JB,t<at)||(t=r.get(e+7),n+=(t&oo)*QB,t<at))return n;throw new RangeError("Could not decode varint")}function oi(r,e,t=0){return e==null&&(e=ar(mt(r))),e instanceof Uint8Array?ul(r,e,t):x3e(r,e,t)}function so(r,e=0){return r instanceof Uint8Array?eO(r,e):v3e(r,e)}var y3e,b3e,w3e,XB,ZB,JB,QB,at,oo,si=_(()=>{Xt();y3e=Math.pow(2,7),b3e=Math.pow(2,14),w3e=Math.pow(2,21),XB=Math.pow(2,28),ZB=Math.pow(2,35),JB=Math.pow(2,42),QB=Math.pow(2,49),at=128,oo=127});function E3e(r){return r?.buffer instanceof ArrayBuffer}function tO(r){if(E3e(r))return r;let e=r.slice();return new Uint8Array(e.buffer,0,e.byteLength)}var rO=_(()=>{});function Ye(r,e){e==null&&(e=r.reduce((o,s)=>o+s.length,0));let t=ar(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return tO(t)}var Mr=_(()=>{Xt();rO()});function ee(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var Ne=_(()=>{});function Dne(r,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let t=0;for(let n of r){let o=t+n.byteLength;if(e<o)return{buf:n,index:e-t};t=o}throw new RangeError("index is out of bounds")}function uT(r){return!!r?.[_ne]}var _ne,Y,ct=_(()=>{Xt();Mr();Ne();_ne=Symbol.for("@achingbrain/uint8arraylist");Y=class r{bufs;length;[_ne]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(let n of e)if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.push(n);else if(uT(n))t+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(let n of e.reverse())if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.unshift(n);else if(uT(n))t+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}get(e){let t=Dne(this.bufs,e);return t.buf[t.index]}set(e,t){let n=Dne(this.bufs,e);n.buf[n.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(t+n,e[n]);else if(uT(e))for(let n=0;n<e.length;n++)this.set(t+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,t){let{bufs:n,length:o}=this._subList(e,t);return Ye(n,o)}subarray(e,t){let{bufs:n,length:o}=this._subList(e,t);return n.length===1?n[0]:Ye(n,o)}sublist(e,t){let{bufs:n,length:o}=this._subList(e,t),s=new r;return s.length=o,s.bufs=[...n],s}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:this.bufs,length:this.length};let n=[],o=0;for(let s=0;s<this.bufs.length;s++){let i=this.bufs[s],a=o,c=a+i.byteLength;if(o=c,e>=c)continue;let l=e>=a&&e<c,u=t>a&&t<=c;if(l&&u){if(e===a&&t===c){n.push(i);break}let d=e-a;n.push(i.subarray(d,d+(t-e)));break}if(l){if(e===0){n.push(i);continue}n.push(i.subarray(e-a));continue}if(u){if(t===c){n.push(i);break}n.push(i.subarray(0,t-a));break}n.push(i)}return{bufs:n,length:t-e}}indexOf(e,t=0){if(!uT(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let s=256,i=new Int32Array(s);for(let d=0;d<s;d++)i[d]=-1;for(let d=0;d<o;d++)i[n[d]]=d;let a=i,c=this.byteLength-n.byteLength,l=n.byteLength-1,u;for(let d=t;d<=c;d+=u){u=0;for(let h=l;h>=0;h--){let p=this.get(d+h);if(n[h]!==p){u=Math.max(1,h-a[p]);break}}if(u===0)return d}return-1}getInt8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){let n=ar(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,t),this.write(n,e)}getInt16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,t)}setInt16(e,t,n){let o=Oe(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,t,n),this.write(o,e)}getInt32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,t)}setInt32(e,t,n){let o=Oe(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,t,n),this.write(o,e)}getBigInt64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,t)}setBigInt64(e,t,n){let o=Oe(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,t,n),this.write(o,e)}getUint8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){let n=ar(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,t),this.write(n,e)}getUint16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,t)}setUint16(e,t,n){let o=Oe(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,t,n),this.write(o,e)}getUint32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,t)}setUint32(e,t,n){let o=Oe(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,t,n),this.write(o,e)}getBigUint64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,t)}setBigUint64(e,t,n){let o=Oe(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,t,n),this.write(o,e)}getFloat32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,t)}setFloat32(e,t,n){let o=Oe(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,t,n),this.write(o,e)}getFloat64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,t)}setFloat64(e,t,n){let o=Oe(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,t,n),this.write(o,e)}equals(e){if(e==null||!(e instanceof r)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!ee(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let n=new r;return n.bufs=e,t==null&&(t=e.reduce((o,s)=>o+s.byteLength,0)),n.length=t,n}}});var Kne=Nr((Ykt,Fne)=>{var Ng=1e3,Ug=Ng*60,Fg=Ug*60,Bh=Fg*24,_3e=Bh*7,P3e=Bh*365.25;Fne.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return R3e(r);if(t==="number"&&isFinite(r))return e.long?M3e(r):L3e(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function R3e(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*P3e;case"weeks":case"week":case"w":return t*_3e;case"days":case"day":case"d":return t*Bh;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Fg;case"minutes":case"minute":case"mins":case"min":case"m":return t*Ug;case"seconds":case"second":case"secs":case"sec":case"s":return t*Ng;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function L3e(r){var e=Math.abs(r);return e>=Bh?Math.round(r/Bh)+"d":e>=Fg?Math.round(r/Fg)+"h":e>=Ug?Math.round(r/Ug)+"m":e>=Ng?Math.round(r/Ng)+"s":r+"ms"}function M3e(r){var e=Math.abs(r);return e>=Bh?yT(r,e,Bh,"day"):e>=Fg?yT(r,e,Fg,"hour"):e>=Ug?yT(r,e,Ug,"minute"):e>=Ng?yT(r,e,Ng,"second"):r+" ms"}function yT(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var $ne=Nr((Xkt,zne)=>{function B3e(r){t.debug=t,t.default=t,t.coerce=c,t.disable=i,t.enable=o,t.enabled=a,t.humanize=Kne(),t.destroy=l,Object.keys(r).forEach(u=>{t[u]=r[u]}),t.names=[],t.skips=[],t.formatters={};function e(u){let d=0;for(let h=0;h<u.length;h++)d=(d<<5)-d+u.charCodeAt(h),d|=0;return t.colors[Math.abs(d)%t.colors.length]}t.selectColor=e;function t(u){let d,h=null,p,f;function g(...y){if(!g.enabled)return;let m=g,w=Number(new Date),b=w-(d||w);m.diff=b,m.prev=d,m.curr=w,d=w,y[0]=t.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let x=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(T,A)=>{if(T==="%%")return"%";x++;let v=t.formatters[A];if(typeof v=="function"){let C=y[x];T=v.call(m,C),y.splice(x,1),x--}return T}),t.formatArgs.call(m,y),(m.log||t.log).apply(m,y)}return g.namespace=u,g.useColors=t.useColors(),g.color=t.selectColor(u),g.extend=n,g.destroy=t.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(p!==t.namespaces&&(p=t.namespaces,f=t.enabled(u)),f),set:y=>{h=y}}),typeof t.init=="function"&&t.init(g),g}function n(u,d){let h=t(this.namespace+(typeof d>"u"?":":d)+u);return h.log=this.log,h}function o(u){t.save(u),t.namespaces=u,t.names=[],t.skips=[];let d=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let h of d)h[0]==="-"?t.skips.push(h.slice(1)):t.names.push(h)}function s(u,d){let h=0,p=0,f=-1,g=0;for(;h<u.length;)if(p<d.length&&(d[p]===u[h]||d[p]==="*"))d[p]==="*"?(f=p,g=h,p++):(h++,p++);else if(f!==-1)p=f+1,g++,h=g;else return!1;for(;p<d.length&&d[p]==="*";)p++;return p===d.length}function i(){let u=[...t.names,...t.skips.map(d=>"-"+d)].join(",");return t.enable(""),u}function a(u){for(let d of t.skips)if(s(u,d))return!1;for(let d of t.names)if(s(u,d))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}zne.exports=B3e});var Hne=Nr((Qo,bT)=>{Qo.formatArgs=N3e;Qo.save=U3e;Qo.load=F3e;Qo.useColors=O3e;Qo.storage=K3e();Qo.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Qo.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function O3e(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function N3e(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+bT.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}Qo.log=console.debug||console.log||(()=>{});function U3e(r){try{r?Qo.storage.setItem("debug",r):Qo.storage.removeItem("debug")}catch{}}function F3e(){let r;try{r=Qo.storage.getItem("debug")||Qo.storage.getItem("DEBUG")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function K3e(){try{return localStorage}catch{}}bT.exports=$ne()(Qo);var{formatters:z3e}=bT.exports;z3e.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Gne,Wne=_(()=>{Gne=Symbol.for("@libp2p/connection")});var Yne=_(()=>{});var Xne=_(()=>{});var Zne=_(()=>{});var fO,Jne=_(()=>{fO=Symbol.for("@libp2p/content-routing")});var ji,xT,vT,q,zt,Fa,Nh,fl,ET,Dd,Vv,Uh,zg,_d,ST,CT,AT,Ds,IT,$g,hl,Hg,qv,TT,Vg,An,Qne=_(()=>{ji=class extends Error{static name="AbortError";constructor(e="The operation was aborted"){super(e),this.name="AbortError"}},xT=class extends Error{static name="UnexpectedPeerError";constructor(e="Unexpected Peer"){super(e),this.name="UnexpectedPeerError"}},vT=class extends Error{static name="InvalidCryptoExchangeError";constructor(e="Invalid crypto exchange"){super(e),this.name="InvalidCryptoExchangeError"}},q=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},zt=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}},Fa=class extends Error{static name="InvalidPrivateKeyError";constructor(e="Invalid private key"){super(e),this.name="InvalidPrivateKeyError"}},Nh=class extends Error{static name="ConnectionClosedError";constructor(e="The connection is closed"){super(e),this.name="ConnectionClosedError"}},fl=class extends Error{static name="MuxerClosedError";constructor(e="The muxer is closed"){super(e),this.name="MuxerClosedError"}},ET=class extends Error{static name="StreamResetError";constructor(e="The stream has been reset"){super(e),this.name="StreamResetError"}},Dd=class extends Error{static name="StreamStateError";constructor(e="The stream is in an invalid state"){super(e),this.name="StreamStateError"}},Vv=class extends Error{static name="StreamBufferError";constructor(e="The stream buffer was full"){super(e),this.name="StreamBufferError"}},Uh=class extends Error{static name="NotFoundError";constructor(e="Not found"){super(e),this.name="NotFoundError"}},zg=class extends Error{static name="InvalidPeerIdError";constructor(e="Invalid PeerID"){super(e),this.name="InvalidPeerIdError"}},_d=class extends Error{static name="InvalidMultiaddrError";constructor(e="Invalid multiaddr"){super(e),this.name="InvalidMultiaddrError"}},ST=class extends Error{static name="InvalidCIDError";constructor(e="Invalid CID"){super(e),this.name="InvalidCIDError"}},CT=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}},AT=class extends Error{static name="UnsupportedProtocolError";constructor(e="Unsupported protocol error"){super(e),this.name="UnsupportedProtocolError"}},Ds=class extends Error{static name="InvalidMessageError";constructor(e="Invalid message"){super(e),this.name="InvalidMessageError"}},IT=class extends Error{static name="ProtocolError";constructor(e="Protocol error"){super(e),this.name="ProtocolError"}},$g=class extends Error{static name="TimeoutError";constructor(e="Timed out"){super(e),this.name="TimeoutError"}},hl=class extends Error{static name="NotStartedError";constructor(e="Not started"){super(e),this.name="NotStartedError"}},Hg=class extends Error{static name="DialError";constructor(e="Dial error"){super(e),this.name="DialError"}},qv=class extends Error{static name="LimitedConnectionError";constructor(e="Limited connection"){super(e),this.name="LimitedConnectionError"}},TT=class extends Error{static name="TooManyInboundProtocolStreamsError";constructor(e="Too many inbound protocol streams"){super(e),this.name="TooManyInboundProtocolStreamsError"}},Vg=class extends Error{static name="TooManyOutboundProtocolStreamsError";constructor(e="Too many outbound protocol streams"){super(e),this.name="TooManyOutboundProtocolStreamsError"}},An=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}}});var kT,Pd,DT,_T,eoe=_(()=>{kT=class extends Event{data;constructor(e,t){super("message",t),this.data=e}},Pd=class extends Event{error;local;constructor(e,t,n){super("close",n),this.error=t,this.local=e}},DT=class extends Pd{constructor(e,t){super(!0,e,t)}},_T=class extends Pd{constructor(e,t){super(!1,e,t)}}});var toe=_(()=>{});var roe=_(()=>{});var noe=_(()=>{});var ooe=_(()=>{});var jv,soe=_(()=>{jv=Symbol.for("@libp2p/peer-discovery")});function Rd(r){return!!r?.[PT]}var PT,ioe=_(()=>{PT=Symbol.for("@libp2p/peer-id")});var aoe=_(()=>{});var hO,coe=_(()=>{hO=Symbol.for("@libp2p/peer-routing")});var Gv,loe=_(()=>{Gv="keep-alive"});var uoe=_(()=>{});function RT(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function doe(...r){let e=[];for(let t of r)RT(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStart!=null&&await t.beforeStart()})),await Promise.all(e.map(async t=>{await t.start()})),await Promise.all(e.map(async t=>{t.afterStart!=null&&await t.afterStart()}))}async function foe(...r){let e=[];for(let t of r)RT(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStop!=null&&await t.beforeStop()})),await Promise.all(e.map(async t=>{await t.stop()})),await Promise.all(e.map(async t=>{t.afterStop!=null&&await t.afterStop()}))}var hoe=_(()=>{});var poe=_(()=>{});var moe=_(()=>{});var goe=_(()=>{});var yoe=_(()=>{});var Wv,boe=_(()=>{(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Wv||(Wv={}))});var Lt,_s=_(()=>{Lt=class extends EventTarget{#e=new Map;constructor(){super()}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:s})=>s!==t),this.#e.set(e,o))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:o})=>!o),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new CustomEvent(e,t))}}});var In,pO,se=_(()=>{Wne();Yne();Xne();Zne();Jne();Qne();eoe();toe();roe();noe();ooe();soe();ioe();aoe();coe();loe();uoe();hoe();poe();moe();goe();yoe();boe();_s();In=Symbol.for("@libp2p/service-capabilities"),pO=Symbol.for("@libp2p/service-dependencies")});function woe(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function Ld(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}var GDt,Yv=_(()=>{GDt=new Uint8Array(0)});function j3e(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var a=r.length,c=r.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function d(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var g=0,y=0,m=0,w=f.length;m!==w&&f[m]===0;)m++,g++;for(var b=(w-m)*u+1>>>0,x=new Uint8Array(b);m!==w;){for(var S=f[m],T=0,A=b-1;(S!==0||T<y)&&A!==-1;A--,T++)S+=256*x[A]>>>0,x[A]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");y=T,m++}for(var v=b-y;v!==b&&x[v]===0;)v++;for(var C=c.repeat(g);v<b;++v)C+=r.charAt(x[v]);return C}function h(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var g=0;if(f[g]!==" "){for(var y=0,m=0;f[g]===c;)y++,g++;for(var w=(f.length-g)*l+1>>>0,b=new Uint8Array(w);f[g];){var x=t[f.charCodeAt(g)];if(x===255)return;for(var S=0,T=w-1;(x!==0||S<m)&&T!==-1;T--,S++)x+=a*b[T]>>>0,b[T]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");m=S,g++}if(f[g]!==" "){for(var A=w-m;A!==w&&b[A]===0;)A++;for(var v=new Uint8Array(y+(w-A)),C=y;A!==w;)v[C++]=b[A++];return v}}}function p(f){var g=h(f);if(g)return g;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:h,decode:p}}var G3e,W3e,xoe,voe=_(()=>{G3e=j3e,W3e=G3e,xoe=W3e});function Eoe(r,e){return new yO({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}function Soe({name:r,prefix:e,encode:t,decode:n}){return new bO(r,e,t,n)}function qg({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=xoe(t,r);return Soe({prefix:e,name:r,encode:n,decode:s=>Ld(o(s))})}function Y3e(r,e,t,n){let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),i=0,a=0,c=0;for(let l=0;l<o;++l){let u=e[r[l]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<t|u,i+=t,i>=8&&(i-=8,s[c++]=255&a>>i)}if(i>=t||(255&a<<8-i)!==0)throw new SyntaxError("Unexpected end of data");return s}function X3e(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],i+=8;i>t;)i-=t,s+=e[o&a>>i];if(i!==0&&(s+=e[o&a<<t-i]),n)for(;(s.length*t&7)!==0;)s+="=";return s}function Z3e(r){let e={};for(let t=0;t<r.length;++t)e[r[t]]=t;return e}function Ka({name:r,prefix:e,bitsPerChar:t,alphabet:n}){let o=Z3e(n);return Soe({prefix:e,name:r,encode(s){return X3e(s,n,t)},decode(s){return Y3e(s,o,t,r)}})}var mO,gO,yO,bO,LT=_(()=>{Yv();voe();mO=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},gO=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let o=t.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Eoe(this,e)}},yO=class{decoders;constructor(e){this.decoders=e}or(e){return Eoe(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};bO=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new mO(e,t,n),this.decoder=new gO(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}});var Ur,e_t,Fh=_(()=>{LT();Ur=qg({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),e_t=qg({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var Xv,n_t,o_t,s_t,i_t,a_t,c_t,l_t,u_t,Coe=_(()=>{LT();Xv=Ka({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),n_t=Ka({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),o_t=Ka({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),s_t=Ka({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),i_t=Ka({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),a_t=Ka({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),c_t=Ka({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),l_t=Ka({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),u_t=Ka({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var MT,h_t,Aoe=_(()=>{LT();MT=qg({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),h_t=qg({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});function koe(r,e,t){e=e||[],t=t||0;for(var n=t;r>=t4e;)e[t++]=r&255|Ioe,r/=128;for(;r&e4e;)e[t++]=r&255|Ioe,r>>>=7;return e[t]=r|0,koe.bytes=t-n+1,e}function wO(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw wO.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&Toe)<<o:(i&Toe)*Math.pow(2,o),o+=7}while(i>=n4e);return wO.bytes=s-n,t}var J3e,Ioe,Q3e,e4e,t4e,r4e,n4e,Toe,o4e,s4e,i4e,a4e,c4e,l4e,u4e,d4e,f4e,h4e,p4e,m4e,Zv,Doe=_(()=>{J3e=koe,Ioe=128,Q3e=127,e4e=~Q3e,t4e=Math.pow(2,31);r4e=wO,n4e=128,Toe=127;o4e=Math.pow(2,7),s4e=Math.pow(2,14),i4e=Math.pow(2,21),a4e=Math.pow(2,28),c4e=Math.pow(2,35),l4e=Math.pow(2,42),u4e=Math.pow(2,49),d4e=Math.pow(2,56),f4e=Math.pow(2,63),h4e=function(r){return r<o4e?1:r<s4e?2:r<i4e?3:r<a4e?4:r<c4e?5:r<l4e?6:r<u4e?7:r<d4e?8:r<f4e?9:10},p4e={encode:J3e,decode:r4e,encodingLength:h4e},m4e=p4e,Zv=m4e});function Jv(r,e=0){return[Zv.decode(r,e),Zv.decode.bytes]}function jg(r,e,t=0){return Zv.encode(r,e,t),e}function Gg(r){return Zv.encodingLength(r)}var xO=_(()=>{Doe()});function Yg(r,e){let t=e.byteLength,n=Gg(r),o=n+Gg(t),s=new Uint8Array(o+t);return jg(r,s,0),jg(t,s,n),s.set(e,o),new Wg(r,t,e,s)}function Qv(r){let e=Ld(r),[t,n]=Jv(e),[o,s]=Jv(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new Wg(t,o,i,e)}function Poe(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&woe(r.bytes,t.bytes)}}var Wg,eE=_(()=>{Yv();xO();Wg=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}}});var Roe=_(()=>{});function Loe(r,e){let{bytes:t,version:n}=r;return n===0?y4e(t,vO(r),e??Ur.encoder):b4e(t,vO(r),e??Xv.encoder)}function vO(r){let e=Moe.get(r);if(e==null){let t=new Map;return Moe.set(r,t),t}return e}function g4e(r,e){switch(r[0]){case"Q":{let t=e??Ur;return[Ur.prefix,t.decode(`${Ur.prefix}${r}`)]}case Ur.prefix:{let t=e??Ur;return[Ur.prefix,t.decode(r)]}case Xv.prefix:{let t=e??Xv;return[Xv.prefix,t.decode(r)]}case MT.prefix:{let t=e??MT;return[MT.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function y4e(r,e,t){let{prefix:n}=t;if(n!==Ur.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o}function b4e(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o}function Boe(r,e,t){let n=Gg(r),o=n+Gg(e),s=new Uint8Array(o+t.byteLength);return jg(r,s,0),jg(e,s,n),s.set(t,o),s}var Moe,Ps,tE,w4e,x4e,Xg=_(()=>{Coe();Aoe();Fh();Yv();eE();xO();Roe();Moe=new WeakMap;Ps=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==tE)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==w4e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=Yg(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&Poe(e.multihash,n.multihash)}toString(e){return Loe(this,e)}toJSON(){return{"/":Loe(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i??Boe(n,o,s.bytes))}else if(t[x4e]===!0){let{version:n,multihash:o,code:s}=t,i=Qv(o);return r.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==tE)throw new Error(`Version 0 CID must use dag-pb (code: ${tE}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=Boe(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,tE,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=Ld(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new Wg(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[d,h]=Jv(e.subarray(t));return t+=h,d},o=n(),s=tE;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,a=n(),c=n(),l=t+c,u=l-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:u,size:l}}static parse(e,t){let[n,o]=g4e(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return vO(s).set(n,e),s}};tE=112,w4e=18;x4e=Symbol.for("@ipld/js-cid/CID")});function E4e(r,e){if(e?.truncate!=null&&e.truncate!==r.byteLength){if(e.truncate<0||e.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e.truncate)}return Yg(Ooe,Noe(r))}var Ooe,v4e,Noe,za,Zg=_(()=>{Yv();eE();Ooe=0,v4e="identity",Noe=Ld;za={code:Ooe,name:v4e,encode:Noe,digest:E4e}});function Uoe(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function pl(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return Kh(r);if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return Kh(new Uint8Array(r.buffer,r.byteOffset,r.byteLength));throw new Error("Unknown type, must be binary type")}function Foe(r){return new TextEncoder().encode(r)}function Koe(r){return new TextDecoder().decode(r)}function S4e(r){return r?.buffer instanceof ArrayBuffer}function Kh(r){return S4e(r)?r:r.slice()}var I_t,Md=_(()=>{I_t=new Uint8Array(0)});function C4e(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var a=r.length,c=r.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function d(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var g=0,y=0,m=0,w=f.length;m!==w&&f[m]===0;)m++,g++;for(var b=(w-m)*u+1>>>0,x=new Uint8Array(b);m!==w;){for(var S=f[m],T=0,A=b-1;(S!==0||T<y)&&A!==-1;A--,T++)S+=256*x[A]>>>0,x[A]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");y=T,m++}for(var v=b-y;v!==b&&x[v]===0;)v++;for(var C=c.repeat(g);v<b;++v)C+=r.charAt(x[v]);return C}function h(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var g=0;if(f[g]!==" "){for(var y=0,m=0;f[g]===c;)y++,g++;for(var w=(f.length-g)*l+1>>>0,b=new Uint8Array(w);f[g];){var x=t[f.charCodeAt(g)];if(x===255)return;for(var S=0,T=w-1;(x!==0||S<m)&&T!==-1;T--,S++)x+=a*b[T]>>>0,b[T]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");m=S,g++}if(f[g]!==" "){for(var A=w-m;A!==w&&b[A]===0;)A++;for(var v=new Uint8Array(y+(w-A)),C=y;A!==w;)v[C++]=b[A++];return v}}}function p(f){var g=h(f);if(g)return g;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:h,decode:p}}var A4e,I4e,$oe,Hoe=_(()=>{A4e=C4e,I4e=A4e,$oe=I4e});function Voe(r,e){return new CO({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}function Jg({name:r,prefix:e,encode:t,decode:n}){return new AO(r,e,t,n)}function Bd({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=$oe(t,r);return Jg({prefix:e,name:r,encode:n,decode:s=>pl(o(s))})}function T4e(r,e,t,n){let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),i=0,a=0,c=0;for(let l=0;l<o;++l){let u=e[r[l]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<t|u,i+=t,i>=8&&(i-=8,s[c++]=255&a>>i)}if(i>=t||(255&a<<8-i)!==0)throw new SyntaxError("Unexpected end of data");return s}function k4e(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],i+=8;i>t;)i-=t,s+=e[o&a>>i];if(i!==0&&(s+=e[o&a<<t-i]),n)for(;(s.length*t&7)!==0;)s+="=";return s}function D4e(r){let e={};for(let t=0;t<r.length;++t)e[r[t]]=t;return e}function cr({name:r,prefix:e,bitsPerChar:t,alphabet:n}){let o=D4e(n);return Jg({prefix:e,name:r,encode(s){return k4e(s,n,t)},decode(s){return T4e(s,o,t,r)}})}var EO,SO,CO,AO,Gi=_(()=>{Md();Hoe();EO=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},SO=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let o=t.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Voe(this,e)}},CO=class{decoders;constructor(e){this.decoders=e}or(e){return Voe(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};AO=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new EO(e,t,n),this.decoder=new SO(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}});var IO={};W(IO,{base10:()=>_4e});var _4e,qoe=_(()=>{Gi();_4e=Bd({prefix:"9",name:"base10",alphabet:"0123456789"})});var TO={};W(TO,{base16:()=>P4e,base16upper:()=>R4e});var P4e,R4e,joe=_(()=>{Gi();P4e=cr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),R4e=cr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var kO={};W(kO,{base2:()=>L4e});var L4e,Goe=_(()=>{Gi();L4e=cr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var DO={};W(DO,{base256emoji:()=>U4e});function O4e(r){return r.reduce((e,t)=>(e+=M4e[t],e),"")}function N4e(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let o=B4e[n];if(o==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(o)}return new Uint8Array(e)}var Woe,M4e,B4e,U4e,Yoe=_(()=>{Gi();Woe=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),M4e=Woe.reduce((r,e,t)=>(r[t]=e,r),[]),B4e=Woe.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);U4e=Jg({prefix:"\u{1F680}",name:"base256emoji",encode:O4e,decode:N4e})});var _O={};W(_O,{base32:()=>Qg,base32hex:()=>$4e,base32hexpad:()=>V4e,base32hexpadupper:()=>q4e,base32hexupper:()=>H4e,base32pad:()=>K4e,base32padupper:()=>z4e,base32upper:()=>F4e,base32z:()=>j4e});var Qg,F4e,K4e,z4e,$4e,H4e,V4e,q4e,j4e,PO=_(()=>{Gi();Qg=cr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),F4e=cr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),K4e=cr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),z4e=cr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$4e=cr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),H4e=cr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),V4e=cr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),q4e=cr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),j4e=cr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var RO={};W(RO,{base36:()=>rE,base36upper:()=>G4e});var rE,G4e,LO=_(()=>{Gi();rE=Bd({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),G4e=Bd({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var MO={};W(MO,{base58btc:()=>$a,base58flickr:()=>W4e});var $a,W4e,BO=_(()=>{Gi();$a=Bd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),W4e=Bd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var OO={};W(OO,{base64:()=>Y4e,base64pad:()=>X4e,base64url:()=>Z4e,base64urlpad:()=>J4e});var Y4e,X4e,Z4e,J4e,Xoe=_(()=>{Gi();Y4e=cr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),X4e=cr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Z4e=cr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),J4e=cr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var NO={};W(NO,{base8:()=>Q4e});var Q4e,Zoe=_(()=>{Gi();Q4e=cr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var UO={};W(UO,{identity:()=>eMe});var eMe,Joe=_(()=>{Md();Gi();eMe=Jg({prefix:"\0",name:"identity",encode:r=>Koe(r),decode:r=>Foe(r)})});var $_t,H_t,Qoe=_(()=>{$_t=new TextEncoder,H_t=new TextDecoder});var ese=_(()=>{Md()});function nse(r,e,t){e=e||[],t=t||0;for(var n=t;r>=iMe;)e[t++]=r&255|tse,r/=128;for(;r&sMe;)e[t++]=r&255|tse,r>>>=7;return e[t]=r|0,nse.bytes=t-n+1,e}function FO(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw FO.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&rse)<<o:(i&rse)*Math.pow(2,o),o+=7}while(i>=cMe);return FO.bytes=s-n,t}var nMe,tse,oMe,sMe,iMe,aMe,cMe,rse,lMe,uMe,dMe,fMe,hMe,pMe,mMe,gMe,yMe,bMe,wMe,xMe,nE,ose=_(()=>{nMe=nse,tse=128,oMe=127,sMe=~oMe,iMe=Math.pow(2,31);aMe=FO,cMe=128,rse=127;lMe=Math.pow(2,7),uMe=Math.pow(2,14),dMe=Math.pow(2,21),fMe=Math.pow(2,28),hMe=Math.pow(2,35),pMe=Math.pow(2,42),mMe=Math.pow(2,49),gMe=Math.pow(2,56),yMe=Math.pow(2,63),bMe=function(r){return r<lMe?1:r<uMe?2:r<dMe?3:r<fMe?4:r<hMe?5:r<pMe?6:r<mMe?7:r<gMe?8:r<yMe?9:10},wMe={encode:nMe,decode:aMe,encodingLength:bMe},xMe=wMe,nE=xMe});function oE(r,e=0){return[nE.decode(r,e),nE.decode.bytes]}function ey(r,e,t=0){return nE.encode(r,e,t),e}function ty(r){return nE.encodingLength(r)}var NT=_(()=>{ose()});function ny(r,e){let t=e.byteLength,n=ty(r),o=n+ty(t),s=new Uint8Array(o+t);return ey(r,s,0),ey(t,s,n),s.set(e,o),new ry(r,t,e,s)}function sse(r){let e=pl(r),[t,n]=oE(e),[o,s]=oE(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new ry(t,o,i,e)}function ise(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Uoe(r.bytes,t.bytes)}}var ry,iE=_(()=>{Md();NT();ry=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=Kh(n),this.bytes=Kh(o)}}});var KO={};W(KO,{identity:()=>SMe});function EMe(r,e){if(e?.truncate!=null&&e.truncate!==r.byteLength){if(e.truncate<0||e.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e.truncate)}return ny(ase,cse(r))}var ase,vMe,cse,SMe,lse=_(()=>{Md();iE();ase=0,vMe="identity",cse=pl;SMe={code:ase,name:vMe,encode:cse,digest:EMe}});function $O({name:r,code:e,encode:t,minDigestLength:n,maxDigestLength:o}){return new zO(r,e,t,n,o)}function use(r,e,t){if(t!=null&&t!==r.byteLength){if(t>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t)}return ny(e,r)}var CMe,zO,HO=_(()=>{iE();CMe=20;zO=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,o,s){this.name=e,this.code=t,this.encode=n,this.minDigestLength=o??CMe,this.maxDigestLength=s}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?use(n,this.code,t?.truncate):n.then(o=>use(o,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}}});var VO={};W(VO,{sha256:()=>AMe,sha512:()=>IMe});function fse(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var AMe,IMe,hse=_(()=>{HO();AMe=$O({name:"sha2-256",code:18,encode:fse("SHA-256")}),IMe=$O({name:"sha2-512",code:19,encode:fse("SHA-512")})});var qO=_(()=>{});function pse(r,e){let{bytes:t,version:n}=r;return n===0?kMe(t,jO(r),e??$a.encoder):DMe(t,jO(r),e??Qg.encoder)}function jO(r){let e=mse.get(r);if(e==null){let t=new Map;return mse.set(r,t),t}return e}function TMe(r,e){switch(r[0]){case"Q":{let t=e??$a;return[$a.prefix,t.decode(`${$a.prefix}${r}`)]}case $a.prefix:{let t=e??$a;return[$a.prefix,t.decode(r)]}case Qg.prefix:{let t=e??Qg;return[Qg.prefix,t.decode(r)]}case rE.prefix:{let t=e??rE;return[rE.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function kMe(r,e,t){let{prefix:n}=t;if(n!==$a.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o}function DMe(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o}function gse(r,e,t){let n=ty(r),o=n+ty(e),s=new Uint8Array(o+t.byteLength);return ey(r,s,0),ey(e,s,n),s.set(t,o),s}var mse,UT,aE,_Me,PMe,yse=_(()=>{PO();LO();BO();Md();iE();NT();qO();mse=new WeakMap;UT=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=Kh(o),this["/"]=this.bytes}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==aE)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==_Me)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=ny(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&ise(e.multihash,n.multihash)}toString(e){return pse(this,e)}toJSON(){return{"/":pse(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i??gse(n,o,s.bytes))}else if(t[PMe]===!0){let{version:n,multihash:o,code:s}=t,i=sse(o);return r.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==aE)throw new Error(`Version 0 CID must use dag-pb (code: ${aE}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=gse(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,aE,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=pl(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new ry(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[d,h]=oE(e.subarray(t));return t+=h,d},o=n(),s=aE;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,a=n(),c=n(),l=t+c,u=l-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:u,size:l}}static parse(e,t){let[n,o]=TMe(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return jO(s).set(n,e),s}};aE=112,_Me=18;PMe=Symbol.for("@ipld/js-cid/CID")});var bse=_(()=>{});var wse=_(()=>{});var xse=_(()=>{});var vse=_(()=>{});var Ese=_(()=>{bse();wse();xse();qO();vse()});var Sse=_(()=>{Md();yse();iE();HO();NT();Ese()});var GO,dPt,Cse=_(()=>{qoe();joe();Goe();Yoe();PO();LO();BO();Xoe();Zoe();Joe();Qoe();ese();lse();hse();Sse();GO={...UO,...kO,...NO,...IO,...TO,..._O,...RO,...MO,...OO,...DO},dPt={...VO,...KO}});function Ise(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Ase,WO,RMe,FT,YO=_(()=>{Cse();Xt();Ase=Ise("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),WO=Ise("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=ar(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),RMe={utf8:Ase,"utf-8":Ase,hex:GO.base16,latin1:WO,ascii:WO,binary:WO,...GO},FT=RMe});function K(r,e="utf8"){let t=FT[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}var me=_(()=>{YO()});function z(r,e="utf8"){let t=FT[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var Le=_(()=>{YO()});function ZO(r,e={offset:0}){let t=r[e.offset]&LMe;if(e.offset++,Tse[t]!=null)return Tse[t](r,e);throw new Error("No decoder for tag "+t)}function lE(r,e){let t=0;if((r[e.offset]&XO)===XO){let n=r[e.offset]&MMe,o="0x";e.offset++;for(let s=0;s<n;s++,e.offset++)o+=r[e.offset].toString(16).padStart(2,"0");t=parseInt(o,16)}else t=r[e.offset],e.offset++;return t}function cE(r,e){lE(r,e);let t=[];for(;!(e.offset>=r.byteLength);){let n=ZO(r,e);if(n===null)break;t.push(n)}return t}function BMe(r,e){let t=lE(r,e),n=e.offset,o=e.offset+t,s=[];for(let i=n;i<o;i++)i===n&&r[i]===0||s.push(r[i]);return e.offset+=t,Uint8Array.from(s)}function OMe(r,e){let t=lE(r,e),n=e.offset+t,o=r[e.offset];e.offset++;let s=0,i=0;o<40?(s=0,i=o):o<80?(s=1,i=o-40):(s=2,i=o-80);let a=`${s}.${i}`,c=[];for(;e.offset<n;){let l=r[e.offset];if(e.offset++,c.push(l&127),l<128){c.reverse();let u=0;for(let d=0;d<c.length;d++)u+=c[d]<<d*7;a+=`.${u}`,c=[]}}return a}function NMe(r,e){return e.offset++,null}function UMe(r,e){let t=lE(r,e),n=r[e.offset];e.offset++;let o=r.subarray(e.offset,e.offset+t-1);if(e.offset+=t,n!==0)throw new Error("Unused bits in bit string is unimplemented");return o}function FMe(r,e){let t=lE(r,e),n=r.subarray(e.offset,e.offset+t);return e.offset+=t,n}function KMe(r){let e=r.toString(16);e.length%2===1&&(e="0"+e);let t=new Y;for(let n=0;n<e.length;n+=2)t.append(Uint8Array.from([parseInt(`${e[n]}${e[n+1]}`,16)]));return t}function JO(r){if(r.byteLength<128)return Uint8Array.from([r.byteLength]);let e=KMe(r.byteLength);return new Y(Uint8Array.from([e.byteLength|XO]),e)}function kse(r){let e=new Y,t=128;return(r.subarray()[0]&t)===t&&e.append(Uint8Array.from([0])),e.append(r),new Y(Uint8Array.from([2]),JO(e),e)}function Dse(r){let e=Uint8Array.from([0]),t=new Y(e,r);return new Y(Uint8Array.from([3]),JO(t),t)}function KT(r,e=48){let t=new Y;for(let n of r)t.append(n);return new Y(Uint8Array.from([e]),JO(t),t)}var LMe,XO,MMe,Tse,_se=_(()=>{ct();LMe=parseInt("11111",2),XO=parseInt("10000000",2),MMe=parseInt("01111111",2),Tse={0:cE,1:cE,2:BMe,3:UMe,4:FMe,5:NMe,6:OMe,16:cE,22:cE,48:cE}});async function Pse(r,e,t,n){let o=await crypto.subtle.importKey("jwk",r,{name:"ECDSA",namedCurve:r.crv??"P-256"},!1,["verify"]);n?.signal?.throwIfAborted();let s=await crypto.subtle.verify({name:"ECDSA",hash:{name:"SHA-256"}},o,e,t.subarray());return n?.signal?.throwIfAborted(),s}var Rse=_(()=>{});function Lse(r){let e=ZO(r);return Mse(e)}function Mse(r){let e=r[1][1][0],t=1,n,o;if(e.byteLength===QO*2+1)return n=z(e.subarray(t,t+QO),"base64url"),o=z(e.subarray(t+QO),"base64url"),new oy({...VMe,key_ops:["verify"],x:n,y:o});if(e.byteLength===eN*2+1)return n=z(e.subarray(t,t+eN),"base64url"),o=z(e.subarray(t+eN),"base64url"),new oy({...qMe,key_ops:["verify"],x:n,y:o});if(e.byteLength===tN*2+1)return n=z(e.subarray(t,t+tN),"base64url"),o=z(e.subarray(t+tN),"base64url"),new oy({...jMe,key_ops:["verify"],x:n,y:o});throw new q(`coordinates were wrong length, got ${e.byteLength}, expected 65, 97 or 133`)}function Bse(r){return KT([kse(Uint8Array.from([1])),KT([GMe(r.crv)],160),KT([Dse(new Y(Uint8Array.from([4]),K(r.x??"","base64url"),K(r.y??"","base64url")))],161)]).subarray()}function GMe(r){if(r==="P-256")return zMe;if(r==="P-384")return $Me;if(r==="P-521")return HMe;throw new q(`Invalid curve ${r}`)}var zMe,$Me,HMe,VMe,qMe,jMe,QO,eN,tN,rN=_(()=>{se();ct();me();Le();_se();Ose();zMe=Uint8Array.from([6,8,42,134,72,206,61,3,1,7]),$Me=Uint8Array.from([6,5,43,129,4,0,34]),HMe=Uint8Array.from([6,5,43,129,4,0,35]),VMe={ext:!0,kty:"EC",crv:"P-256"},qMe={ext:!0,kty:"EC",crv:"P-384"},jMe={ext:!0,kty:"EC",crv:"P-521"},QO=32,eN=48,tN=66});var oy,Ose=_(()=>{Fh();Xg();Zg();Ne();uE();rN();Rse();oy=class{type="ECDSA";jwk;_raw;constructor(e){this.jwk=e}get raw(){return this._raw==null&&(this._raw=Bse(this.jwk)),this._raw}toMultihash(){return za.digest(sy(this))}toCID(){return Ps.createV1(114,this.toMultihash())}toString(){return Ur.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:ee(this.raw,e.raw)}async verify(e,t,n){return Pse(this.jwk,t,e,n)}}});function zh(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function ci(r,e=""){if(!Number.isSafeInteger(r)||r<0){let t=e&&`"${e}" `;throw new Error(`${t}expected integer >= 0, got ${r}`)}}function Me(r,e,t=""){let n=zh(r),o=r?.length,s=e!==void 0;if(!n||s&&o!==e){let i=t&&`"${t}" `,a=s?` of length ${e}`:"",c=n?`length=${o}`:`type=${typeof r}`;throw new Error(i+"expected Uint8Array"+a+", got "+c)}return r}function $h(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash must wrapped by utils.createHasher");ci(r.outputLen),ci(r.blockLen)}function iy(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function Use(r,e){Me(r,void 0,"digestInto() output");let t=e.outputLen;if(r.length<t)throw new Error('"digestInto() output" expected to be of length >='+t)}function Wi(...r){for(let e=0;e<r.length;e++)r[e].fill(0)}function zT(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function Yi(r,e){return r<<32-e|r>>>e}function gl(r){if(Me(r),Fse)return r.toHex();let e="";for(let t=0;t<r.length;t++)e+=WMe[r[t]];return e}function Nse(r){if(r>=ml._0&&r<=ml._9)return r-ml._0;if(r>=ml.A&&r<=ml.F)return r-(ml.A-10);if(r>=ml.a&&r<=ml.f)return r-(ml.a-10)}function yl(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);if(Fse)return Uint8Array.fromHex(r);let e=r.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(t);for(let o=0,s=0;o<t;o++,s+=2){let i=Nse(r.charCodeAt(s)),a=Nse(r.charCodeAt(s+1));if(i===void 0||a===void 0){let c=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[o]=i*16+a}return n}function es(...r){let e=0;for(let n=0;n<r.length;n++){let o=r[n];Me(o),e+=o.length}let t=new Uint8Array(e);for(let n=0,o=0;n<r.length;n++){let s=r[n];t.set(s,o),o+=s.length}return t}function nN(r,e={}){let t=(o,s)=>r(s).update(o).digest(),n=r(void 0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=o=>r(o),Object.assign(t,e),Object.freeze(t)}function ts(r=32){let e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return e.getRandomValues(new Uint8Array(r))}var Fse,WMe,ml,oN,Xi=_(()=>{Fse=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",WMe=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));ml={_0:48,_9:57,A:65,F:70,a:97,f:102};oN=r=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,r])})});function Kse(r,e,t){return r&e^~r&t}function zse(r,e,t){return r&e^r&t^e&t}var dE,bl,Tn,$se=_(()=>{Xi();dE=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,o){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(e),this.view=zT(this.buffer)}update(e){iy(this),Me(e);let{view:t,buffer:n,blockLen:o}=this,s=e.length;for(let i=0;i<s;){let a=Math.min(o-this.pos,s-i);if(a===o){let c=zT(e);for(;o<=s-i;i+=o)this.process(c,i);continue}n.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){iy(this),Use(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;t[i++]=128,Wi(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(n,0),i=0);for(let d=i;d<o;d++)t[d]=0;n.setBigUint64(o-8,BigInt(this.length*8),s),this.process(n,0);let a=zT(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)a.setUint32(4*d,u[d],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:o,finished:s,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=s,e.length=o,e.pos=a,o%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}},bl=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Tn=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])});function YMe(r,e=!1){return e?{h:Number(r&$T),l:Number(r>>Hse&$T)}:{h:Number(r>>Hse&$T)|0,l:Number(r&$T)|0}}function Vse(r,e=!1){let t=r.length,n=new Uint32Array(t),o=new Uint32Array(t);for(let s=0;s<t;s++){let{h:i,l:a}=YMe(r[s],e);[n[s],o[s]]=[i,a]}return[n,o]}function Ha(r,e,t,n){let o=(e>>>0)+(n>>>0);return{h:r+t+(o/2**32|0)|0,l:o|0}}var $T,Hse,sN,iN,Hh,Vh,fE,hE,qse,jse,Gse,Wse,Yse,Xse,Zse=_(()=>{$T=BigInt(4294967295),Hse=BigInt(32);sN=(r,e,t)=>r>>>t,iN=(r,e,t)=>r<<32-t|e>>>t,Hh=(r,e,t)=>r>>>t|e<<32-t,Vh=(r,e,t)=>r<<32-t|e>>>t,fE=(r,e,t)=>r<<64-t|e>>>t-32,hE=(r,e,t)=>r>>>t-32|e<<64-t;qse=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),jse=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Gse=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),Wse=(r,e,t,n,o)=>e+t+n+o+(r/2**32|0)|0,Yse=(r,e,t,n,o)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(o>>>0),Xse=(r,e,t,n,o,s)=>e+t+n+o+s+(r/2**32|0)|0});var ZMe,Od,aN,cN,Jse,JMe,QMe,Nd,Ud,lN,uN,lt,Qse,Va=_(()=>{$se();Zse();Xi();ZMe=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]),Od=new Uint32Array(64),aN=class extends dE{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[e,t,n,o,s,i,a,c]}set(e,t,n,o,s,i,a,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}process(e,t){for(let d=0;d<16;d++,t+=4)Od[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let h=Od[d-15],p=Od[d-2],f=Yi(h,7)^Yi(h,18)^h>>>3,g=Yi(p,17)^Yi(p,19)^p>>>10;Od[d]=g+Od[d-7]+f+Od[d-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){let h=Yi(a,6)^Yi(a,11)^Yi(a,25),p=u+h+Kse(a,c,l)+ZMe[d]+Od[d]|0,g=(Yi(n,2)^Yi(n,13)^Yi(n,22))+zse(n,o,s)|0;u=l,l=c,c=a,a=i+p|0,i=s,s=o,o=n,n=p+g|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(n,o,s,i,a,c,l,u)}roundClean(){Wi(Od)}destroy(){this.set(0,0,0,0,0,0,0,0),Wi(this.buffer)}},cN=class extends aN{A=bl[0]|0;B=bl[1]|0;C=bl[2]|0;D=bl[3]|0;E=bl[4]|0;F=bl[5]|0;G=bl[6]|0;H=bl[7]|0;constructor(){super(32)}},Jse=Vse(["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(r=>BigInt(r))),JMe=Jse[0],QMe=Jse[1],Nd=new Uint32Array(80),Ud=new Uint32Array(80),lN=class extends dE{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:t,Bh:n,Bl:o,Ch:s,Cl:i,Dh:a,Dl:c,Eh:l,El:u,Fh:d,Fl:h,Gh:p,Gl:f,Hh:g,Hl:y}=this;return[e,t,n,o,s,i,a,c,l,u,d,h,p,f,g,y]}set(e,t,n,o,s,i,a,c,l,u,d,h,p,f,g,y){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=u|0,this.Fh=d|0,this.Fl=h|0,this.Gh=p|0,this.Gl=f|0,this.Hh=g|0,this.Hl=y|0}process(e,t){for(let b=0;b<16;b++,t+=4)Nd[b]=e.getUint32(t),Ud[b]=e.getUint32(t+=4);for(let b=16;b<80;b++){let x=Nd[b-15]|0,S=Ud[b-15]|0,T=Hh(x,S,1)^Hh(x,S,8)^sN(x,S,7),A=Vh(x,S,1)^Vh(x,S,8)^iN(x,S,7),v=Nd[b-2]|0,C=Ud[b-2]|0,P=Hh(v,C,19)^fE(v,C,61)^sN(v,C,6),F=Vh(v,C,19)^hE(v,C,61)^iN(v,C,6),R=Gse(A,F,Ud[b-7],Ud[b-16]),k=Wse(R,T,P,Nd[b-7],Nd[b-16]);Nd[b]=k|0,Ud[b]=R|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:a,Cl:c,Dh:l,Dl:u,Eh:d,El:h,Fh:p,Fl:f,Gh:g,Gl:y,Hh:m,Hl:w}=this;for(let b=0;b<80;b++){let x=Hh(d,h,14)^Hh(d,h,18)^fE(d,h,41),S=Vh(d,h,14)^Vh(d,h,18)^hE(d,h,41),T=d&p^~d&g,A=h&f^~h&y,v=Yse(w,S,A,QMe[b],Ud[b]),C=Xse(v,m,x,T,JMe[b],Nd[b]),P=v|0,F=Hh(n,o,28)^fE(n,o,34)^fE(n,o,39),R=Vh(n,o,28)^hE(n,o,34)^hE(n,o,39),k=n&s^n&a^s&a,I=o&i^o&c^i&c;m=g|0,w=y|0,g=p|0,y=f|0,p=d|0,f=h|0,{h:d,l:h}=Ha(l|0,u|0,C|0,P|0),l=a|0,u=c|0,a=s|0,c=i|0,s=n|0,i=o|0;let E=qse(P,R,I);n=jse(E,C,F,k),o=E|0}({h:n,l:o}=Ha(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=Ha(this.Bh|0,this.Bl|0,s|0,i|0),{h:a,l:c}=Ha(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:u}=Ha(this.Dh|0,this.Dl|0,l|0,u|0),{h:d,l:h}=Ha(this.Eh|0,this.El|0,d|0,h|0),{h:p,l:f}=Ha(this.Fh|0,this.Fl|0,p|0,f|0),{h:g,l:y}=Ha(this.Gh|0,this.Gl|0,g|0,y|0),{h:m,l:w}=Ha(this.Hh|0,this.Hl|0,m|0,w|0),this.set(n,o,s,i,a,c,l,u,d,h,p,f,g,y,m,w)}roundClean(){Wi(Nd,Ud)}destroy(){Wi(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},uN=class extends lN{Ah=Tn[0]|0;Al=Tn[1]|0;Bh=Tn[2]|0;Bl=Tn[3]|0;Ch=Tn[4]|0;Cl=Tn[5]|0;Dh=Tn[6]|0;Dl=Tn[7]|0;Eh=Tn[8]|0;El=Tn[9]|0;Fh=Tn[10]|0;Fl=Tn[11]|0;Gh=Tn[12]|0;Gl=Tn[13]|0;Hh=Tn[14]|0;Hl=Tn[15]|0;constructor(){super(64)}},lt=nN(()=>new cN,oN(1)),Qse=nN(()=>new uN,oN(3))});function wl(r,e=""){if(typeof r!="boolean"){let t=e&&`"${e}" `;throw new Error(t+"expected boolean, got type="+typeof r)}return r}function eie(r){if(typeof r=="bigint"){if(!HT(r))throw new Error("positive bigint expected, got "+r)}else ci(r);return r}function pE(r){let e=eie(r).toString(16);return e.length&1?"0"+e:e}function tie(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return r===""?fN:BigInt("0x"+r)}function ay(r){return tie(gl(r))}function qa(r){return tie(gl(qh(Me(r)).reverse()))}function VT(r,e){ci(e),r=eie(r);let t=yl(r.toString(16).padStart(e*2,"0"));if(t.length!==e)throw new Error("number too large");return t}function mE(r,e){return VT(r,e).reverse()}function qh(r){return Uint8Array.from(r)}function eBe(r,e,t){return HT(r)&&HT(e)&&HT(t)&&e<=r&&r<t}function Fd(r,e,t,n){if(!eBe(e,t,n))throw new Error("expected valid "+r+": "+t+" <= n < "+n+", got "+e)}function hN(r){let e;for(e=0;r>fN;r>>=dN,e+=1);return e}function rie(r,e,t){if(ci(r,"hashLen"),ci(e,"qByteLen"),typeof t!="function")throw new Error("hmacFn must be a function");let n=y=>new Uint8Array(y),o=Uint8Array.of(),s=Uint8Array.of(0),i=Uint8Array.of(1),a=1e3,c=n(r),l=n(r),u=0,d=()=>{c.fill(1),l.fill(0),u=0},h=(...y)=>t(l,es(c,...y)),p=(y=o)=>{l=h(s,y),c=h(),y.length!==0&&(l=h(i,y),c=h())},f=()=>{if(u++>=a)throw new Error("drbg: tried max amount of iterations");let y=0,m=[];for(;y<e;){c=h();let w=c.slice();m.push(w),y+=c.length}return es(...m)};return(y,m)=>{d(),p(y);let w;for(;!(w=m(f()));)p();return d(),w}}function ja(r,e={},t={}){if(!r||typeof r!="object")throw new Error("expected valid options object");function n(s,i,a){let c=r[s];if(a&&c===void 0)return;let l=typeof c;if(l!==i||c===null)throw new Error(`param "${s}" is invalid: expected ${i}, got ${l}`)}let o=(s,i)=>Object.entries(s).forEach(([a,c])=>n(a,c,i));o(e,!1),o(t,!0)}function cy(r){let e=new WeakMap;return(t,...n)=>{let o=e.get(t);if(o!==void 0)return o;let s=r(t,...n);return e.set(t,s),s}}var fN,dN,HT,gE,ly=_(()=>{Xi();Xi();fN=BigInt(0),dN=BigInt(1);HT=r=>typeof r=="bigint"&&fN<=r;gE=r=>(dN<<BigInt(r))-dN});function $t(r,e){let t=r%e;return t>=Lo?t:e+t}function Mt(r,e,t){let n=r;for(;e-- >Lo;)n*=n,n%=t;return n}function nie(r,e){if(r===Lo)throw new Error("invert: expected non-zero number");if(e<=Lo)throw new Error("invert: expected positive modulus, got "+e);let t=$t(r,e),n=e,o=Lo,s=Yr,i=Yr,a=Lo;for(;t!==Lo;){let l=n/t,u=n%t,d=o-i*l,h=s-a*l;n=t,t=u,o=i,s=a,i=d,a=h}if(n!==Yr)throw new Error("invert: does not exist");return $t(o,e)}function mN(r,e,t){if(!r.eql(r.sqr(e),t))throw new Error("Cannot find square root")}function uie(r,e){let t=(r.ORDER+Yr)/iie,n=r.pow(e,t);return mN(r,n,e),n}function nBe(r,e){let t=(r.ORDER-aie)/cie,n=r.mul(e,jh),o=r.pow(n,t),s=r.mul(e,o),i=r.mul(r.mul(s,jh),o),a=r.mul(s,r.sub(i,r.ONE));return mN(r,a,e),a}function oBe(r){let e=uy(r),t=die(r),n=t(e,e.neg(e.ONE)),o=t(e,n),s=t(e,e.neg(n)),i=(r+tBe)/lie;return(a,c)=>{let l=a.pow(c,i),u=a.mul(l,n),d=a.mul(l,o),h=a.mul(l,s),p=a.eql(a.sqr(u),c),f=a.eql(a.sqr(d),c);l=a.cmov(l,u,p),u=a.cmov(h,d,f);let g=a.eql(a.sqr(u),c),y=a.cmov(l,u,g);return mN(a,y,c),y}}function die(r){if(r<sie)throw new Error("sqrt is not defined for small field");let e=r-Yr,t=0;for(;e%jh===Lo;)e/=jh,t++;let n=jh,o=uy(r);for(;oie(o,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(t===1)return uie;let s=o.pow(n,e),i=(e+Yr)/jh;return function(c,l){if(c.is0(l))return l;if(oie(c,l)!==1)throw new Error("Cannot find square root");let u=t,d=c.mul(c.ONE,s),h=c.pow(l,e),p=c.pow(l,i);for(;!c.eql(h,c.ONE);){if(c.is0(h))return c.ZERO;let f=1,g=c.sqr(h);for(;!c.eql(g,c.ONE);)if(f++,g=c.sqr(g),f===u)throw new Error("Cannot find square root");let y=Yr<<BigInt(u-f-1),m=c.pow(d,y);u=f,d=c.sqr(m),h=c.mul(h,d),p=c.mul(p,m)}return p}}function sBe(r){return r%iie===sie?uie:r%cie===aie?nBe:r%lie===rBe?oBe(r):die(r)}function gN(r){let e={ORDER:"bigint",BYTES:"number",BITS:"number"},t=iBe.reduce((n,o)=>(n[o]="function",n),e);return ja(r,t),r}function aBe(r,e,t){if(t<Lo)throw new Error("invalid exponent, negatives unsupported");if(t===Lo)return r.ONE;if(t===Yr)return e;let n=r.ONE,o=e;for(;t>Lo;)t&Yr&&(n=r.mul(n,o)),o=r.sqr(o),t>>=Yr;return n}function yE(r,e,t=!1){let n=new Array(e.length).fill(t?r.ZERO:void 0),o=e.reduce((i,a,c)=>r.is0(a)?i:(n[c]=i,r.mul(i,a)),r.ONE),s=r.inv(o);return e.reduceRight((i,a,c)=>r.is0(a)?i:(n[c]=r.mul(i,n[c]),r.mul(i,a)),s),n}function oie(r,e){let t=(r.ORDER-Yr)/jh,n=r.pow(e,t),o=r.eql(n,r.ONE),s=r.eql(n,r.ZERO),i=r.eql(n,r.neg(r.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function cBe(r,e){e!==void 0&&ci(e);let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function uy(r,e={}){return new pN(r,e)}function hie(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function yN(r){let e=hie(r);return e+Math.ceil(e/2)}function bN(r,e,t=!1){Me(r);let n=r.length,o=hie(e),s=yN(e);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let i=t?qa(r):ay(r),a=$t(i,e-Yr)+Yr;return t?mE(a,o):VT(a,o)}var Lo,Yr,jh,sie,iie,aie,tBe,cie,rBe,lie,fie,iBe,pN,dy=_(()=>{ly();Lo=BigInt(0),Yr=BigInt(1),jh=BigInt(2),sie=BigInt(3),iie=BigInt(4),aie=BigInt(5),tBe=BigInt(7),cie=BigInt(8),rBe=BigInt(9),lie=BigInt(16);fie=(r,e)=>($t(r,e)&Yr)===Yr,iBe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];pN=class{ORDER;BITS;BYTES;isLE;ZERO=Lo;ONE=Yr;_lengths;_sqrt;_mod;constructor(e,t={}){if(e<=Lo)throw new Error("invalid field: expected ORDER > 0, got "+e);let n;this.isLE=!1,t!=null&&typeof t=="object"&&(typeof t.BITS=="number"&&(n=t.BITS),typeof t.sqrt=="function"&&(this.sqrt=t.sqrt),typeof t.isLE=="boolean"&&(this.isLE=t.isLE),t.allowedLengths&&(this._lengths=t.allowedLengths?.slice()),typeof t.modFromBytes=="boolean"&&(this._mod=t.modFromBytes));let{nBitLength:o,nByteLength:s}=cBe(e,n);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=o,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(e){return $t(e,this.ORDER)}isValid(e){if(typeof e!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof e);return Lo<=e&&e<this.ORDER}is0(e){return e===Lo}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&Yr)===Yr}neg(e){return $t(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return $t(e*e,this.ORDER)}add(e,t){return $t(e+t,this.ORDER)}sub(e,t){return $t(e-t,this.ORDER)}mul(e,t){return $t(e*t,this.ORDER)}pow(e,t){return aBe(this,e,t)}div(e,t){return $t(e*nie(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return nie(e,this.ORDER)}sqrt(e){return this._sqrt||(this._sqrt=sBe(this.ORDER)),this._sqrt(this,e)}toBytes(e){return this.isLE?mE(e,this.BYTES):VT(e,this.BYTES)}fromBytes(e,t=!1){Me(e);let{_lengths:n,BYTES:o,isLE:s,ORDER:i,_mod:a}=this;if(n){if(!n.includes(e.length)||e.length>o)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+e.length);let l=new Uint8Array(o);l.set(e,s?0:l.length-e.length),e=l}if(e.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);let c=s?qa(e):ay(e);if(a&&(c=$t(c,i)),!t&&!this.isValid(c))throw new Error("invalid field element: outside of range 0..ORDER");return c}invertBatch(e){return yE(this,e)}cmov(e,t,n){return n?t:e}}});function bE(r,e){let t=e.negate();return r?t:e}function Wh(r,e){let t=yE(r.Fp,e.map(n=>n.Z));return e.map((n,o)=>r.fromAffine(n.toAffine(t[o])))}function yie(r,e){if(!Number.isSafeInteger(r)||r<=0||r>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+r)}function wN(r,e){yie(r,e);let t=Math.ceil(e/r)+1,n=2**(r-1),o=2**r,s=gE(r),i=BigInt(r);return{windows:t,windowSize:n,mask:s,maxNumber:o,shiftBy:i}}function pie(r,e,t){let{windowSize:n,mask:o,maxNumber:s,shiftBy:i}=t,a=Number(r&o),c=r>>i;a>n&&(a-=s,c+=Gh);let l=e*n,u=l+Math.abs(a)-1,d=a===0,h=a<0,p=e%2!==0;return{nextN:c,offset:u,isZero:d,isNeg:h,isNegF:p,offsetF:l}}function vN(r){return bie.get(r)||1}function mie(r){if(r!==fy)throw new Error("invalid wNAF")}function wie(r,e,t,n){let o=e,s=r.ZERO,i=r.ZERO;for(;t>fy||n>fy;)t&Gh&&(s=s.add(o)),n&Gh&&(i=i.add(o)),o=o.double(),t>>=Gh,n>>=Gh;return{p1:s,p2:i}}function gie(r,e,t){if(e){if(e.ORDER!==r)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return gN(e),e}else return uy(r,{isLE:t})}function qT(r,e,t={},n){if(n===void 0&&(n=r==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${r} CURVE object`);for(let c of["p","n","h"]){let l=e[c];if(!(typeof l=="bigint"&&l>fy))throw new Error(`CURVE.${c} must be positive bigint`)}let o=gie(e.p,t.Fp,n),s=gie(e.n,t.Fn,n),a=["Gx","Gy","a",r==="weierstrass"?"b":"d"];for(let c of a)if(!o.isValid(e[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:o,Fn:s}}function py(r,e){return function(n){let o=r(n);return{secretKey:o,publicKey:e(o)}}}var fy,Gh,xN,bie,hy,jT=_(()=>{ly();dy();fy=BigInt(0),Gh=BigInt(1);xN=new WeakMap,bie=new WeakMap;hy=class{BASE;ZERO;Fn;bits;constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,n=this.ZERO){let o=e;for(;t>fy;)t&Gh&&(n=n.add(o)),o=o.double(),t>>=Gh;return n}precomputeWindow(e,t){let{windows:n,windowSize:o}=wN(t,this.bits),s=[],i=e,a=i;for(let c=0;c<n;c++){a=i,s.push(a);for(let l=1;l<o;l++)a=a.add(i),s.push(a);i=a.double()}return s}wNAF(e,t,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE,i=wN(e,this.bits);for(let a=0;a<i.windows;a++){let{nextN:c,offset:l,isZero:u,isNeg:d,isNegF:h,offsetF:p}=pie(n,a,i);n=c,u?s=s.add(bE(h,t[p])):o=o.add(bE(d,t[l]))}return mie(n),{p:o,f:s}}wNAFUnsafe(e,t,n,o=this.ZERO){let s=wN(e,this.bits);for(let i=0;i<s.windows&&n!==fy;i++){let{nextN:a,offset:c,isZero:l,isNeg:u}=pie(n,i,s);if(n=a,!l){let d=t[c];o=o.add(u?d.negate():d)}}return mie(n),o}getPrecomputes(e,t,n){let o=xN.get(t);return o||(o=this.precomputeWindow(t,e),e!==1&&(typeof n=="function"&&(o=n(o)),xN.set(t,o))),o}cached(e,t,n){let o=vN(e);return this.wNAF(o,this.getPrecomputes(o,e,n),t)}unsafe(e,t,n,o){let s=vN(e);return s===1?this._unsafeLadder(e,t,o):this.wNAFUnsafe(s,this.getPrecomputes(s,e,n),t,o)}createCache(e,t){yie(t,this.bits),bie.set(e,t),xN.delete(e)}hasCache(e){return vN(e)!==1}}});function uBe(r,e,t,n){let o=r.sqr(t),s=r.sqr(n),i=r.add(r.mul(e.a,o),s),a=r.add(r.ONE,r.mul(e.d,r.mul(o,s)));return r.eql(i,a)}function xie(r,e={}){let t=qT("edwards",r,e,e.FpFnLE),{Fp:n,Fn:o}=t,s=t.CURVE,{h:i}=s;ja(e,{},{uvRatio:"function"});let a=EN<<BigInt(o.BYTES*8)-Xr,c=y=>n.create(y),l=e.uvRatio||((y,m)=>{try{return{isValid:!0,value:n.sqrt(n.div(y,m))}}catch{return{isValid:!1,value:Kd}}});if(!uBe(n,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function u(y,m,w=!1){let b=w?Xr:Kd;return Fd("coordinate "+y,m,b,a),m}function d(y){if(!(y instanceof f))throw new Error("EdwardsPoint expected")}let h=cy((y,m)=>{let{X:w,Y:b,Z:x}=y,S=y.is0();m==null&&(m=S?lBe:n.inv(x));let T=c(w*m),A=c(b*m),v=n.mul(x,m);if(S)return{x:Kd,y:Xr};if(v!==Xr)throw new Error("invZ was invalid");return{x:T,y:A}}),p=cy(y=>{let{a:m,d:w}=s;if(y.is0())throw new Error("bad point: ZERO");let{X:b,Y:x,Z:S,T}=y,A=c(b*b),v=c(x*x),C=c(S*S),P=c(C*C),F=c(A*m),R=c(C*c(F+v)),k=c(P+c(w*c(A*v)));if(R!==k)throw new Error("bad point: equation left != right (1)");let I=c(b*x),E=c(S*T);if(I!==E)throw new Error("bad point: equation left != right (2)");return!0});class f{static BASE=new f(s.Gx,s.Gy,Xr,c(s.Gx*s.Gy));static ZERO=new f(Kd,Xr,Xr,Kd);static Fp=n;static Fn=o;X;Y;Z;T;constructor(m,w,b,x){this.X=u("x",m),this.Y=u("y",w),this.Z=u("z",b,!0),this.T=u("t",x),Object.freeze(this)}static CURVE(){return s}static fromAffine(m){if(m instanceof f)throw new Error("extended point not allowed");let{x:w,y:b}=m||{};return u("x",w),u("y",b),new f(w,b,Xr,c(w*b))}static fromBytes(m,w=!1){let b=n.BYTES,{a:x,d:S}=s;m=qh(Me(m,b,"point")),wl(w,"zip215");let T=qh(m),A=m[b-1];T[b-1]=A&-129;let v=qa(T),C=w?a:n.ORDER;Fd("point.y",v,Kd,C);let P=c(v*v),F=c(P-Xr),R=c(S*P-x),{isValid:k,value:I}=l(F,R);if(!k)throw new Error("bad point: invalid y coordinate");let E=(I&Xr)===Xr,D=(A&128)!==0;if(!w&&I===Kd&&D)throw new Error("bad point: x=0 and x_0=1");return D!==E&&(I=c(-I)),f.fromAffine({x:I,y:v})}static fromHex(m,w=!1){return f.fromBytes(yl(m),w)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(m=8,w=!0){return g.createCache(this,m),w||this.multiply(EN),this}assertValidity(){p(this)}equals(m){d(m);let{X:w,Y:b,Z:x}=this,{X:S,Y:T,Z:A}=m,v=c(w*A),C=c(S*x),P=c(b*A),F=c(T*x);return v===C&&P===F}is0(){return this.equals(f.ZERO)}negate(){return new f(c(-this.X),this.Y,this.Z,c(-this.T))}double(){let{a:m}=s,{X:w,Y:b,Z:x}=this,S=c(w*w),T=c(b*b),A=c(EN*c(x*x)),v=c(m*S),C=w+b,P=c(c(C*C)-S-T),F=v+T,R=F-A,k=v-T,I=c(P*R),E=c(F*k),D=c(P*k),M=c(R*F);return new f(I,E,M,D)}add(m){d(m);let{a:w,d:b}=s,{X:x,Y:S,Z:T,T:A}=this,{X:v,Y:C,Z:P,T:F}=m,R=c(x*v),k=c(S*C),I=c(A*b*F),E=c(T*P),D=c((x+S)*(v+C)-R-k),M=E-I,B=E+I,L=c(k-w*R),O=c(D*M),U=c(B*L),$=c(D*L),J=c(M*B);return new f(O,U,J,$)}subtract(m){return this.add(m.negate())}multiply(m){if(!o.isValidNot0(m))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:w,f:b}=g.cached(this,m,x=>Wh(f,x));return Wh(f,[w,b])[0]}multiplyUnsafe(m,w=f.ZERO){if(!o.isValid(m))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return m===Kd?f.ZERO:this.is0()||m===Xr?this:g.unsafe(this,m,b=>Wh(f,b),w)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}isTorsionFree(){return g.unsafe(this,s.n).is0()}toAffine(m){return h(this,m)}clearCofactor(){return i===Xr?this:this.multiplyUnsafe(i)}toBytes(){let{x:m,y:w}=this.toAffine(),b=n.toBytes(w);return b[b.length-1]|=m&Xr?128:0,b}toHex(){return gl(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let g=new hy(f,o.BITS);return f.BASE.precompute(8),f}function vie(r,e,t={}){if(typeof e!="function")throw new Error('"hash" function param is required');ja(t,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=t,{BASE:o,Fp:s,Fn:i}=r,a=t.randomBytes||ts,c=t.adjustScalarBytes||(v=>v),l=t.domain||((v,C,P)=>{if(wl(P,"phflag"),C.length||P)throw new Error("Contexts/pre-hash are not supported");return v});function u(v){return i.create(qa(v))}function d(v){let C=b.secretKey;Me(v,b.secretKey,"secretKey");let P=Me(e(v),2*C,"hashedSecretKey"),F=c(P.slice(0,C)),R=P.slice(C,2*C),k=u(F);return{head:F,prefix:R,scalar:k}}function h(v){let{head:C,prefix:P,scalar:F}=d(v),R=o.multiply(F),k=R.toBytes();return{head:C,prefix:P,scalar:F,point:R,pointBytes:k}}function p(v){return h(v).pointBytes}function f(v=Uint8Array.of(),...C){let P=es(...C);return u(e(l(P,Me(v,void 0,"context"),!!n)))}function g(v,C,P={}){v=Me(v,void 0,"message"),n&&(v=n(v));let{prefix:F,scalar:R,pointBytes:k}=h(C),I=f(P.context,F,v),E=o.multiply(I).toBytes(),D=f(P.context,E,k,v),M=i.create(I+D*R);if(!i.isValid(M))throw new Error("sign failed: invalid s");let B=es(E,i.toBytes(M));return Me(B,b.signature,"result")}let y={zip215:!0};function m(v,C,P,F=y){let{context:R,zip215:k}=F,I=b.signature;v=Me(v,I,"signature"),C=Me(C,void 0,"message"),P=Me(P,b.publicKey,"publicKey"),k!==void 0&&wl(k,"zip215"),n&&(C=n(C));let E=I/2,D=v.subarray(0,E),M=qa(v.subarray(E,I)),B,L,O;try{B=r.fromBytes(P,k),L=r.fromBytes(D,k),O=o.multiplyUnsafe(M)}catch{return!1}if(!k&&B.isSmallOrder())return!1;let U=f(R,L.toBytes(),B.toBytes(),C);return L.add(B.multiplyUnsafe(U)).subtract(O).clearCofactor().is0()}let w=s.BYTES,b={secretKey:w,publicKey:w,signature:2*w,seed:w};function x(v=a(b.seed)){return Me(v,b.seed,"seed")}function S(v){return zh(v)&&v.length===i.BYTES}function T(v,C){try{return!!r.fromBytes(v,C)}catch{return!1}}let A={getExtendedPublicKey:h,randomSecretKey:x,isValidSecretKey:S,isValidPublicKey:T,toMontgomery(v){let{y:C}=r.fromBytes(v),P=b.publicKey,F=P===32;if(!F&&P!==57)throw new Error("only defined for 25519 and 448");let R=F?s.div(Xr+C,Xr-C):s.div(C-Xr,C+Xr);return s.toBytes(R)},toMontgomerySecret(v){let C=b.secretKey;Me(v,C);let P=e(v.subarray(0,C));return c(P).subarray(0,C)}};return Object.freeze({keygen:py(x,p),getPublicKey:p,sign:g,verify:m,utils:A,Point:r,lengths:b})}var Kd,Xr,EN,lBe,Eie=_(()=>{ly();jT();Kd=BigInt(0),Xr=BigInt(1),EN=BigInt(2),lBe=BigInt(8)});function dBe(r){return ja(r,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...r})}function Sie(r){let e=dBe(r),{P:t,type:n,adjustScalarBytes:o,powPminus2:s,randomBytes:i}=e,a=n==="x25519";if(!a&&n!=="x448")throw new Error("invalid type");let c=i||ts,l=a?255:448,u=a?32:56,d=BigInt(a?9:5),h=BigInt(a?121665:39081),p=a?GT**BigInt(254):GT**BigInt(447),f=a?BigInt(8)*GT**BigInt(251)-my:BigInt(4)*GT**BigInt(445)-my,g=p+f+my,y=I=>$t(I,t),m=w(d);function w(I){return mE(y(I),u)}function b(I){let E=qh(Me(I,u,"uCoordinate"));return a&&(E[31]&=127),y(qa(E))}function x(I){return qa(o(qh(Me(I,u,"scalar"))))}function S(I,E){let D=P(b(E),x(I));if(D===wE)throw new Error("invalid private or public key received");return w(D)}function T(I){return S(I,m)}let A=T,v=S;function C(I,E,D){let M=y(I*(E-D));return E=y(E-M),D=y(D+M),{x_2:E,x_3:D}}function P(I,E){Fd("u",I,wE,t),Fd("scalar",E,p,g);let D=E,M=I,B=my,L=wE,O=I,U=my,$=wE;for(let X=BigInt(l-1);X>=wE;X--){let N=D>>X&my;$^=N,{x_2:B,x_3:O}=C($,B,O),{x_2:L,x_3:U}=C($,L,U),$=N;let H=B+L,Z=y(H*H),ae=B-L,Q=y(ae*ae),oe=Z-Q,Fe=O+U,nr=O-U,fe=y(nr*H),Ce=y(Fe*ae),Ve=fe+Ce,Er=fe-Ce;O=y(Ve*Ve),U=y(M*y(Er*Er)),B=y(Z*Q),L=y(oe*(Z+y(h*oe)))}({x_2:B,x_3:O}=C($,B,O)),{x_2:L,x_3:U}=C($,L,U);let J=s(L);return y(B*J)}let F={secretKey:u,publicKey:u,seed:u},R=(I=c(u))=>(Me(I,F.seed,"seed"),I),k={randomSecretKey:R};return Object.freeze({keygen:py(R,A),getSharedSecret:v,getPublicKey:A,scalarMult:S,scalarMultBase:T,utils:k,GuBytes:m.slice(),lengths:F})}var wE,my,GT,Cie=_(()=>{ly();jT();dy();wE=BigInt(0),my=BigInt(1),GT=BigInt(2)});function Tie(r){let e=BigInt(10),t=BigInt(20),n=BigInt(40),o=BigInt(80),s=WT,a=r*r%s*r%s,c=Mt(a,Aie,s)*a%s,l=Mt(c,fBe,s)*r%s,u=Mt(l,pBe,s)*l%s,d=Mt(u,e,s)*u%s,h=Mt(d,t,s)*d%s,p=Mt(h,n,s)*h%s,f=Mt(p,o,s)*p%s,g=Mt(f,o,s)*p%s,y=Mt(g,e,s)*u%s;return{pow_p_5_8:Mt(y,Aie,s)*r%s,b2:a}}function kie(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function yBe(r,e){let t=WT,n=$t(e*e*e,t),o=$t(n*n*e,t),s=Tie(r*o).pow_p_5_8,i=$t(r*n*s,t),a=$t(e*i*i,t),c=i,l=$t(i*Iie,t),u=a===r,d=a===$t(-r,t),h=a===$t(-r*Iie,t);return u&&(i=c),(d||h)&&(i=l),fie(i,t)&&(i=$t(-i,t)),{isValid:u||d,value:i}}function wBe(r){return vie(bBe,Qse,Object.assign({adjustScalarBytes:kie},r))}var fBe,Aie,hBe,pBe,mBe,WT,gBe,Iie,bBe,Ht,xE,Ga=_(()=>{Va();Eie();dy();Cie();fBe=BigInt(1),Aie=BigInt(2),hBe=BigInt(3),pBe=BigInt(5),mBe=BigInt(8),WT=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),gBe={p:WT,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:mBe,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};Iie=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");bBe=xie(gBe,{uvRatio:yBe});Ht=wBe({}),xE=(()=>{let r=WT;return Sie({P:r,type:"x25519",powPminus2:e=>{let{pow_p_5_8:t,b2:n}=Tie(e);return $t(Mt(t,hBe,r)*n,r)},adjustScalarBytes:kie})})()});var vE,YT,SN=_(()=>{vE=class extends Error{constructor(e="An error occurred while verifying a message"){super(e),this.name="VerificationError"}},YT=class extends Error{constructor(e="Missing Web Crypto API"){super(e),this.name="WebCryptoMissingError"}}});var Die,_ie=_(()=>{SN();Die={get(r=globalThis){let e=r.crypto;if(e?.subtle==null)throw new YT("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api");return e}}});var XT,Pie=_(()=>{_ie();XT=Die});async function vBe(r,e,t){if(r.buffer instanceof ArrayBuffer){let n=await XT.get().subtle.importKey("raw",r.buffer,{name:"Ed25519"},!1,["verify"]);return await XT.get().subtle.verify({name:"Ed25519"},n,e,t instanceof Uint8Array?t:t.subarray())}throw new TypeError("WebCrypto does not support SharedArrayBuffer for Ed25519 keys")}function EBe(r,e,t){return Ht.verify(e,t instanceof Uint8Array?t:t.subarray(),r)}async function Rie(r,e,t){return CN==null&&(CN=await xBe),CN?vBe(r,e,t):EBe(r,e,t)}var ZT,CN,xBe,AN=_(()=>{Ga();Le();Pie();ZT=32,xBe=(async()=>{try{return await XT.get().subtle.generateKey({name:"Ed25519"},!0,["sign","verify"]),!0}catch{return!1}})()});function JT(r){return r==null?!1:typeof r.then=="function"&&typeof r.catch=="function"&&typeof r.finally=="function"}var IN=_(()=>{Mr();me()});var QT,Mie=_(()=>{Fh();Xg();Zg();Ne();IN();uE();kN();AN();QT=class{type="Ed25519";raw;constructor(e){this.raw=TN(e,ZT)}toMultihash(){return za.digest(sy(this))}toCID(){return Ps.createV1(114,this.toMultihash())}toString(){return Ur.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:ee(this.raw,e.raw)}verify(e,t,n){n?.signal?.throwIfAborted();let o=Rie(this.raw,t,e);return JT(o)?o.then(s=>(n?.signal?.throwIfAborted(),s)):o}}});function Bie(r){return r=TN(r,ZT),new QT(r)}function TN(r,e){if(r=Uint8Array.from(r??[]),r.length!==e)throw new q(`Key must be a Uint8Array of length ${e}, got ${r.length}`);return r}var kN=_(()=>{se();Mie();AN()});function Oie(r,e,t){DN[0]=r,e[t]=zd[0],e[t+1]=zd[1],e[t+2]=zd[2],e[t+3]=zd[3]}function Nie(r,e){return zd[0]=r[e],zd[1]=r[e+1],zd[2]=r[e+2],zd[3]=r[e+3],DN[0]}function Uie(r,e,t){_N[0]=r,e[t]=io[0],e[t+1]=io[1],e[t+2]=io[2],e[t+3]=io[3],e[t+4]=io[4],e[t+5]=io[5],e[t+6]=io[6],e[t+7]=io[7]}function Fie(r,e){return io[0]=r[e],io[1]=r[e+1],io[2]=r[e+2],io[3]=r[e+3],io[4]=r[e+4],io[5]=r[e+5],io[6]=r[e+6],io[7]=r[e+7],_N[0]}var DN,zd,_N,io,PN=_(()=>{DN=new Float32Array([-0]),zd=new Uint8Array(DN.buffer);_N=new Float64Array([-0]),io=new Uint8Array(_N.buffer)});var CBe,ABe,Rs,Yh,Kie,RN=_(()=>{CBe=BigInt(Number.MAX_SAFE_INTEGER),ABe=BigInt(Number.MIN_SAFE_INTEGER),Rs=class r{lo;hi;constructor(e,t){this.lo=e|0,this.hi=t|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(BigInt(t)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return Yh;if(e<CBe&&e>ABe)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let n=e>>32n,o=e-(n<<32n);return t&&(n=~n|0n,o=~o|0n,++o>Kie&&(o=0n,++n>Kie&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(e){if(e===0)return Yh;let t=e<0;t&&(e=-e);let n=e>>>0,o=(e-n)/4294967296>>>0;return t&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(e){return typeof e=="number"?r.fromNumber(e):typeof e=="bigint"?r.fromBigInt(e):typeof e=="string"?r.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new r(e.low>>>0,e.high>>>0):Yh}},Yh=new Rs(0,0);Yh.toBigInt=function(){return 0n};Yh.zzEncode=Yh.zzDecode=function(){return this};Yh.length=function(){return 1};Kie=4294967296n});function zie(r){let e=0,t=0;for(let n=0;n<r.length;++n)t=r.charCodeAt(n),t<128?e+=1:t<2048?e+=2:(t&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function $ie(r,e,t){if(t-e<1)return"";let o,s=[],i=0,a;for(;e<t;)a=r[e++],a<128?s[i++]=a:a>191&&a<224?s[i++]=(a&31)<<6|r[e++]&63:a>239&&a<365?(a=((a&7)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,s[i++]=55296+(a>>10),s[i++]=56320+(a&1023)):s[i++]=(a&15)<<12|(r[e++]&63)<<6|r[e++]&63,i>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o!=null?(i>0&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))}function LN(r,e,t){let n=t,o,s;for(let i=0;i<r.length;++i)o=r.charCodeAt(i),o<128?e[t++]=o:o<2048?(e[t++]=o>>6|192,e[t++]=o&63|128):(o&64512)===55296&&((s=r.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,e[t++]=o>>18|240,e[t++]=o>>12&63|128,e[t++]=o>>6&63|128,e[t++]=o&63|128):(e[t++]=o>>12|224,e[t++]=o>>6&63|128,e[t++]=o&63|128);return t-n}var MN=_(()=>{});function Zi(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function e6(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}function EE(r){return new BN(r instanceof Uint8Array?r:r.subarray())}var BN,t6=_(()=>{si();PN();RN();MN();BN=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Zi(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw Zi(this,4);return e6(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Zi(this,4);return e6(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Zi(this,4);let e=Nie(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw Zi(this,4);let e=Fie(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw Zi(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return $ie(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Zi(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Zi(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new Rs(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Zi(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Zi(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Zi(this,8);let e=e6(this.buf,this.pos+=4),t=e6(this.buf,this.pos+=4);return new Rs(e,t)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=eO(this.buf,this.pos);return this.pos+=mt(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}}});function ye(r,e,t){let n=EE(r);return e.decode(n,void 0,t)}var Vie=_(()=>{t6()});function ON(r){let e=r??8192,t=e>>>1,n,o=e;return function(i){if(i<1||i>t)return ar(i);o+i>e&&(n=ar(e),o=0);let a=n.subarray(o,o+=i);return(o&7)!==0&&(o=(o|7)+1),a}}var qie=_(()=>{Xt()});function NN(){}function TBe(r){return globalThis.Buffer!=null?ar(r):IBe(r)}function UN(r,e,t){e[t]=r&255}function kBe(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function r6(r,e,t){for(;r.hi!==0;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}function SE(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function DBe(r,e,t){e.set(r,t)}function _Be(r,e,t){e.set(r,t)}function PBe(r,e,t){r.length<40?LN(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(K(r),t)}function zN(){return new CE}var Xh,FN,IBe,CE,KN,$N=_(()=>{si();Xt();me();PN();RN();qie();MN();Xh=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};FN=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},IBe=ON();CE=class{len;head;tail;states;constructor(){this.len=0,this.head=new Xh(NN,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new Xh(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new KN((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(r6,10,Rs.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=Rs.fromBigInt(e);return this._push(r6,t.length(),t)}uint64Number(e){return this._push(ul,mt(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let t=Rs.fromBigInt(e).zzEncode();return this._push(r6,t.length(),t)}sint64Number(e){let t=Rs.fromNumber(e).zzEncode();return this._push(r6,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(UN,1,e?1:0)}fixed32(e){return this._push(SE,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=Rs.fromBigInt(e);return this._push(SE,4,t.lo)._push(SE,4,t.hi)}fixed64Number(e){let t=Rs.fromNumber(e);return this._push(SE,4,t.lo)._push(SE,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(Oie,4,e)}double(e){return this._push(Uie,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(UN,1,0):this.uint32(t)._push(DBe,t,e)}string(e){let t=zie(e);return t!==0?this.uint32(t)._push(LN,t,e):this._push(UN,1,0)}fork(){return this.states=new FN(this),this.head=this.tail=new Xh(NN,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Xh(NN,0,0),this.len=0),this}ldelim(){let e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=t,this.len+=n),this}finish(){let e=this.head.next,t=TBe(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};KN=class extends Xh{next;constructor(e,t){super(kBe,e,t),this.next=void 0}};globalThis.Buffer!=null&&(CE.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(_Be,e,r),this},CE.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(PBe,e,r),this})});function be(r,e){let t=zN();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var jie=_(()=>{$N()});function*Ji(r,e,t){let n=EE(r);yield*e.stream(n,void 0,"$",t)}var Gie=_(()=>{t6()});function o6(r,e,t,n,o){return{name:r,type:e,encode:t,decode:n,stream:o}}var n6,HN=_(()=>{n6={VARINT:0,BIT64:1,LENGTH_DELIMITED:2,START_GROUP:3,END_GROUP:4,BIT32:5}});function Pt(r){function e(s){if(r[s.toString()]==null)throw new Error("Invalid enum value");return r[s]}let t=function(i,a){let c=e(i);a.int32(c)},n=function(i){let a=i.int32();return e(a)},o=function*(i){let a=i.int32();yield e(a)};return o6("enum",n6.VARINT,t,n,o)}var Wie=_(()=>{HN()});function we(r,e,t){return o6("message",n6.LENGTH_DELIMITED,r,e,t)}var Yie=_(()=>{HN()});var lr,AE,kn=_(()=>{Vie();jie();Gie();Wie();Yie();t6();$N();lr=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"},AE=class extends Error{code="ERR_MAX_SIZE";name="MaxSizeError"}});var Ls,VN,IE,qN,Xie=_(()=>{kn();(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1",r.ECDSA="ECDSA"})(Ls||(Ls={}));(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1",r[r.ECDSA=3]="ECDSA"})(VN||(VN={}));(function(r){r.codec=()=>Pt(VN)})(Ls||(Ls={}));(function(r){let e;r.codec=()=>(e==null&&(e=we((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),Ls.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let s={},i=n==null?t.len:t.pos+n;for(;t.pos<i;){let a=t.uint32();switch(a>>>3){case 1:{s.Type=Ls.codec().decode(t);break}case 2:{s.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>be(t,r.codec()),r.decode=(t,n)=>ye(t,r.codec(),n)})(IE||(IE={}));(function(r){let e;r.codec=()=>(e==null&&(e=we((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),Ls.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let s={},i=n==null?t.len:t.pos+n;for(;t.pos<i;){let a=t.uint32();switch(a>>>3){case 1:{s.Type=Ls.codec().decode(t);break}case 2:{s.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>be(t,r.codec()),r.decode=(t,n)=>ye(t,r.codec(),n)})(qN||(qN={}))});var s6,gy,jN=_(()=>{Xi();s6=class{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){if($h(e),Me(t,void 0,"key"),this.iHash=e.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;let n=this.blockLen,o=new Uint8Array(n);o.set(t.length>n?e.create().update(t).digest():t);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),Wi(o)}update(e){return iy(this),this.iHash.update(e),this}digestInto(e){iy(this),Me(e,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:a}=this;return e=e,e.finished=o,e.destroyed=s,e.blockLen=i,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},gy=(r,e,t)=>new s6(r,e).update(t).digest();gy.create=(r,e)=>new s6(r,e)});function LBe(r,e,t){let[[n,o],[s,i]]=e,a=Zie(i*r,t),c=Zie(-o*r,t),l=r-a*n-c*s,u=-a*o-c*i,d=l<xl,h=u<xl;d&&(l=-l),h&&(u=-u);let p=gE(Math.ceil(hN(t)/2))+yy;if(l<xl||l>=p||u<xl||u>=p)throw new Error("splitScalar (endomorphism): failed, k="+r);return{k1neg:d,k1:l,k2neg:h,k2:u}}function WN(r){if(!["compact","recovered","der"].includes(r))throw new Error('Signature format must be "compact", "recovered", or "der"');return r}function GN(r,e){let t={};for(let n of Object.keys(e))t[n]=r[n]===void 0?e[n]:r[n];return wl(t.lowS,"lowS"),wl(t.prehash,"prehash"),t.format!==void 0&&WN(t.format),t}function Qie(r,e={}){let t=qT("weierstrass",r,e),{Fp:n,Fn:o}=t,s=t.CURVE,{h:i,n:a}=s;ja(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:c}=e;if(c&&(!n.is0(s.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let l=tae(n,o);function u(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function d(R,k,I){let{x:E,y:D}=k.toAffine(),M=n.toBytes(E);if(wl(I,"isCompressed"),I){u();let B=!n.isOdd(D);return es(eae(B),M)}else return es(Uint8Array.of(4),M,n.toBytes(D))}function h(R){Me(R,void 0,"Point");let{publicKey:k,publicKeyUncompressed:I}=l,E=R.length,D=R[0],M=R.subarray(1);if(E===k&&(D===2||D===3)){let B=n.fromBytes(M);if(!n.isValid(B))throw new Error("bad point: is not on curve, wrong x");let L=g(B),O;try{O=n.sqrt(L)}catch(J){let X=J instanceof Error?": "+J.message:"";throw new Error("bad point: is not on curve, sqrt error"+X)}u();let U=n.isOdd(O);return(D&1)===1!==U&&(O=n.neg(O)),{x:B,y:O}}else if(E===I&&D===4){let B=n.BYTES,L=n.fromBytes(M.subarray(0,B)),O=n.fromBytes(M.subarray(B,B*2));if(!y(L,O))throw new Error("bad point: is not on curve");return{x:L,y:O}}else throw new Error(`bad point: got length ${E}, expected compressed=${k} or uncompressed=${I}`)}let p=e.toBytes||d,f=e.fromBytes||h;function g(R){let k=n.sqr(R),I=n.mul(k,R);return n.add(n.add(I,n.mul(R,s.a)),s.b)}function y(R,k){let I=n.sqr(k),E=g(R);return n.eql(I,E)}if(!y(s.Gx,s.Gy))throw new Error("bad curve params: generator point");let m=n.mul(n.pow(s.a,i6),MBe),w=n.mul(n.sqr(s.b),BigInt(27));if(n.is0(n.add(m,w)))throw new Error("bad curve params: a or b");function b(R,k,I=!1){if(!n.isValid(k)||I&&n.is0(k))throw new Error(`bad point coordinate ${R}`);return k}function x(R){if(!(R instanceof C))throw new Error("Weierstrass Point expected")}function S(R){if(!c||!c.basises)throw new Error("no endo");return LBe(R,c.basises,o.ORDER)}let T=cy((R,k)=>{let{X:I,Y:E,Z:D}=R;if(n.eql(D,n.ONE))return{x:I,y:E};let M=R.is0();k==null&&(k=M?n.ONE:n.inv(D));let B=n.mul(I,k),L=n.mul(E,k),O=n.mul(D,k);if(M)return{x:n.ZERO,y:n.ZERO};if(!n.eql(O,n.ONE))throw new Error("invZ was invalid");return{x:B,y:L}}),A=cy(R=>{if(R.is0()){if(e.allowInfinityPoint&&!n.is0(R.Y))return;throw new Error("bad point: ZERO")}let{x:k,y:I}=R.toAffine();if(!n.isValid(k)||!n.isValid(I))throw new Error("bad point: x or y not field elements");if(!y(k,I))throw new Error("bad point: equation left != right");if(!R.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function v(R,k,I,E,D){return I=new C(n.mul(I.X,R),I.Y,I.Z),k=bE(E,k),I=bE(D,I),k.add(I)}class C{static BASE=new C(s.Gx,s.Gy,n.ONE);static ZERO=new C(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=o;X;Y;Z;constructor(k,I,E){this.X=b("x",k),this.Y=b("y",I,!0),this.Z=b("z",E),Object.freeze(this)}static CURVE(){return s}static fromAffine(k){let{x:I,y:E}=k||{};if(!k||!n.isValid(I)||!n.isValid(E))throw new Error("invalid affine point");if(k instanceof C)throw new Error("projective point not allowed");return n.is0(I)&&n.is0(E)?C.ZERO:new C(I,E,n.ONE)}static fromBytes(k){let I=C.fromAffine(f(Me(k,void 0,"point")));return I.assertValidity(),I}static fromHex(k){return C.fromBytes(yl(k))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(k=8,I=!0){return F.createCache(this,k),I||this.multiply(i6),this}assertValidity(){A(this)}hasEvenY(){let{y:k}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(k)}equals(k){x(k);let{X:I,Y:E,Z:D}=this,{X:M,Y:B,Z:L}=k,O=n.eql(n.mul(I,L),n.mul(M,D)),U=n.eql(n.mul(E,L),n.mul(B,D));return O&&U}negate(){return new C(this.X,n.neg(this.Y),this.Z)}double(){let{a:k,b:I}=s,E=n.mul(I,i6),{X:D,Y:M,Z:B}=this,L=n.ZERO,O=n.ZERO,U=n.ZERO,$=n.mul(D,D),J=n.mul(M,M),X=n.mul(B,B),N=n.mul(D,M);return N=n.add(N,N),U=n.mul(D,B),U=n.add(U,U),L=n.mul(k,U),O=n.mul(E,X),O=n.add(L,O),L=n.sub(J,O),O=n.add(J,O),O=n.mul(L,O),L=n.mul(N,L),U=n.mul(E,U),X=n.mul(k,X),N=n.sub($,X),N=n.mul(k,N),N=n.add(N,U),U=n.add($,$),$=n.add(U,$),$=n.add($,X),$=n.mul($,N),O=n.add(O,$),X=n.mul(M,B),X=n.add(X,X),$=n.mul(X,N),L=n.sub(L,$),U=n.mul(X,J),U=n.add(U,U),U=n.add(U,U),new C(L,O,U)}add(k){x(k);let{X:I,Y:E,Z:D}=this,{X:M,Y:B,Z:L}=k,O=n.ZERO,U=n.ZERO,$=n.ZERO,J=s.a,X=n.mul(s.b,i6),N=n.mul(I,M),H=n.mul(E,B),Z=n.mul(D,L),ae=n.add(I,E),Q=n.add(M,B);ae=n.mul(ae,Q),Q=n.add(N,H),ae=n.sub(ae,Q),Q=n.add(I,D);let oe=n.add(M,L);return Q=n.mul(Q,oe),oe=n.add(N,Z),Q=n.sub(Q,oe),oe=n.add(E,D),O=n.add(B,L),oe=n.mul(oe,O),O=n.add(H,Z),oe=n.sub(oe,O),$=n.mul(J,Q),O=n.mul(X,Z),$=n.add(O,$),O=n.sub(H,$),$=n.add(H,$),U=n.mul(O,$),H=n.add(N,N),H=n.add(H,N),Z=n.mul(J,Z),Q=n.mul(X,Q),H=n.add(H,Z),Z=n.sub(N,Z),Z=n.mul(J,Z),Q=n.add(Q,Z),N=n.mul(H,Q),U=n.add(U,N),N=n.mul(oe,Q),O=n.mul(ae,O),O=n.sub(O,N),N=n.mul(ae,H),$=n.mul(oe,$),$=n.add($,N),new C(O,U,$)}subtract(k){return this.add(k.negate())}is0(){return this.equals(C.ZERO)}multiply(k){let{endo:I}=e;if(!o.isValidNot0(k))throw new Error("invalid scalar: out of range");let E,D,M=B=>F.cached(this,B,L=>Wh(C,L));if(I){let{k1neg:B,k1:L,k2neg:O,k2:U}=S(k),{p:$,f:J}=M(L),{p:X,f:N}=M(U);D=J.add(N),E=v(I.beta,$,X,B,O)}else{let{p:B,f:L}=M(k);E=B,D=L}return Wh(C,[E,D])[0]}multiplyUnsafe(k){let{endo:I}=e,E=this;if(!o.isValid(k))throw new Error("invalid scalar: out of range");if(k===xl||E.is0())return C.ZERO;if(k===yy)return E;if(F.hasCache(this))return this.multiply(k);if(I){let{k1neg:D,k1:M,k2neg:B,k2:L}=S(k),{p1:O,p2:U}=wie(C,E,M,L);return v(I.beta,O,U,D,B)}else return F.unsafe(E,k)}toAffine(k){return T(this,k)}isTorsionFree(){let{isTorsionFree:k}=e;return i===yy?!0:k?k(C,this):F.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:k}=e;return i===yy?this:k?k(C,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(k=!0){return wl(k,"isCompressed"),this.assertValidity(),p(C,this,k)}toHex(k=!0){return gl(this.toBytes(k))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let P=o.BITS,F=new hy(C,e.endo?Math.ceil(P/2):P);return C.BASE.precompute(8),C}function eae(r){return Uint8Array.of(r?2:3)}function tae(r,e){return{secretKey:e.BYTES,publicKey:1+r.BYTES,publicKeyUncompressed:1+2*r.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function BBe(r,e={}){let{Fn:t}=r,n=e.randomBytes||ts,o=Object.assign(tae(r.Fp,t),{seed:yN(t.ORDER)});function s(p){try{let f=t.fromBytes(p);return t.isValidNot0(f)}catch{return!1}}function i(p,f){let{publicKey:g,publicKeyUncompressed:y}=o;try{let m=p.length;return f===!0&&m!==g||f===!1&&m!==y?!1:!!r.fromBytes(p)}catch{return!1}}function a(p=n(o.seed)){return bN(Me(p,o.seed,"seed"),t.ORDER)}function c(p,f=!0){return r.BASE.multiply(t.fromBytes(p)).toBytes(f)}function l(p){let{secretKey:f,publicKey:g,publicKeyUncompressed:y}=o;if(!zh(p)||"_lengths"in t&&t._lengths||f===g)return;let m=Me(p,void 0,"key").length;return m===g||m===y}function u(p,f,g=!0){if(l(p)===!0)throw new Error("first arg must be private key");if(l(f)===!1)throw new Error("second arg must be public key");let y=t.fromBytes(p);return r.fromBytes(f).multiply(y).toBytes(g)}let d={isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:a},h=py(a,c);return Object.freeze({getPublicKey:c,getSharedSecret:u,keygen:h,Point:r,utils:d,lengths:o})}function rae(r,e,t={}){$h(e),ja(t,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),t=Object.assign({},t);let n=t.randomBytes||ts,o=t.hmac||((I,E)=>gy(e,I,E)),{Fp:s,Fn:i}=r,{ORDER:a,BITS:c}=i,{keygen:l,getPublicKey:u,getSharedSecret:d,utils:h,lengths:p}=BBe(r,t),f={prehash:!0,lowS:typeof t.lowS=="boolean"?t.lowS:!0,format:"compact",extraEntropy:!1},g=a*Jie<s.ORDER;function y(I){let E=a>>yy;return I>E}function m(I,E){if(!i.isValidNot0(E))throw new Error(`invalid signature ${I}: out of range 1..Point.Fn.ORDER`);return E}function w(){if(g)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function b(I,E){WN(E);let D=p.signature,M=E==="compact"?D:E==="recovered"?D+1:void 0;return Me(I,M)}class x{r;s;recovery;constructor(E,D,M){if(this.r=m("r",E),this.s=m("s",D),M!=null){if(w(),![0,1,2,3].includes(M))throw new Error("invalid recovery id");this.recovery=M}Object.freeze(this)}static fromBytes(E,D=f.format){b(E,D);let M;if(D==="der"){let{r:U,s:$}=$d.toSig(Me(E));return new x(U,$)}D==="recovered"&&(M=E[0],D="compact",E=E.subarray(1));let B=p.signature/2,L=E.subarray(0,B),O=E.subarray(B,B*2);return new x(i.fromBytes(L),i.fromBytes(O),M)}static fromHex(E,D){return this.fromBytes(yl(E),D)}assertRecovery(){let{recovery:E}=this;if(E==null)throw new Error("invalid recovery id: must be present");return E}addRecoveryBit(E){return new x(this.r,this.s,E)}recoverPublicKey(E){let{r:D,s:M}=this,B=this.assertRecovery(),L=B===2||B===3?D+a:D;if(!s.isValid(L))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let O=s.toBytes(L),U=r.fromBytes(es(eae((B&1)===0),O)),$=i.inv(L),J=T(Me(E,void 0,"msgHash")),X=i.create(-J*$),N=i.create(M*$),H=r.BASE.multiplyUnsafe(X).add(U.multiplyUnsafe(N));if(H.is0())throw new Error("invalid recovery: point at infinify");return H.assertValidity(),H}hasHighS(){return y(this.s)}toBytes(E=f.format){if(WN(E),E==="der")return yl($d.hexFromSig(this));let{r:D,s:M}=this,B=i.toBytes(D),L=i.toBytes(M);return E==="recovered"?(w(),es(Uint8Array.of(this.assertRecovery()),B,L)):es(B,L)}toHex(E){return gl(this.toBytes(E))}}let S=t.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");let D=ay(E),M=E.length*8-c;return M>0?D>>BigInt(M):D},T=t.bits2int_modN||function(E){return i.create(S(E))},A=gE(c);function v(I){return Fd("num < 2^"+c,I,xl,A),i.toBytes(I)}function C(I,E){return Me(I,void 0,"message"),E?Me(e(I),void 0,"prehashed message"):I}function P(I,E,D){let{lowS:M,prehash:B,extraEntropy:L}=GN(D,f);I=C(I,B);let O=T(I),U=i.fromBytes(E);if(!i.isValidNot0(U))throw new Error("invalid private key");let $=[v(U),v(O)];if(L!=null&&L!==!1){let H=L===!0?n(p.secretKey):L;$.push(Me(H,void 0,"extraEntropy"))}let J=es(...$),X=O;function N(H){let Z=S(H);if(!i.isValidNot0(Z))return;let ae=i.inv(Z),Q=r.BASE.multiply(Z).toAffine(),oe=i.create(Q.x);if(oe===xl)return;let Fe=i.create(ae*i.create(X+oe*U));if(Fe===xl)return;let nr=(Q.x===oe?0:2)|Number(Q.y&yy),fe=Fe;return M&&y(Fe)&&(fe=i.neg(Fe),nr^=1),new x(oe,fe,g?void 0:nr)}return{seed:J,k2sig:N}}function F(I,E,D={}){let{seed:M,k2sig:B}=P(I,E,D);return rie(e.outputLen,i.BYTES,o)(M,B).toBytes(D.format)}function R(I,E,D,M={}){let{lowS:B,prehash:L,format:O}=GN(M,f);if(D=Me(D,void 0,"publicKey"),E=C(E,L),!zh(I)){let U=I instanceof x?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+U)}b(I,O);try{let U=x.fromBytes(I,O),$=r.fromBytes(D);if(B&&U.hasHighS())return!1;let{r:J,s:X}=U,N=T(E),H=i.inv(X),Z=i.create(N*H),ae=i.create(J*H),Q=r.BASE.multiplyUnsafe(Z).add($.multiplyUnsafe(ae));return Q.is0()?!1:i.create(Q.x)===J}catch{return!1}}function k(I,E,D={}){let{prehash:M}=GN(D,f);return E=C(E,M),x.fromBytes(I,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:l,getPublicKey:u,getSharedSecret:d,utils:h,lengths:p,Point:r,sign:F,verify:R,recoverPublicKey:k,Signature:x,hash:e})}var Zie,YN,$d,xl,yy,Jie,i6,MBe,nae=_(()=>{jN();Xi();ly();jT();dy();Zie=(r,e)=>(r+(r>=0?e:-e)/Jie)/e;YN=class extends Error{constructor(e=""){super(e)}},$d={Err:YN,_tlv:{encode:(r,e)=>{let{Err:t}=$d;if(r<0||r>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");let n=e.length/2,o=pE(n);if(o.length/2&128)throw new t("tlv.encode: long form length too big");let s=n>127?pE(o.length/2|128):"";return pE(r)+s+o+e},decode(r,e){let{Err:t}=$d,n=0;if(r<0||r>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[n++]!==r)throw new t("tlv.decode: wrong tlv");let o=e[n++],s=!!(o&128),i=0;if(!s)i=o;else{let c=o&127;if(!c)throw new t("tlv.decode(long): indefinite length not supported");if(c>4)throw new t("tlv.decode(long): byte length is too big");let l=e.subarray(n,n+c);if(l.length!==c)throw new t("tlv.decode: length bytes not complete");if(l[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(let u of l)i=i<<8|u;if(n+=c,i<128)throw new t("tlv.decode(long): not minimal encoding")}let a=e.subarray(n,n+i);if(a.length!==i)throw new t("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+i)}}},_int:{encode(r){let{Err:e}=$d;if(r<xl)throw new e("integer: negative integers are not allowed");let t=pE(r);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(r){let{Err:e}=$d;if(r[0]&128)throw new e("invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return ay(r)}},toSig(r){let{Err:e,_int:t,_tlv:n}=$d,o=Me(r,void 0,"signature"),{v:s,l:i}=n.decode(48,o);if(i.length)throw new e("invalid signature: left bytes after parsing");let{v:a,l:c}=n.decode(2,s),{v:l,l:u}=n.decode(2,c);if(u.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(a),s:t.decode(l)}},hexFromSig(r){let{_tlv:e,_int:t}=$d,n=e.encode(2,t.encode(r.r)),o=e.encode(2,t.encode(r.s)),s=n+o;return e.encode(48,s)}},xl=BigInt(0),yy=BigInt(1),Jie=BigInt(2),i6=BigInt(3),MBe=BigInt(4)});function NBe(r){let e=ZN.p,t=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),a=BigInt(44),c=BigInt(88),l=r*r*r%e,u=l*l*r%e,d=Mt(u,t,e)*u%e,h=Mt(d,t,e)*u%e,p=Mt(h,oae,e)*l%e,f=Mt(p,o,e)*p%e,g=Mt(f,s,e)*f%e,y=Mt(g,a,e)*g%e,m=Mt(y,c,e)*y%e,w=Mt(m,a,e)*g%e,b=Mt(w,t,e)*u%e,x=Mt(b,i,e)*f%e,S=Mt(x,n,e)*l%e,T=Mt(S,oae,e);if(!XN.eql(XN.sqr(T),r))throw new Error("Cannot find square root");return T}var ZN,OBe,oae,XN,UBe,Ie,Mo=_(()=>{Va();dy();nae();ZN={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},OBe={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},oae=BigInt(2);XN=uy(ZN.p,{sqrt:NBe}),UBe=Qie(ZN,{Fp:XN,endo:OBe}),Ie=rae(UBe,lt)});function QN({name:r,code:e,encode:t,minDigestLength:n,maxDigestLength:o}){return new JN(r,e,t,n,o)}function sae(r,e,t){if(t!=null&&t!==r.byteLength){if(t>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t)}return Yg(e,r)}var FBe,JN,iae=_(()=>{eE();FBe=20;JN=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,o,s){this.name=e,this.code=t,this.encode=n,this.minDigestLength=o??FBe,this.maxDigestLength=s}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?sae(n,this.code,t?.truncate):n.then(o=>sae(o,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}}});function aae(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var a6,z5t,eU=_(()=>{iae();a6=QN({name:"sha2-256",code:18,encode:aae("SHA-256")}),z5t=QN({name:"sha2-512",code:19,encode:aae("SHA-512")})});function cae(r,e,t,n){let o=a6.digest(t instanceof Uint8Array?t:t.subarray());if(JT(o))return o.then(({digest:s})=>(n?.signal?.throwIfAborted(),Ie.verify(e,s,r,{prehash:!1,format:"der"}))).catch(s=>{throw s.name==="AbortError"?s:new vE(String(s))});try{return n?.signal?.throwIfAborted(),Ie.verify(e,o.digest,r,{prehash:!1,format:"der"})}catch(s){throw new vE(String(s))}}var lae=_(()=>{Mo();eU();SN();IN()});var c6,uae=_(()=>{Fh();Xg();Zg();Ne();uE();tU();lae();c6=class{type="secp256k1";raw;_key;constructor(e){this._key=fae(e),this.raw=dae(this._key)}toMultihash(){return za.digest(sy(this))}toCID(){return Ps.createV1(114,this.toMultihash())}toString(){return Ur.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:ee(this.raw,e.raw)}verify(e,t,n){return cae(this._key,t,e,n)}}});function hae(r){return new c6(r)}function dae(r){return Ie.Point.fromBytes(r).toBytes()}function fae(r){try{return Ie.Point.fromBytes(r),r}catch(e){throw new zt(String(e))}}var tU=_(()=>{se();Mo();uae()});function pae(r){let{Type:e,Data:t}=IE.decode(r.digest),n=t??new Uint8Array;switch(e){case Ls.Ed25519:return Bie(n);case Ls.secp256k1:return hae(n);case Ls.ECDSA:return Lse(n);default:throw new An}}function sy(r){return IE.encode({Type:Ls[r.type],Data:r.raw})}var uE=_(()=>{se();rN();kN();Xie();tU()});var mae,KBe,TE,kE,DE,_E,zBe,PE,gae=_(()=>{se();Fh();Xg();Zg();Ne();me();Le();mae=Symbol.for("nodejs.util.inspect.custom"),KBe=114,TE=class{type;multihash;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[PT]=!0;toString(){return this.string==null&&(this.string=Ur.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return Ps.createV1(KBe,this.multihash)}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return ee(this.multihash.bytes,e);if(typeof e=="string")return this.toString()===e;if(e?.toMultihash()?.bytes!=null)return ee(this.multihash.bytes,e.toMultihash().bytes);throw new Error("not valid Id")}[mae](){return`PeerId(${this.toString()})`}},kE=class extends TE{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},DE=class extends TE{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.publicKey}},_E=class extends TE{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.publicKey}},zBe=2336,PE=class{type="url";multihash;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=za.digest(K(this.url))}[mae](){return`PeerId(${this.url})`}[PT]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return Ps.createV1(zBe,this.toMultihash())}toJSON(){return this.toString()}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=z(e)),e.toString()===this.toString())}}});var bae={};W(bae,{peerIdFromCID:()=>Wa,peerIdFromMultihash:()=>El,peerIdFromPrivateKey:()=>RE,peerIdFromPublicKey:()=>vl,peerIdFromString:()=>le});function le(r,e){let t;if(r.charAt(0)==="1"||r.charAt(0)==="Q")t=Qv(Ur.decode(`z${r}`));else{if(r.startsWith("k51qzi5uqu5")||r.startsWith("kzwfwjn5ji4")||r.startsWith("k2k4r8")||r.startsWith("bafz"))return Wa(Ps.parse(r));if(e==null)throw new q('Please pass a multibase decoder for strings that do not start with "1" or "Q"');t=Qv(e.decode(r))}return El(t)}function vl(r){if(r.type==="Ed25519")return new DE({multihash:r.toCID().multihash,publicKey:r});if(r.type==="secp256k1")return new _E({multihash:r.toCID().multihash,publicKey:r});if(r.type==="RSA")return new kE({multihash:r.toCID().multihash,publicKey:r});throw new An}function RE(r){return vl(r.publicKey)}function El(r){if(VBe(r))return new kE({multihash:r});if(HBe(r))try{let e=pae(r);if(e.type==="Ed25519")return new DE({multihash:r,publicKey:e});if(e.type==="secp256k1")return new _E({multihash:r,publicKey:e})}catch{let t=z(r.digest);return new PE(new URL(t))}throw new CT("Supplied PeerID Multihash is invalid")}function Wa(r){if(r?.multihash==null||r.version==null||r.version===1&&r.code!==$Be&&r.code!==yae)throw new ST("Supplied PeerID CID is invalid");if(r.code===yae){let e=z(r.multihash.digest);return new PE(new URL(e))}return El(r.multihash)}function HBe(r){return r.code===za.code}function VBe(r){return r.code===a6.code}var $Be,yae,Be=_(()=>{uE();se();Fh();Xg();eE();Zg();eU();Le();gae();$Be=114,yae=2336});var ec,pS,Zle=_(()=>{ec=class{entries;constructor(e){this.entries=e}},pS=class{partitions;nodes;constructor(e,t){this.partitions=e,this.nodes=t}}});var Pl,eb,HF=_(()=>{Pl=class r{node;index;constructor(e,t){this.node=e,this.index=t}clone(){return new r(this.node,this.index)}},eb=class r{branches;leafNode;leafIndex;on;version;constructor(e,t,n,o,s){this.branches=e,this.leafNode=t,this.leafIndex=n,this.on=o,this.version=s}isEqual(e){return this.leafNode===e.leafNode&&this.leafIndex===e.leafIndex&&this.on===e.on&&this.version===e.version}clone(){return new r(this.branches.map(e=>e.clone()),this.leafNode,this.leafIndex,this.on,this.version)}}});var fi,ek,tk,Jle=_(()=>{Zle();HF();fi=64,ek=class{keyFromEntry;compare;_root;_version=0;constructor(e=n=>n,t=(n,o)=>n<o?-1:n>o?1:0){this.keyFromEntry=e,this.compare=t,this._root=new ec([])}first(){return this.getFirst(this._root)}last(){return this.getLast(this._root)}find(e){return this.getPath(this._root,e)}get(e){return this.at(this.find(e))}at(e){return this.validatePath(e),e.on?e.leafNode.entries[e.leafIndex]:void 0}*range(e){let t=e.first?this.findFirst(e):e.isAscending?this.first():this.last(),n=e.last?this.findLast(e):e.isAscending?this.last():this.first(),o=n.on?this.keyFromEntry(n.leafNode.entries[n.leafIndex]):void 0,s=e.isAscending?this.internalAscending(t):this.internalDescending(t),i=e.isAscending?1:-1;for(let a of s){if(!a.on||!n.on||this.compareKeys(this.keyFromEntry(a.leafNode.entries[a.leafIndex]),o)*i>0)break;yield a}}isValid(e){return e.version===this._version}insert(e){Object.freeze(e);let t=this.internalInsert(e);return t.on&&(t.version=++this._version),t}updateAt(e,t){this.validatePath(e),e.on&&Object.freeze(t);let n=this.internalUpdate(e,t);return n[0].on&&(n[0].version=++this._version),n}upsert(e){let t=this.find(this.keyFromEntry(e));return Object.freeze(e),t.on?t.leafNode.entries[t.leafIndex]=e:this.internalInsertAt(t,e),t.version=++this._version,t}merge(e,t){let n=this.keyFromEntry(e),o=this.find(n);return o.on?this.updateAt(o,t(o.leafNode.entries[o.leafIndex])):(this.internalInsertAt(o,Object.freeze(e)),o.on=!0,o.version=++this._version,[o,!1])}deleteAt(e){this.validatePath(e);let t=this.internalDelete(e);return t&&++this._version,t}ascending(e){return this.validatePath(e),this.internalAscending(e.clone())}descending(e){return this.validatePath(e),this.internalDescending(e.clone())}getCount(e){let t=0,n=e?e.path.clone():this.first();if(e?.ascending??!0)for(;n.on;)t+=n.leafNode.entries.length-n.leafIndex,n.leafIndex=n.leafNode.entries.length-1,this.internalNext(n);else for(;n.on;)t+=n.leafIndex+1,n.leafIndex=0,this.internalPrior(n);return t}next(e){let t=e.clone();return this.moveNext(t),t}moveNext(e){this.validatePath(e),this.internalNext(e)}prior(e){let t=e.clone();return this.movePrior(t),t}movePrior(e){this.validatePath(e),this.internalPrior(e)}compareKeys(e,t){let n=this.compare(e,t);if(n!==0&&n===this.compare(t,e))throw new Error("Inconsistent comparison function for given values");return n}*internalAscending(e){for(this.validatePath(e);e.on;)yield e,this.moveNext(e)}*internalDescending(e){for(this.validatePath(e);e.on;)yield e,this.movePrior(e)}findFirst(e){let t=this.find(e.first.key);return(!t.on||e.first&&!e.first.inclusive)&&(e.isAscending?this.internalNext(t):this.internalPrior(t)),t}findLast(e){let t=this.find(e.last.key);return(!t.on||e.last&&!e.last.inclusive)&&(e.isAscending?this.internalPrior(t):this.internalNext(t)),t}getPath(e,t){if(e instanceof ec){let n=e,[o,s]=this.indexOfEntry(n.entries,t);return new eb([],n,s,o,this._version)}else{let n=e,o=this.indexOfKey(n.partitions,t),s=this.getPath(n.nodes[o],t);return s.branches.unshift(new Pl(n,o)),s}}indexOfEntry(e,t){let n=0,o=e.length-1,s=0,i=-1;for(;n<=o;){if(s=n+o>>>1,i=this.compareKeys(t,this.keyFromEntry(e[s])),i===0)return[!0,s];i<0?o=s-1:n=s+1}return[!1,n]}indexOfKey(e,t){let n=0,o=e.length-1,s=0,i=-1;for(;n<=o;){if(s=n+o>>>1,i=this.compareKeys(t,e[s]),i===0)return s+1;i<0?o=s-1:n=s+1}return n}internalNext(e){if(e.on)if(e.leafIndex>=e.leafNode.entries.length-1){let t=0,n=!1,o=e.branches.length-1;for(;t<=o&&!n;){let s=e.branches[o-t];s.index===s.node.partitions.length?++t:n=!0}if(!n)e.leafIndex=e.leafNode.entries.length,e.on=!1;else{e.branches.splice(-t,t);let s=e.branches.at(-1);++s.index,this.moveToFirst(s.node.nodes[s.index],e)}}else++e.leafIndex,e.on=!0;else if(e.on=e.branches.every(t=>t.index>=0&&t.index<t.node.nodes.length)&&e.leafIndex>=0&&e.leafIndex<e.leafNode.entries.length,e.on)return}internalPrior(e){if(this.validatePath(e),e.leafIndex<=0){let t=0,n=!1,o=e.branches.length-1;for(;t<=o&&!n;)e.branches[o-t].index===0?++t:n=!0;if(!n)e.leafIndex=0,e.on=!1;else{e.branches.splice(-t,t);let s=e.branches.at(-1);--s.index,this.moveToLast(s.node.nodes[s.index],e)}}else--e.leafIndex,e.on=!0}internalUpdate(e,t){if(e.on){let n=this.keyFromEntry(e.leafNode.entries[e.leafIndex]),o=this.keyFromEntry(t);if(this.compareKeys(n,o)!==0){let s=this.internalInsert(t);return s.on&&(this.internalDelete(this.find(n)),s=this.find(o)),[s,!1]}else e.leafNode.entries[e.leafIndex]=t}return[e,!0]}internalDelete(e){if(e.on){if(e.leafNode.entries.splice(e.leafIndex,1),e.branches.length>0){if(e.leafIndex===0&&e.leafNode.entries.length>0){let n=e.branches.at(-1);this.updatePartition(n.index,e,e.branches.length-1,this.keyFromEntry(e.leafNode.entries[e.leafIndex]))}let t=this.rebalanceLeaf(e);t&&(this._root=t)}return e.on=!1,!0}else return!1}internalInsert(e){let t=this.find(this.keyFromEntry(e));return t.on?(t.on=!1,t):(this.internalInsertAt(t,e),t.on=!0,t)}internalInsertAt(e,t){let n=this.leafInsert(e,t),o=e.branches.length-1;for(;n&&o>=0;)n=this.branchInsert(e,o,n),--o;if(n){let s=new pS([n.key],[this._root,n.right]);this._root=s,e.branches.unshift(new Pl(s,n.indexDelta))}}moveToFirst(e,t){if(e instanceof ec){let n=e;t.leafNode=n,t.leafIndex=0,t.on=n.entries.length>0}else t.branches.push(new Pl(e,0)),this.moveToFirst(e.nodes[0],t)}moveToLast(e,t){if(e instanceof ec){let n=e,o=n.entries.length;t.leafNode=n,t.on=o>0,t.leafIndex=o>0?o-1:0}else{let n=e,o=new Pl(n,n.partitions.length);t.branches.push(o),this.moveToLast(n.nodes[o.index],t)}}getFirst(e){if(e instanceof ec){let t=e;return new eb([],t,0,t.entries.length>0,this._version)}else{let t=e,n=this.getFirst(t.nodes[0]);return n.branches.unshift(new Pl(t,0)),n}}getLast(e){if(e instanceof ec){let t=e,n=t.entries.length;return new eb([],t,n>0?n-1:0,n>0,this._version)}else{let t=e,n=t.nodes.length-1,o=this.getLast(t.nodes[n]);return o.branches.unshift(new Pl(t,n)),o}}leafInsert(e,t){let{leafNode:n,leafIndex:o}=e;if(n.entries.length<fi){n.entries.splice(o,0,t);return}let s=n.entries.length+1>>>1,i=n.entries.splice(s),a=new ec(i),c=o<s?0:1;return c?(e.leafNode=a,e.leafIndex-=n.entries.length,a.entries.splice(e.leafIndex,0,t)):n.entries.splice(o,0,t),new tk(this.keyFromEntry(i[0]),a,c)}branchInsert(e,t,n){let o=e.branches[t],{index:s,node:i}=o;if(o.index+=n.indexDelta,i.partitions.splice(s,0,n.key),i.nodes.splice(s+1,0,n.right),i.nodes.length<=fi)return;let a=i.nodes.length>>>1,c=i.partitions.splice(a),l=i.partitions.pop(),u=i.nodes.splice(a),d=new pS(c,u),h=o.index<a?0:1;return h&&(o.index-=a,o.node=d),new tk(l,d,h)}rebalanceLeaf(e){if(e.leafNode.entries.length>=fi>>>1)return;let t=e.leafNode,n=e.branches.at(-1),o=e.branches.length-1,s=n.index,i=n.node,a=i.nodes[s+1];if(a&&a.entries.length>fi>>>1){let l=a.entries.shift();t.entries.push(l),this.updatePartition(s+1,e,o,this.keyFromEntry(a.entries[0]));return}let c=i.nodes[s-1];if(c&&c.entries.length>fi>>>1){let l=c.entries.pop();t.entries.unshift(l),this.updatePartition(s,e,o,this.keyFromEntry(l)),e.leafIndex+=1;return}if(a&&a.entries.length+t.entries.length<=fi)return t.entries.push(...a.entries),i.partitions.splice(s,1),i.nodes.splice(s+1,1),s===0&&this.updatePartition(s,e,o,this.keyFromEntry(t.entries[0])),this.rebalanceBranch(e,o);if(c&&c.entries.length+t.entries.length<=fi)return e.leafNode=c,e.leafIndex+=c.entries.length,c.entries.push(...t.entries),i.partitions.splice(s-1,1),i.nodes.splice(s,1),this.rebalanceBranch(e,o)}rebalanceBranch(e,t){let n=e.branches[t],o=n.node;if(t===0&&o.partitions.length===0)return e.branches[t+1]?.node??e.leafNode;if(t===0||o.nodes.length>=fi>>>1)return;let s=e.branches.at(t-1),i=s.index,a=s.node,c=a.nodes[i+1];if(c&&c.nodes.length>fi>>>1){o.partitions.push(a.partitions[i]);let u=c.nodes.shift();o.nodes.push(u);let d=c.partitions.shift();this.updatePartition(i+1,e,t-1,d);return}let l=a.nodes[i-1];if(l&&l.nodes.length>fi>>>1){o.partitions.unshift(a.partitions[i-1]);let u=l.nodes.pop();o.nodes.unshift(u);let d=l.partitions.pop();n.index+=1,this.updatePartition(i,e,t-1,d);return}if(c&&c.nodes.length+o.nodes.length<=fi){let u=a.partitions.splice(i,1)[0];return o.partitions.push(u),o.partitions.push(...c.partitions),o.nodes.push(...c.nodes),a.nodes.splice(i+1,1),i===0&&a.partitions.length>0&&this.updatePartition(i,e,t-1,a.partitions[0]),this.rebalanceBranch(e,t-1)}if(l&&l.nodes.length+o.nodes.length<=fi){n.node=l,n.index+=l.nodes.length;let u=a.partitions.splice(i-1,1)[0];return l.partitions.push(u),l.partitions.push(...o.partitions),l.nodes.push(...o.nodes),a.nodes.splice(i,1),this.rebalanceBranch(e,t-1)}}updatePartition(e,t,n,o){let s=t.branches[n];e>0?s.node.partitions[e-1]=o:n!==0&&this.updatePartition(t.branches[n-1].index,t,n-1,o)}validatePath(e){if(!this.isValid(e))throw new Error("Path is invalid due to mutation of the tree")}},tk=class{key;right;indexDelta;constructor(e,t,n){this.key=e,this.right=t,this.indexDelta=n}}});var Qle=_(()=>{});var eue=_(()=>{Jle();Qle();HF()});function tue(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function Rl(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function rue(r){return new TextEncoder().encode(r)}function nue(r){return new TextDecoder().decode(r)}var kNt,Xd=_(()=>{kNt=new Uint8Array(0)});function aue(r,e,t){e=e||[],t=t||0;for(var n=t;r>=pFe;)e[t++]=r&255|sue,r/=128;for(;r&hFe;)e[t++]=r&255|sue,r>>>=7;return e[t]=r|0,aue.bytes=t-n+1,e}function VF(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw VF.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&iue)<<o:(i&iue)*Math.pow(2,o),o+=7}while(i>=gFe);return VF.bytes=s-n,t}var dFe,sue,fFe,hFe,pFe,mFe,gFe,iue,yFe,bFe,wFe,xFe,vFe,EFe,SFe,CFe,AFe,IFe,TFe,kFe,mS,cue=_(()=>{dFe=aue,sue=128,fFe=127,hFe=~fFe,pFe=Math.pow(2,31);mFe=VF,gFe=128,iue=127;yFe=Math.pow(2,7),bFe=Math.pow(2,14),wFe=Math.pow(2,21),xFe=Math.pow(2,28),vFe=Math.pow(2,35),EFe=Math.pow(2,42),SFe=Math.pow(2,49),CFe=Math.pow(2,56),AFe=Math.pow(2,63),IFe=function(r){return r<yFe?1:r<bFe?2:r<wFe?3:r<xFe?4:r<vFe?5:r<EFe?6:r<SFe?7:r<CFe?8:r<AFe?9:10},TFe={encode:dFe,decode:mFe,encodingLength:IFe},kFe=TFe,mS=kFe});function gS(r,e=0){return[mS.decode(r,e),mS.decode.bytes]}function tb(r,e,t=0){return mS.encode(r,e,t),e}function rb(r){return mS.encodingLength(r)}var nk=_(()=>{cue()});function ob(r,e){let t=e.byteLength,n=rb(r),o=n+rb(t),s=new Uint8Array(o+t);return tb(r,s,0),tb(t,s,n),s.set(e,o),new nb(r,t,e,s)}function yS(r){let e=Rl(r),[t,n]=gS(e),[o,s]=gS(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new nb(t,o,i,e)}function lue(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&tue(r.bytes,t.bytes)}}var nb,ib=_(()=>{Xd();nk();nb=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}}});function jF({name:r,code:e,encode:t,minDigestLength:n,maxDigestLength:o}){return new qF(r,e,t,n,o)}function uue(r,e,t){if(t!=null&&t!==r.byteLength){if(t>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t)}return ob(e,r)}var DFe,qF,GF=_(()=>{ib();DFe=20;qF=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,o,s){this.name=e,this.code=t,this.encode=n,this.minDigestLength=o??DFe,this.maxDigestLength=s}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?uue(n,this.code,t?.truncate):n.then(o=>uue(o,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}}});var WF={};W(WF,{sha256:()=>Zd,sha512:()=>_Fe});function fue(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var Zd,_Fe,bS=_(()=>{GF();Zd=jF({name:"sha2-256",code:18,encode:fue("SHA-256")}),_Fe=jF({name:"sha2-512",code:19,encode:fue("SHA-512")})});function PFe(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var a=r.length,c=r.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function d(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var g=0,y=0,m=0,w=f.length;m!==w&&f[m]===0;)m++,g++;for(var b=(w-m)*u+1>>>0,x=new Uint8Array(b);m!==w;){for(var S=f[m],T=0,A=b-1;(S!==0||T<y)&&A!==-1;A--,T++)S+=256*x[A]>>>0,x[A]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");y=T,m++}for(var v=b-y;v!==b&&x[v]===0;)v++;for(var C=c.repeat(g);v<b;++v)C+=r.charAt(x[v]);return C}function h(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var g=0;if(f[g]!==" "){for(var y=0,m=0;f[g]===c;)y++,g++;for(var w=(f.length-g)*l+1>>>0,b=new Uint8Array(w);f[g];){var x=t[f.charCodeAt(g)];if(x===255)return;for(var S=0,T=w-1;(x!==0||S<m)&&T!==-1;T--,S++)x+=a*b[T]>>>0,b[T]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");m=S,g++}if(f[g]!==" "){for(var A=w-m;A!==w&&b[A]===0;)A++;for(var v=new Uint8Array(y+(w-A)),C=y;A!==w;)v[C++]=b[A++];return v}}}function p(f){var g=h(f);if(g)return g;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:h,decode:p}}var RFe,LFe,hue,pue=_(()=>{RFe=PFe,LFe=RFe,hue=LFe});function mue(r,e){return new ZF({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}function ab({name:r,prefix:e,encode:t,decode:n}){return new JF(r,e,t,n)}function Jd({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=hue(t,r);return ab({prefix:e,name:r,encode:n,decode:s=>Rl(o(s))})}function MFe(r,e,t,n){let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),i=0,a=0,c=0;for(let l=0;l<o;++l){let u=e[r[l]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<t|u,i+=t,i>=8&&(i-=8,s[c++]=255&a>>i)}if(i>=t||(255&a<<8-i)!==0)throw new SyntaxError("Unexpected end of data");return s}function BFe(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],i+=8;i>t;)i-=t,s+=e[o&a>>i];if(i!==0&&(s+=e[o&a<<t-i]),n)for(;(s.length*t&7)!==0;)s+="=";return s}function OFe(r){let e={};for(let t=0;t<r.length;++t)e[r[t]]=t;return e}function fr({name:r,prefix:e,bitsPerChar:t,alphabet:n}){let o=OFe(n);return ab({prefix:e,name:r,encode(s){return BFe(s,n,t)},decode(s){return MFe(s,o,t,r)}})}var YF,XF,ZF,JF,ta=_(()=>{Xd();pue();YF=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},XF=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let o=t.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return mue(this,e)}},ZF=class{decoders;constructor(e){this.decoders=e}or(e){return mue(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};JF=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new YF(e,t,n),this.decoder=new XF(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}});var QF={};W(QF,{base10:()=>NFe});var NFe,gue=_(()=>{ta();NFe=Jd({prefix:"9",name:"base10",alphabet:"0123456789"})});var eK={};W(eK,{base16:()=>UFe,base16upper:()=>FFe});var UFe,FFe,yue=_(()=>{ta();UFe=fr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),FFe=fr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var tK={};W(tK,{base2:()=>KFe});var KFe,bue=_(()=>{ta();KFe=fr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var rK={};W(rK,{base256emoji:()=>qFe});function HFe(r){return r.reduce((e,t)=>(e+=zFe[t],e),"")}function VFe(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let o=$Fe[n];if(o==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(o)}return new Uint8Array(e)}var wue,zFe,$Fe,qFe,xue=_(()=>{ta();wue=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),zFe=wue.reduce((r,e,t)=>(r[t]=e,r),[]),$Fe=wue.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);qFe=ab({prefix:"\u{1F680}",name:"base256emoji",encode:HFe,decode:VFe})});var nK={};W(nK,{base32:()=>tc,base32hex:()=>YFe,base32hexpad:()=>ZFe,base32hexpadupper:()=>JFe,base32hexupper:()=>XFe,base32pad:()=>GFe,base32padupper:()=>WFe,base32upper:()=>jFe,base32z:()=>QFe});var tc,jFe,GFe,WFe,YFe,XFe,ZFe,JFe,QFe,wS=_(()=>{ta();tc=fr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),jFe=fr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),GFe=fr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),WFe=fr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),YFe=fr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),XFe=fr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ZFe=fr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),JFe=fr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),QFe=fr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var oK={};W(oK,{base36:()=>xS,base36upper:()=>eKe});var xS,eKe,sK=_(()=>{ta();xS=Jd({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),eKe=Jd({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var iK={};W(iK,{base58btc:()=>hr,base58flickr:()=>tKe});var hr,tKe,Ll=_(()=>{ta();hr=Jd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),tKe=Jd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var lK={};W(lK,{base64:()=>aK,base64pad:()=>rKe,base64url:()=>cK,base64urlpad:()=>nKe});var aK,rKe,cK,nKe,ok=_(()=>{ta();aK=fr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),rKe=fr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cK=fr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),nKe=fr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var uK={};W(uK,{base8:()=>oKe});var oKe,vue=_(()=>{ta();oKe=fr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var dK={};W(dK,{identity:()=>sKe});var sKe,Eue=_(()=>{Xd();ta();sKe=ab({prefix:"\0",name:"identity",encode:r=>nue(r),decode:r=>rue(r)})});var WNt,YNt,Sue=_(()=>{WNt=new TextEncoder,YNt=new TextDecoder});var Cue=_(()=>{Xd()});var fK={};W(fK,{identity:()=>ra});function lKe(r,e){if(e?.truncate!=null&&e.truncate!==r.byteLength){if(e.truncate<0||e.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e.truncate)}return ob(Aue,Iue(r))}var Aue,cKe,Iue,ra,ip=_(()=>{Xd();ib();Aue=0,cKe="identity",Iue=Rl;ra={code:Aue,name:cKe,encode:Iue,digest:lKe}});var hK=_(()=>{});function Tue(r,e){let{bytes:t,version:n}=r;return n===0?dKe(t,pK(r),e??hr.encoder):fKe(t,pK(r),e??tc.encoder)}function pK(r){let e=kue.get(r);if(e==null){let t=new Map;return kue.set(r,t),t}return e}function uKe(r,e){switch(r[0]){case"Q":{let t=e??hr;return[hr.prefix,t.decode(`${hr.prefix}${r}`)]}case hr.prefix:{let t=e??hr;return[hr.prefix,t.decode(r)]}case tc.prefix:{let t=e??tc;return[tc.prefix,t.decode(r)]}case xS.prefix:{let t=e??xS;return[xS.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function dKe(r,e,t){let{prefix:n}=t;if(n!==hr.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o}function fKe(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o}function Due(r,e,t){let n=rb(r),o=n+rb(e),s=new Uint8Array(o+t.byteLength);return tb(r,s,0),tb(e,s,n),s.set(t,o),s}var kue,Rn,vS,hKe,pKe,ap=_(()=>{wS();sK();Ll();Xd();ib();nk();hK();kue=new WeakMap;Rn=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==vS)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==hKe)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=ob(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&lue(e.multihash,n.multihash)}toString(e){return Tue(this,e)}toJSON(){return{"/":Tue(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i??Due(n,o,s.bytes))}else if(t[pKe]===!0){let{version:n,multihash:o,code:s}=t,i=yS(o);return r.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==vS)throw new Error(`Version 0 CID must use dag-pb (code: ${vS}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=Due(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,vS,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=Rl(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new nb(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[d,h]=gS(e.subarray(t));return t+=h,d},o=n(),s=vS;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,a=n(),c=n(),l=t+c,u=l-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:u,size:l}}static parse(e,t){let[n,o]=uKe(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return pK(s).set(n,e),s}};vS=112,hKe=18;pKe=Symbol.for("@ipld/js-cid/CID")});var _ue=_(()=>{});var Pue=_(()=>{});var Rue=_(()=>{});var Lue=_(()=>{});var Mue=_(()=>{_ue();Pue();Rue();hK();Lue()});var mK=_(()=>{Xd();ap();ib();GF();nk();Mue()});var ES,hUt,gK=_(()=>{gue();yue();bue();xue();wS();sK();Ll();ok();vue();Eue();Sue();Cue();ip();bS();mK();ES={...dK,...tK,...uK,...QF,...eK,...nK,...oK,...iK,...lK,...rK},hUt={...WF,...fK}});function Ml(r=0){return new Uint8Array(r)}function ao(r=0){return new Uint8Array(r)}var Qd=_(()=>{});function Oue(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Bue,yK,mKe,sk,bK=_(()=>{gK();Qd();Bue=Oue("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),yK=Oue("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=ao(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),mKe={utf8:Bue,"utf-8":Bue,hex:ES.base16,latin1:yK,ascii:yK,binary:yK,...ES},sk=mKe});function pr(r,e="utf8"){let t=sk[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var ef=_(()=>{bK()});function Ir(r,e="utf8"){let t=sk[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}var rc=_(()=>{bK()});async function Or(r){let e=r.toMultihash().bytes;return await Zd.encode(e)}async function Jt(r){return await Zd.encode(r)}function lb(r){let e="";for(let t=0;t<r.length;t++)e+=gKe[r[t]];return e}function ub(r){return pr(r,"base64url")}function ik(r){let e=Ir(r,"base64url");if(e.length!==cb)throw new Error(`base64urlToCoord: expected ${cb} bytes, got ${e.length}`);return e}var cb,gKe,IUt,SS=_(()=>{"use strict";bS();ef();rc();cb=32;gKe=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));IUt=new RegExp(`^[0-9a-fA-F]{${cb*2}}$`)});function yKe(r){if(r.length!==cb)throw new Error(`DigitreeStore: ring coordinate must be ${cb} bytes, got ${r.length}`)}function CS(r){let e=Nue.get(r.coord);if(e!==void 0&&e.id===r.id)return e.key;let t=`${lb(r.coord)}|${r.id}`;return Nue.set(r.coord,{id:r.id,key:t}),t}var Nue,tf,wK=_(()=>{"use strict";eue();SS();Nue=new WeakMap;tf=class{byKey;byId;membershipCounts=new Map;stateCounts=new Map;constructor(){this.byKey=new ek(e=>CS(e)),this.byId=new Map}bumpCount(e,t,n){let o=(e.get(t)??0)+n;o<=0?e.delete(t):e.set(t,o)}tally(e,t){this.bumpCount(this.membershipCounts,e.membership,t),this.bumpCount(this.stateCounts,e.state,t)}countByMembership(e){return this.membershipCounts.get(e)??0}countByState(e){return this.stateCounts.get(e)??0}put(e){yKe(e.coord);let t=CS(e),n=this.byId.get(e.id);if(n!==void 0){let o=CS(n);if(o!==t){let s=this.byKey.find(o);s.on&&this.byKey.deleteAt(s)}}return this.byKey.upsert(e),this.byId.set(e.id,e),n&&this.tally(n,-1),this.tally(e,1),e}upsert(e,t){let n=Date.now(),o=this.getById(e);return o?this.put({...o,coord:t,lastAccess:n}):this.put({id:e,coord:t,relevance:0,lastAccess:n,state:"disconnected",membership:"unknown",negotiateFailures:0,lastNegotiateFailureAt:0,contactFailures:0,lastContactFailureAt:0,accessCount:0,successCount:0,failureCount:0,avgLatencyMs:null})}update(e,t){let n=this.getById(e);n&&this.put({...n,...t})}getById(e){return this.byId.get(e)}remove(e){let t=this.byId.get(e);if(!t)return;let n=this.byKey.find(CS(t));n.on&&(this.tally(this.byKey.at(n),-1),this.byKey.deleteAt(n)),this.byId.delete(e)}list(){let e=[];for(let t of this.byKey.ascending(this.byKey.first()))e.push(this.byKey.at(t));return e}size(){return this.byId.size}setState(e,t){this.update(e,{state:t})}setMembership(e,t){this.update(e,{membership:t})}ceilPath(e){let t=`${e}|\0`,n=this.byKey.find(t);return n.on||(n=this.byKey.next(n)),n}floorPath(e){let t=`${e}|\uFFFF`,n=this.byKey.find(t);return n.on||(n=this.byKey.prior(n)),n}*walkRing(e,t,n,o){let s=t==="next"?l=>this.byKey.next(l):l=>this.byKey.prior(l),i=t==="next"?()=>this.byKey.first():()=>this.byKey.last(),a=e,c=0;for(;c<n;){if(!a.on&&(a=i(),!a.on))return;let l=this.byKey.at(a);c++,(!o||o(l))&&(yield l),a=s(a)}}collectRing(e,t,n,o){let s=new Set;if(n<=0)return[];let i=o?this.size():Number.POSITIVE_INFINITY;for(let a of this.walkRing(e,t,i,o))if(s.has(a.id)||(s.add(a.id),s.size>=n))break;return Array.from(s)}successorOfCoord(e,t){let n=this.ceilPath(lb(e));for(let o of this.walkRing(n,"next",this.size(),t))return o}predecessorOfCoord(e,t){let n=this.floorPath(lb(e));for(let o of this.walkRing(n,"prior",this.size(),t))return o}neighborsRight(e,t,n){return this.collectRing(this.ceilPath(lb(e)),"next",t,n)}neighborsLeft(e,t,n){return this.collectRing(this.floorPath(lb(e)),"prior",t,n)}walkFrom(e,t,n){let o=[],s=e,i=this.size();if(t<=0||i===0)return{entries:o,next:s};let a=e?this.byKey.next(this.byKey.find(e.key)):this.byKey.first();for(let c of this.walkRing(a,"next",i,n))if(o.push(c),s={key:CS(c)},o.length>=t)break;return{entries:o,next:s}}exportEntries(){return this.list().map(e=>({id:e.id,coord:ub(e.coord),relevance:e.relevance,lastAccess:e.lastAccess,state:e.state,membership:e.membership,negotiateFailures:e.negotiateFailures,contactFailures:e.contactFailures,accessCount:e.accessCount,successCount:e.successCount,failureCount:e.failureCount,avgLatencyMs:e.avgLatencyMs,...e.metadata?{metadata:e.metadata}:{}}))}importEntries(e){let t=e.map(o=>({s:o,coord:ik(o.coord)})),n=new Set;for(let{s:o,coord:s}of t){let i={id:o.id,coord:s,relevance:o.relevance,lastAccess:o.lastAccess,state:"disconnected",membership:o.membership??"unknown",negotiateFailures:0,lastNegotiateFailureAt:0,contactFailures:0,lastContactFailureAt:0,accessCount:o.accessCount,successCount:o.successCount,failureCount:o.failureCount,avgLatencyMs:o.avgLatencyMs??null,...o.metadata?{metadata:o.metadata}:{}};this.put(i),n.add(i.id)}return n.size}}});function Jr(r){if(r<bKe)return 1;if(r<wKe)return 2;if(r<xKe)return 3;if(r<xK)return 4;if(r<vK)return 5;if(r<EK)return 6;if(r<SK)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function db(r,e,t=0){switch(Jr(r)){case 8:e[t++]=r&255|ut,r/=128;case 7:e[t++]=r&255|ut,r/=128;case 6:e[t++]=r&255|ut,r/=128;case 5:e[t++]=r&255|ut,r/=128;case 4:e[t++]=r&255|ut,r>>>=7;case 3:e[t++]=r&255|ut,r>>>=7;case 2:e[t++]=r&255|ut,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function vKe(r,e,t=0){switch(Jr(r)){case 8:e.set(t++,r&255|ut),r/=128;case 7:e.set(t++,r&255|ut),r/=128;case 6:e.set(t++,r&255|ut),r/=128;case 5:e.set(t++,r&255|ut),r/=128;case 4:e.set(t++,r&255|ut),r>>>=7;case 3:e.set(t++,r&255|ut),r>>>=7;case 2:e.set(t++,r&255|ut),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function CK(r,e){let t=r[e],n=0;if(n+=t&co,t<ut||(t=r[e+1],n+=(t&co)<<7,t<ut)||(t=r[e+2],n+=(t&co)<<14,t<ut)||(t=r[e+3],n+=(t&co)<<21,t<ut)||(t=r[e+4],n+=(t&co)*xK,t<ut)||(t=r[e+5],n+=(t&co)*vK,t<ut)||(t=r[e+6],n+=(t&co)*EK,t<ut)||(t=r[e+7],n+=(t&co)*SK,t<ut))return n;throw new RangeError("Could not decode varint")}function EKe(r,e){let t=r.get(e),n=0;if(n+=t&co,t<ut||(t=r.get(e+1),n+=(t&co)<<7,t<ut)||(t=r.get(e+2),n+=(t&co)<<14,t<ut)||(t=r.get(e+3),n+=(t&co)<<21,t<ut)||(t=r.get(e+4),n+=(t&co)*xK,t<ut)||(t=r.get(e+5),n+=(t&co)*vK,t<ut)||(t=r.get(e+6),n+=(t&co)*EK,t<ut)||(t=r.get(e+7),n+=(t&co)*SK,t<ut))return n;throw new RangeError("Could not decode varint")}function AK(r,e,t=0){return e==null&&(e=ao(Jr(r))),e instanceof Uint8Array?db(r,e,t):vKe(r,e,t)}function Bl(r,e=0){return r instanceof Uint8Array?CK(r,e):EKe(r,e)}var bKe,wKe,xKe,xK,vK,EK,SK,ut,co,Ol=_(()=>{Qd();bKe=Math.pow(2,7),wKe=Math.pow(2,14),xKe=Math.pow(2,21),xK=Math.pow(2,28),vK=Math.pow(2,35),EK=Math.pow(2,42),SK=Math.pow(2,49),ut=128,co=127});var Uue=_(()=>{});function Nl(r,e){e==null&&(e=r.reduce((o,s)=>o+s.length,0));let t=ao(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return t}var IS=_(()=>{Qd();Uue()});function Os(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var cp=_(()=>{});function Fue(r,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let t=0;for(let n of r){let o=t+n.byteLength;if(e<o)return{buf:n,index:e-t};t=o}throw new RangeError("index is out of bounds")}function ak(r){return!!r?.[Kue]}var Kue,Tr,Ul=_(()=>{Qd();IS();cp();Kue=Symbol.for("@achingbrain/uint8arraylist");Tr=class r{bufs;length;[Kue]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(let n of e)if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.push(n);else if(ak(n))t+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(let n of e.reverse())if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.unshift(n);else if(ak(n))t+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}get(e){let t=Fue(this.bufs,e);return t.buf[t.index]}set(e,t){let n=Fue(this.bufs,e);n.buf[n.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(t+n,e[n]);else if(ak(e))for(let n=0;n<e.length;n++)this.set(t+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,t){let{bufs:n,length:o}=this._subList(e,t);return Nl(n,o)}subarray(e,t){let{bufs:n,length:o}=this._subList(e,t);return n.length===1?n[0]:Nl(n,o)}sublist(e,t){let{bufs:n,length:o}=this._subList(e,t),s=new r;return s.length=o,s.bufs=[...n],s}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:this.bufs,length:this.length};let n=[],o=0;for(let s=0;s<this.bufs.length;s++){let i=this.bufs[s],a=o,c=a+i.byteLength;if(o=c,e>=c)continue;let l=e>=a&&e<c,u=t>a&&t<=c;if(l&&u){if(e===a&&t===c){n.push(i);break}let d=e-a;n.push(i.subarray(d,d+(t-e)));break}if(l){if(e===0){n.push(i);continue}n.push(i.subarray(e-a));continue}if(u){if(t===c){n.push(i);break}n.push(i.subarray(0,t-a));break}n.push(i)}return{bufs:n,length:t-e}}indexOf(e,t=0){if(!ak(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let s=256,i=new Int32Array(s);for(let d=0;d<s;d++)i[d]=-1;for(let d=0;d<o;d++)i[n[d]]=d;let a=i,c=this.byteLength-n.byteLength,l=n.byteLength-1,u;for(let d=t;d<=c;d+=u){u=0;for(let h=l;h>=0;h--){let p=this.get(d+h);if(n[h]!==p){u=Math.max(1,h-a[p]);break}}if(u===0)return d}return-1}getInt8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){let n=ao(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,t),this.write(n,e)}getInt16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,t)}setInt16(e,t,n){let o=Ml(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,t,n),this.write(o,e)}getInt32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,t)}setInt32(e,t,n){let o=Ml(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,t,n),this.write(o,e)}getBigInt64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,t)}setBigInt64(e,t,n){let o=Ml(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,t,n),this.write(o,e)}getUint8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){let n=ao(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,t),this.write(n,e)}getUint16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,t)}setUint16(e,t,n){let o=Ml(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,t,n),this.write(o,e)}getUint32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,t)}setUint32(e,t,n){let o=Ml(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,t,n),this.write(o,e)}getBigUint64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,t)}setBigUint64(e,t,n){let o=Ml(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,t,n),this.write(o,e)}getFloat32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,t)}setFloat32(e,t,n){let o=Ml(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,t,n),this.write(o,e)}getFloat64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,t)}setFloat64(e,t,n){let o=Ml(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,t,n),this.write(o,e)}equals(e){if(e==null||!(e instanceof r)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!Os(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let n=new r;return n.bufs=e,t==null&&(t=e.reduce((o,s)=>o+s.byteLength,0)),n.length=t,n}}});var IK=_(()=>{});var ck,fb,lk,TS,TK=_(()=>{ck=class extends Error{name="InvalidMessageLengthError";code="ERR_INVALID_MSG_LENGTH"},fb=class extends Error{name="InvalidDataLengthError";code="ERR_MSG_DATA_TOO_LONG"},lk=class extends Error{name="InvalidDataLengthLengthError";code="ERR_MSG_LENGTH_TOO_LONG"},TS=class extends Error{name="UnexpectedEOFError";code="ERR_UNEXPECTED_EOF"}});function uk(r){return r[Symbol.asyncIterator]!=null}var kK=_(()=>{});function zue(r,e){if(r.byteLength>e)throw new fb("Message length too long")}function kS(r,e){e=e??{};let t=e.lengthEncoder??fk,n=e?.maxDataLength??4194304;function*o(s){zue(s,n);let i=t(s.byteLength);i instanceof Uint8Array?yield i:yield*i,s instanceof Uint8Array?yield s:yield*s}return uk(r)?(async function*(){for await(let s of r)yield*o(s)})():(function*(){for(let s of r)yield*o(s)})()}var fk,$ue=_(()=>{Ol();Ul();Qd();IK();TK();kK();fk=r=>{let e=Jr(r),t=ao(e);return AK(r,t),fk.bytes=e,t};fk.bytes=0;kS.single=(r,e)=>{e=e??{};let t=e.lengthEncoder??fk,n=e?.maxDataLength??4194304;return zue(r,n),new Tr(t(r.byteLength),r)}});function hb(r,e){let t=new Tr,n=lp.LENGTH,o=-1,s=e?.lengthDecoder??DK,i=e?.maxLengthLength??8,a=e?.maxDataLength??4194304;function*c(){for(;t.byteLength>0;){if(n===lp.LENGTH)try{if(o=s(t),o<0)throw new ck("Invalid message length");if(o>a)throw new fb("Message length too long");let l=s.bytes;t.consume(l),e?.onLength!=null&&e.onLength(o),n=lp.DATA}catch(l){if(l instanceof RangeError){if(t.byteLength>i)throw new lk("Message length length too long");break}throw l}if(n===lp.DATA){if(t.byteLength<o)break;let l=t.sublist(0,o);t.consume(o),e?.onData!=null&&e.onData(l),yield l,n=lp.LENGTH}}}return uk(r)?(async function*(){for await(let l of r)t.append(l),yield*c();if(t.byteLength>0)throw new TS("Unexpected end of input")})():(function*(){for(let l of r)t.append(l),yield*c();if(t.byteLength>0)throw new TS("Unexpected end of input")})()}var lp,DK,Hue=_(()=>{Ol();Ul();IK();TK();kK();(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(lp||(lp={}));DK=r=>{let e=Bl(r);return DK.bytes=Jr(e),e};DK.bytes=0;hb.fromReader=(r,e)=>{let t=1,n=(async function*(){for(;;)try{let{done:s,value:i}=await r.next(t);if(s===!0)return;i!=null&&(yield i)}catch(s){if(s.code==="ERR_UNDER_READ")return{done:!0,value:null};throw s}finally{t=1}})();return hb(n,{...e??{},onLength:s=>{t=s}})}});var _K=_(()=>{$ue();Hue()});var DS,hk,PK=_(()=>{DS=class extends Error{constructor(e="An error occurred while verifying a message"){super(e),this.name="VerificationError"}},hk=class extends Error{constructor(e="Missing Web Crypto API"){super(e),this.name="WebCryptoMissingError"}}});var que,jue=_(()=>{PK();que={get(r=globalThis){let e=r.crypto;if(e?.subtle==null)throw new hk("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api");return e}}});var pk,Gue=_(()=>{jue();pk=que});var Wue=_(()=>{});var Yue=_(()=>{});var Xue=_(()=>{});var Zue=_(()=>{});var Jue=_(()=>{});var hi,mk,gk,yk,_S,Que=_(()=>{hi=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},mk=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}},gk=class extends Error{static name="InvalidCIDError";constructor(e="Invalid CID"){super(e),this.name="InvalidCIDError"}},yk=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}},_S=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}}});var ede=_(()=>{});var tde=_(()=>{});var rde=_(()=>{});var nde=_(()=>{});var ode=_(()=>{});var bk,sde=_(()=>{bk=Symbol.for("@libp2p/peer-discovery")});var RK,ide=_(()=>{RK=Symbol.for("@libp2p/peer-id")});var ade=_(()=>{});var cde=_(()=>{});var lde=_(()=>{});var ude=_(()=>{});var dde=_(()=>{});var fde=_(()=>{});var hde=_(()=>{});var pde=_(()=>{});var mde=_(()=>{});var gde,yde=_(()=>{(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(gde||(gde={}))});var wk,LK=_(()=>{wk=class extends EventTarget{#e=new Map;constructor(){super()}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:s})=>s!==t),this.#e.set(e,o))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:o})=>!o),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new CustomEvent(e,t))}}});var nc=_(()=>{Wue();Yue();Xue();Zue();Jue();Que();ede();tde();rde();nde();ode();sde();ide();ade();cde();lde();ude();dde();fde();hde();pde();mde();yde();LK()});function BK(r,e={offset:0}){let t=r[e.offset]&CKe;if(e.offset++,bde[t]!=null)return bde[t](r,e);throw new Error("No decoder for tag "+t)}function RS(r,e){let t=0;if((r[e.offset]&MK)===MK){let n=r[e.offset]&AKe,o="0x";e.offset++;for(let s=0;s<n;s++,e.offset++)o+=r[e.offset].toString(16).padStart(2,"0");t=parseInt(o,16)}else t=r[e.offset],e.offset++;return t}function PS(r,e){RS(r,e);let t=[];for(;!(e.offset>=r.byteLength);){let n=BK(r,e);if(n===null)break;t.push(n)}return t}function IKe(r,e){let t=RS(r,e),n=e.offset,o=e.offset+t,s=[];for(let i=n;i<o;i++)i===n&&r[i]===0||s.push(r[i]);return e.offset+=t,Uint8Array.from(s)}function TKe(r,e){let t=RS(r,e),n=e.offset+t,o=r[e.offset];e.offset++;let s=0,i=0;o<40?(s=0,i=o):o<80?(s=1,i=o-40):(s=2,i=o-80);let a=`${s}.${i}`,c=[];for(;e.offset<n;){let l=r[e.offset];if(e.offset++,c.push(l&127),l<128){c.reverse();let u=0;for(let d=0;d<c.length;d++)u+=c[d]<<d*7;a+=`.${u}`,c=[]}}return a}function kKe(r,e){return e.offset++,null}function DKe(r,e){let t=RS(r,e),n=r[e.offset];e.offset++;let o=r.subarray(e.offset,e.offset+t-1);if(e.offset+=t,n!==0)throw new Error("Unused bits in bit string is unimplemented");return o}function _Ke(r,e){let t=RS(r,e),n=r.subarray(e.offset,e.offset+t);return e.offset+=t,n}function PKe(r){let e=r.toString(16);e.length%2===1&&(e="0"+e);let t=new Tr;for(let n=0;n<e.length;n+=2)t.append(Uint8Array.from([parseInt(`${e[n]}${e[n+1]}`,16)]));return t}function OK(r){if(r.byteLength<128)return Uint8Array.from([r.byteLength]);let e=PKe(r.byteLength);return new Tr(Uint8Array.from([e.byteLength|MK]),e)}function wde(r){let e=new Tr,t=128;return(r.subarray()[0]&t)===t&&e.append(Uint8Array.from([0])),e.append(r),new Tr(Uint8Array.from([2]),OK(e),e)}function xde(r){let e=Uint8Array.from([0]),t=new Tr(e,r);return new Tr(Uint8Array.from([3]),OK(t),t)}function xk(r,e=48){let t=new Tr;for(let n of r)t.append(n);return new Tr(Uint8Array.from([e]),OK(t),t)}var CKe,MK,AKe,bde,vde=_(()=>{Ul();CKe=parseInt("11111",2),MK=parseInt("10000000",2),AKe=parseInt("01111111",2),bde={0:PS,1:PS,2:IKe,3:DKe,4:_Ke,5:kKe,6:TKe,16:PS,22:PS,48:PS}});async function Ede(r,e,t,n){let o=await crypto.subtle.importKey("jwk",r,{name:"ECDSA",namedCurve:r.crv??"P-256"},!1,["verify"]);n?.signal?.throwIfAborted();let s=await crypto.subtle.verify({name:"ECDSA",hash:{name:"SHA-256"}},o,e,t.subarray());return n?.signal?.throwIfAborted(),s}var Sde=_(()=>{});function Cde(r){let e=BK(r);return Ade(e)}function Ade(r){let e=r[1][1][0],t=1,n,o;if(e.byteLength===NK*2+1)return n=pr(e.subarray(t,t+NK),"base64url"),o=pr(e.subarray(t+NK),"base64url"),new pb({...BKe,key_ops:["verify"],x:n,y:o});if(e.byteLength===UK*2+1)return n=pr(e.subarray(t,t+UK),"base64url"),o=pr(e.subarray(t+UK),"base64url"),new pb({...OKe,key_ops:["verify"],x:n,y:o});if(e.byteLength===FK*2+1)return n=pr(e.subarray(t,t+FK),"base64url"),o=pr(e.subarray(t+FK),"base64url"),new pb({...NKe,key_ops:["verify"],x:n,y:o});throw new hi(`coordinates were wrong length, got ${e.byteLength}, expected 65, 97 or 133`)}function Ide(r){return xk([wde(Uint8Array.from([1])),xk([UKe(r.crv)],160),xk([xde(new Tr(Uint8Array.from([4]),Ir(r.x??"","base64url"),Ir(r.y??"","base64url")))],161)]).subarray()}function UKe(r){if(r==="P-256")return RKe;if(r==="P-384")return LKe;if(r==="P-521")return MKe;throw new hi(`Invalid curve ${r}`)}var RKe,LKe,MKe,BKe,OKe,NKe,NK,UK,FK,KK=_(()=>{nc();Ul();rc();ef();vde();Tde();RKe=Uint8Array.from([6,8,42,134,72,206,61,3,1,7]),LKe=Uint8Array.from([6,5,43,129,4,0,34]),MKe=Uint8Array.from([6,5,43,129,4,0,35]),BKe={ext:!0,kty:"EC",crv:"P-256"},OKe={ext:!0,kty:"EC",crv:"P-384"},NKe={ext:!0,kty:"EC",crv:"P-521"},NK=32,UK=48,FK=66});var pb,Tde=_(()=>{Ll();ap();ip();cp();LS();KK();Sde();pb=class{type="ECDSA";jwk;_raw;constructor(e){this.jwk=e}get raw(){return this._raw==null&&(this._raw=Ide(this.jwk)),this._raw}toMultihash(){return ra.digest(mb(this))}toCID(){return Rn.createV1(114,this.toMultihash())}toString(){return hr.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Os(this.raw,e.raw)}async verify(e,t,n){return Ede(this.jwk,t,e,n)}}});function up(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function oc(r,e=""){if(!Number.isSafeInteger(r)||r<0){let t=e&&`"${e}" `;throw new Error(`${t}expected integer >= 0, got ${r}`)}}function ze(r,e,t=""){let n=up(r),o=r?.length,s=e!==void 0;if(!n||s&&o!==e){let i=t&&`"${t}" `,a=s?` of length ${e}`:"",c=n?`length=${o}`:`type=${typeof r}`;throw new Error(i+"expected Uint8Array"+a+", got "+c)}return r}function vk(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash must wrapped by utils.createHasher");oc(r.outputLen),oc(r.blockLen)}function gb(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function Dde(r,e){ze(r,void 0,"digestInto() output");let t=e.outputLen;if(r.length<t)throw new Error('"digestInto() output" expected to be of length >='+t)}function Kl(...r){for(let e=0;e<r.length;e++)r[e].fill(0)}function Ek(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function na(r,e){return r<<32-e|r>>>e}function zl(r){if(ze(r),_de)return r.toHex();let e="";for(let t=0;t<r.length;t++)e+=FKe[r[t]];return e}function kde(r){if(r>=Fl._0&&r<=Fl._9)return r-Fl._0;if(r>=Fl.A&&r<=Fl.F)return r-(Fl.A-10);if(r>=Fl.a&&r<=Fl.f)return r-(Fl.a-10)}function $l(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);if(_de)return Uint8Array.fromHex(r);let e=r.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(t);for(let o=0,s=0;o<t;o++,s+=2){let i=kde(r.charCodeAt(s)),a=kde(r.charCodeAt(s+1));if(i===void 0||a===void 0){let c=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[o]=i*16+a}return n}function os(...r){let e=0;for(let n=0;n<r.length;n++){let o=r[n];ze(o),e+=o.length}let t=new Uint8Array(e);for(let n=0,o=0;n<r.length;n++){let s=r[n];t.set(s,o),o+=s.length}return t}function zK(r,e={}){let t=(o,s)=>r(s).update(o).digest(),n=r(void 0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=o=>r(o),Object.assign(t,e),Object.freeze(t)}function yb(r=32){let e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return e.getRandomValues(new Uint8Array(r))}var _de,FKe,Fl,$K,dp=_(()=>{_de=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",FKe=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));Fl={_0:48,_9:57,A:65,F:70,a:97,f:102};$K=r=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,r])})});function Pde(r,e,t){return r&e^~r&t}function Rde(r,e,t){return r&e^r&t^e&t}var MS,Hl,Ln,Lde=_(()=>{dp();MS=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,o){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(e),this.view=Ek(this.buffer)}update(e){gb(this),ze(e);let{view:t,buffer:n,blockLen:o}=this,s=e.length;for(let i=0;i<s;){let a=Math.min(o-this.pos,s-i);if(a===o){let c=Ek(e);for(;o<=s-i;i+=o)this.process(c,i);continue}n.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){gb(this),Dde(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;t[i++]=128,Kl(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(n,0),i=0);for(let d=i;d<o;d++)t[d]=0;n.setBigUint64(o-8,BigInt(this.length*8),s),this.process(n,0);let a=Ek(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)a.setUint32(4*d,u[d],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:o,finished:s,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=s,e.length=o,e.pos=a,o%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}},Hl=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ln=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])});function KKe(r,e=!1){return e?{h:Number(r&Sk),l:Number(r>>Mde&Sk)}:{h:Number(r>>Mde&Sk)|0,l:Number(r&Sk)|0}}function Bde(r,e=!1){let t=r.length,n=new Uint32Array(t),o=new Uint32Array(t);for(let s=0;s<t;s++){let{h:i,l:a}=KKe(r[s],e);[n[s],o[s]]=[i,a]}return[n,o]}function sc(r,e,t,n){let o=(e>>>0)+(n>>>0);return{h:r+t+(o/2**32|0)|0,l:o|0}}var Sk,Mde,HK,VK,fp,hp,BS,OS,Ode,Nde,Ude,Fde,Kde,zde,$de=_(()=>{Sk=BigInt(4294967295),Mde=BigInt(32);HK=(r,e,t)=>r>>>t,VK=(r,e,t)=>r<<32-t|e>>>t,fp=(r,e,t)=>r>>>t|e<<32-t,hp=(r,e,t)=>r<<32-t|e>>>t,BS=(r,e,t)=>r<<64-t|e>>>t-32,OS=(r,e,t)=>r>>>t-32|e<<64-t;Ode=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),Nde=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Ude=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),Fde=(r,e,t,n,o)=>e+t+n+o+(r/2**32|0)|0,Kde=(r,e,t,n,o)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(o>>>0),zde=(r,e,t,n,o,s)=>e+t+n+o+s+(r/2**32|0)|0});var $Ke,rf,qK,jK,Hde,HKe,VKe,nf,of,GK,WK,Vde,qde,YK=_(()=>{Lde();$de();dp();$Ke=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]),rf=new Uint32Array(64),qK=class extends MS{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[e,t,n,o,s,i,a,c]}set(e,t,n,o,s,i,a,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}process(e,t){for(let d=0;d<16;d++,t+=4)rf[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let h=rf[d-15],p=rf[d-2],f=na(h,7)^na(h,18)^h>>>3,g=na(p,17)^na(p,19)^p>>>10;rf[d]=g+rf[d-7]+f+rf[d-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){let h=na(a,6)^na(a,11)^na(a,25),p=u+h+Pde(a,c,l)+$Ke[d]+rf[d]|0,g=(na(n,2)^na(n,13)^na(n,22))+Rde(n,o,s)|0;u=l,l=c,c=a,a=i+p|0,i=s,s=o,o=n,n=p+g|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(n,o,s,i,a,c,l,u)}roundClean(){Kl(rf)}destroy(){this.set(0,0,0,0,0,0,0,0),Kl(this.buffer)}},jK=class extends qK{A=Hl[0]|0;B=Hl[1]|0;C=Hl[2]|0;D=Hl[3]|0;E=Hl[4]|0;F=Hl[5]|0;G=Hl[6]|0;H=Hl[7]|0;constructor(){super(32)}},Hde=Bde(["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(r=>BigInt(r))),HKe=Hde[0],VKe=Hde[1],nf=new Uint32Array(80),of=new Uint32Array(80),GK=class extends MS{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:t,Bh:n,Bl:o,Ch:s,Cl:i,Dh:a,Dl:c,Eh:l,El:u,Fh:d,Fl:h,Gh:p,Gl:f,Hh:g,Hl:y}=this;return[e,t,n,o,s,i,a,c,l,u,d,h,p,f,g,y]}set(e,t,n,o,s,i,a,c,l,u,d,h,p,f,g,y){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=u|0,this.Fh=d|0,this.Fl=h|0,this.Gh=p|0,this.Gl=f|0,this.Hh=g|0,this.Hl=y|0}process(e,t){for(let b=0;b<16;b++,t+=4)nf[b]=e.getUint32(t),of[b]=e.getUint32(t+=4);for(let b=16;b<80;b++){let x=nf[b-15]|0,S=of[b-15]|0,T=fp(x,S,1)^fp(x,S,8)^HK(x,S,7),A=hp(x,S,1)^hp(x,S,8)^VK(x,S,7),v=nf[b-2]|0,C=of[b-2]|0,P=fp(v,C,19)^BS(v,C,61)^HK(v,C,6),F=hp(v,C,19)^OS(v,C,61)^VK(v,C,6),R=Ude(A,F,of[b-7],of[b-16]),k=Fde(R,T,P,nf[b-7],nf[b-16]);nf[b]=k|0,of[b]=R|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:a,Cl:c,Dh:l,Dl:u,Eh:d,El:h,Fh:p,Fl:f,Gh:g,Gl:y,Hh:m,Hl:w}=this;for(let b=0;b<80;b++){let x=fp(d,h,14)^fp(d,h,18)^BS(d,h,41),S=hp(d,h,14)^hp(d,h,18)^OS(d,h,41),T=d&p^~d&g,A=h&f^~h&y,v=Kde(w,S,A,VKe[b],of[b]),C=zde(v,m,x,T,HKe[b],nf[b]),P=v|0,F=fp(n,o,28)^BS(n,o,34)^BS(n,o,39),R=hp(n,o,28)^OS(n,o,34)^OS(n,o,39),k=n&s^n&a^s&a,I=o&i^o&c^i&c;m=g|0,w=y|0,g=p|0,y=f|0,p=d|0,f=h|0,{h:d,l:h}=sc(l|0,u|0,C|0,P|0),l=a|0,u=c|0,a=s|0,c=i|0,s=n|0,i=o|0;let E=Ode(P,R,I);n=Nde(E,C,F,k),o=E|0}({h:n,l:o}=sc(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=sc(this.Bh|0,this.Bl|0,s|0,i|0),{h:a,l:c}=sc(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:u}=sc(this.Dh|0,this.Dl|0,l|0,u|0),{h:d,l:h}=sc(this.Eh|0,this.El|0,d|0,h|0),{h:p,l:f}=sc(this.Fh|0,this.Fl|0,p|0,f|0),{h:g,l:y}=sc(this.Gh|0,this.Gl|0,g|0,y|0),{h:m,l:w}=sc(this.Hh|0,this.Hl|0,m|0,w|0),this.set(n,o,s,i,a,c,l,u,d,h,p,f,g,y,m,w)}roundClean(){Kl(nf,of)}destroy(){Kl(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},WK=class extends GK{Ah=Ln[0]|0;Al=Ln[1]|0;Bh=Ln[2]|0;Bl=Ln[3]|0;Ch=Ln[4]|0;Cl=Ln[5]|0;Dh=Ln[6]|0;Dl=Ln[7]|0;Eh=Ln[8]|0;El=Ln[9]|0;Fh=Ln[10]|0;Fl=Ln[11]|0;Gh=Ln[12]|0;Gl=Ln[13]|0;Hh=Ln[14]|0;Hl=Ln[15]|0;constructor(){super(64)}},Vde=zK(()=>new jK,$K(1)),qde=zK(()=>new WK,$K(3))});function Vl(r,e=""){if(typeof r!="boolean"){let t=e&&`"${e}" `;throw new Error(t+"expected boolean, got type="+typeof r)}return r}function jde(r){if(typeof r=="bigint"){if(!Ck(r))throw new Error("positive bigint expected, got "+r)}else oc(r);return r}function NS(r){let e=jde(r).toString(16);return e.length&1?"0"+e:e}function Gde(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return r===""?ZK:BigInt("0x"+r)}function bb(r){return Gde(zl(r))}function pp(r){return Gde(zl(Ik(ze(r)).reverse()))}function Ak(r,e){oc(e),r=jde(r);let t=$l(r.toString(16).padStart(e*2,"0"));if(t.length!==e)throw new Error("number too large");return t}function JK(r,e){return Ak(r,e).reverse()}function Ik(r){return Uint8Array.from(r)}function qKe(r,e,t){return Ck(r)&&Ck(e)&&Ck(t)&&e<=r&&r<t}function US(r,e,t,n){if(!qKe(e,t,n))throw new Error("expected valid "+r+": "+t+" <= n < "+n+", got "+e)}function QK(r){let e;for(e=0;r>ZK;r>>=XK,e+=1);return e}function Wde(r,e,t){if(oc(r,"hashLen"),oc(e,"qByteLen"),typeof t!="function")throw new Error("hmacFn must be a function");let n=y=>new Uint8Array(y),o=Uint8Array.of(),s=Uint8Array.of(0),i=Uint8Array.of(1),a=1e3,c=n(r),l=n(r),u=0,d=()=>{c.fill(1),l.fill(0),u=0},h=(...y)=>t(l,os(c,...y)),p=(y=o)=>{l=h(s,y),c=h(),y.length!==0&&(l=h(i,y),c=h())},f=()=>{if(u++>=a)throw new Error("drbg: tried max amount of iterations");let y=0,m=[];for(;y<e;){c=h();let w=c.slice();m.push(w),y+=c.length}return os(...m)};return(y,m)=>{d(),p(y);let w;for(;!(w=m(f()));)p();return d(),w}}function sf(r,e={},t={}){if(!r||typeof r!="object")throw new Error("expected valid options object");function n(s,i,a){let c=r[s];if(a&&c===void 0)return;let l=typeof c;if(l!==i||c===null)throw new Error(`param "${s}" is invalid: expected ${i}, got ${l}`)}let o=(s,i)=>Object.entries(s).forEach(([a,c])=>n(a,c,i));o(e,!1),o(t,!0)}function wb(r){let e=new WeakMap;return(t,...n)=>{let o=e.get(t);if(o!==void 0)return o;let s=r(t,...n);return e.set(t,s),s}}var ZK,XK,Ck,FS,KS=_(()=>{dp();dp();ZK=BigInt(0),XK=BigInt(1);Ck=r=>typeof r=="bigint"&&ZK<=r;FS=r=>(XK<<BigInt(r))-XK});function kr(r,e){let t=r%e;return t>=No?t:e+t}function Vt(r,e,t){let n=r;for(;e-- >No;)n*=n,n%=t;return n}function Yde(r,e){if(r===No)throw new Error("invert: expected non-zero number");if(e<=No)throw new Error("invert: expected positive modulus, got "+e);let t=kr(r,e),n=e,o=No,s=Qr,i=Qr,a=No;for(;t!==No;){let l=n/t,u=n%t,d=o-i*l,h=s-a*l;n=t,t=u,o=i,s=a,i=d,a=h}if(n!==Qr)throw new Error("invert: does not exist");return kr(o,e)}function t9(r,e,t){if(!r.eql(r.sqr(e),t))throw new Error("Cannot find square root")}function rfe(r,e){let t=(r.ORDER+Qr)/Jde,n=r.pow(e,t);return t9(r,n,e),n}function WKe(r,e){let t=(r.ORDER-Qde)/efe,n=r.mul(e,mp),o=r.pow(n,t),s=r.mul(e,o),i=r.mul(r.mul(s,mp),o),a=r.mul(s,r.sub(i,r.ONE));return t9(r,a,e),a}function YKe(r){let e=xb(r),t=nfe(r),n=t(e,e.neg(e.ONE)),o=t(e,n),s=t(e,e.neg(n)),i=(r+jKe)/tfe;return(a,c)=>{let l=a.pow(c,i),u=a.mul(l,n),d=a.mul(l,o),h=a.mul(l,s),p=a.eql(a.sqr(u),c),f=a.eql(a.sqr(d),c);l=a.cmov(l,u,p),u=a.cmov(h,d,f);let g=a.eql(a.sqr(u),c),y=a.cmov(l,u,g);return t9(a,y,c),y}}function nfe(r){if(r<Zde)throw new Error("sqrt is not defined for small field");let e=r-Qr,t=0;for(;e%mp===No;)e/=mp,t++;let n=mp,o=xb(r);for(;Xde(o,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(t===1)return rfe;let s=o.pow(n,e),i=(e+Qr)/mp;return function(c,l){if(c.is0(l))return l;if(Xde(c,l)!==1)throw new Error("Cannot find square root");let u=t,d=c.mul(c.ONE,s),h=c.pow(l,e),p=c.pow(l,i);for(;!c.eql(h,c.ONE);){if(c.is0(h))return c.ZERO;let f=1,g=c.sqr(h);for(;!c.eql(g,c.ONE);)if(f++,g=c.sqr(g),f===u)throw new Error("Cannot find square root");let y=Qr<<BigInt(u-f-1),m=c.pow(d,y);u=f,d=c.sqr(m),h=c.mul(h,d),p=c.mul(p,m)}return p}}function XKe(r){return r%Jde===Zde?rfe:r%efe===Qde?WKe:r%tfe===GKe?YKe(r):nfe(r)}function r9(r){let e={ORDER:"bigint",BYTES:"number",BITS:"number"},t=ZKe.reduce((n,o)=>(n[o]="function",n),e);return sf(r,t),r}function JKe(r,e,t){if(t<No)throw new Error("invalid exponent, negatives unsupported");if(t===No)return r.ONE;if(t===Qr)return e;let n=r.ONE,o=e;for(;t>No;)t&Qr&&(n=r.mul(n,o)),o=r.sqr(o),t>>=Qr;return n}function zS(r,e,t=!1){let n=new Array(e.length).fill(t?r.ZERO:void 0),o=e.reduce((i,a,c)=>r.is0(a)?i:(n[c]=i,r.mul(i,a)),r.ONE),s=r.inv(o);return e.reduceRight((i,a,c)=>r.is0(a)?i:(n[c]=r.mul(i,n[c]),r.mul(i,a)),s),n}function Xde(r,e){let t=(r.ORDER-Qr)/mp,n=r.pow(e,t),o=r.eql(n,r.ONE),s=r.eql(n,r.ZERO),i=r.eql(n,r.neg(r.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function QKe(r,e){e!==void 0&&oc(e);let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function xb(r,e={}){return new e9(r,e)}function sfe(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function n9(r){let e=sfe(r);return e+Math.ceil(e/2)}function o9(r,e,t=!1){ze(r);let n=r.length,o=sfe(e),s=n9(e);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let i=t?pp(r):bb(r),a=kr(i,e-Qr)+Qr;return t?JK(a,o):Ak(a,o)}var No,Qr,mp,Zde,Jde,Qde,jKe,efe,GKe,tfe,ofe,ZKe,e9,$S=_(()=>{KS();No=BigInt(0),Qr=BigInt(1),mp=BigInt(2),Zde=BigInt(3),Jde=BigInt(4),Qde=BigInt(5),jKe=BigInt(7),efe=BigInt(8),GKe=BigInt(9),tfe=BigInt(16);ofe=(r,e)=>(kr(r,e)&Qr)===Qr,ZKe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];e9=class{ORDER;BITS;BYTES;isLE;ZERO=No;ONE=Qr;_lengths;_sqrt;_mod;constructor(e,t={}){if(e<=No)throw new Error("invalid field: expected ORDER > 0, got "+e);let n;this.isLE=!1,t!=null&&typeof t=="object"&&(typeof t.BITS=="number"&&(n=t.BITS),typeof t.sqrt=="function"&&(this.sqrt=t.sqrt),typeof t.isLE=="boolean"&&(this.isLE=t.isLE),t.allowedLengths&&(this._lengths=t.allowedLengths?.slice()),typeof t.modFromBytes=="boolean"&&(this._mod=t.modFromBytes));let{nBitLength:o,nByteLength:s}=QKe(e,n);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=o,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(e){return kr(e,this.ORDER)}isValid(e){if(typeof e!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof e);return No<=e&&e<this.ORDER}is0(e){return e===No}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&Qr)===Qr}neg(e){return kr(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return kr(e*e,this.ORDER)}add(e,t){return kr(e+t,this.ORDER)}sub(e,t){return kr(e-t,this.ORDER)}mul(e,t){return kr(e*t,this.ORDER)}pow(e,t){return JKe(this,e,t)}div(e,t){return kr(e*Yde(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return Yde(e,this.ORDER)}sqrt(e){return this._sqrt||(this._sqrt=XKe(this.ORDER)),this._sqrt(this,e)}toBytes(e){return this.isLE?JK(e,this.BYTES):Ak(e,this.BYTES)}fromBytes(e,t=!1){ze(e);let{_lengths:n,BYTES:o,isLE:s,ORDER:i,_mod:a}=this;if(n){if(!n.includes(e.length)||e.length>o)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+e.length);let l=new Uint8Array(o);l.set(e,s?0:l.length-e.length),e=l}if(e.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);let c=s?pp(e):bb(e);if(a&&(c=kr(c,i)),!t&&!this.isValid(c))throw new Error("invalid field element: outside of range 0..ORDER");return c}invertBatch(e){return zS(this,e)}cmov(e,t,n){return n?t:e}}});function HS(r,e){let t=e.negate();return r?t:e}function yp(r,e){let t=zS(r.Fp,e.map(n=>n.Z));return e.map((n,o)=>r.fromAffine(n.toAffine(t[o])))}function lfe(r,e){if(!Number.isSafeInteger(r)||r<=0||r>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+r)}function s9(r,e){lfe(r,e);let t=Math.ceil(e/r)+1,n=2**(r-1),o=2**r,s=FS(r),i=BigInt(r);return{windows:t,windowSize:n,mask:s,maxNumber:o,shiftBy:i}}function ife(r,e,t){let{windowSize:n,mask:o,maxNumber:s,shiftBy:i}=t,a=Number(r&o),c=r>>i;a>n&&(a-=s,c+=gp);let l=e*n,u=l+Math.abs(a)-1,d=a===0,h=a<0,p=e%2!==0;return{nextN:c,offset:u,isZero:d,isNeg:h,isNegF:p,offsetF:l}}function a9(r){return ufe.get(r)||1}function afe(r){if(r!==vb)throw new Error("invalid wNAF")}function dfe(r,e,t,n){let o=e,s=r.ZERO,i=r.ZERO;for(;t>vb||n>vb;)t&gp&&(s=s.add(o)),n&gp&&(i=i.add(o)),o=o.double(),t>>=gp,n>>=gp;return{p1:s,p2:i}}function cfe(r,e,t){if(e){if(e.ORDER!==r)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return r9(e),e}else return xb(r,{isLE:t})}function Tk(r,e,t={},n){if(n===void 0&&(n=r==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${r} CURVE object`);for(let c of["p","n","h"]){let l=e[c];if(!(typeof l=="bigint"&&l>vb))throw new Error(`CURVE.${c} must be positive bigint`)}let o=cfe(e.p,t.Fp,n),s=cfe(e.n,t.Fn,n),a=["Gx","Gy","a",r==="weierstrass"?"b":"d"];for(let c of a)if(!o.isValid(e[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:o,Fn:s}}function kk(r,e){return function(n){let o=r(n);return{secretKey:o,publicKey:e(o)}}}var vb,gp,i9,ufe,Eb,c9=_(()=>{KS();$S();vb=BigInt(0),gp=BigInt(1);i9=new WeakMap,ufe=new WeakMap;Eb=class{BASE;ZERO;Fn;bits;constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,n=this.ZERO){let o=e;for(;t>vb;)t&gp&&(n=n.add(o)),o=o.double(),t>>=gp;return n}precomputeWindow(e,t){let{windows:n,windowSize:o}=s9(t,this.bits),s=[],i=e,a=i;for(let c=0;c<n;c++){a=i,s.push(a);for(let l=1;l<o;l++)a=a.add(i),s.push(a);i=a.double()}return s}wNAF(e,t,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE,i=s9(e,this.bits);for(let a=0;a<i.windows;a++){let{nextN:c,offset:l,isZero:u,isNeg:d,isNegF:h,offsetF:p}=ife(n,a,i);n=c,u?s=s.add(HS(h,t[p])):o=o.add(HS(d,t[l]))}return afe(n),{p:o,f:s}}wNAFUnsafe(e,t,n,o=this.ZERO){let s=s9(e,this.bits);for(let i=0;i<s.windows&&n!==vb;i++){let{nextN:a,offset:c,isZero:l,isNeg:u}=ife(n,i,s);if(n=a,!l){let d=t[c];o=o.add(u?d.negate():d)}}return afe(n),o}getPrecomputes(e,t,n){let o=i9.get(t);return o||(o=this.precomputeWindow(t,e),e!==1&&(typeof n=="function"&&(o=n(o)),i9.set(t,o))),o}cached(e,t,n){let o=a9(e);return this.wNAF(o,this.getPrecomputes(o,e,n),t)}unsafe(e,t,n,o){let s=a9(e);return s===1?this._unsafeLadder(e,t,o):this.wNAFUnsafe(s,this.getPrecomputes(s,e,n),t,o)}createCache(e,t){lfe(t,this.bits),ufe.set(e,t),i9.delete(e)}hasCache(e){return a9(e)!==1}}});function t9e(r,e,t,n){let o=r.sqr(t),s=r.sqr(n),i=r.add(r.mul(e.a,o),s),a=r.add(r.ONE,r.mul(e.d,r.mul(o,s)));return r.eql(i,a)}function ffe(r,e={}){let t=Tk("edwards",r,e,e.FpFnLE),{Fp:n,Fn:o}=t,s=t.CURVE,{h:i}=s;sf(e,{},{uvRatio:"function"});let a=l9<<BigInt(o.BYTES*8)-en,c=y=>n.create(y),l=e.uvRatio||((y,m)=>{try{return{isValid:!0,value:n.sqrt(n.div(y,m))}}catch{return{isValid:!1,value:af}}});if(!t9e(n,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function u(y,m,w=!1){let b=w?en:af;return US("coordinate "+y,m,b,a),m}function d(y){if(!(y instanceof f))throw new Error("EdwardsPoint expected")}let h=wb((y,m)=>{let{X:w,Y:b,Z:x}=y,S=y.is0();m==null&&(m=S?e9e:n.inv(x));let T=c(w*m),A=c(b*m),v=n.mul(x,m);if(S)return{x:af,y:en};if(v!==en)throw new Error("invZ was invalid");return{x:T,y:A}}),p=wb(y=>{let{a:m,d:w}=s;if(y.is0())throw new Error("bad point: ZERO");let{X:b,Y:x,Z:S,T}=y,A=c(b*b),v=c(x*x),C=c(S*S),P=c(C*C),F=c(A*m),R=c(C*c(F+v)),k=c(P+c(w*c(A*v)));if(R!==k)throw new Error("bad point: equation left != right (1)");let I=c(b*x),E=c(S*T);if(I!==E)throw new Error("bad point: equation left != right (2)");return!0});class f{static BASE=new f(s.Gx,s.Gy,en,c(s.Gx*s.Gy));static ZERO=new f(af,en,en,af);static Fp=n;static Fn=o;X;Y;Z;T;constructor(m,w,b,x){this.X=u("x",m),this.Y=u("y",w),this.Z=u("z",b,!0),this.T=u("t",x),Object.freeze(this)}static CURVE(){return s}static fromAffine(m){if(m instanceof f)throw new Error("extended point not allowed");let{x:w,y:b}=m||{};return u("x",w),u("y",b),new f(w,b,en,c(w*b))}static fromBytes(m,w=!1){let b=n.BYTES,{a:x,d:S}=s;m=Ik(ze(m,b,"point")),Vl(w,"zip215");let T=Ik(m),A=m[b-1];T[b-1]=A&-129;let v=pp(T),C=w?a:n.ORDER;US("point.y",v,af,C);let P=c(v*v),F=c(P-en),R=c(S*P-x),{isValid:k,value:I}=l(F,R);if(!k)throw new Error("bad point: invalid y coordinate");let E=(I&en)===en,D=(A&128)!==0;if(!w&&I===af&&D)throw new Error("bad point: x=0 and x_0=1");return D!==E&&(I=c(-I)),f.fromAffine({x:I,y:v})}static fromHex(m,w=!1){return f.fromBytes($l(m),w)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(m=8,w=!0){return g.createCache(this,m),w||this.multiply(l9),this}assertValidity(){p(this)}equals(m){d(m);let{X:w,Y:b,Z:x}=this,{X:S,Y:T,Z:A}=m,v=c(w*A),C=c(S*x),P=c(b*A),F=c(T*x);return v===C&&P===F}is0(){return this.equals(f.ZERO)}negate(){return new f(c(-this.X),this.Y,this.Z,c(-this.T))}double(){let{a:m}=s,{X:w,Y:b,Z:x}=this,S=c(w*w),T=c(b*b),A=c(l9*c(x*x)),v=c(m*S),C=w+b,P=c(c(C*C)-S-T),F=v+T,R=F-A,k=v-T,I=c(P*R),E=c(F*k),D=c(P*k),M=c(R*F);return new f(I,E,M,D)}add(m){d(m);let{a:w,d:b}=s,{X:x,Y:S,Z:T,T:A}=this,{X:v,Y:C,Z:P,T:F}=m,R=c(x*v),k=c(S*C),I=c(A*b*F),E=c(T*P),D=c((x+S)*(v+C)-R-k),M=E-I,B=E+I,L=c(k-w*R),O=c(D*M),U=c(B*L),$=c(D*L),J=c(M*B);return new f(O,U,J,$)}subtract(m){return this.add(m.negate())}multiply(m){if(!o.isValidNot0(m))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:w,f:b}=g.cached(this,m,x=>yp(f,x));return yp(f,[w,b])[0]}multiplyUnsafe(m,w=f.ZERO){if(!o.isValid(m))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return m===af?f.ZERO:this.is0()||m===en?this:g.unsafe(this,m,b=>yp(f,b),w)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}isTorsionFree(){return g.unsafe(this,s.n).is0()}toAffine(m){return h(this,m)}clearCofactor(){return i===en?this:this.multiplyUnsafe(i)}toBytes(){let{x:m,y:w}=this.toAffine(),b=n.toBytes(w);return b[b.length-1]|=m&en?128:0,b}toHex(){return zl(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let g=new Eb(f,o.BITS);return f.BASE.precompute(8),f}function hfe(r,e,t={}){if(typeof e!="function")throw new Error('"hash" function param is required');sf(t,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=t,{BASE:o,Fp:s,Fn:i}=r,a=t.randomBytes||yb,c=t.adjustScalarBytes||(v=>v),l=t.domain||((v,C,P)=>{if(Vl(P,"phflag"),C.length||P)throw new Error("Contexts/pre-hash are not supported");return v});function u(v){return i.create(pp(v))}function d(v){let C=b.secretKey;ze(v,b.secretKey,"secretKey");let P=ze(e(v),2*C,"hashedSecretKey"),F=c(P.slice(0,C)),R=P.slice(C,2*C),k=u(F);return{head:F,prefix:R,scalar:k}}function h(v){let{head:C,prefix:P,scalar:F}=d(v),R=o.multiply(F),k=R.toBytes();return{head:C,prefix:P,scalar:F,point:R,pointBytes:k}}function p(v){return h(v).pointBytes}function f(v=Uint8Array.of(),...C){let P=os(...C);return u(e(l(P,ze(v,void 0,"context"),!!n)))}function g(v,C,P={}){v=ze(v,void 0,"message"),n&&(v=n(v));let{prefix:F,scalar:R,pointBytes:k}=h(C),I=f(P.context,F,v),E=o.multiply(I).toBytes(),D=f(P.context,E,k,v),M=i.create(I+D*R);if(!i.isValid(M))throw new Error("sign failed: invalid s");let B=os(E,i.toBytes(M));return ze(B,b.signature,"result")}let y={zip215:!0};function m(v,C,P,F=y){let{context:R,zip215:k}=F,I=b.signature;v=ze(v,I,"signature"),C=ze(C,void 0,"message"),P=ze(P,b.publicKey,"publicKey"),k!==void 0&&Vl(k,"zip215"),n&&(C=n(C));let E=I/2,D=v.subarray(0,E),M=pp(v.subarray(E,I)),B,L,O;try{B=r.fromBytes(P,k),L=r.fromBytes(D,k),O=o.multiplyUnsafe(M)}catch{return!1}if(!k&&B.isSmallOrder())return!1;let U=f(R,L.toBytes(),B.toBytes(),C);return L.add(B.multiplyUnsafe(U)).subtract(O).clearCofactor().is0()}let w=s.BYTES,b={secretKey:w,publicKey:w,signature:2*w,seed:w};function x(v=a(b.seed)){return ze(v,b.seed,"seed")}function S(v){return up(v)&&v.length===i.BYTES}function T(v,C){try{return!!r.fromBytes(v,C)}catch{return!1}}let A={getExtendedPublicKey:h,randomSecretKey:x,isValidSecretKey:S,isValidPublicKey:T,toMontgomery(v){let{y:C}=r.fromBytes(v),P=b.publicKey,F=P===32;if(!F&&P!==57)throw new Error("only defined for 25519 and 448");let R=F?s.div(en+C,en-C):s.div(C-en,C+en);return s.toBytes(R)},toMontgomerySecret(v){let C=b.secretKey;ze(v,C);let P=e(v.subarray(0,C));return c(P).subarray(0,C)}};return Object.freeze({keygen:kk(x,p),getPublicKey:p,sign:g,verify:m,utils:A,Point:r,lengths:b})}var af,en,l9,e9e,pfe=_(()=>{KS();c9();af=BigInt(0),en=BigInt(1),l9=BigInt(2),e9e=BigInt(8)});function i9e(r){let e=BigInt(10),t=BigInt(20),n=BigInt(40),o=BigInt(80),s=u9,a=r*r%s*r%s,c=Vt(a,mfe,s)*a%s,l=Vt(c,r9e,s)*r%s,u=Vt(l,n9e,s)*l%s,d=Vt(u,e,s)*u%s,h=Vt(d,t,s)*d%s,p=Vt(h,n,s)*h%s,f=Vt(p,o,s)*p%s,g=Vt(f,o,s)*p%s,y=Vt(g,e,s)*u%s;return{pow_p_5_8:Vt(y,mfe,s)*r%s,b2:a}}function a9e(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function c9e(r,e){let t=u9,n=kr(e*e*e,t),o=kr(n*n*e,t),s=i9e(r*o).pow_p_5_8,i=kr(r*n*s,t),a=kr(e*i*i,t),c=i,l=kr(i*gfe,t),u=a===r,d=a===kr(-r,t),h=a===kr(-r*gfe,t);return u&&(i=c),(d||h)&&(i=l),ofe(i,t)&&(i=kr(-i,t)),{isValid:u||d,value:i}}function u9e(r){return hfe(l9e,qde,Object.assign({adjustScalarBytes:a9e},r))}var r9e,mfe,n9e,o9e,u9,s9e,gfe,l9e,yfe,bfe=_(()=>{YK();pfe();$S();r9e=BigInt(1),mfe=BigInt(2),n9e=BigInt(5),o9e=BigInt(8),u9=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),s9e={p:u9,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:o9e,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};gfe=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");l9e=ffe(s9e,{uvRatio:c9e});yfe=u9e({})});async function f9e(r,e,t){if(r.buffer instanceof ArrayBuffer){let n=await pk.get().subtle.importKey("raw",r.buffer,{name:"Ed25519"},!1,["verify"]);return await pk.get().subtle.verify({name:"Ed25519"},n,e,t instanceof Uint8Array?t:t.subarray())}throw new TypeError("WebCrypto does not support SharedArrayBuffer for Ed25519 keys")}function h9e(r,e,t){return yfe.verify(e,t instanceof Uint8Array?t:t.subarray(),r)}async function wfe(r,e,t){return d9==null&&(d9=await d9e),d9?f9e(r,e,t):h9e(r,e,t)}var Dk,d9,d9e,f9=_(()=>{bfe();ef();Gue();Dk=32,d9e=(async()=>{try{return await pk.get().subtle.generateKey({name:"Ed25519"},!0,["sign","verify"]),!0}catch{return!1}})()});function _k(r){return r==null?!1:typeof r.then=="function"&&typeof r.catch=="function"&&typeof r.finally=="function"}var h9=_(()=>{IS();rc()});var Pk,vfe=_(()=>{Ll();ap();ip();cp();h9();LS();m9();f9();Pk=class{type="Ed25519";raw;constructor(e){this.raw=p9(e,Dk)}toMultihash(){return ra.digest(mb(this))}toCID(){return Rn.createV1(114,this.toMultihash())}toString(){return hr.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Os(this.raw,e.raw)}verify(e,t,n){n?.signal?.throwIfAborted();let o=wfe(this.raw,t,e);return _k(o)?o.then(s=>(n?.signal?.throwIfAborted(),s)):o}}});function Efe(r){return r=p9(r,Dk),new Pk(r)}function p9(r,e){if(r=Uint8Array.from(r??[]),r.length!==e)throw new hi(`Key must be a Uint8Array of length ${e}, got ${r.length}`);return r}var m9=_(()=>{nc();vfe();f9()});function Sfe(r,e,t){g9[0]=r,e[t]=cf[0],e[t+1]=cf[1],e[t+2]=cf[2],e[t+3]=cf[3]}function Cfe(r,e){return cf[0]=r[e],cf[1]=r[e+1],cf[2]=r[e+2],cf[3]=r[e+3],g9[0]}function Afe(r,e,t){y9[0]=r,e[t]=lo[0],e[t+1]=lo[1],e[t+2]=lo[2],e[t+3]=lo[3],e[t+4]=lo[4],e[t+5]=lo[5],e[t+6]=lo[6],e[t+7]=lo[7]}function Ife(r,e){return lo[0]=r[e],lo[1]=r[e+1],lo[2]=r[e+2],lo[3]=r[e+3],lo[4]=r[e+4],lo[5]=r[e+5],lo[6]=r[e+6],lo[7]=r[e+7],y9[0]}var g9,cf,y9,lo,b9=_(()=>{g9=new Float32Array([-0]),cf=new Uint8Array(g9.buffer);y9=new Float64Array([-0]),lo=new Uint8Array(y9.buffer)});var m9e,g9e,Ns,bp,Tfe,w9=_(()=>{m9e=BigInt(Number.MAX_SAFE_INTEGER),g9e=BigInt(Number.MIN_SAFE_INTEGER),Ns=class r{lo;hi;constructor(e,t){this.lo=e|0,this.hi=t|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(BigInt(t)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return bp;if(e<m9e&&e>g9e)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let n=e>>32n,o=e-(n<<32n);return t&&(n=~n|0n,o=~o|0n,++o>Tfe&&(o=0n,++n>Tfe&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(e){if(e===0)return bp;let t=e<0;t&&(e=-e);let n=e>>>0,o=(e-n)/4294967296>>>0;return t&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(e){return typeof e=="number"?r.fromNumber(e):typeof e=="bigint"?r.fromBigInt(e):typeof e=="string"?r.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new r(e.low>>>0,e.high>>>0):bp}},bp=new Ns(0,0);bp.toBigInt=function(){return 0n};bp.zzEncode=bp.zzDecode=function(){return this};bp.length=function(){return 1};Tfe=4294967296n});function kfe(r){let e=0,t=0;for(let n=0;n<r.length;++n)t=r.charCodeAt(n),t<128?e+=1:t<2048?e+=2:(t&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function Dfe(r,e,t){if(t-e<1)return"";let o,s=[],i=0,a;for(;e<t;)a=r[e++],a<128?s[i++]=a:a>191&&a<224?s[i++]=(a&31)<<6|r[e++]&63:a>239&&a<365?(a=((a&7)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,s[i++]=55296+(a>>10),s[i++]=56320+(a&1023)):s[i++]=(a&15)<<12|(r[e++]&63)<<6|r[e++]&63,i>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o!=null?(i>0&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))}function x9(r,e,t){let n=t,o,s;for(let i=0;i<r.length;++i)o=r.charCodeAt(i),o<128?e[t++]=o:o<2048?(e[t++]=o>>6|192,e[t++]=o&63|128):(o&64512)===55296&&((s=r.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,e[t++]=o>>18|240,e[t++]=o>>12&63|128,e[t++]=o>>6&63|128,e[t++]=o&63|128):(e[t++]=o>>12|224,e[t++]=o>>6&63|128,e[t++]=o&63|128);return t-n}var v9=_(()=>{});function oa(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function Rk(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}function S9(r){return new E9(r instanceof Uint8Array?r:r.subarray())}var E9,C9=_(()=>{Ol();b9();w9();v9();E9=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,oa(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw oa(this,4);return Rk(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw oa(this,4);return Rk(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw oa(this,4);let e=Cfe(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw oa(this,4);let e=Ife(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw oa(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return Dfe(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw oa(this,e);this.pos+=e}else do if(this.pos>=this.len)throw oa(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new Ns(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw oa(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw oa(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw oa(this,8);let e=Rk(this.buf,this.pos+=4),t=Rk(this.buf,this.pos+=4);return new Ns(e,t)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=CK(this.buf,this.pos);return this.pos+=Jr(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}}});function Lk(r,e,t){let n=S9(r);return e.decode(n,void 0,t)}var Pfe=_(()=>{C9()});function A9(r){let e=r??8192,t=e>>>1,n,o=e;return function(i){if(i<1||i>t)return ao(i);o+i>e&&(n=ao(e),o=0);let a=n.subarray(o,o+=i);return(o&7)!==0&&(o=(o|7)+1),a}}var Rfe=_(()=>{Qd()});function I9(){}function b9e(r){return globalThis.Buffer!=null?ao(r):y9e(r)}function T9(r,e,t){e[t]=r&255}function w9e(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function Mk(r,e,t){for(;r.hi!==0;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}function VS(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function x9e(r,e,t){e.set(r,t)}function v9e(r,e,t){e.set(r,t)}function E9e(r,e,t){r.length<40?x9(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(Ir(r),t)}function _9(){return new qS}var wp,k9,y9e,qS,D9,P9=_(()=>{Ol();Qd();rc();b9();w9();Rfe();v9();wp=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};k9=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},y9e=A9();qS=class{len;head;tail;states;constructor(){this.len=0,this.head=new wp(I9,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new wp(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new D9((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(Mk,10,Ns.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=Ns.fromBigInt(e);return this._push(Mk,t.length(),t)}uint64Number(e){return this._push(db,Jr(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let t=Ns.fromBigInt(e).zzEncode();return this._push(Mk,t.length(),t)}sint64Number(e){let t=Ns.fromNumber(e).zzEncode();return this._push(Mk,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(T9,1,e?1:0)}fixed32(e){return this._push(VS,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=Ns.fromBigInt(e);return this._push(VS,4,t.lo)._push(VS,4,t.hi)}fixed64Number(e){let t=Ns.fromNumber(e);return this._push(VS,4,t.lo)._push(VS,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(Sfe,4,e)}double(e){return this._push(Afe,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(T9,1,0):this.uint32(t)._push(x9e,t,e)}string(e){let t=kfe(e);return t!==0?this.uint32(t)._push(x9,t,e):this._push(T9,1,0)}fork(){return this.states=new k9(this),this.head=this.tail=new wp(I9,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new wp(I9,0,0),this.len=0),this}ldelim(){let e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=t,this.len+=n),this}finish(){let e=this.head.next,t=b9e(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};D9=class extends wp{next;constructor(e,t){super(w9e,e,t),this.next=void 0}};globalThis.Buffer!=null&&(qS.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(v9e,e,r),this},qS.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(E9e,e,r),this})});function Bk(r,e){let t=_9();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var Lfe=_(()=>{P9()});function Ok(r,e,t,n){return{name:r,type:e,encode:t,decode:n}}var Sb,R9=_(()=>{(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(Sb||(Sb={}))});function L9(r){function e(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let t=function(s,i){let a=e(s);i.int32(a)},n=function(s){let i=s.int32();return e(i)};return Ok("enum",Sb.VARINT,t,n)}var Mfe=_(()=>{R9()});function Nk(r,e){return Ok("message",Sb.LENGTH_DELIMITED,r,e)}var Bfe=_(()=>{R9()});var Ofe=_(()=>{Pfe();Lfe();Mfe();Bfe();C9();P9()});var Us,M9,jS,B9,Nfe=_(()=>{Ofe();(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1",r.ECDSA="ECDSA"})(Us||(Us={}));(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1",r[r.ECDSA=3]="ECDSA"})(M9||(M9={}));(function(r){r.codec=()=>L9(M9)})(Us||(Us={}));(function(r){let e;r.codec=()=>(e==null&&(e=Nk((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),Us.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let s={},i=n==null?t.len:t.pos+n;for(;t.pos<i;){let a=t.uint32();switch(a>>>3){case 1:{s.Type=Us.codec().decode(t);break}case 2:{s.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>Bk(t,r.codec()),r.decode=(t,n)=>Lk(t,r.codec(),n)})(jS||(jS={}));(function(r){let e;r.codec=()=>(e==null&&(e=Nk((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),Us.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let s={},i=n==null?t.len:t.pos+n;for(;t.pos<i;){let a=t.uint32();switch(a>>>3){case 1:{s.Type=Us.codec().decode(t);break}case 2:{s.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>Bk(t,r.codec()),r.decode=(t,n)=>Lk(t,r.codec(),n)})(B9||(B9={}))});var Uk,O9,Ufe=_(()=>{dp();Uk=class{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){if(vk(e),ze(t,void 0,"key"),this.iHash=e.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;let n=this.blockLen,o=new Uint8Array(n);o.set(t.length>n?e.create().update(t).digest():t);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),Kl(o)}update(e){return gb(this),this.iHash.update(e),this}digestInto(e){gb(this),ze(e,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:a}=this;return e=e,e.finished=o,e.destroyed=s,e.blockLen=i,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},O9=(r,e,t)=>new Uk(r,e).update(t).digest();O9.create=(r,e)=>new Uk(r,e)});function C9e(r,e,t){let[[n,o],[s,i]]=e,a=Ffe(i*r,t),c=Ffe(-o*r,t),l=r-a*n-c*s,u=-a*o-c*i,d=l<ql,h=u<ql;d&&(l=-l),h&&(u=-u);let p=FS(Math.ceil(QK(t)/2))+Cb;if(l<ql||l>=p||u<ql||u>=p)throw new Error("splitScalar (endomorphism): failed, k="+r);return{k1neg:d,k1:l,k2neg:h,k2:u}}function U9(r){if(!["compact","recovered","der"].includes(r))throw new Error('Signature format must be "compact", "recovered", or "der"');return r}function N9(r,e){let t={};for(let n of Object.keys(e))t[n]=r[n]===void 0?e[n]:r[n];return Vl(t.lowS,"lowS"),Vl(t.prehash,"prehash"),t.format!==void 0&&U9(t.format),t}function zfe(r,e={}){let t=Tk("weierstrass",r,e),{Fp:n,Fn:o}=t,s=t.CURVE,{h:i,n:a}=s;sf(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:c}=e;if(c&&(!n.is0(s.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let l=Hfe(n,o);function u(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function d(R,k,I){let{x:E,y:D}=k.toAffine(),M=n.toBytes(E);if(Vl(I,"isCompressed"),I){u();let B=!n.isOdd(D);return os($fe(B),M)}else return os(Uint8Array.of(4),M,n.toBytes(D))}function h(R){ze(R,void 0,"Point");let{publicKey:k,publicKeyUncompressed:I}=l,E=R.length,D=R[0],M=R.subarray(1);if(E===k&&(D===2||D===3)){let B=n.fromBytes(M);if(!n.isValid(B))throw new Error("bad point: is not on curve, wrong x");let L=g(B),O;try{O=n.sqrt(L)}catch(J){let X=J instanceof Error?": "+J.message:"";throw new Error("bad point: is not on curve, sqrt error"+X)}u();let U=n.isOdd(O);return(D&1)===1!==U&&(O=n.neg(O)),{x:B,y:O}}else if(E===I&&D===4){let B=n.BYTES,L=n.fromBytes(M.subarray(0,B)),O=n.fromBytes(M.subarray(B,B*2));if(!y(L,O))throw new Error("bad point: is not on curve");return{x:L,y:O}}else throw new Error(`bad point: got length ${E}, expected compressed=${k} or uncompressed=${I}`)}let p=e.toBytes||d,f=e.fromBytes||h;function g(R){let k=n.sqr(R),I=n.mul(k,R);return n.add(n.add(I,n.mul(R,s.a)),s.b)}function y(R,k){let I=n.sqr(k),E=g(R);return n.eql(I,E)}if(!y(s.Gx,s.Gy))throw new Error("bad curve params: generator point");let m=n.mul(n.pow(s.a,Fk),A9e),w=n.mul(n.sqr(s.b),BigInt(27));if(n.is0(n.add(m,w)))throw new Error("bad curve params: a or b");function b(R,k,I=!1){if(!n.isValid(k)||I&&n.is0(k))throw new Error(`bad point coordinate ${R}`);return k}function x(R){if(!(R instanceof C))throw new Error("Weierstrass Point expected")}function S(R){if(!c||!c.basises)throw new Error("no endo");return C9e(R,c.basises,o.ORDER)}let T=wb((R,k)=>{let{X:I,Y:E,Z:D}=R;if(n.eql(D,n.ONE))return{x:I,y:E};let M=R.is0();k==null&&(k=M?n.ONE:n.inv(D));let B=n.mul(I,k),L=n.mul(E,k),O=n.mul(D,k);if(M)return{x:n.ZERO,y:n.ZERO};if(!n.eql(O,n.ONE))throw new Error("invZ was invalid");return{x:B,y:L}}),A=wb(R=>{if(R.is0()){if(e.allowInfinityPoint&&!n.is0(R.Y))return;throw new Error("bad point: ZERO")}let{x:k,y:I}=R.toAffine();if(!n.isValid(k)||!n.isValid(I))throw new Error("bad point: x or y not field elements");if(!y(k,I))throw new Error("bad point: equation left != right");if(!R.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function v(R,k,I,E,D){return I=new C(n.mul(I.X,R),I.Y,I.Z),k=HS(E,k),I=HS(D,I),k.add(I)}class C{static BASE=new C(s.Gx,s.Gy,n.ONE);static ZERO=new C(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=o;X;Y;Z;constructor(k,I,E){this.X=b("x",k),this.Y=b("y",I,!0),this.Z=b("z",E),Object.freeze(this)}static CURVE(){return s}static fromAffine(k){let{x:I,y:E}=k||{};if(!k||!n.isValid(I)||!n.isValid(E))throw new Error("invalid affine point");if(k instanceof C)throw new Error("projective point not allowed");return n.is0(I)&&n.is0(E)?C.ZERO:new C(I,E,n.ONE)}static fromBytes(k){let I=C.fromAffine(f(ze(k,void 0,"point")));return I.assertValidity(),I}static fromHex(k){return C.fromBytes($l(k))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(k=8,I=!0){return F.createCache(this,k),I||this.multiply(Fk),this}assertValidity(){A(this)}hasEvenY(){let{y:k}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(k)}equals(k){x(k);let{X:I,Y:E,Z:D}=this,{X:M,Y:B,Z:L}=k,O=n.eql(n.mul(I,L),n.mul(M,D)),U=n.eql(n.mul(E,L),n.mul(B,D));return O&&U}negate(){return new C(this.X,n.neg(this.Y),this.Z)}double(){let{a:k,b:I}=s,E=n.mul(I,Fk),{X:D,Y:M,Z:B}=this,L=n.ZERO,O=n.ZERO,U=n.ZERO,$=n.mul(D,D),J=n.mul(M,M),X=n.mul(B,B),N=n.mul(D,M);return N=n.add(N,N),U=n.mul(D,B),U=n.add(U,U),L=n.mul(k,U),O=n.mul(E,X),O=n.add(L,O),L=n.sub(J,O),O=n.add(J,O),O=n.mul(L,O),L=n.mul(N,L),U=n.mul(E,U),X=n.mul(k,X),N=n.sub($,X),N=n.mul(k,N),N=n.add(N,U),U=n.add($,$),$=n.add(U,$),$=n.add($,X),$=n.mul($,N),O=n.add(O,$),X=n.mul(M,B),X=n.add(X,X),$=n.mul(X,N),L=n.sub(L,$),U=n.mul(X,J),U=n.add(U,U),U=n.add(U,U),new C(L,O,U)}add(k){x(k);let{X:I,Y:E,Z:D}=this,{X:M,Y:B,Z:L}=k,O=n.ZERO,U=n.ZERO,$=n.ZERO,J=s.a,X=n.mul(s.b,Fk),N=n.mul(I,M),H=n.mul(E,B),Z=n.mul(D,L),ae=n.add(I,E),Q=n.add(M,B);ae=n.mul(ae,Q),Q=n.add(N,H),ae=n.sub(ae,Q),Q=n.add(I,D);let oe=n.add(M,L);return Q=n.mul(Q,oe),oe=n.add(N,Z),Q=n.sub(Q,oe),oe=n.add(E,D),O=n.add(B,L),oe=n.mul(oe,O),O=n.add(H,Z),oe=n.sub(oe,O),$=n.mul(J,Q),O=n.mul(X,Z),$=n.add(O,$),O=n.sub(H,$),$=n.add(H,$),U=n.mul(O,$),H=n.add(N,N),H=n.add(H,N),Z=n.mul(J,Z),Q=n.mul(X,Q),H=n.add(H,Z),Z=n.sub(N,Z),Z=n.mul(J,Z),Q=n.add(Q,Z),N=n.mul(H,Q),U=n.add(U,N),N=n.mul(oe,Q),O=n.mul(ae,O),O=n.sub(O,N),N=n.mul(ae,H),$=n.mul(oe,$),$=n.add($,N),new C(O,U,$)}subtract(k){return this.add(k.negate())}is0(){return this.equals(C.ZERO)}multiply(k){let{endo:I}=e;if(!o.isValidNot0(k))throw new Error("invalid scalar: out of range");let E,D,M=B=>F.cached(this,B,L=>yp(C,L));if(I){let{k1neg:B,k1:L,k2neg:O,k2:U}=S(k),{p:$,f:J}=M(L),{p:X,f:N}=M(U);D=J.add(N),E=v(I.beta,$,X,B,O)}else{let{p:B,f:L}=M(k);E=B,D=L}return yp(C,[E,D])[0]}multiplyUnsafe(k){let{endo:I}=e,E=this;if(!o.isValid(k))throw new Error("invalid scalar: out of range");if(k===ql||E.is0())return C.ZERO;if(k===Cb)return E;if(F.hasCache(this))return this.multiply(k);if(I){let{k1neg:D,k1:M,k2neg:B,k2:L}=S(k),{p1:O,p2:U}=dfe(C,E,M,L);return v(I.beta,O,U,D,B)}else return F.unsafe(E,k)}toAffine(k){return T(this,k)}isTorsionFree(){let{isTorsionFree:k}=e;return i===Cb?!0:k?k(C,this):F.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:k}=e;return i===Cb?this:k?k(C,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(k=!0){return Vl(k,"isCompressed"),this.assertValidity(),p(C,this,k)}toHex(k=!0){return zl(this.toBytes(k))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let P=o.BITS,F=new Eb(C,e.endo?Math.ceil(P/2):P);return C.BASE.precompute(8),C}function $fe(r){return Uint8Array.of(r?2:3)}function Hfe(r,e){return{secretKey:e.BYTES,publicKey:1+r.BYTES,publicKeyUncompressed:1+2*r.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function I9e(r,e={}){let{Fn:t}=r,n=e.randomBytes||yb,o=Object.assign(Hfe(r.Fp,t),{seed:n9(t.ORDER)});function s(p){try{let f=t.fromBytes(p);return t.isValidNot0(f)}catch{return!1}}function i(p,f){let{publicKey:g,publicKeyUncompressed:y}=o;try{let m=p.length;return f===!0&&m!==g||f===!1&&m!==y?!1:!!r.fromBytes(p)}catch{return!1}}function a(p=n(o.seed)){return o9(ze(p,o.seed,"seed"),t.ORDER)}function c(p,f=!0){return r.BASE.multiply(t.fromBytes(p)).toBytes(f)}function l(p){let{secretKey:f,publicKey:g,publicKeyUncompressed:y}=o;if(!up(p)||"_lengths"in t&&t._lengths||f===g)return;let m=ze(p,void 0,"key").length;return m===g||m===y}function u(p,f,g=!0){if(l(p)===!0)throw new Error("first arg must be private key");if(l(f)===!1)throw new Error("second arg must be public key");let y=t.fromBytes(p);return r.fromBytes(f).multiply(y).toBytes(g)}let d={isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:a},h=kk(a,c);return Object.freeze({getPublicKey:c,getSharedSecret:u,keygen:h,Point:r,utils:d,lengths:o})}function Vfe(r,e,t={}){vk(e),sf(t,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),t=Object.assign({},t);let n=t.randomBytes||yb,o=t.hmac||((I,E)=>O9(e,I,E)),{Fp:s,Fn:i}=r,{ORDER:a,BITS:c}=i,{keygen:l,getPublicKey:u,getSharedSecret:d,utils:h,lengths:p}=I9e(r,t),f={prehash:!0,lowS:typeof t.lowS=="boolean"?t.lowS:!0,format:"compact",extraEntropy:!1},g=a*Kfe<s.ORDER;function y(I){let E=a>>Cb;return I>E}function m(I,E){if(!i.isValidNot0(E))throw new Error(`invalid signature ${I}: out of range 1..Point.Fn.ORDER`);return E}function w(){if(g)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function b(I,E){U9(E);let D=p.signature,M=E==="compact"?D:E==="recovered"?D+1:void 0;return ze(I,M)}class x{r;s;recovery;constructor(E,D,M){if(this.r=m("r",E),this.s=m("s",D),M!=null){if(w(),![0,1,2,3].includes(M))throw new Error("invalid recovery id");this.recovery=M}Object.freeze(this)}static fromBytes(E,D=f.format){b(E,D);let M;if(D==="der"){let{r:U,s:$}=lf.toSig(ze(E));return new x(U,$)}D==="recovered"&&(M=E[0],D="compact",E=E.subarray(1));let B=p.signature/2,L=E.subarray(0,B),O=E.subarray(B,B*2);return new x(i.fromBytes(L),i.fromBytes(O),M)}static fromHex(E,D){return this.fromBytes($l(E),D)}assertRecovery(){let{recovery:E}=this;if(E==null)throw new Error("invalid recovery id: must be present");return E}addRecoveryBit(E){return new x(this.r,this.s,E)}recoverPublicKey(E){let{r:D,s:M}=this,B=this.assertRecovery(),L=B===2||B===3?D+a:D;if(!s.isValid(L))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let O=s.toBytes(L),U=r.fromBytes(os($fe((B&1)===0),O)),$=i.inv(L),J=T(ze(E,void 0,"msgHash")),X=i.create(-J*$),N=i.create(M*$),H=r.BASE.multiplyUnsafe(X).add(U.multiplyUnsafe(N));if(H.is0())throw new Error("invalid recovery: point at infinify");return H.assertValidity(),H}hasHighS(){return y(this.s)}toBytes(E=f.format){if(U9(E),E==="der")return $l(lf.hexFromSig(this));let{r:D,s:M}=this,B=i.toBytes(D),L=i.toBytes(M);return E==="recovered"?(w(),os(Uint8Array.of(this.assertRecovery()),B,L)):os(B,L)}toHex(E){return zl(this.toBytes(E))}}let S=t.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");let D=bb(E),M=E.length*8-c;return M>0?D>>BigInt(M):D},T=t.bits2int_modN||function(E){return i.create(S(E))},A=FS(c);function v(I){return US("num < 2^"+c,I,ql,A),i.toBytes(I)}function C(I,E){return ze(I,void 0,"message"),E?ze(e(I),void 0,"prehashed message"):I}function P(I,E,D){let{lowS:M,prehash:B,extraEntropy:L}=N9(D,f);I=C(I,B);let O=T(I),U=i.fromBytes(E);if(!i.isValidNot0(U))throw new Error("invalid private key");let $=[v(U),v(O)];if(L!=null&&L!==!1){let H=L===!0?n(p.secretKey):L;$.push(ze(H,void 0,"extraEntropy"))}let J=os(...$),X=O;function N(H){let Z=S(H);if(!i.isValidNot0(Z))return;let ae=i.inv(Z),Q=r.BASE.multiply(Z).toAffine(),oe=i.create(Q.x);if(oe===ql)return;let Fe=i.create(ae*i.create(X+oe*U));if(Fe===ql)return;let nr=(Q.x===oe?0:2)|Number(Q.y&Cb),fe=Fe;return M&&y(Fe)&&(fe=i.neg(Fe),nr^=1),new x(oe,fe,g?void 0:nr)}return{seed:J,k2sig:N}}function F(I,E,D={}){let{seed:M,k2sig:B}=P(I,E,D);return Wde(e.outputLen,i.BYTES,o)(M,B).toBytes(D.format)}function R(I,E,D,M={}){let{lowS:B,prehash:L,format:O}=N9(M,f);if(D=ze(D,void 0,"publicKey"),E=C(E,L),!up(I)){let U=I instanceof x?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+U)}b(I,O);try{let U=x.fromBytes(I,O),$=r.fromBytes(D);if(B&&U.hasHighS())return!1;let{r:J,s:X}=U,N=T(E),H=i.inv(X),Z=i.create(N*H),ae=i.create(J*H),Q=r.BASE.multiplyUnsafe(Z).add($.multiplyUnsafe(ae));return Q.is0()?!1:i.create(Q.x)===J}catch{return!1}}function k(I,E,D={}){let{prehash:M}=N9(D,f);return E=C(E,M),x.fromBytes(I,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:l,getPublicKey:u,getSharedSecret:d,utils:h,lengths:p,Point:r,sign:F,verify:R,recoverPublicKey:k,Signature:x,hash:e})}var Ffe,F9,lf,ql,Cb,Kfe,Fk,A9e,qfe=_(()=>{Ufe();dp();KS();c9();$S();Ffe=(r,e)=>(r+(r>=0?e:-e)/Kfe)/e;F9=class extends Error{constructor(e=""){super(e)}},lf={Err:F9,_tlv:{encode:(r,e)=>{let{Err:t}=lf;if(r<0||r>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");let n=e.length/2,o=NS(n);if(o.length/2&128)throw new t("tlv.encode: long form length too big");let s=n>127?NS(o.length/2|128):"";return NS(r)+s+o+e},decode(r,e){let{Err:t}=lf,n=0;if(r<0||r>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[n++]!==r)throw new t("tlv.decode: wrong tlv");let o=e[n++],s=!!(o&128),i=0;if(!s)i=o;else{let c=o&127;if(!c)throw new t("tlv.decode(long): indefinite length not supported");if(c>4)throw new t("tlv.decode(long): byte length is too big");let l=e.subarray(n,n+c);if(l.length!==c)throw new t("tlv.decode: length bytes not complete");if(l[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(let u of l)i=i<<8|u;if(n+=c,i<128)throw new t("tlv.decode(long): not minimal encoding")}let a=e.subarray(n,n+i);if(a.length!==i)throw new t("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+i)}}},_int:{encode(r){let{Err:e}=lf;if(r<ql)throw new e("integer: negative integers are not allowed");let t=NS(r);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(r){let{Err:e}=lf;if(r[0]&128)throw new e("invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return bb(r)}},toSig(r){let{Err:e,_int:t,_tlv:n}=lf,o=ze(r,void 0,"signature"),{v:s,l:i}=n.decode(48,o);if(i.length)throw new e("invalid signature: left bytes after parsing");let{v:a,l:c}=n.decode(2,s),{v:l,l:u}=n.decode(2,c);if(u.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(a),s:t.decode(l)}},hexFromSig(r){let{_tlv:e,_int:t}=lf,n=e.encode(2,t.encode(r.r)),o=e.encode(2,t.encode(r.s)),s=n+o;return e.encode(48,s)}},ql=BigInt(0),Cb=BigInt(1),Kfe=BigInt(2),Fk=BigInt(3),A9e=BigInt(4)});function k9e(r){let e=z9.p,t=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),a=BigInt(44),c=BigInt(88),l=r*r*r%e,u=l*l*r%e,d=Vt(u,t,e)*u%e,h=Vt(d,t,e)*u%e,p=Vt(h,jfe,e)*l%e,f=Vt(p,o,e)*p%e,g=Vt(f,s,e)*f%e,y=Vt(g,a,e)*g%e,m=Vt(y,c,e)*y%e,w=Vt(m,a,e)*g%e,b=Vt(w,t,e)*u%e,x=Vt(b,i,e)*f%e,S=Vt(x,n,e)*l%e,T=Vt(S,jfe,e);if(!K9.eql(K9.sqr(T),r))throw new Error("Cannot find square root");return T}var z9,T9e,jfe,K9,D9e,Ab,$9=_(()=>{YK();$S();qfe();z9={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},T9e={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},jfe=BigInt(2);K9=xb(z9.p,{sqrt:k9e}),D9e=zfe(z9,{Fp:K9,endo:T9e}),Ab=Vfe(D9e,Vde)});function Gfe(r,e,t,n){let o=Zd.digest(t instanceof Uint8Array?t:t.subarray());if(_k(o))return o.then(({digest:s})=>(n?.signal?.throwIfAborted(),Ab.verify(e,s,r,{prehash:!1,format:"der"}))).catch(s=>{throw s.name==="AbortError"?s:new DS(String(s))});try{return n?.signal?.throwIfAborted(),Ab.verify(e,o.digest,r,{prehash:!1,format:"der"})}catch(s){throw new DS(String(s))}}var Wfe=_(()=>{$9();bS();PK();h9()});var Kk,Yfe=_(()=>{Ll();ap();ip();cp();LS();H9();Wfe();Kk=class{type="secp256k1";raw;_key;constructor(e){this._key=Zfe(e),this.raw=Xfe(this._key)}toMultihash(){return ra.digest(mb(this))}toCID(){return Rn.createV1(114,this.toMultihash())}toString(){return hr.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Os(this.raw,e.raw)}verify(e,t,n){return Gfe(this._key,t,e,n)}}});function Jfe(r){return new Kk(r)}function Xfe(r){return Ab.Point.fromBytes(r).toBytes()}function Zfe(r){try{return Ab.Point.fromBytes(r),r}catch(e){throw new mk(String(e))}}var H9=_(()=>{nc();$9();Yfe()});function Qfe(r){let{Type:e,Data:t}=jS.decode(r.digest),n=t??new Uint8Array;switch(e){case Us.Ed25519:return Efe(n);case Us.secp256k1:return Jfe(n);case Us.ECDSA:return Cde(n);default:throw new _S}}function mb(r){return jS.encode({Type:Us[r.type],Data:r.raw})}var LS=_(()=>{nc();KK();m9();Nfe();H9()});var ehe=_(()=>{});var the=_(()=>{});var zk,rhe=_(()=>{zk=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let t=this.index,n=e();return n===void 0&&(this.index=t),n}parseWith(e){let t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let t=this.readChar();if(t===e)return t})}readSeparator(e,t,n){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,t,n,o){return this.readAtomically(()=>{let s=0,i=0,a=this.peekChar();if(a===void 0)return;let c=a==="0",l=2**(8*o)-1;for(;;){let u=this.readAtomically(()=>{let d=this.readChar();if(d===void 0)return;let h=Number.parseInt(d,e);if(!Number.isNaN(h))return h});if(u===void 0)break;if(s*=e,s+=u,s>l||(i+=1,t!==void 0&&i>t))return}if(i!==0)return!n&&c&&i>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;t<e.length;t++){let n=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[t]=n}return e})}readIPv6Addr(){let e=t=>{for(let n=0;n<t.length/2;n++){let o=n*2;if(n<t.length-3){let i=this.readSeparator(":",n,()=>this.readIPv4Addr());if(i!==void 0)return t[o]=i[0],t[o+1]=i[1],t[o+2]=i[2],t[o+3]=i[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];t[o]=s>>8,t[o+1]=s&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,o]=e(t);if(n===16)return t;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),i=16-(n+2),[a]=e(s.subarray(0,i));return t.set(s.subarray(0,a),16-a),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}}});function V9(r){if(!(r.length>P9e))return $k.new(r).parseWith(()=>$k.readIPv4Addr())}function q9(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>_9e))return $k.new(r).parseWith(()=>$k.readIPv6Addr())}var _9e,P9e,$k,GS=_(()=>{rhe();_9e=45,P9e=15,$k=new zk});var Hk=_(()=>{WS()});var q7t,j7t,WS=_(()=>{GS();Hk();q7t=parseInt("0xFFFF",16),j7t=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255])});var j9=_(()=>{GS();WS()});var G9=_(()=>{GS();j9();WS();Hk()});var W9=_(()=>{G9();Hk();WS();G9();j9()});var she=_(()=>{W9()});var ihe=_(()=>{});var ahe=_(()=>{});var che=_(()=>{ahe()});var lhe=_(()=>{});function Ib(r){return!!V9(r)}function YS(r){return!!q9(r)}var Tb=_(()=>{GS()});var uhe=Nr(XS=>{(function(){var r,e,t,n,o,s,i,a;a=function(c){var l,u,d,h;return l=(c&255<<24)>>>24,u=(c&255<<16)>>>16,d=(c&65280)>>>8,h=c&255,[l,u,d,h].join(".")},i=function(c){var l,u,d,h,p,f;for(l=[],d=h=0;h<=3&&c.length!==0;d=++h){if(d>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}f=e(c),p=f[0],u=f[1],c=c.substring(u),l.push(p)}if(c.length!==0)throw new Error("Invalid IP");switch(l.length){case 1:if(l[0]>4294967295)throw new Error("Invalid IP");return l[0]>>>0;case 2:if(l[0]>255||l[1]>16777215)throw new Error("Invalid IP");return(l[0]<<24|l[1])>>>0;case 3:if(l[0]>255||l[1]>255||l[2]>65535)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2])>>>0;case 4:if(l[0]>255||l[1]>255||l[2]>255||l[3]>255)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2]<<8|l[3])>>>0;default:throw new Error("Invalid IP")}},t=function(c){return c.charCodeAt(0)},n=t("0"),s=t("a"),o=t("A"),e=function(c){var l,u,d,h,p;for(h=0,l=10,u="9",d=0,c.length>1&&c[d]==="0"&&(c[d+1]==="x"||c[d+1]==="X"?(d+=2,l=16):"0"<=c[d+1]&&c[d+1]<="9"&&(d++,l=8,u="7")),p=d;d<c.length;){if("0"<=c[d]&&c[d]<=u)h=h*l+(t(c[d])-n)>>>0;else if(l===16)if("a"<=c[d]&&c[d]<="f")h=h*l+(10+t(c[d])-s)>>>0;else if("A"<=c[d]&&c[d]<="F")h=h*l+(10+t(c[d])-o)>>>0;else break;else break;if(h>4294967295)throw new Error("too large");d++}if(d===p)throw new Error("empty octet");return[h,d]},r=(function(){function c(l,u){var d,h,p,f;if(typeof l!="string")throw new Error("Missing `net' parameter");if(u||(f=l.split("/",2),l=f[0],u=f[1]),u||(u=32),typeof u=="string"&&u.indexOf(".")>-1){try{this.maskLong=i(u)}catch(g){throw d=g,new Error("Invalid mask: "+u)}for(h=p=32;p>=0;h=--p)if(this.maskLong===4294967295<<32-h>>>0){this.bitmask=h;break}}else if(u||u===0)this.bitmask=parseInt(u,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(i(l)&this.maskLong)>>>0}catch(g){throw d=g,new Error("Invalid net address: "+l)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+u);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return c.prototype.contains=function(l){return typeof l=="string"&&(l.indexOf("/")>0||l.split(".").length!==4)&&(l=new c(l)),l instanceof c?this.contains(l.base)&&this.contains(l.broadcast||l.last):(i(l)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(l){return l==null&&(l=1),new c(a(this.netLong+this.size*l),this.mask)},c.prototype.forEach=function(l){var u,d,h;for(h=i(this.first),d=i(this.last),u=0;h<=d;)l(a(h),h,u),u++,h++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c})(),XS.ip2long=i,XS.long2ip=a,XS.Netmask=r}).call(XS)});var dhe,U9e,Izt,fhe=_(()=>{Tb();dhe=Ri(uhe(),1),U9e=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],Izt=U9e.map(r=>new dhe.Netmask(r))});var hhe=_(()=>{});var phe=_(()=>{the();she();ihe();che();lhe();hhe()});var mhe=_(()=>{});var kb=_(()=>{mhe()});function X9(r,e){let{milliseconds:t,fallback:n,message:o,customTimers:s={setTimeout,clearTimeout},signal:i}=e,a,c,u=new Promise((d,h)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(i?.aborted){h(ghe(i));return}if(i&&(c=()=>{h(ghe(i))},i.addEventListener("abort",c,{once:!0})),r.then(d,h),t===Number.POSITIVE_INFINITY)return;let p=new Y9;a=s.setTimeout.call(void 0,()=>{if(n){try{d(n())}catch(f){h(f)}return}typeof r.cancel=="function"&&r.cancel(),o===!1?d():o instanceof Error?h(o):(p.message=o??`Promise timed out after ${t} milliseconds`,h(p))},t)}).finally(()=>{u.clear(),c&&i&&i.removeEventListener("abort",c)});return u.clear=()=>{s.clearTimeout.call(void 0,a),a=void 0},u}var Y9,ghe,yhe=_(()=>{Y9=class r extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,r)}},ghe=r=>r.reason??new DOMException("This operation was aborted.","AbortError")});function K9e(r,e,t){let n,o=new Promise((s,i)=>{if(t={rejectionEvents:["error"],multiArgs:!1,rejectionMultiArgs:!1,resolveImmediately:!1,...t},!(t.count>=0&&(t.count===Number.POSITIVE_INFINITY||Number.isInteger(t.count))))throw new TypeError("The `count` option should be at least 0 or more");t.signal?.throwIfAborted();let a=[e].flat(),c=[],{addListener:l,removeListener:u}=F9e(r),d=async(...p)=>{let f=t.multiArgs?p:p[0];if(t.filter)try{if(!await t.filter(f))return}catch(g){n(),i(g);return}c.push(f),t.count===c.length&&(n(),s(c))},h=(...p)=>{n(),i(t.rejectionMultiArgs?p:p[0])};n=()=>{for(let p of a)u(p,d);for(let p of t.rejectionEvents)a.includes(p)||u(p,h)};for(let p of a)l(p,d);for(let p of t.rejectionEvents)a.includes(p)||l(p,h);t.signal&&t.signal.addEventListener("abort",()=>{h(t.signal.reason)},{once:!0}),t.resolveImmediately&&s(c)});if(o.cancel=n,typeof t.timeout=="number"){let s=X9(o,{milliseconds:t.timeout});return s.cancel=()=>{n(),s.clear()},s}return o}function bhe(r,e,t){typeof t=="function"&&(t={filter:t}),t={...t,count:1,resolveImmediately:!1};let n=K9e(r,e,t),o=n.then(s=>s[0]);return o.cancel=n.cancel,o}var F9e,whe=_(()=>{yhe();F9e=r=>{let e=r.addEventListener||r.on||r.addListener,t=r.removeEventListener||r.off||r.removeListener;if(!e||!t)throw new TypeError("Emitter is not compatible");return{addListener:e.bind(r),removeListener:t.bind(r)}}});var xhe=_(()=>{});var ZS,Z9=_(()=>{ZS=class extends Error{static name="UnexpectedEOFError";name="UnexpectedEOFError"}});function z9e(r){return r.reason}async function xp(r,e,t){if(e==null)return r;let n=t?.translateError??z9e;if(e.aborted)return r.catch(()=>{}),Promise.reject(n(e));let o;try{return await Promise.race([r,new Promise((s,i)=>{o=()=>{i(n(e))},e.addEventListener("abort",o)})])}finally{o!=null&&e.removeEventListener("abort",o)}}var vp=_(()=>{});var vhe=_(()=>{kb()});var Zzt,Ehe=_(()=>{kb();vp();Ul();Zzt=Math.pow(2,20)*4});var She=_(()=>{});var Che=_(()=>{});var Ahe=_(()=>{vp()});var Ihe=_(()=>{});var J9=_(()=>{});var The=_(()=>{});var khe=_(()=>{J9()});var Mn,jl,qk,jk,Db=_(()=>{Mn=class extends Error{static name="InvalidMultiaddrError";name="InvalidMultiaddrError"},jl=class extends Error{static name="ValidationError";name="ValidationError"},qk=class extends Error{static name="InvalidParametersError";name="InvalidParametersError"},jk=class extends Error{static name="UnknownProtocolError";name="UnknownProtocolError"}});var Q9=_(()=>{});function t7(r){return e=>pr(e,r)}function r7(r){return e=>Ir(e,r)}function _b(r){return new DataView(r.buffer).getUint16(r.byteOffset).toString()}function Ep(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,typeof r=="string"?parseInt(r):r),new Uint8Array(e)}function Dhe(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=Ir(e[0],"base32"),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Ep(n);return Nl([t,o],t.length+o.length)}function _he(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=tc.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Ep(n);return Nl([t,o],t.length+o.length)}function n7(r){let e=r.subarray(0,r.length-2),t=r.subarray(r.length-2),n=pr(e,"base32"),o=_b(t);return`${n}:${o}`}function Mhe(r){try{let e=new URL(`http://[${r}]`);return e.hostname.substring(1,e.hostname.length-1)}catch{throw new Mn(`Invalid IPv6 address "${r}"`)}}function Bhe(r){return H9e.decode(r)}function Ohe(r){return e=>r.encoder.encode(e)}var o7,Phe,Rhe,Lhe,e7,H9e,Nhe=_(()=>{Tb();wS();gK();IS();rc();ef();Db();o7=function(r){r=r.toString().trim();let e=new Uint8Array(4);return r.split(/\./g).forEach((t,n)=>{let o=parseInt(t,10);if(isNaN(o)||o<0||o>255)throw new Mn("Invalid byte value in IP address");e[n]=o}),e},Phe=function(r){let e=0;r=r.toString().trim();let t=r.split(":",8),n;for(n=0;n<t.length;n++){let s=Ib(t[n]),i;s&&(i=o7(t[n]),t[n]=pr(i.subarray(0,2),"base16")),i!=null&&++n<8&&t.splice(n,0,pr(i.subarray(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let s=[n,1];for(n=9-t.length;n>0;n--)s.push("0");t.splice.apply(t,s)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){t[n]===""&&(t[n]="0");let s=parseInt(t[n],16);if(isNaN(s)||s<0||s>65535)throw new Mn("Invalid byte value in IP address");o[e++]=s>>8&255,o[e++]=s&255}return o},Rhe=function(r){if(r.byteLength!==4)throw new Mn("IPv4 address was incorrect length");let e=[];for(let t=0;t<r.byteLength;t++)e.push(r[t]);return e.join(".")},Lhe=function(r){if(r.byteLength!==16)throw new Mn("IPv6 address was incorrect length");let e=[];for(let n=0;n<r.byteLength;n+=2){let o=r[n],s=r[n+1],i=`${o.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`;e.push(i)}let t=e.join(":");try{let n=new URL(`http://[${t}]`);return n.hostname.substring(1,n.hostname.length-1)}catch{throw new Mn(`Invalid IPv6 address "${t}"`)}};e7=Object.values(ES).map(r=>r.decoder),H9e=(function(){let r=e7[0].or(e7[1]);return e7.slice(2).forEach(e=>r=r.or(e)),r})()});function V9e(r){if(parseInt(r).toString()!==r)throw new jl("Value must be an integer")}function q9e(r){if(r<0)throw new jl("Value must be a positive integer, or zero")}function j9e(r){return e=>{if(e>r)throw new jl(`Value must be smaller than or equal to ${r}`)}}function G9e(...r){return e=>{for(let t of r)t(e)}}var JS,Uhe=_(()=>{Db();JS=G9e(V9e,q9e,j9e(65535))});var tn,s7,Gl,M7e,Gk=_(()=>{Tb();mK();ok();Q9();Db();Nhe();Uhe();tn=-1,s7=class{protocolsByCode=new Map;protocolsByName=new Map;getProtocol(e){let t;if(typeof e=="string"?t=this.protocolsByName.get(e):t=this.protocolsByCode.get(e),t==null)throw new jk(`Protocol ${e} was unknown`);return t}addProtocol(e){this.protocolsByCode.set(e.code,e),this.protocolsByName.set(e.name,e),e.aliases?.forEach(t=>{this.protocolsByName.set(t,e)})}removeProtocol(e){let t=this.protocolsByCode.get(e);t!=null&&(this.protocolsByCode.delete(t.code),this.protocolsByName.delete(t.name),t.aliases?.forEach(n=>{this.protocolsByName.delete(n)}))}},Gl=new s7,M7e=[{code:4,name:"ip4",size:32,valueToBytes:o7,bytesToValue:Rhe,validate:r=>{if(!Ib(r))throw new jl(`Invalid IPv4 address "${r}"`)}},{code:6,name:"tcp",size:16,valueToBytes:Ep,bytesToValue:_b,validate:JS},{code:273,name:"udp",size:16,valueToBytes:Ep,bytesToValue:_b,validate:JS},{code:33,name:"dccp",size:16,valueToBytes:Ep,bytesToValue:_b,validate:JS},{code:41,name:"ip6",size:128,valueToBytes:Phe,bytesToValue:Lhe,stringToValue:Mhe,validate:r=>{if(!YS(r))throw new jl(`Invalid IPv6 address "${r}"`)}},{code:42,name:"ip6zone",size:tn},{code:43,name:"ipcidr",size:8,bytesToValue:t7("base10"),valueToBytes:r7("base10")},{code:53,name:"dns",size:tn},{code:54,name:"dns4",size:tn},{code:55,name:"dns6",size:tn},{code:56,name:"dnsaddr",size:tn},{code:132,name:"sctp",size:16,valueToBytes:Ep,bytesToValue:_b,validate:JS},{code:301,name:"udt"},{code:302,name:"utp"},{code:400,name:"unix",size:tn,stringToValue:r=>decodeURIComponent(r),valueToString:r=>encodeURIComponent(r)},{code:421,name:"p2p",aliases:["ipfs"],size:tn,bytesToValue:t7("base58btc"),valueToBytes:r=>r.startsWith("Q")||r.startsWith("1")?r7("base58btc")(r):Rn.parse(r).multihash.bytes},{code:444,name:"onion",size:96,bytesToValue:n7,valueToBytes:Dhe},{code:445,name:"onion3",size:296,bytesToValue:n7,valueToBytes:_he},{code:446,name:"garlic64",size:tn},{code:447,name:"garlic32",size:tn},{code:448,name:"tls"},{code:449,name:"sni",size:tn},{code:454,name:"noise"},{code:460,name:"quic"},{code:461,name:"quic-v1"},{code:465,name:"webtransport"},{code:466,name:"certhash",size:tn,bytesToValue:Ohe(cK),valueToBytes:Bhe},{code:480,name:"http"},{code:481,name:"http-path",size:tn,stringToValue:r=>`/${decodeURIComponent(r)}`,valueToString:r=>encodeURIComponent(r.substring(1))},{code:443,name:"https"},{code:477,name:"ws"},{code:478,name:"wss"},{code:479,name:"p2p-websocket-star"},{code:277,name:"p2p-stardust"},{code:275,name:"p2p-webrtc-star"},{code:276,name:"p2p-webrtc-direct"},{code:280,name:"webrtc-direct"},{code:281,name:"webrtc"},{code:290,name:"p2p-circuit"},{code:777,name:"memory",size:tn}];M7e.forEach(r=>{Gl.addProtocol(r)})});function Fhe(r){let e=[],t=0;for(;t<r.length;){let n=Bl(r,t),o=Gl.getProtocol(n),s=Jr(n),i=B7e(o,r,t+s),a=0;i>0&&o.size===tn&&(a=Jr(i));let c=s+a+i,l={code:n,name:o.name,bytes:r.subarray(t,t+c)};if(i>0){let u=t+s+a,d=r.subarray(u,u+i);l.value=o.bytesToValue?.(d)??pr(d)}e.push(l),t+=c}return e}function Khe(r){let e=0,t=[];for(let n of r){if(n.bytes==null){let o=Gl.getProtocol(n.code),s=Jr(n.code),i,a=0,c=0;n.value!=null&&(i=o.valueToBytes?.(n.value)??Ir(n.value),a=i.byteLength,o.size===tn&&(c=Jr(a)));let l=new Uint8Array(s+c+a),u=0;db(n.code,l,u),u+=s,i!=null&&(o.size===tn&&(db(a,l,u),u+=c),l.set(i,u)),n.bytes=l}t.push(n.bytes),e+=n.bytes.byteLength}return Nl(t,e)}function zhe(r){if(r.charAt(0)!=="/")throw new Mn('String multiaddr must start with "/"');let e=[],t="protocol",n="",o="";for(let s=1;s<r.length;s++){let i=r.charAt(s);i!=="/"&&(t==="protocol"?o+=r.charAt(s):n+=r.charAt(s));let a=s===r.length-1;if(i==="/"||a){let c=Gl.getProtocol(o);if(t==="protocol"){if(c.size==null||c.size===0){e.push({code:c.code,name:c.name}),n="",o="",t="protocol";continue}else if(a)throw new Mn(`Component ${o} was missing value`);t="value"}else if(t==="value"){let l={code:c.code,name:c.name};if(c.size!=null&&c.size!==0){if(n==="")throw new Mn(`Component ${o} was missing value`);l.value=c.stringToValue?.(n)??n}e.push(l),n="",o="",t="protocol"}}}if(o!==""&&n!=="")throw new Mn("Incomplete multiaddr");return e}function $he(r){return`/${r.flatMap(e=>{if(e.value==null)return e.name;let t=Gl.getProtocol(e.code);if(t==null)throw new Mn(`Unknown protocol code ${e.code}`);return[e.name,t.valueToString?.(e.value)??e.value]}).join("/")}`}function B7e(r,e,t){return r.size==null||r.size===0?0:r.size>0?r.size/8:Bl(e,t)}var Hhe=_(()=>{Ol();IS();rc();ef();Db();Gk()});function N7e(r){if(r==null&&(r="/"),qhe(r))return r.getComponents();if(r instanceof Uint8Array)return Fhe(r);if(typeof r=="string")return r=r.replace(/\/(\/)+/,"/").replace(/(\/)+$/,""),r===""&&(r="/"),zhe(r);if(Array.isArray(r))return r;throw new Mn("Must be a string, Uint8Array, Component[], or another Multiaddr")}function U7e(r){r.getComponents().forEach(e=>{let t=Gl.getProtocol(e.code);e.value!=null&&t.validate?.(e.value)})}var O7e,i7,Wk,Vhe=_(()=>{cp();Hhe();Db();Gk();QS();O7e=Symbol.for("nodejs.util.inspect.custom"),i7=Symbol.for("@multiformats/multiaddr");Wk=class r{[i7]=!0;#e;#t;#r;constructor(e="/",t={}){this.#e=N7e(e),t.validate!==!1&&U7e(this)}get bytes(){return this.#r==null&&(this.#r=Khe(this.#e)),this.#r}toString(){return this.#t==null&&(this.#t=$he(this.#e)),this.#t}toJSON(){return this.toString()}getComponents(){return[...this.#e.map(e=>({...e}))]}encapsulate(e){let t=new r(e);return new r([...this.#e,...t.getComponents()],{validate:!1})}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new qk(`Address ${this.toString()} does not contain subaddress: ${t}`);return new r(n.slice(0,o),{validate:!1})}decapsulateCode(e){let t;for(let n=this.#e.length-1;n>-1;n--)if(this.#e[n].code===e){t=n;break}return new r(this.#e.slice(0,t),{validate:!1})}equals(e){return Os(this.bytes,e.bytes)}[O7e](){return`Multiaddr(${this.toString()})`}}});function qhe(r){return!!r?.[i7]}function Yk(r){return new Wk(r)}var QS=_(()=>{Vhe();Gk();Q9()});var jhe=_(()=>{});var Ghe=_(()=>{Tb();W9()});var Whe=_(()=>{Tb();QS()});var Yhe=_(()=>{});var Xhe=_(()=>{});var Zhe=_(()=>{vp()});var Jhe=_(()=>{Zhe()});var Qhe=_(()=>{kb();Jhe()});function K7e(r){return typeof r?.closeRead=="function"}function z7e(r){return typeof r?.close=="function"}function a7(r){return K7e(r)?r.remoteWriteStatus!=="writable"&&r.readBufferLength===0:z7e(r)?r.status!=="open":!1}function $7e(r){return r?.addEventListener!=null&&r?.removeEventListener!=null&&r?.send!=null&&r?.push!=null&&r?.log!=null}function epe(r,e){let t=e?.maxBufferSize??F7e,n=new Tr,o,s=!1;if(!$7e(r))throw new hi("Argument should be a Stream or a Multiaddr");let i=u=>{if(n.append(u.data),n.byteLength>t){let d=n.byteLength;n.consume(n.byteLength),o?.reject(new Error(`Read buffer overflow - ${d} > ${t}`))}o?.resolve()};r.addEventListener("message",i);let a=u=>{u.error!=null?o?.reject(u.error):o?.resolve()};r.addEventListener("close",a);let c=()=>{o?.resolve()};r.addEventListener("remoteCloseWrite",c);let l={readBuffer:n,async read(u){if(s===!0)throw new Xk("Stream was unwrapped");if(a7(r)){if(u?.bytes==null)return null;if(n.byteLength<u.bytes)throw r.log.error("closed after reading %d/%d bytes",n.byteLength,u.bytes),new ZS(`Unexpected EOF - stream closed after reading ${n.byteLength}/${u.bytes} bytes`)}let d=u?.bytes??1;for(o=Promise.withResolvers();;){if(n.byteLength>=d){o.resolve();break}if(await xp(o.promise,u?.signal),a7(r)){if(n.byteLength===0&&u?.bytes==null)return null;break}o=Promise.withResolvers()}let h=u?.bytes??n.byteLength;if(n.byteLength<h){if(a7(r))throw r.log.error("closed while reading %d/%d bytes",n.byteLength,h),new ZS(`Unexpected EOF - stream closed while reading ${n.byteLength}/${h} bytes`);return l.read(u)}let p=n.sublist(0,h);return n.consume(h),p},async write(u,d){if(s===!0)throw new Xk("Stream was unwrapped");r.send(u)||await bhe(r,"drain",{signal:d?.signal,rejectionEvents:["close"]})},unwrap(){return s||(s=!0,r.removeEventListener("message",i),r.removeEventListener("close",a),r.removeEventListener("remoteCloseWrite",c),n.byteLength>0&&(r.log("stream unwrapped with %d unread bytes",n.byteLength),r.push(n))),r}};return l}var F7e,Xk,tpe=_(()=>{nc();Qhe();kb();whe();vp();Ol();Ul();Z9();F7e=4194304,Xk=class extends Error{static name="UnwrappedError";name="UnwrappedError"}});var xHt,vHt,rpe=_(()=>{Ol();Ul();xHt=1024*1024*4,vHt=1024*1024*4});var npe=_(()=>{});function ope(r){if(r===null)return"null";if(r===void 0)return"undefined";if(r===!0||r===!1)return"boolean";let e=typeof r;if(e==="string"||e==="number"||e==="bigint"||e==="symbol")return e;if(e==="function")return"Function";if(Array.isArray(r))return"Array";if(r instanceof Uint8Array)return"Uint8Array";if(r.constructor===Object)return"Object";let t=V7e(r);return t||"Object"}function V7e(r){let e=Object.prototype.toString.call(r).slice(8,-1);if(H7e.includes(e))return e}var H7e,spe=_(()=>{H7e=["Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]});var G,de,Fs=_(()=>{G=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};G.uint=new G(0,"uint",!0);G.negint=new G(1,"negint",!0);G.bytes=new G(2,"bytes",!0);G.string=new G(3,"string",!0);G.array=new G(4,"array",!1);G.map=new G(5,"map",!1);G.tag=new G(6,"tag",!1);G.float=new G(7,"float",!0);G.false=new G(7,"false",!0);G.true=new G(7,"true",!0);G.null=new G(7,"null",!0);G.undefined=new G(7,"undefined",!0);G.break=new G(7,"break",!0);de=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}}});function Zk(r){return e1&&globalThis.Buffer.isBuffer(r)}function Jk(r){return r instanceof Uint8Array?Zk(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r:Uint8Array.from(r)}function Qk(r,e){if(Zk(r)&&Zk(e))return r.compare(e);for(let t=0;t<r.length;t++)if(r[t]!==e[t])return r[t]<e[t]?-1:1;return 0}function ipe(r){let e=[],t=0;for(let n=0;n<r.length;n++){let o=r.charCodeAt(n);o<128?e[t++]=o:o<2048?(e[t++]=o>>6|192,e[t++]=o&63|128):(o&64512)===55296&&n+1<r.length&&(r.charCodeAt(n+1)&64512)===56320?(o=65536+((o&1023)<<10)+(r.charCodeAt(++n)&1023),e[t++]=o>>18|240,e[t++]=o>>12&63|128,e[t++]=o>>6&63|128,e[t++]=o&63|128):(o>=55296&&o<=57343&&(o=65533),e[t++]=o>>12|224,e[t++]=o>>6&63|128,e[t++]=o&63|128)}return e}var e1,q7e,j7e,G7e,c7,ic,ape,cpe,lpe,Pb=_(()=>{e1=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",q7e=new TextEncoder;j7e=24,G7e=200,c7=e1?r=>r.length>=j7e?globalThis.Buffer.from(r):ipe(r):r=>r.length>=G7e?q7e.encode(r):ipe(r),ic=r=>Uint8Array.from(r),ape=e1?(r,e,t)=>Zk(r)?new Uint8Array(r.subarray(e,t)):r.slice(e,t):(r,e,t)=>r.slice(e,t),cpe=e1?(r,e)=>(r=r.map(t=>t instanceof Uint8Array?t:globalThis.Buffer.from(t)),Jk(globalThis.Buffer.concat(r,e))):(r,e)=>{let t=new Uint8Array(e),n=0;for(let o of r)n+o.length>t.length&&(o=o.subarray(0,t.length-n)),t.set(o,n),n+=o.length;return t},lpe=e1?r=>globalThis.Buffer.allocUnsafe(r):r=>new Uint8Array(r)});var W7e,t1,eD,upe=_(()=>{Pb();W7e=256,t1=class{constructor(e=W7e){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let o=t.length-(this.maxCursor-this.cursor)-1;t.set(e,o)}else{if(t){let o=t.length-(this.maxCursor-this.cursor)-1;o<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,o),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=lpe(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=ape(n,0,this.cursor)}else t=cpe(this.chunks,this.cursor);return e&&this.reset(),t}},eD=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}}});function Wl(r,e,t){if(r.length-e<t)throw new Error(`${et} not enough data for type`)}var et,l7,r1,sa=_(()=>{et="CBOR decode error:",l7="CBOR encode error:",r1=[];r1[23]=1;r1[24]=2;r1[25]=3;r1[26]=5;r1[27]=9});function Ks(r,e,t){Wl(r,e,1);let n=r[e];if(t.strict===!0&&n<rn[0])throw new Error(`${et} integer encoded in more bytes than necessary (strict decode)`);return n}function zs(r,e,t){Wl(r,e,2);let n=r[e]<<8|r[e+1];if(t.strict===!0&&n<rn[1])throw new Error(`${et} integer encoded in more bytes than necessary (strict decode)`);return n}function $s(r,e,t){Wl(r,e,4);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3];if(t.strict===!0&&n<rn[2])throw new Error(`${et} integer encoded in more bytes than necessary (strict decode)`);return n}function Hs(r,e,t){Wl(r,e,8);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3],o=r[e+4]*16777216+(r[e+5]<<16)+(r[e+6]<<8)+r[e+7],s=(BigInt(n)<<BigInt(32))+BigInt(o);if(t.strict===!0&&s<rn[3])throw new Error(`${et} integer encoded in more bytes than necessary (strict decode)`);if(s<=Number.MAX_SAFE_INTEGER)return Number(s);if(t.allowBigInt===!0)return s;throw new Error(`${et} integers outside of the safe integer range are not supported`)}function dpe(r,e,t,n){return new de(G.uint,Ks(r,e+1,n),2)}function fpe(r,e,t,n){return new de(G.uint,zs(r,e+1,n),3)}function hpe(r,e,t,n){return new de(G.uint,$s(r,e+1,n),5)}function ppe(r,e,t,n){return new de(G.uint,Hs(r,e+1,n),9)}function pi(r,e){return nn(r,0,e.value)}function nn(r,e,t){if(t<rn[0]){let n=Number(t);r.push([e|n])}else if(t<rn[1]){let n=Number(t);r.push([e|24,n])}else if(t<rn[2]){let n=Number(t);r.push([e|25,n>>>8,n&255])}else if(t<rn[3]){let n=Number(t);r.push([e|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(t);if(n<rn[4]){let o=[e|27,0,0,0,0,0,0,0],s=Number(n&BigInt(4294967295)),i=Number(n>>BigInt(32)&BigInt(4294967295));o[8]=s&255,s=s>>8,o[7]=s&255,s=s>>8,o[6]=s&255,s=s>>8,o[5]=s&255,o[4]=i&255,i=i>>8,o[3]=i&255,i=i>>8,o[2]=i&255,i=i>>8,o[1]=i&255,r.push(o)}else throw new Error(`${et} encountered BigInt larger than allowable range`)}}var rn,ac=_(()=>{Fs();sa();rn=[24,256,65536,4294967296,BigInt("18446744073709551616")];pi.encodedSize=function(e){return nn.encodedSize(e.value)};nn.encodedSize=function(e){return e<rn[0]?1:e<rn[1]?2:e<rn[2]?3:e<rn[3]?5:9};pi.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0}});function mpe(r,e,t,n){return new de(G.negint,-1-Ks(r,e+1,n),2)}function gpe(r,e,t,n){return new de(G.negint,-1-zs(r,e+1,n),3)}function ype(r,e,t,n){return new de(G.negint,-1-$s(r,e+1,n),5)}function wpe(r,e,t,n){let o=Hs(r,e+1,n);if(typeof o!="bigint"){let s=-1-o;if(s>=Number.MIN_SAFE_INTEGER)return new de(G.negint,s,9)}if(n.allowBigInt!==!0)throw new Error(`${et} integers outside of the safe integer range are not supported`);return new de(G.negint,u7-BigInt(o),9)}function tD(r,e){let t=e.value,n=typeof t=="bigint"?t*u7-bpe:t*-1-1;nn(r,e.type.majorEncoded,n)}var u7,bpe,d7=_(()=>{Fs();ac();sa();u7=BigInt(-1),bpe=BigInt(1);tD.encodedSize=function(e){let t=e.value,n=typeof t=="bigint"?t*u7-bpe:t*-1-1;return n<rn[0]?1:n<rn[1]?2:n<rn[2]?3:n<rn[3]?5:9};tD.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0}});function n1(r,e,t,n){Wl(r,e,t+n);let o=r.slice(e+t,e+t+n);return new de(G.bytes,o,t+n)}function xpe(r,e,t,n){return n1(r,e,1,t)}function vpe(r,e,t,n){return n1(r,e,2,Ks(r,e+1,n))}function Epe(r,e,t,n){return n1(r,e,3,zs(r,e+1,n))}function Spe(r,e,t,n){return n1(r,e,5,$s(r,e+1,n))}function Cpe(r,e,t,n){let o=Hs(r,e+1,n);if(typeof o=="bigint")throw new Error(`${et} 64-bit integer bytes lengths not supported`);return n1(r,e,9,o)}function rD(r){return r.encodedBytes===void 0&&(r.encodedBytes=G.equals(r.type,G.string)?c7(r.value):r.value),r.encodedBytes}function Rb(r,e){let t=rD(e);nn(r,e.type.majorEncoded,t.length),r.push(t)}function X7e(r,e){return r.length<e.length?-1:r.length>e.length?1:Qk(r,e)}var nD=_(()=>{Fs();sa();ac();Pb();Rb.encodedSize=function(e){let t=rD(e);return nn.encodedSize(t.length)+t.length};Rb.compareTokens=function(e,t){return X7e(rD(e),rD(t))}});function Q7e(r,e,t){if(t-e<J7e){let o="";for(let s=e;s<t;s++){let i=r[s];if(i&128)return Ape.decode(r.subarray(e,t));o+=String.fromCharCode(i)}return o}return Ape.decode(r.subarray(e,t))}function o1(r,e,t,n,o){let s=t+n;Wl(r,e,s);let i=new de(G.string,Q7e(r,e+t,e+s),s);return o.retainStringBytes===!0&&(i.byteValue=r.slice(e+t,e+s)),i}function Ipe(r,e,t,n){return o1(r,e,1,t,n)}function Tpe(r,e,t,n){return o1(r,e,2,Ks(r,e+1,n),n)}function kpe(r,e,t,n){return o1(r,e,3,zs(r,e+1,n),n)}function Dpe(r,e,t,n){return o1(r,e,5,$s(r,e+1,n),n)}function _pe(r,e,t,n){let o=Hs(r,e+1,n);if(typeof o=="bigint")throw new Error(`${et} 64-bit integer string lengths not supported`);return o1(r,e,9,o,n)}var Ape,J7e,Ppe,f7=_(()=>{Fs();sa();ac();nD();Ape=new TextDecoder,J7e=32;Ppe=Rb});function Lb(r,e,t,n){return new de(G.array,n,t)}function Rpe(r,e,t,n){return Lb(r,e,1,t)}function Lpe(r,e,t,n){return Lb(r,e,2,Ks(r,e+1,n))}function Mpe(r,e,t,n){return Lb(r,e,3,zs(r,e+1,n))}function Bpe(r,e,t,n){return Lb(r,e,5,$s(r,e+1,n))}function Ope(r,e,t,n){let o=Hs(r,e+1,n);if(typeof o=="bigint")throw new Error(`${et} 64-bit integer array lengths not supported`);return Lb(r,e,9,o)}function Npe(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${et} indefinite length items not allowed`);return Lb(r,e,1,1/0)}function oD(r,e){nn(r,G.array.majorEncoded,e.value)}var h7=_(()=>{Fs();ac();sa();oD.compareTokens=pi.compareTokens;oD.encodedSize=function(e){return nn.encodedSize(e.value)}});function Mb(r,e,t,n){return new de(G.map,n,t)}function Upe(r,e,t,n){return Mb(r,e,1,t)}function Fpe(r,e,t,n){return Mb(r,e,2,Ks(r,e+1,n))}function Kpe(r,e,t,n){return Mb(r,e,3,zs(r,e+1,n))}function zpe(r,e,t,n){return Mb(r,e,5,$s(r,e+1,n))}function $pe(r,e,t,n){let o=Hs(r,e+1,n);if(typeof o=="bigint")throw new Error(`${et} 64-bit integer map lengths not supported`);return Mb(r,e,9,o)}function Hpe(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${et} indefinite length items not allowed`);return Mb(r,e,1,1/0)}function sD(r,e){nn(r,G.map.majorEncoded,e.value)}var p7=_(()=>{Fs();ac();sa();sD.compareTokens=pi.compareTokens;sD.encodedSize=function(e){return nn.encodedSize(e.value)}});function Vpe(r,e,t,n){return new de(G.tag,t,1)}function qpe(r,e,t,n){return new de(G.tag,Ks(r,e+1,n),2)}function jpe(r,e,t,n){return new de(G.tag,zs(r,e+1,n),3)}function Gpe(r,e,t,n){return new de(G.tag,$s(r,e+1,n),5)}function Wpe(r,e,t,n){return new de(G.tag,Hs(r,e+1,n),9)}function iD(r,e){nn(r,G.tag.majorEncoded,e.value)}var m7=_(()=>{Fs();ac();iD.compareTokens=pi.compareTokens;iD.encodedSize=function(e){return nn.encodedSize(e.value)}});function Ype(r,e,t,n){if(n.allowUndefined===!1)throw new Error(`${et} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new de(G.null,null,1):new de(G.undefined,void 0,1)}function Xpe(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${et} indefinite length items not allowed`);return new de(G.break,void 0,1)}function x7(r,e,t){if(t){if(t.allowNaN===!1&&Number.isNaN(r))throw new Error(`${et} NaN values are not supported`);if(t.allowInfinity===!1&&(r===1/0||r===-1/0))throw new Error(`${et} Infinity values are not supported`)}return new de(G.float,r,e)}function Zpe(r,e,t,n){return x7(v7(r,e+1),3,n)}function Jpe(r,e,t,n){return x7(E7(r,e+1),5,n)}function Qpe(r,e,t,n){return x7(nme(r,e+1),9,n)}function aD(r,e,t){let n=e.value;if(n===!1)r.push([G.float.majorEncoded|g7]);else if(n===!0)r.push([G.float.majorEncoded|y7]);else if(n===null)r.push([G.float.majorEncoded|b7]);else if(n===void 0)r.push([G.float.majorEncoded|w7]);else{let o,s=!1;(!t||t.float64!==!0)&&(tme(n),o=v7(ia,1),n===o||Number.isNaN(n)?(ia[0]=249,r.push(ia.slice(0,3)),s=!0):(rme(n),o=E7(ia,1),n===o&&(ia[0]=250,r.push(ia.slice(0,5)),s=!0))),s||(oze(n),o=nme(ia,1),ia[0]=251,r.push(ia.slice(0,9)))}}function tme(r){if(r===1/0)mi.setUint16(0,31744,!1);else if(r===-1/0)mi.setUint16(0,64512,!1);else if(Number.isNaN(r))mi.setUint16(0,32256,!1);else{mi.setFloat32(0,r);let e=mi.getUint32(0),t=(e&2139095040)>>23,n=e&8388607;if(t===255)mi.setUint16(0,31744,!1);else if(t===0)mi.setUint16(0,(r&2147483648)>>16|n>>13,!1);else{let o=t-127;o<-24?mi.setUint16(0,0):o<-14?mi.setUint16(0,(e&2147483648)>>16|1<<24+o,!1):mi.setUint16(0,(e&2147483648)>>16|o+15<<10|n>>13,!1)}}}function v7(r,e){if(r.length-e<2)throw new Error(`${et} not enough data for float16`);let t=(r[e]<<8)+r[e+1];if(t===31744)return 1/0;if(t===64512)return-1/0;if(t===32256)return NaN;let n=t>>10&31,o=t&1023,s;return n===0?s=o*2**-24:n!==31?s=(o+1024)*2**(n-25):s=o===0?1/0:NaN,t&32768?-s:s}function rme(r){mi.setFloat32(0,r,!1)}function E7(r,e){if(r.length-e<4)throw new Error(`${et} not enough data for float32`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,4).getFloat32(0,!1)}function oze(r){mi.setFloat64(0,r,!1)}function nme(r,e){if(r.length-e<8)throw new Error(`${et} not enough data for float64`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,8).getFloat64(0,!1)}var g7,y7,b7,w7,eme,mi,ia,S7=_(()=>{Fs();sa();ac();g7=20,y7=21,b7=22,w7=23;aD.encodedSize=function(e,t){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!t||t.float64!==!0){tme(n);let o=v7(ia,1);if(n===o||Number.isNaN(n))return 3;if(rme(n),o=E7(ia,1),n===o)return 5}return 9};eme=new ArrayBuffer(9),mi=new DataView(eme,1),ia=new Uint8Array(eme,0);aD.compareTokens=pi.compareTokens});function tt(r,e,t){throw new Error(`${et} encountered invalid minor (${t}) for major ${r[e]>>>5}`)}function cD(r){return()=>{throw new Error(`${et} ${r}`)}}function ome(r){switch(r.type){case G.false:return ic([244]);case G.true:return ic([245]);case G.null:return ic([246]);case G.bytes:return r.value.length?void 0:ic([64]);case G.string:return r.value===""?ic([96]):void 0;case G.array:return r.value===0?ic([128]):void 0;case G.map:return r.value===0?ic([160]):void 0;case G.uint:return r.value<24?ic([Number(r.value)]):void 0;case G.negint:if(r.value>=-24)return ic([31-Number(r.value)])}}var ie,cc,C7=_(()=>{Fs();ac();d7();nD();f7();h7();p7();m7();S7();sa();Pb();ie=[];for(let r=0;r<=23;r++)ie[r]=tt;ie[24]=dpe;ie[25]=fpe;ie[26]=hpe;ie[27]=ppe;ie[28]=tt;ie[29]=tt;ie[30]=tt;ie[31]=tt;for(let r=32;r<=55;r++)ie[r]=tt;ie[56]=mpe;ie[57]=gpe;ie[58]=ype;ie[59]=wpe;ie[60]=tt;ie[61]=tt;ie[62]=tt;ie[63]=tt;for(let r=64;r<=87;r++)ie[r]=xpe;ie[88]=vpe;ie[89]=Epe;ie[90]=Spe;ie[91]=Cpe;ie[92]=tt;ie[93]=tt;ie[94]=tt;ie[95]=cD("indefinite length bytes/strings are not supported");for(let r=96;r<=119;r++)ie[r]=Ipe;ie[120]=Tpe;ie[121]=kpe;ie[122]=Dpe;ie[123]=_pe;ie[124]=tt;ie[125]=tt;ie[126]=tt;ie[127]=cD("indefinite length bytes/strings are not supported");for(let r=128;r<=151;r++)ie[r]=Rpe;ie[152]=Lpe;ie[153]=Mpe;ie[154]=Bpe;ie[155]=Ope;ie[156]=tt;ie[157]=tt;ie[158]=tt;ie[159]=Npe;for(let r=160;r<=183;r++)ie[r]=Upe;ie[184]=Fpe;ie[185]=Kpe;ie[186]=zpe;ie[187]=$pe;ie[188]=tt;ie[189]=tt;ie[190]=tt;ie[191]=Hpe;for(let r=192;r<=215;r++)ie[r]=Vpe;ie[216]=qpe;ie[217]=jpe;ie[218]=Gpe;ie[219]=Wpe;ie[220]=tt;ie[221]=tt;ie[222]=tt;ie[223]=tt;for(let r=224;r<=243;r++)ie[r]=cD("simple values are not supported");ie[244]=tt;ie[245]=tt;ie[246]=tt;ie[247]=Ype;ie[248]=cD("simple values are not supported");ie[249]=Zpe;ie[250]=Jpe;ie[251]=Qpe;ie[252]=tt;ie[253]=tt;ie[254]=tt;ie[255]=Xpe;cc=[];for(let r=0;r<24;r++)cc[r]=new de(G.uint,r,1);for(let r=-1;r>=-24;r--)cc[31-r]=new de(G.negint,r,1);cc[64]=new de(G.bytes,new Uint8Array(0),1);cc[96]=new de(G.string,"",1);cc[128]=new de(G.array,0,1);cc[160]=new de(G.map,0,1);cc[244]=new de(G.false,!1,1);cc[245]=new de(G.true,!0,1);cc[246]=new de(G.null,null,1)});function ize(){let r=[];return r[G.uint.major]=pi,r[G.negint.major]=tD,r[G.bytes.major]=Rb,r[G.string.major]=Ppe,r[G.array.major]=oD,r[G.map.major]=sD,r[G.tag.major]=iD,r[G.float.major]=aD,r}function lD(r,e={},t){let n=ope(r),o=e&&e.typeEncoders&&e.typeEncoders[n]||df[n];if(typeof o=="function"){let i=o(r,n,e,t);if(i!=null)return i}let s=df[n];if(!s)throw new Error(`${l7} unsupported type: ${n}`);return s(r,n,e,t)}function lze(r,e){e.mapSorter&&r.sort(e.mapSorter)}function uze(r,e){if(r[0]instanceof de&&e[0]instanceof de){let t=r[0],n=e[0];return t._keyBytes||(t._keyBytes=sme(t.value)),n._keyBytes||(n._keyBytes=sme(n.value)),Qk(t._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function sme(r){return dze(r,aze,ime)}function ame(r,e,t,n){if(Array.isArray(e))for(let o of e)ame(r,o,t,n);else t[e.type.major](r,e,n)}function dze(r,e,t,n){let o=n instanceof Uint8Array,s=o?new eD(n):cze,i=lD(r,t);if(!Array.isArray(i)&&t.quickEncodeToken){let a=t.quickEncodeToken(i);if(a)return o?(s.push(a),s.toBytes()):a;let c=e[i.type.major];if(c.encodedSize){let l=c.encodedSize(i,t);if(o||(s=new t1(l)),c(s,i,t),s.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${i} was wrong`);return o?s.toBytes():Jk(s.chunks[0])}}return s.reset(),ame(s,i,e,t),s.toBytes(!0)}var ime,aze,cze,uD,uf,df,fVt,hVt,pVt,mVt,gVt,yVt,bVt,wVt,xVt,vVt,EVt,cme=_(()=>{spe();Fs();upe();sa();C7();Pb();ac();d7();nD();f7();h7();p7();m7();S7();ime=Object.freeze({float64:!0,mapSorter:uze,quickEncodeToken:ome});aze=ize(),cze=new t1,uD=class r{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do if(t.obj===e)return!0;while(t=t.parent);return!1}static createCheck(e,t){if(e&&e.includes(t))throw new Error(`${l7} object contains circular references`);return new r(t,e)}},uf={null:new de(G.null,null),undefined:new de(G.undefined,void 0),true:new de(G.true,!0),false:new de(G.false,!1),emptyArray:new de(G.array,0),emptyMap:new de(G.map,0)},df={number(r,e,t,n){return!Number.isInteger(r)||!Number.isSafeInteger(r)?new de(G.float,r):r>=0?new de(G.uint,r):new de(G.negint,r)},bigint(r,e,t,n){return r>=BigInt(0)?new de(G.uint,r):new de(G.negint,r)},Uint8Array(r,e,t,n){return new de(G.bytes,r)},string(r,e,t,n){return new de(G.string,r)},boolean(r,e,t,n){return r?uf.true:uf.false},null(r,e,t,n){return uf.null},undefined(r,e,t,n){return uf.undefined},ArrayBuffer(r,e,t,n){return new de(G.bytes,new Uint8Array(r))},DataView(r,e,t,n){return new de(G.bytes,new Uint8Array(r.buffer,r.byteOffset,r.byteLength))},Array(r,e,t,n){if(!r.length)return t.addBreakTokens===!0?[uf.emptyArray,new de(G.break)]:uf.emptyArray;n=uD.createCheck(n,r);let o=[],s=0;for(let i of r)o[s++]=lD(i,t,n);return t.addBreakTokens?[new de(G.array,r.length),o,new de(G.break)]:[new de(G.array,r.length),o]},Object(r,e,t,n){let o=e!=="Object",s=o?r.keys():Object.keys(r),i=o?r.size:s.length,a;if(i){a=new Array(i),n=uD.createCheck(n,r);let c=!o&&t.ignoreUndefinedProperties,l=0;for(let u of s){let d=o?r.get(u):r[u];c&&d===void 0||(a[l++]=[lD(u,t,n),lD(d,t,n)])}l<i&&(a.length=l)}return a?.length?(lze(a,t),t.addBreakTokens?[new de(G.map,a.length),a,new de(G.break)]:[new de(G.map,a.length),a]):t.addBreakTokens===!0?[uf.emptyMap,new de(G.break)]:uf.emptyMap}};df.Map=df.Object;df.Buffer=df.Uint8Array;for(let r of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))df[`${r}Array`]=df.DataView;fVt=G.uint.majorEncoded,hVt=G.negint.majorEncoded,pVt=G.bytes.majorEncoded,mVt=G.string.majorEncoded,gVt=G.array.majorEncoded,yVt=G.float.majorEncoded|g7,bVt=G.float.majorEncoded|y7,wVt=G.float.majorEncoded|b7,xVt=G.float.majorEncoded|w7,vVt=BigInt(-1),EVt=BigInt(1)});var lme=_(()=>{sa();Fs();C7();Pb()});var ume=_(()=>{cme();lme();Fs()});var dme=_(()=>{ume();_K();kb();Ul()});function mze(r,e){if(typeof r=="string")return gze(r);if(typeof r=="number")return wze(r,e);throw Error(`Value provided to ms() must be a string or number. value=${JSON.stringify(r)}`)}function gze(r){if(typeof r!="string"||r.length===0||r.length>100)throw Error(`Value provided to ms.parse() must be a string with length between 1 and 99. value=${JSON.stringify(r)}`);let e=/^(?<value>-?\d*\.?\d+) *(?<unit>milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.exec(r);if(!e?.groups)return NaN;let{value:t,unit:n="ms"}=e.groups,o=parseFloat(t),s=n.toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return o*315576e5;case"months":case"month":case"mo":return o*26298e5;case"weeks":case"week":case"w":return o*6048e5;case"days":case"day":case"d":return o*864e5;case"hours":case"hour":case"hrs":case"hr":case"h":return o*36e5;case"minutes":case"minute":case"mins":case"min":case"m":return o*6e4;case"seconds":case"second":case"secs":case"sec":case"s":return o*1e3;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:throw Error(`Unknown unit "${s}" provided to ms.parse(). value=${JSON.stringify(r)}`)}}function yze(r){let e=Math.abs(r);return e>=315576e5?`${Math.round(r/315576e5)}y`:e>=26298e5?`${Math.round(r/26298e5)}mo`:e>=6048e5?`${Math.round(r/6048e5)}w`:e>=864e5?`${Math.round(r/864e5)}d`:e>=36e5?`${Math.round(r/36e5)}h`:e>=6e4?`${Math.round(r/6e4)}m`:e>=1e3?`${Math.round(r/1e3)}s`:`${r}ms`}function bze(r){let e=Math.abs(r);return e>=315576e5?Cp(r,e,315576e5,"year"):e>=26298e5?Cp(r,e,26298e5,"month"):e>=6048e5?Cp(r,e,6048e5,"week"):e>=864e5?Cp(r,e,864e5,"day"):e>=36e5?Cp(r,e,36e5,"hour"):e>=6e4?Cp(r,e,6e4,"minute"):e>=1e3?Cp(r,e,1e3,"second"):`${r} ms`}function wze(r,e){if(typeof r!="number"||!Number.isFinite(r))throw Error("Value provided to ms.format() must be of type number.");return e?.long?bze(r):yze(r)}function Cp(r,e,t,n){let o=e>=t*1.5;return`${Math.round(r/t)} ${n}${o?"s":""}`}var dD,A7=_(()=>{dD=mze});function I7(r){t.debug=t,t.default=t,t.coerce=c,t.disable=s,t.enable=o,t.enabled=i,t.humanize=dD,t.destroy=l,Object.keys(r).forEach(u=>{t[u]=r[u]}),t.names=[],t.skips=[],t.formatters={};function e(u){let d=0;for(let h=0;h<u.length;h++)d=(d<<5)-d+u.charCodeAt(h),d|=0;return t.colors[Math.abs(d)%t.colors.length]}t.selectColor=e;function t(u,d){let h,p=null,f,g;function y(...m){if(!y.enabled)return;let w=y,b=Number(new Date),x=b-(h||b);w.diff=x,w.prev=h,w.curr=b,h=b,m[0]=t.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let S=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(A,v)=>{if(A==="%%")return"%";S++;let C=t.formatters[v];if(typeof C=="function"){let P=m[S];A=C.call(w,P),m.splice(S,1),S--}return A}),t.formatArgs.call(w,m),d?.onLog!=null&&d.onLog(...m),(w.log||t.log).apply(w,m)}return y.namespace=u,y.useColors=t.useColors(),y.color=t.selectColor(u),y.extend=n,y.destroy=t.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(f!==t.namespaces&&(f=t.namespaces,g=t.enabled(u)),g),set:m=>{p=m}}),typeof t.init=="function"&&t.init(y),y}function n(u,d){let h=t(this.namespace+(typeof d>"u"?":":d)+u);return h.log=this.log,h}function o(u){t.save(u),t.namespaces=u,t.names=[],t.skips=[];let d,h=(typeof u=="string"?u:"").split(/[\s,]+/),p=h.length;for(d=0;d<p;d++)h[d]&&(u=h[d].replace(/\*/g,".*?"),u[0]==="-"?t.skips.push(new RegExp("^"+u.substr(1)+"$")):t.names.push(new RegExp("^"+u+"$")))}function s(){let u=[...t.names.map(a),...t.skips.map(a).map(d=>"-"+d)].join(",");return t.enable(""),u}function i(u){if(u[u.length-1]==="*")return!0;let d,h;for(d=0,h=t.skips.length;d<h;d++)if(t.skips[d].test(u))return!1;for(d=0,h=t.names.length;d<h;d++)if(t.names[d].test(u))return!0;return!1}function a(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function c(u){return u instanceof Error?u.stack??u.message:u}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.setupFormatters(t.formatters),t.enable(t.load()),t}var fme=_(()=>{A7()});function vze(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/(edge|trident)\/(\d+)/)!=null?!1:typeof document<"u"&&document.documentElement?.style?.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/firefox\/(\d+)/)!=null&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/applewebkit\/(\d+)/)}function Eze(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+dD(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}function Cze(r){try{r?fD?.setItem("debug",r):fD?.removeItem("debug")}catch{}}function Aze(){let r;try{r=fD?.getItem("debug")}catch{}return!r&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(r=globalThis.process.env.DEBUG),r}function Ize(){try{return localStorage}catch{}}function Tze(r){r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}var fD,xze,Sze,hme,pme=_(()=>{A7();fme();fD=Ize(),xze=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];Sze=console.debug??console.log??(()=>{});hme=I7({formatArgs:Eze,save:Cze,load:Aze,useColors:vze,setupFormatters:Tze,colors:xze,storage:fD,log:Sze})});var ss,mme=_(()=>{pme();ss=hme});function gme(r,e=""){let t=yme(r.message),n=yme(r.stack);return t!=null&&n!=null?n.includes(t)?`${n.split(`
|
|
3
3
|
`).join(`
|
|
4
4
|
${e}`)}`:`${t}
|