@web3-storage/w3up-client
Version:
Client for the web3.storage w3up api
1 lines • 339 kB
JavaScript
"use strict";var w3up=(()=>{var Kk=Object.create;var Pi=Object.defineProperty;var Jk=Object.getOwnPropertyDescriptor;var Zk=Object.getOwnPropertyNames;var Qk=Object.getPrototypeOf,Yk=Object.prototype.hasOwnProperty;var Z=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),_=(t,e)=>{for(var r in e)Pi(t,r,{get:e[r],enumerable:!0})},fg=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Zk(e))!Yk.call(t,o)&&o!==r&&Pi(t,o,{get:()=>e[o],enumerable:!(n=Jk(e,o))||n.enumerable});return t};var Rt=(t,e,r)=>(r=t!=null?Kk(Qk(t)):{},fg(e||!t||!t.__esModule?Pi(r,"default",{value:t,enumerable:!0}):r,t)),Xk=t=>fg(Pi({},"__esModule",{value:!0}),t);var by=Z((eU,yy)=>{yy.exports=Tl;var wy=128,iA=127,aA=~iA,cA=Math.pow(2,31);function Tl(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw Tl.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var n=r;t>=cA;)e[r++]=t&255|wy,t/=128;for(;t&aA;)e[r++]=t&255|wy,t>>>=7;return e[r]=t|0,Tl.bytes=r-n+1,e}});var ky=Z((tU,vy)=>{vy.exports=Il;var uA=128,xy=127;function Il(t,n){var r=0,n=n||0,o=0,s=n,i,a=t.length;do{if(s>=a||o>49)throw Il.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&xy)<<o:(i&xy)*Math.pow(2,o),o+=7}while(i>=uA);return Il.bytes=s-n,r}});var Ey=Z((rU,Sy)=>{var fA=Math.pow(2,7),lA=Math.pow(2,14),dA=Math.pow(2,21),pA=Math.pow(2,28),hA=Math.pow(2,35),mA=Math.pow(2,42),gA=Math.pow(2,49),wA=Math.pow(2,56),yA=Math.pow(2,63);Sy.exports=function(t){return t<fA?1:t<lA?2:t<dA?3:t<pA?4:t<hA?5:t<mA?6:t<gA?7:t<wA?8:t<yA?9:10}});var ds=Z((nU,Ay)=>{Ay.exports={encode:by(),decode:ky(),encodingLength:Ey()}});var Eb=Z(()=>{});var g0=Z((Q$,m0)=>{function nt(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}m0.exports=nt;nt.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};nt.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};nt.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0};nt.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};nt.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};nt.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};nt.prototype.start=nt.prototype.try;nt.prototype.errors=function(){return this._errors};nt.prototype.attempts=function(){return this._attempts};nt.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],s=o.message,i=(t[s]||0)+1;t[s]=i,i>=r&&(e=o,r=i)}return e}});var w0=Z(Dn=>{var MI=g0();Dn.operation=function(t){var e=Dn.timeouts(t);return new MI(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};Dn.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(s,i){return s-i}),n};Dn.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};Dn.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var o=0;o<r.length;o++){var s=r[o],i=t[s];t[s]=function(c){var u=Dn.operation(e),f=Array.prototype.slice.call(arguments,1),d=f.pop();f.push(function(w){u.retry(w)||(w&&(arguments[0]=u.mainError()),d.apply(this,arguments))}),u.attempt(function(){c.apply(t,f)})}.bind(t,i),t[s].options=e}}});var b0=Z((X$,y0)=>{y0.exports=w0()});var H0=Z((A7,q0)=>{"use strict";q0.exports=k3;function k3(t,e){for(var r=new Array(arguments.length-1),n=0,o=2,s=!0;o<arguments.length;)r[n++]=arguments[o++];return new Promise(function(a,c){r[n]=function(f){if(s)if(s=!1,f)c(f);else{for(var d=new Array(arguments.length-1),w=0;w<d.length;)d[w++]=arguments[w];a.apply(null,d)}};try{t.apply(e||null,r)}catch(u){s&&(s=!1,c(u))}})}});var K0=Z(G0=>{"use strict";var fu=G0;fu.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Do=new Array(64),V0=new Array(123);for(wt=0;wt<64;)V0[Do[wt]=wt<26?wt+65:wt<52?wt+71:wt<62?wt-4:wt-59|43]=wt++;var wt;fu.encode=function(e,r,n){for(var o=null,s=[],i=0,a=0,c;r<n;){var u=e[r++];switch(a){case 0:s[i++]=Do[u>>2],c=(u&3)<<4,a=1;break;case 1:s[i++]=Do[c|u>>4],c=(u&15)<<2,a=2;break;case 2:s[i++]=Do[c|u>>6],s[i++]=Do[u&63],a=0;break}i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),i=0)}return a&&(s[i++]=Do[c],s[i++]=61,a===1&&(s[i++]=61)),o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))};var W0="invalid encoding";fu.decode=function(e,r,n){for(var o=n,s=0,i,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&s>1)break;if((c=V0[c])===void 0)throw Error(W0);switch(s){case 0:i=c,s=1;break;case 1:r[n++]=i<<2|(c&48)>>4,i=c,s=2;break;case 2:r[n++]=(i&15)<<4|(c&60)>>2,i=c,s=3;break;case 3:r[n++]=(i&3)<<6|c,s=0;break}}if(s===1)throw Error(W0);return n-o};fu.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var Z0=Z((T7,J0)=>{"use strict";J0.exports=lu;function lu(){this._listeners={}}lu.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};lu.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],o=0;o<n.length;)n[o].fn===r?n.splice(o,1):++o;return this};lu.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<r.length;)r[o].fn.apply(r[o++].ctx,n)}return this}});var nv=Z((I7,rv)=>{"use strict";rv.exports=Q0(Q0);function Q0(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function o(c,u,f){e[0]=c,u[f]=r[0],u[f+1]=r[1],u[f+2]=r[2],u[f+3]=r[3]}function s(c,u,f){e[0]=c,u[f]=r[3],u[f+1]=r[2],u[f+2]=r[1],u[f+3]=r[0]}t.writeFloatLE=n?o:s,t.writeFloatBE=n?s:o;function i(c,u){return r[0]=c[u],r[1]=c[u+1],r[2]=c[u+2],r[3]=c[u+3],e[0]}function a(c,u){return r[3]=c[u],r[2]=c[u+1],r[1]=c[u+2],r[0]=c[u+3],e[0]}t.readFloatLE=n?i:a,t.readFloatBE=n?a:i}():function(){function e(n,o,s,i){var a=o<0?1:0;if(a&&(o=-o),o===0)n(1/o>0?0:2147483648,s,i);else if(isNaN(o))n(2143289344,s,i);else if(o>34028234663852886e22)n((a<<31|2139095040)>>>0,s,i);else if(o<11754943508222875e-54)n((a<<31|Math.round(o/1401298464324817e-60))>>>0,s,i);else{var c=Math.floor(Math.log(o)/Math.LN2),u=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|u)>>>0,s,i)}}t.writeFloatLE=e.bind(null,Y0),t.writeFloatBE=e.bind(null,X0);function r(n,o,s){var i=n(o,s),a=(i>>31)*2+1,c=i>>>23&255,u=i&8388607;return c===255?u?NaN:a*(1/0):c===0?a*1401298464324817e-60*u:a*Math.pow(2,c-150)*(u+8388608)}t.readFloatLE=r.bind(null,ev),t.readFloatBE=r.bind(null,tv)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function o(c,u,f){e[0]=c,u[f]=r[0],u[f+1]=r[1],u[f+2]=r[2],u[f+3]=r[3],u[f+4]=r[4],u[f+5]=r[5],u[f+6]=r[6],u[f+7]=r[7]}function s(c,u,f){e[0]=c,u[f]=r[7],u[f+1]=r[6],u[f+2]=r[5],u[f+3]=r[4],u[f+4]=r[3],u[f+5]=r[2],u[f+6]=r[1],u[f+7]=r[0]}t.writeDoubleLE=n?o:s,t.writeDoubleBE=n?s:o;function i(c,u){return r[0]=c[u],r[1]=c[u+1],r[2]=c[u+2],r[3]=c[u+3],r[4]=c[u+4],r[5]=c[u+5],r[6]=c[u+6],r[7]=c[u+7],e[0]}function a(c,u){return r[7]=c[u],r[6]=c[u+1],r[5]=c[u+2],r[4]=c[u+3],r[3]=c[u+4],r[2]=c[u+5],r[1]=c[u+6],r[0]=c[u+7],e[0]}t.readDoubleLE=n?i:a,t.readDoubleBE=n?a:i}():function(){function e(n,o,s,i,a,c){var u=i<0?1:0;if(u&&(i=-i),i===0)n(0,a,c+o),n(1/i>0?0:2147483648,a,c+s);else if(isNaN(i))n(0,a,c+o),n(2146959360,a,c+s);else if(i>17976931348623157e292)n(0,a,c+o),n((u<<31|2146435072)>>>0,a,c+s);else{var f;if(i<22250738585072014e-324)f=i/5e-324,n(f>>>0,a,c+o),n((u<<31|f/4294967296)>>>0,a,c+s);else{var d=Math.floor(Math.log(i)/Math.LN2);d===1024&&(d=1023),f=i*Math.pow(2,-d),n(f*4503599627370496>>>0,a,c+o),n((u<<31|d+1023<<20|f*1048576&1048575)>>>0,a,c+s)}}}t.writeDoubleLE=e.bind(null,Y0,0,4),t.writeDoubleBE=e.bind(null,X0,4,0);function r(n,o,s,i,a){var c=n(i,a+o),u=n(i,a+s),f=(u>>31)*2+1,d=u>>>20&2047,w=4294967296*(u&1048575)+c;return d===2047?w?NaN:f*(1/0):d===0?f*5e-324*w:f*Math.pow(2,d-1075)*(w+4503599627370496)}t.readDoubleLE=r.bind(null,ev,0,4),t.readDoubleBE=r.bind(null,tv,4,0)}(),t}function Y0(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function X0(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function ev(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function tv(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var ov=Z((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var iv=Z(sv=>{"use strict";var _h=sv;_h.length=function(e){for(var r=0,n=0,o=0;o<e.length;++o)n=e.charCodeAt(o),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320?(++o,r+=4):r+=3;return r};_h.read=function(e,r,n){var o=n-r;if(o<1)return"";for(var s=null,i=[],a=0,c;r<n;)c=e[r++],c<128?i[a++]=c:c>191&&c<224?i[a++]=(c&31)<<6|e[r++]&63:c>239&&c<365?(c=((c&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,i[a++]=55296+(c>>10),i[a++]=56320+(c&1023)):i[a++]=(c&15)<<12|(e[r++]&63)<<6|e[r++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,i)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,i.slice(0,a))),s.join("")):String.fromCharCode.apply(String,i.slice(0,a))};_h.write=function(e,r,n){for(var o=n,s,i,a=0;a<e.length;++a)s=e.charCodeAt(a),s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=s&63|128):(s&64512)===55296&&((i=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(i&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-o}});var cv=Z((_7,av)=>{"use strict";av.exports=S3;function S3(t,e,r){var n=r||8192,o=n>>>1,s=null,i=n;return function(c){if(c<1||c>o)return t(c);i+c>n&&(s=t(n),i=0);var u=e.call(s,i,i+=c);return i&7&&(i=(i|7)+1),u}}});var fv=Z((C7,uv)=>{"use strict";uv.exports=be;var ri=Mr();function be(t,e){this.lo=t>>>0,this.hi=e>>>0}var _n=be.zero=new be(0,0);_n.toNumber=function(){return 0};_n.zzEncode=_n.zzDecode=function(){return this};_n.length=function(){return 1};var E3=be.zeroHash="\0\0\0\0\0\0\0\0";be.fromNumber=function(e){if(e===0)return _n;var r=e<0;r&&(e=-e);var n=e>>>0,o=(e-n)/4294967296>>>0;return r&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new be(n,o)};be.from=function(e){if(typeof e=="number")return be.fromNumber(e);if(ri.isString(e))if(ri.Long)e=ri.Long.fromString(e);else return be.fromNumber(parseInt(e,10));return e.low||e.high?new be(e.low>>>0,e.high>>>0):_n};be.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};be.prototype.toLong=function(e){return ri.Long?new ri.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var zr=String.prototype.charCodeAt;be.fromHash=function(e){return e===E3?_n:new be((zr.call(e,0)|zr.call(e,1)<<8|zr.call(e,2)<<16|zr.call(e,3)<<24)>>>0,(zr.call(e,4)|zr.call(e,5)<<8|zr.call(e,6)<<16|zr.call(e,7)<<24)>>>0)};be.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};be.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};be.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};be.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Mr=Z(Ch=>{"use strict";var P=Ch;P.asPromise=H0();P.base64=K0();P.EventEmitter=Z0();P.float=nv();P.inquire=ov();P.utf8=iv();P.pool=cv();P.LongBits=fv();P.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);P.global=P.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Ch;P.emptyArray=Object.freeze?Object.freeze([]):[];P.emptyObject=Object.freeze?Object.freeze({}):{};P.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};P.isString=function(e){return typeof e=="string"||e instanceof String};P.isObject=function(e){return e&&typeof e=="object"};P.isset=P.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};P.Buffer=function(){try{var t=P.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();P._Buffer_from=null;P._Buffer_allocUnsafe=null;P.newBuffer=function(e){return typeof e=="number"?P.Buffer?P._Buffer_allocUnsafe(e):new P.Array(e):P.Buffer?P._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};P.Array=typeof Uint8Array<"u"?Uint8Array:Array;P.Long=P.global.dcodeIO&&P.global.dcodeIO.Long||P.global.Long||P.inquire("long");P.key2Re=/^true|false|0|1$/;P.key32Re=/^-?(?:0|[1-9][0-9]*)$/;P.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;P.longToHash=function(e){return e?P.LongBits.from(e).toHash():P.LongBits.zeroHash};P.longFromHash=function(e,r){var n=P.LongBits.fromHash(e);return P.Long?P.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function lv(t,e,r){for(var n=Object.keys(e),o=0;o<n.length;++o)(t[n[o]]===void 0||!r)&&(t[n[o]]=e[n[o]]);return t}P.merge=lv;P.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function dv(t){function e(r,n){if(!(this instanceof e))return new e(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&lv(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return t},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}P.newError=dv;P.ProtocolError=dv("ProtocolError");P.oneOfGetter=function(e){for(var r={},n=0;n<e.length;++n)r[e[n]]=1;return function(){for(var o=Object.keys(this),s=o.length-1;s>-1;--s)if(r[o[s]]===1&&this[o[s]]!==void 0&&this[o[s]]!==null)return o[s]}};P.oneOfSetter=function(e){return function(r){for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}};P.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};P._configure=function(){var t=P.Buffer;if(!t){P._Buffer_from=P._Buffer_allocUnsafe=null;return}P._Buffer_from=t.from!==Uint8Array.from&&t.from||function(r,n){return new t(r,n)},P._Buffer_allocUnsafe=t.allocUnsafe||function(r){return new t(r)}}});var $h=Z((U7,gv)=>{"use strict";gv.exports=G;var ot=Mr(),Lh,du=ot.LongBits,pv=ot.base64,hv=ot.utf8;function ni(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Ph(){}function A3(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function G(){this.len=0,this.head=new ni(Ph,0,0),this.tail=this.head,this.states=null}var mv=function(){return ot.Buffer?function(){return(G.create=function(){return new Lh})()}:function(){return new G}};G.create=mv();G.alloc=function(e){return new ot.Array(e)};ot.Array!==Array&&(G.alloc=ot.pool(G.alloc,ot.Array.prototype.subarray));G.prototype._push=function(e,r,n){return this.tail=this.tail.next=new ni(e,r,n),this.len+=r,this};function Rh(t,e,r){e[r]=t&255}function D3(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function Oh(t,e){this.len=t,this.next=void 0,this.val=e}Oh.prototype=Object.create(ni.prototype);Oh.prototype.fn=D3;G.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Oh((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};G.prototype.int32=function(e){return e<0?this._push(Nh,10,du.fromNumber(e)):this.uint32(e)};G.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Nh(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}G.prototype.uint64=function(e){var r=du.from(e);return this._push(Nh,r.length(),r)};G.prototype.int64=G.prototype.uint64;G.prototype.sint64=function(e){var r=du.from(e).zzEncode();return this._push(Nh,r.length(),r)};G.prototype.bool=function(e){return this._push(Rh,1,e?1:0)};function Uh(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}G.prototype.fixed32=function(e){return this._push(Uh,4,e>>>0)};G.prototype.sfixed32=G.prototype.fixed32;G.prototype.fixed64=function(e){var r=du.from(e);return this._push(Uh,4,r.lo)._push(Uh,4,r.hi)};G.prototype.sfixed64=G.prototype.fixed64;G.prototype.float=function(e){return this._push(ot.float.writeFloatLE,4,e)};G.prototype.double=function(e){return this._push(ot.float.writeDoubleLE,8,e)};var T3=ot.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var o=0;o<e.length;++o)r[n+o]=e[o]};G.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(Rh,1,0);if(ot.isString(e)){var n=G.alloc(r=pv.length(e));pv.decode(e,n,0),e=n}return this.uint32(r)._push(T3,r,e)};G.prototype.string=function(e){var r=hv.length(e);return r?this.uint32(r)._push(hv.write,r,e):this._push(Rh,1,0)};G.prototype.fork=function(){return this.states=new A3(this),this.head=this.tail=new ni(Ph,0,0),this.len=0,this};G.prototype.reset=function(){return this.states?(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 ni(Ph,0,0),this.len=0),this};G.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};G.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};G._configure=function(t){Lh=t,G.create=mv(),Lh._configure()}});var bv=Z((P7,yv)=>{"use strict";yv.exports=Lt;var wv=$h();(Lt.prototype=Object.create(wv.prototype)).constructor=Lt;var Fr=Mr();function Lt(){wv.call(this)}Lt._configure=function(){Lt.alloc=Fr._Buffer_allocUnsafe,Lt.writeBytesBuffer=Fr.Buffer&&Fr.Buffer.prototype instanceof Uint8Array&&Fr.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var o=0;o<e.length;)r[n++]=e[o++]}};Lt.prototype.bytes=function(e){Fr.isString(e)&&(e=Fr._Buffer_from(e,"base64"));var r=e.length>>>0;return this.uint32(r),r&&this._push(Lt.writeBytesBuffer,r,e),this};function I3(t,e,r){t.length<40?Fr.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Lt.prototype.string=function(e){var r=Fr.Buffer.byteLength(e);return this.uint32(r),r&&this._push(I3,r,e),this};Lt._configure()});var Fh=Z((R7,Ev)=>{"use strict";Ev.exports=fe;var yt=Mr(),Mh,kv=yt.LongBits,B3=yt.utf8;function bt(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function fe(t){this.buf=t,this.pos=0,this.len=t.length}var xv=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new fe(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new fe(e);throw Error("illegal buffer")},Sv=function(){return yt.Buffer?function(r){return(fe.create=function(o){return yt.Buffer.isBuffer(o)?new Mh(o):xv(o)})(r)}:xv};fe.create=Sv();fe.prototype._slice=yt.Array.prototype.subarray||yt.Array.prototype.slice;fe.prototype.uint32=function(){var e=4294967295;return function(){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,bt(this,10);return e}}();fe.prototype.int32=function(){return this.uint32()|0};fe.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function zh(){var t=new kv(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw bt(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw bt(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}fe.prototype.bool=function(){return this.uint32()!==0};function pu(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}fe.prototype.fixed32=function(){if(this.pos+4>this.len)throw bt(this,4);return pu(this.buf,this.pos+=4)};fe.prototype.sfixed32=function(){if(this.pos+4>this.len)throw bt(this,4);return pu(this.buf,this.pos+=4)|0};function vv(){if(this.pos+8>this.len)throw bt(this,8);return new kv(pu(this.buf,this.pos+=4),pu(this.buf,this.pos+=4))}fe.prototype.float=function(){if(this.pos+4>this.len)throw bt(this,4);var e=yt.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};fe.prototype.double=function(){if(this.pos+8>this.len)throw bt(this,4);var e=yt.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};fe.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw bt(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var o=yt.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};fe.prototype.string=function(){var e=this.bytes();return B3.read(e,0,e.length)};fe.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw bt(this,e);this.pos+=e}else do if(this.pos>=this.len)throw bt(this);while(this.buf[this.pos++]&128);return this};fe.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};fe._configure=function(t){Mh=t,fe.create=Sv(),Mh._configure();var e=yt.Long?"toLong":"toNumber";yt.merge(fe.prototype,{int64:function(){return zh.call(this)[e](!1)},uint64:function(){return zh.call(this)[e](!0)},sint64:function(){return zh.call(this).zzDecode()[e](!1)},fixed64:function(){return vv.call(this)[e](!0)},sfixed64:function(){return vv.call(this)[e](!1)}})}});var Iv=Z((O7,Tv)=>{"use strict";Tv.exports=Cn;var Dv=Fh();(Cn.prototype=Object.create(Dv.prototype)).constructor=Cn;var Av=Mr();function Cn(t){Dv.call(this,t)}Cn._configure=function(){Av.Buffer&&(Cn.prototype._slice=Av.Buffer.prototype.slice)};Cn.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Cn._configure()});var _v=Z((N7,Bv)=>{"use strict";Bv.exports=oi;var jh=Mr();(oi.prototype=Object.create(jh.EventEmitter.prototype)).constructor=oi;function oi(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");jh.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}oi.prototype.rpcCall=function t(e,r,n,o,s){if(!o)throw TypeError("request must be specified");var i=this;if(!s)return jh.asPromise(t,i,e,r,n,o);if(!i.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return i.rpcImpl(e,r[i.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,u){if(c)return i.emit("error",c,e),s(c);if(u===null){i.end(!0);return}if(!(u instanceof n))try{u=n[i.responseDelimited?"decodeDelimited":"decode"](u)}catch(f){return i.emit("error",f,e),s(f)}return i.emit("data",u,e),s(null,u)})}catch(a){i.emit("error",a,e),setTimeout(function(){s(a)},0);return}};oi.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Lv=Z(Cv=>{"use strict";var _3=Cv;_3.Service=_v()});var Pv=Z((z7,Uv)=>{"use strict";Uv.exports={}});var Nv=Z(Ov=>{"use strict";var $e=Ov;$e.build="minimal";$e.Writer=$h();$e.BufferWriter=bv();$e.Reader=Fh();$e.BufferReader=Iv();$e.util=Mr();$e.rpc=Lv();$e.roots=Pv();$e.configure=Rv;function Rv(){$e.util._configure(),$e.Writer._configure($e.BufferWriter),$e.Reader._configure($e.BufferReader)}Rv()});var zv=Z((F7,$v)=>{"use strict";$v.exports=Nv()});var R1=Z((yi,Uu)=>{(function(t,e){"use strict";var r={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(l){if(!Array.isArray(l)&&!ArrayBuffer.isView(l))return!1;for(var p=0;p<l.length;p++)if(!Number.isInteger(l[p])||l[p]<0||l[p]>255)return!1;return!0}function o(l,p){return(l&65535)*p+(((l>>>16)*p&65535)<<16)}function s(l,p){return l<<p|l>>>32-p}function i(l){return l^=l>>>16,l=o(l,2246822507),l^=l>>>13,l=o(l,3266489909),l^=l>>>16,l}function a(l,p){l=[l[0]>>>16,l[0]&65535,l[1]>>>16,l[1]&65535],p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535];var g=[0,0,0,0];return g[3]+=l[3]+p[3],g[2]+=g[3]>>>16,g[3]&=65535,g[2]+=l[2]+p[2],g[1]+=g[2]>>>16,g[2]&=65535,g[1]+=l[1]+p[1],g[0]+=g[1]>>>16,g[1]&=65535,g[0]+=l[0]+p[0],g[0]&=65535,[g[0]<<16|g[1],g[2]<<16|g[3]]}function c(l,p){l=[l[0]>>>16,l[0]&65535,l[1]>>>16,l[1]&65535],p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535];var g=[0,0,0,0];return g[3]+=l[3]*p[3],g[2]+=g[3]>>>16,g[3]&=65535,g[2]+=l[2]*p[3],g[1]+=g[2]>>>16,g[2]&=65535,g[2]+=l[3]*p[2],g[1]+=g[2]>>>16,g[2]&=65535,g[1]+=l[1]*p[3],g[0]+=g[1]>>>16,g[1]&=65535,g[1]+=l[2]*p[2],g[0]+=g[1]>>>16,g[1]&=65535,g[1]+=l[3]*p[1],g[0]+=g[1]>>>16,g[1]&=65535,g[0]+=l[0]*p[3]+l[1]*p[2]+l[2]*p[1]+l[3]*p[0],g[0]&=65535,[g[0]<<16|g[1],g[2]<<16|g[3]]}function u(l,p){return p%=64,p===32?[l[1],l[0]]:p<32?[l[0]<<p|l[1]>>>32-p,l[1]<<p|l[0]>>>32-p]:(p-=32,[l[1]<<p|l[0]>>>32-p,l[0]<<p|l[1]>>>32-p])}function f(l,p){return p%=64,p===0?l:p<32?[l[0]<<p|l[1]>>>32-p,l[1]<<p]:[l[1]<<p-32,0]}function d(l,p){return[l[0]^p[0],l[1]^p[1]]}function w(l){return l=d(l,[0,l[0]>>>1]),l=c(l,[4283543511,3981806797]),l=d(l,[0,l[0]>>>1]),l=c(l,[3301882366,444984403]),l=d(l,[0,l[0]>>>1]),l}r.x86.hash32=function(l,p){if(r.inputValidation&&!n(l))return e;p=p||0;for(var g=l.length%4,R=l.length-g,y=p,b=0,D=3432918353,S=461845907,C=0;C<R;C=C+4)b=l[C]|l[C+1]<<8|l[C+2]<<16|l[C+3]<<24,b=o(b,D),b=s(b,15),b=o(b,S),y^=b,y=s(y,13),y=o(y,5)+3864292196;switch(b=0,g){case 3:b^=l[C+2]<<16;case 2:b^=l[C+1]<<8;case 1:b^=l[C],b=o(b,D),b=s(b,15),b=o(b,S),y^=b}return y^=l.length,y=i(y),y>>>0},r.x86.hash128=function(l,p){if(r.inputValidation&&!n(l))return e;p=p||0;for(var g=l.length%16,R=l.length-g,y=p,b=p,D=p,S=p,C=0,$=0,T=0,M=0,Ae=597399067,Pn=2869860233,Vr=951274213,Ui=2716044179,H=0;H<R;H=H+16)C=l[H]|l[H+1]<<8|l[H+2]<<16|l[H+3]<<24,$=l[H+4]|l[H+5]<<8|l[H+6]<<16|l[H+7]<<24,T=l[H+8]|l[H+9]<<8|l[H+10]<<16|l[H+11]<<24,M=l[H+12]|l[H+13]<<8|l[H+14]<<16|l[H+15]<<24,C=o(C,Ae),C=s(C,15),C=o(C,Pn),y^=C,y=s(y,19),y+=b,y=o(y,5)+1444728091,$=o($,Pn),$=s($,16),$=o($,Vr),b^=$,b=s(b,17),b+=D,b=o(b,5)+197830471,T=o(T,Vr),T=s(T,17),T=o(T,Ui),D^=T,D=s(D,15),D+=S,D=o(D,5)+2530024501,M=o(M,Ui),M=s(M,18),M=o(M,Ae),S^=M,S=s(S,13),S+=y,S=o(S,5)+850148119;switch(C=0,$=0,T=0,M=0,g){case 15:M^=l[H+14]<<16;case 14:M^=l[H+13]<<8;case 13:M^=l[H+12],M=o(M,Ui),M=s(M,18),M=o(M,Ae),S^=M;case 12:T^=l[H+11]<<24;case 11:T^=l[H+10]<<16;case 10:T^=l[H+9]<<8;case 9:T^=l[H+8],T=o(T,Vr),T=s(T,17),T=o(T,Ui),D^=T;case 8:$^=l[H+7]<<24;case 7:$^=l[H+6]<<16;case 6:$^=l[H+5]<<8;case 5:$^=l[H+4],$=o($,Pn),$=s($,16),$=o($,Vr),b^=$;case 4:C^=l[H+3]<<24;case 3:C^=l[H+2]<<16;case 2:C^=l[H+1]<<8;case 1:C^=l[H],C=o(C,Ae),C=s(C,15),C=o(C,Pn),y^=C}return y^=l.length,b^=l.length,D^=l.length,S^=l.length,y+=b,y+=D,y+=S,b+=y,D+=y,S+=y,y=i(y),b=i(b),D=i(D),S=i(S),y+=b,y+=D,y+=S,b+=y,D+=y,S+=y,("00000000"+(y>>>0).toString(16)).slice(-8)+("00000000"+(b>>>0).toString(16)).slice(-8)+("00000000"+(D>>>0).toString(16)).slice(-8)+("00000000"+(S>>>0).toString(16)).slice(-8)},r.x64.hash128=function(l,p){if(r.inputValidation&&!n(l))return e;p=p||0;for(var g=l.length%16,R=l.length-g,y=[0,p],b=[0,p],D=[0,0],S=[0,0],C=[2277735313,289559509],$=[1291169091,658871167],T=0;T<R;T=T+16)D=[l[T+4]|l[T+5]<<8|l[T+6]<<16|l[T+7]<<24,l[T]|l[T+1]<<8|l[T+2]<<16|l[T+3]<<24],S=[l[T+12]|l[T+13]<<8|l[T+14]<<16|l[T+15]<<24,l[T+8]|l[T+9]<<8|l[T+10]<<16|l[T+11]<<24],D=c(D,C),D=u(D,31),D=c(D,$),y=d(y,D),y=u(y,27),y=a(y,b),y=a(c(y,[0,5]),[0,1390208809]),S=c(S,$),S=u(S,33),S=c(S,C),b=d(b,S),b=u(b,31),b=a(b,y),b=a(c(b,[0,5]),[0,944331445]);switch(D=[0,0],S=[0,0],g){case 15:S=d(S,f([0,l[T+14]],48));case 14:S=d(S,f([0,l[T+13]],40));case 13:S=d(S,f([0,l[T+12]],32));case 12:S=d(S,f([0,l[T+11]],24));case 11:S=d(S,f([0,l[T+10]],16));case 10:S=d(S,f([0,l[T+9]],8));case 9:S=d(S,[0,l[T+8]]),S=c(S,$),S=u(S,33),S=c(S,C),b=d(b,S);case 8:D=d(D,f([0,l[T+7]],56));case 7:D=d(D,f([0,l[T+6]],48));case 6:D=d(D,f([0,l[T+5]],40));case 5:D=d(D,f([0,l[T+4]],32));case 4:D=d(D,f([0,l[T+3]],24));case 3:D=d(D,f([0,l[T+2]],16));case 2:D=d(D,f([0,l[T+1]],8));case 1:D=d(D,[0,l[T]]),D=c(D,C),D=u(D,31),D=c(D,$),y=d(y,D)}return y=d(y,[0,l.length]),b=d(b,[0,l.length]),y=a(y,b),b=a(b,y),y=w(y),b=w(b),y=a(y,b),b=a(b,y),("00000000"+(y[0]>>>0).toString(16)).slice(-8)+("00000000"+(y[1]>>>0).toString(16)).slice(-8)+("00000000"+(b[0]>>>0).toString(16)).slice(-8)+("00000000"+(b[1]>>>0).toString(16)).slice(-8)},typeof yi<"u"?(typeof Uu<"u"&&Uu.exports&&(yi=Uu.exports=r),yi.murmurHash3=r):typeof define=="function"&&define.amd?define([],function(){return r}):(r._murmurHash3=t.murmurHash3,r.noConflict=function(){return t.murmurHash3=r._murmurHash3,r._murmurHash3=e,r.noConflict=e,r},t.murmurHash3=r)})(yi)});var km=Z((pM,O1)=>{O1.exports=R1()});var $_={};_($_,{Account:()=>cf,Client:()=>jo,Result:()=>zo,asAbilities:()=>O_,authorizeContentServe:()=>ug,create:()=>N_});var Se={};_(Se,{ArchiveSchema:()=>Gy,Delegation:()=>rt,View:()=>rt,allows:()=>p8,archive:()=>Vy,create:()=>kd,delegate:()=>Re,exportDAG:()=>xd,extract:()=>m8,importDAG:()=>vd,isDelegation:()=>lt,isLink:()=>d8,view:()=>Ra});var ro={};_(ro,{VERSION:()=>py,code:()=>GE,decode:()=>El,encode:()=>JE,format:()=>YE,isExpired:()=>eA,isTooEarly:()=>tA,issue:()=>Al,link:()=>ZE,name:()=>VE,now:()=>fa,parse:()=>QE,verifySignature:()=>XE,write:()=>ua});var eS=["string","number","bigint","symbol"],tS=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function lg(t){if(t===null)return"null";if(t===void 0)return"undefined";if(t===!0||t===!1)return"boolean";let e=typeof t;if(eS.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(t))return"Array";if(rS(t))return"Buffer";let r=nS(t);return r||"Object"}function rS(t){return t&&t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer.call(null,t)}function nS(t){let e=Object.prototype.toString.call(t).slice(8,-1);if(tS.includes(e))return e}var h=class{constructor(e,r,n){this.major=e,this.majorEncoded=e<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};h.uint=new h(0,"uint",!0);h.negint=new h(1,"negint",!0);h.bytes=new h(2,"bytes",!0);h.string=new h(3,"string",!0);h.array=new h(4,"array",!1);h.map=new h(5,"map",!1);h.tag=new h(6,"tag",!1);h.float=new h(7,"float",!0);h.false=new h(7,"false",!0);h.true=new h(7,"true",!0);h.null=new h(7,"null",!0);h.undefined=new h(7,"undefined",!0);h.break=new h(7,"break",!0);var x=class{constructor(e,r,n){this.type=e,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};var Rn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",oS=new TextDecoder,sS=new TextEncoder;function Ri(t){return Rn&&globalThis.Buffer.isBuffer(t)}function qo(t){return t instanceof Uint8Array?Ri(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t:Uint8Array.from(t)}var mg=Rn?(t,e,r)=>r-e>64?globalThis.Buffer.from(t.subarray(e,r)).toString("utf8"):pg(t,e,r):(t,e,r)=>r-e>64?oS.decode(t.subarray(e,r)):pg(t,e,r),Oi=Rn?t=>t.length>64?globalThis.Buffer.from(t):dg(t):t=>t.length>64?sS.encode(t):dg(t),xt=t=>Uint8Array.from(t),On=Rn?(t,e,r)=>Ri(t)?new Uint8Array(t.subarray(e,r)):t.slice(e,r):(t,e,r)=>t.slice(e,r),gg=Rn?(t,e)=>(t=t.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),qo(globalThis.Buffer.concat(t,e))):(t,e)=>{let r=new Uint8Array(e),n=0;for(let o of t)n+o.length>r.length&&(o=o.subarray(0,r.length-n)),r.set(o,n),n+=o.length;return r},wg=Rn?t=>globalThis.Buffer.allocUnsafe(t):t=>new Uint8Array(t);function yg(t,e){if(Ri(t)&&Ri(e))return t.compare(e);for(let r=0;r<t.length;r++)if(t[r]!==e[r])return t[r]<e[r]?-1:1;return 0}function dg(t){let e=[],r=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);o<128?e[r++]=o:o<2048?(e[r++]=o>>6|192,e[r++]=o&63|128):(o&64512)===55296&&n+1<t.length&&(t.charCodeAt(n+1)&64512)===56320?(o=65536+((o&1023)<<10)+(t.charCodeAt(++n)&1023),e[r++]=o>>18|240,e[r++]=o>>12&63|128,e[r++]=o>>6&63|128,e[r++]=o&63|128):(e[r++]=o>>12|224,e[r++]=o>>6&63|128,e[r++]=o&63|128)}return e}function pg(t,e,r){let n=[];for(;e<r;){let o=t[e],s=null,i=o>239?4:o>223?3:o>191?2:1;if(e+i<=r){let a,c,u,f;switch(i){case 1:o<128&&(s=o);break;case 2:a=t[e+1],(a&192)===128&&(f=(o&31)<<6|a&63,f>127&&(s=f));break;case 3:a=t[e+1],c=t[e+2],(a&192)===128&&(c&192)===128&&(f=(o&15)<<12|(a&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:a=t[e+1],c=t[e+2],u=t[e+3],(a&192)===128&&(c&192)===128&&(u&192)===128&&(f=(o&15)<<18|(a&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,i=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),e+=i}return yf(n)}var hg=4096;function yf(t){let e=t.length;if(e<=hg)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=hg));return r}var iS=256,Ho=class{constructor(e=iS){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let r=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let o=r.length-(this.maxCursor-this.cursor)-1;r.set(e,o)}else{if(r){let o=r.length-(this.maxCursor-this.cursor)-1;o<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,o),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(r=wg(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=On(n,0,this.cursor)}else r=gg(this.chunks,this.cursor);return e&&this.reset(),r}};var U="CBOR decode error:",Ot="CBOR encode error:",Wo=[];Wo[23]=1;Wo[24]=2;Wo[25]=3;Wo[26]=5;Wo[27]=9;function Nt(t,e,r){if(t.length-e<r)throw new Error(`${U} not enough data for type`)}var he=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Me(t,e,r){Nt(t,e,1);let n=t[e];if(r.strict===!0&&n<he[0])throw new Error(`${U} integer encoded in more bytes than necessary (strict decode)`);return n}function Fe(t,e,r){Nt(t,e,2);let n=t[e]<<8|t[e+1];if(r.strict===!0&&n<he[1])throw new Error(`${U} integer encoded in more bytes than necessary (strict decode)`);return n}function je(t,e,r){Nt(t,e,4);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3];if(r.strict===!0&&n<he[2])throw new Error(`${U} integer encoded in more bytes than necessary (strict decode)`);return n}function qe(t,e,r){Nt(t,e,8);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3],o=t[e+4]*16777216+(t[e+5]<<16)+(t[e+6]<<8)+t[e+7],s=(BigInt(n)<<BigInt(32))+BigInt(o);if(r.strict===!0&&s<he[3])throw new Error(`${U} integer encoded in more bytes than necessary (strict decode)`);if(s<=Number.MAX_SAFE_INTEGER)return Number(s);if(r.allowBigInt===!0)return s;throw new Error(`${U} integers outside of the safe integer range are not supported`)}function bg(t,e,r,n){return new x(h.uint,Me(t,e+1,n),2)}function xg(t,e,r,n){return new x(h.uint,Fe(t,e+1,n),3)}function vg(t,e,r,n){return new x(h.uint,je(t,e+1,n),5)}function kg(t,e,r,n){return new x(h.uint,qe(t,e+1,n),9)}function Je(t,e){return xe(t,0,e.value)}function xe(t,e,r){if(r<he[0]){let n=Number(r);t.push([e|n])}else if(r<he[1]){let n=Number(r);t.push([e|24,n])}else if(r<he[2]){let n=Number(r);t.push([e|25,n>>>8,n&255])}else if(r<he[3]){let n=Number(r);t.push([e|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<he[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,t.push(o)}else throw new Error(`${U} encountered BigInt larger than allowable range`)}}Je.encodedSize=function(e){return xe.encodedSize(e.value)};xe.encodedSize=function(e){return e<he[0]?1:e<he[1]?2:e<he[2]?3:e<he[3]?5:9};Je.compareTokens=function(e,r){return e.value<r.value?-1:e.value>r.value?1:0};function Sg(t,e,r,n){return new x(h.negint,-1-Me(t,e+1,n),2)}function Eg(t,e,r,n){return new x(h.negint,-1-Fe(t,e+1,n),3)}function Ag(t,e,r,n){return new x(h.negint,-1-je(t,e+1,n),5)}var bf=BigInt(-1),Dg=BigInt(1);function Tg(t,e,r,n){let o=qe(t,e+1,n);if(typeof o!="bigint"){let s=-1-o;if(s>=Number.MIN_SAFE_INTEGER)return new x(h.negint,s,9)}if(n.allowBigInt!==!0)throw new Error(`${U} integers outside of the safe integer range are not supported`);return new x(h.negint,bf-BigInt(o),9)}function Ni(t,e){let r=e.value,n=typeof r=="bigint"?r*bf-Dg:r*-1-1;xe(t,e.type.majorEncoded,n)}Ni.encodedSize=function(e){let r=e.value,n=typeof r=="bigint"?r*bf-Dg:r*-1-1;return n<he[0]?1:n<he[1]?2:n<he[2]?3:n<he[3]?5:9};Ni.compareTokens=function(e,r){return e.value<r.value?1:e.value>r.value?-1:0};function Vo(t,e,r,n){Nt(t,e,r+n);let o=On(t,e+r,e+r+n);return new x(h.bytes,o,r+n)}function Ig(t,e,r,n){return Vo(t,e,1,r)}function Bg(t,e,r,n){return Vo(t,e,2,Me(t,e+1,n))}function _g(t,e,r,n){return Vo(t,e,3,Fe(t,e+1,n))}function Cg(t,e,r,n){return Vo(t,e,5,je(t,e+1,n))}function Lg(t,e,r,n){let o=qe(t,e+1,n);if(typeof o=="bigint")throw new Error(`${U} 64-bit integer bytes lengths not supported`);return Vo(t,e,9,o)}function $i(t){return t.encodedBytes===void 0&&(t.encodedBytes=t.type===h.string?Oi(t.value):t.value),t.encodedBytes}function Nn(t,e){let r=$i(e);xe(t,e.type.majorEncoded,r.length),t.push(r)}Nn.encodedSize=function(e){let r=$i(e);return xe.encodedSize(r.length)+r.length};Nn.compareTokens=function(e,r){return cS($i(e),$i(r))};function cS(t,e){return t.length<e.length?-1:t.length>e.length?1:yg(t,e)}function Go(t,e,r,n,o){let s=r+n;Nt(t,e,s);let i=new x(h.string,mg(t,e+r,e+s),s);return o.retainStringBytes===!0&&(i.byteValue=On(t,e+r,e+s)),i}function Ug(t,e,r,n){return Go(t,e,1,r,n)}function Pg(t,e,r,n){return Go(t,e,2,Me(t,e+1,n),n)}function Rg(t,e,r,n){return Go(t,e,3,Fe(t,e+1,n),n)}function Og(t,e,r,n){return Go(t,e,5,je(t,e+1,n),n)}function Ng(t,e,r,n){let o=qe(t,e+1,n);if(typeof o=="bigint")throw new Error(`${U} 64-bit integer string lengths not supported`);return Go(t,e,9,o,n)}var $g=Nn;function $n(t,e,r,n){return new x(h.array,n,r)}function zg(t,e,r,n){return $n(t,e,1,r)}function Mg(t,e,r,n){return $n(t,e,2,Me(t,e+1,n))}function Fg(t,e,r,n){return $n(t,e,3,Fe(t,e+1,n))}function jg(t,e,r,n){return $n(t,e,5,je(t,e+1,n))}function qg(t,e,r,n){let o=qe(t,e+1,n);if(typeof o=="bigint")throw new Error(`${U} 64-bit integer array lengths not supported`);return $n(t,e,9,o)}function Hg(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${U} indefinite length items not allowed`);return $n(t,e,1,1/0)}function zi(t,e){xe(t,h.array.majorEncoded,e.value)}zi.compareTokens=Je.compareTokens;zi.encodedSize=function(e){return xe.encodedSize(e.value)};function zn(t,e,r,n){return new x(h.map,n,r)}function Wg(t,e,r,n){return zn(t,e,1,r)}function Vg(t,e,r,n){return zn(t,e,2,Me(t,e+1,n))}function Gg(t,e,r,n){return zn(t,e,3,Fe(t,e+1,n))}function Kg(t,e,r,n){return zn(t,e,5,je(t,e+1,n))}function Jg(t,e,r,n){let o=qe(t,e+1,n);if(typeof o=="bigint")throw new Error(`${U} 64-bit integer map lengths not supported`);return zn(t,e,9,o)}function Zg(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${U} indefinite length items not allowed`);return zn(t,e,1,1/0)}function Mi(t,e){xe(t,h.map.majorEncoded,e.value)}Mi.compareTokens=Je.compareTokens;Mi.encodedSize=function(e){return xe.encodedSize(e.value)};function Qg(t,e,r,n){return new x(h.tag,r,1)}function Yg(t,e,r,n){return new x(h.tag,Me(t,e+1,n),2)}function Xg(t,e,r,n){return new x(h.tag,Fe(t,e+1,n),3)}function ew(t,e,r,n){return new x(h.tag,je(t,e+1,n),5)}function tw(t,e,r,n){return new x(h.tag,qe(t,e+1,n),9)}function Fi(t,e){xe(t,h.tag.majorEncoded,e.value)}Fi.compareTokens=Je.compareTokens;Fi.encodedSize=function(e){return xe.encodedSize(e.value)};var hS=20,mS=21,gS=22,wS=23;function rw(t,e,r,n){if(n.allowUndefined===!1)throw new Error(`${U} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new x(h.null,null,1):new x(h.undefined,void 0,1)}function nw(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${U} indefinite length items not allowed`);return new x(h.break,void 0,1)}function xf(t,e,r){if(r){if(r.allowNaN===!1&&Number.isNaN(t))throw new Error(`${U} NaN values are not supported`);if(r.allowInfinity===!1&&(t===1/0||t===-1/0))throw new Error(`${U} Infinity values are not supported`)}return new x(h.float,t,e)}function ow(t,e,r,n){return xf(vf(t,e+1),3,n)}function sw(t,e,r,n){return xf(kf(t,e+1),5,n)}function iw(t,e,r,n){return xf(fw(t,e+1),9,n)}function ji(t,e,r){let n=e.value;if(n===!1)t.push([h.float.majorEncoded|hS]);else if(n===!0)t.push([h.float.majorEncoded|mS]);else if(n===null)t.push([h.float.majorEncoded|gS]);else if(n===void 0)t.push([h.float.majorEncoded|wS]);else{let o,s=!1;(!r||r.float64!==!0)&&(cw(n),o=vf(st,1),n===o||Number.isNaN(n)?(st[0]=249,t.push(st.slice(0,3)),s=!0):(uw(n),o=kf(st,1),n===o&&(st[0]=250,t.push(st.slice(0,5)),s=!0))),s||(yS(n),o=fw(st,1),st[0]=251,t.push(st.slice(0,9)))}}ji.encodedSize=function(e,r){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){cw(n);let o=vf(st,1);if(n===o||Number.isNaN(n))return 3;if(uw(n),o=kf(st,1),n===o)return 5}return 9};var aw=new ArrayBuffer(9),Ze=new DataView(aw,1),st=new Uint8Array(aw,0);function cw(t){if(t===1/0)Ze.setUint16(0,31744,!1);else if(t===-1/0)Ze.setUint16(0,64512,!1);else if(Number.isNaN(t))Ze.setUint16(0,32256,!1);else{Ze.setFloat32(0,t);let e=Ze.getUint32(0),r=(e&2139095040)>>23,n=e&8388607;if(r===255)Ze.setUint16(0,31744,!1);else if(r===0)Ze.setUint16(0,(t&2147483648)>>16|n>>13,!1);else{let o=r-127;o<-24?Ze.setUint16(0,0):o<-14?Ze.setUint16(0,(e&2147483648)>>16|1<<24+o,!1):Ze.setUint16(0,(e&2147483648)>>16|o+15<<10|n>>13,!1)}}}function vf(t,e){if(t.length-e<2)throw new Error(`${U} not enough data for float16`);let r=(t[e]<<8)+t[e+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,o=r&1023,s;return n===0?s=o*2**-24:n!==31?s=(o+1024)*2**(n-25):s=o===0?1/0:NaN,r&32768?-s:s}function uw(t){Ze.setFloat32(0,t,!1)}function kf(t,e){if(t.length-e<4)throw new Error(`${U} not enough data for float32`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,4).getFloat32(0,!1)}function yS(t){Ze.setFloat64(0,t,!1)}function fw(t,e){if(t.length-e<8)throw new Error(`${U} not enough data for float64`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,8).getFloat64(0,!1)}ji.compareTokens=Je.compareTokens;function K(t,e,r){throw new Error(`${U} encountered invalid minor (${r}) for major ${t[e]>>>5}`)}function qi(t){return()=>{throw new Error(`${U} ${t}`)}}var I=[];for(let t=0;t<=23;t++)I[t]=K;I[24]=bg;I[25]=xg;I[26]=vg;I[27]=kg;I[28]=K;I[29]=K;I[30]=K;I[31]=K;for(let t=32;t<=55;t++)I[t]=K;I[56]=Sg;I[57]=Eg;I[58]=Ag;I[59]=Tg;I[60]=K;I[61]=K;I[62]=K;I[63]=K;for(let t=64;t<=87;t++)I[t]=Ig;I[88]=Bg;I[89]=_g;I[90]=Cg;I[91]=Lg;I[92]=K;I[93]=K;I[94]=K;I[95]=qi("indefinite length bytes/strings are not supported");for(let t=96;t<=119;t++)I[t]=Ug;I[120]=Pg;I[121]=Rg;I[122]=Og;I[123]=Ng;I[124]=K;I[125]=K;I[126]=K;I[127]=qi("indefinite length bytes/strings are not supported");for(let t=128;t<=151;t++)I[t]=zg;I[152]=Mg;I[153]=Fg;I[154]=jg;I[155]=qg;I[156]=K;I[157]=K;I[158]=K;I[159]=Hg;for(let t=160;t<=183;t++)I[t]=Wg;I[184]=Vg;I[185]=Gg;I[186]=Kg;I[187]=Jg;I[188]=K;I[189]=K;I[190]=K;I[191]=Zg;for(let t=192;t<=215;t++)I[t]=Qg;I[216]=Yg;I[217]=Xg;I[218]=ew;I[219]=tw;I[220]=K;I[221]=K;I[222]=K;I[223]=K;for(let t=224;t<=243;t++)I[t]=qi("simple values are not supported");I[244]=K;I[245]=K;I[246]=K;I[247]=rw;I[248]=qi("simple values are not supported");I[249]=ow;I[250]=sw;I[251]=iw;I[252]=K;I[253]=K;I[254]=K;I[255]=nw;var it=[];for(let t=0;t<24;t++)it[t]=new x(h.uint,t,1);for(let t=-1;t>=-24;t--)it[31-t]=new x(h.negint,t,1);it[64]=new x(h.bytes,new Uint8Array(0),1);it[96]=new x(h.string,"",1);it[128]=new x(h.array,0,1);it[160]=new x(h.map,0,1);it[244]=new x(h.false,!1,1);it[245]=new x(h.true,!0,1);it[246]=new x(h.null,null,1);function Hi(t){switch(t.type){case h.false:return xt([244]);case h.true:return xt([245]);case h.null:return xt([246]);case h.bytes:return t.value.length?void 0:xt([64]);case h.string:return t.value===""?xt([96]):void 0;case h.array:return t.value===0?xt([128]):void 0;case h.map:return t.value===0?xt([160]):void 0;case h.uint:return t.value<24?xt([Number(t.value)]):void 0;case h.negint:if(t.value>=-24)return xt([31-Number(t.value)])}}var xS={float64:!1,mapSorter:kS,quickEncodeToken:Hi};function Ef(){let t=[];return t[h.uint.major]=Je,t[h.negint.major]=Ni,t[h.bytes.major]=Nn,t[h.string.major]=$g,t[h.array.major]=zi,t[h.map.major]=Mi,t[h.tag.major]=Fi,t[h.float.major]=ji,t}var lw=Ef(),Sf=new Ho,Wi=class t{constructor(e,r){this.obj=e,this.parent=r}includes(e){let r=this;do if(r.obj===e)return!0;while(r=r.parent);return!1}static createCheck(e,r){if(e&&e.includes(r))throw new Error(`${Ot} object contains circular references`);return new t(r,e)}},ur={null:new x(h.null,null),undefined:new x(h.undefined,void 0),true:new x(h.true,!0),false:new x(h.false,!1),emptyArray:new x(h.array,0),emptyMap:new x(h.map,0)},fr={number(t,e,r,n){return!Number.isInteger(t)||!Number.isSafeInteger(t)?new x(h.float,t):t>=0?new x(h.uint,t):new x(h.negint,t)},bigint(t,e,r,n){return t>=BigInt(0)?new x(h.uint,t):new x(h.negint,t)},Uint8Array(t,e,r,n){return new x(h.bytes,t)},string(t,e,r,n){return new x(h.string,t)},boolean(t,e,r,n){return t?ur.true:ur.false},null(t,e,r,n){return ur.null},undefined(t,e,r,n){return ur.undefined},ArrayBuffer(t,e,r,n){return new x(h.bytes,new Uint8Array(t))},DataView(t,e,r,n){return new x(h.bytes,new Uint8Array(t.buffer,t.byteOffset,t.byteLength))},Array(t,e,r,n){if(!t.length)return r.addBreakTokens===!0?[ur.emptyArray,new x(h.break)]:ur.emptyArray;n=Wi.createCheck(n,t);let o=[],s=0;for(let i of t)o[s++]=Ko(i,r,n);return r.addBreakTokens?[new x(h.array,t.length),