ipfs-http-client
Version:
A client library for the IPFS HTTP API
2 lines • 189 kB
JavaScript
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.IpfsHttpClient = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var IpfsHttpClient=(()=>{var hd=Object.create;var xr=Object.defineProperty;var md=Object.getOwnPropertyDescriptor;var gd=Object.getOwnPropertyNames;var yd=Object.getPrototypeOf,wd=Object.prototype.hasOwnProperty;var _s=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var E=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),q=(e,t)=>{for(var r in t)xr(e,r,{get:t[r],enumerable:!0})},Ds=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of gd(t))!wd.call(e,o)&&o!==r&&xr(e,o,{get:()=>t[o],enumerable:!(n=md(t,o))||n.enumerable});return e};var N=(e,t,r)=>(r=e!=null?hd(yd(e)):{},Ds(t||!e||!e.__esModule?xr(r,"default",{value:e,enumerable:!0}):r,e)),bd=e=>Ds(xr({},"__esModule",{value:!0}),e);var Da=E((F1,_a)=>{_a.exports=ko;var Na=128,ag=127,cg=~ag,ug=Math.pow(2,31);function ko(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw ko.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=ug;)t[r++]=e&255|Na,e/=128;for(;e&cg;)t[r++]=e&255|Na,e>>>=7;return t[r]=e|0,ko.bytes=r-n+1,t}});var Oa=E((z1,La)=>{La.exports=Uo;var fg=128,Ra=127;function Uo(e,n){var r=0,n=n||0,o=0,s=n,i,a=e.length;do{if(s>=a||o>49)throw Uo.bytes=0,new RangeError("Could not decode varint");i=e[s++],r+=o<28?(i&Ra)<<o:(i&Ra)*Math.pow(2,o),o+=7}while(i>=fg);return Uo.bytes=s-n,r}});var Fa=E((j1,$a)=>{var lg=Math.pow(2,7),pg=Math.pow(2,14),dg=Math.pow(2,21),hg=Math.pow(2,28),mg=Math.pow(2,35),gg=Math.pow(2,42),yg=Math.pow(2,49),wg=Math.pow(2,56),bg=Math.pow(2,63);$a.exports=function(e){return e<lg?1:e<pg?2:e<dg?3:e<hg?4:e<mg?5:e<gg?6:e<yg?7:e<wg?8:e<bg?9:10}});var st=E((M1,za)=>{za.exports={encode:Da(),decode:Oa(),encodingLength:Fa()}});var te=E((cx,Qa)=>{"use strict";function Xa(e,t){for(let r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}function Dg(e,t,r){if(!e||typeof e=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof t=="object"&&(r=t,t=""),t&&(r.code=t);try{return Xa(e,r)}catch{r.message=e.message,r.stack=e.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(e)),Xa(new o,r)}}Qa.exports=Dg});var rc=E((gx,tc)=>{function $g(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}tc.exports=$g});var zo=E((yx,nc)=>{"use strict";var Fg=rc(),Xr=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,or=Fg(),zg=Xr&&!or,jg=or&&!Xr,Mg=or&&Xr,qg=typeof _s=="function"&&typeof process<"u"&&typeof process.release<"u"&&process.release.name==="node"&&!or,Vg=typeof importScripts=="function"&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Hg=typeof process<"u"&&typeof process.env<"u"&&!1,Gg=typeof navigator<"u"&&navigator.product==="ReactNative";nc.exports={isTest:Hg,isElectron:or,isElectronMain:jg,isElectronRenderer:Mg,isNode:qg,isBrowser:zg,isWebWorker:Vg,isEnvWithDom:Xr,isReactNative:Gg}});var ac=E((xx,ic)=>{var kt=1e3,Ut=kt*60,Bt=Ut*60,at=Bt*24,Jg=at*7,Kg=at*365.25;ic.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Xg(e);if(r==="number"&&isFinite(e))return t.long?Zg(e):Qg(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Xg(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Kg;case"weeks":case"week":case"w":return r*Jg;case"days":case"day":case"d":return r*at;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Bt;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ut;case"seconds":case"second":case"secs":case"sec":case"s":return r*kt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Qg(e){var t=Math.abs(e);return t>=at?Math.round(e/at)+"d":t>=Bt?Math.round(e/Bt)+"h":t>=Ut?Math.round(e/Ut)+"m":t>=kt?Math.round(e/kt)+"s":e+"ms"}function Zg(e){var t=Math.abs(e);return t>=at?Qr(e,t,at,"day"):t>=Bt?Qr(e,t,Bt,"hour"):t>=Ut?Qr(e,t,Ut,"minute"):t>=kt?Qr(e,t,kt,"second"):e+" ms"}function Qr(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}});var uc=E((Sx,cc)=>{function Yg(e){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=o,r.enabled=i,r.humanize=ac(),r.destroy=l,Object.keys(e).forEach(d=>{r[d]=e[d]}),r.names=[],r.skips=[],r.formatters={};function t(d){let m=0;for(let x=0;x<d.length;x++)m=(m<<5)-m+d.charCodeAt(x),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=t;function r(d){let m,x=null,P,T;function B(...D){if(!B.enabled)return;let M=B,Z=Number(new Date),fe=Z-(m||Z);M.diff=fe,M.prev=m,M.curr=Z,m=Z,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let W=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(le,ne)=>{if(le==="%%")return"%";W++;let pe=r.formatters[ne];if(typeof pe=="function"){let lt=D[W];le=pe.call(M,lt),D.splice(W,1),W--}return le}),r.formatArgs.call(M,D),(M.log||r.log).apply(M,D)}return B.namespace=d,B.useColors=r.useColors(),B.color=r.selectColor(d),B.extend=n,B.destroy=r.destroy,Object.defineProperty(B,"enabled",{enumerable:!0,configurable:!1,get:()=>x!==null?x:(P!==r.namespaces&&(P=r.namespaces,T=r.enabled(d)),T),set:D=>{x=D}}),typeof r.init=="function"&&r.init(B),B}function n(d,m){let x=r(this.namespace+(typeof m>"u"?":":m)+d);return x.log=this.log,x}function o(d){r.save(d),r.namespaces=d,r.names=[],r.skips=[];let m,x=(typeof d=="string"?d:"").split(/[\s,]+/),P=x.length;for(m=0;m<P;m++)x[m]&&(d=x[m].replace(/\*/g,".*?"),d[0]==="-"?r.skips.push(new RegExp("^"+d.slice(1)+"$")):r.names.push(new RegExp("^"+d+"$")))}function s(){let d=[...r.names.map(a),...r.skips.map(a).map(m=>"-"+m)].join(",");return r.enable(""),d}function i(d){if(d[d.length-1]==="*")return!0;let m,x;for(m=0,x=r.skips.length;m<x;m++)if(r.skips[m].test(d))return!1;for(m=0,x=r.names.length;m<x;m++)if(r.names[m].test(d))return!0;return!1}function a(d){return d.toString().substring(2,d.toString().length-2).replace(/\.\*\?$/,"*")}function c(d){return d instanceof Error?d.stack||d.message:d}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 r.enable(r.load()),r}cc.exports=Yg});var fc=E((ce,Zr)=>{ce.formatArgs=ty;ce.save=ry;ce.load=ny;ce.useColors=ey;ce.storage=oy();ce.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})();ce.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 ey(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1: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&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ty(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Zr.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),e.splice(n,0,t)}ce.log=console.debug||console.log||(()=>{});function ry(e){try{e?ce.storage.setItem("debug",e):ce.storage.removeItem("debug")}catch{}}function ny(){let e;try{e=ce.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function oy(){try{return localStorage}catch{}}Zr.exports=uc()(ce);var{formatters:sy}=Zr.exports;sy.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Vo=E(en=>{"use strict";var jo=class extends Error{constructor(t="Request timed out"){super(t),this.name="TimeoutError"}};en.TimeoutError=jo;var Mo=class extends Error{constructor(t="The operation was aborted."){super(t),this.name="AbortError"}};en.AbortError=Mo;var qo=class extends Error{constructor(t){super(t.statusText),this.name="HTTPError",this.response=t}};en.HTTPError=qo});var sr=E(()=>{});var lc=E((kx,Ho)=>{"use strict";globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?Ho.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:Ho.exports={default:sr().default,Headers:sr().Headers,Request:sr().Request,Response:sr().Response}});var dc=E((Ux,pc)=>{"use strict";pc.exports=lc()});var gc=E((Bx,mc)=>{"use strict";var{TimeoutError:ay,AbortError:cy}=Vo(),{Response:hc,Request:uy,Headers:Wo,default:fy}=dc(),ly=(e,t={})=>{let r=new XMLHttpRequest;r.open(t.method||"GET",e.toString(),!0);let{timeout:n,headers:o}=t;if(n&&n>0&&n<1/0&&(r.timeout=n),t.overrideMimeType!=null&&r.overrideMimeType(t.overrideMimeType),o)for(let[s,i]of new Wo(o))r.setRequestHeader(s,i);return t.signal&&(t.signal.onabort=()=>r.abort()),t.onUploadProgress&&(r.upload.onprogress=t.onUploadProgress),r.responseType="arraybuffer",new Promise((s,i)=>{let a=c=>{switch(c.type){case"error":{s(hc.error());break}case"load":{s(new Go(r.responseURL,r.response,{status:r.status,statusText:r.statusText,headers:hy(r.getAllResponseHeaders())}));break}case"timeout":{i(new ay);break}case"abort":{i(new cy);break}default:break}};r.onerror=a,r.onload=a,r.ontimeout=a,r.onabort=a,r.send(t.body)})},py=fy,dy=(e,t={})=>t.onUploadProgress!=null?ly(e,t):py(e,t),hy=e=>{let t=new Wo;for(let r of e.trim().split(/[\r\n]+/)){let n=r.indexOf(": ");n>0&&t.set(r.slice(0,n),r.slice(n+1))}return t},Go=class extends hc{constructor(t,r,n){super(r,n),Object.defineProperty(this,"url",{value:t})}};mc.exports={fetch:dy,Request:uy,Headers:Wo}});var wc=E((Nx,yc)=>{"use strict";yc.exports=e=>{if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}});var Ko=E((Ec,Pc)=>{"use strict";var tn=wc(),{hasOwnProperty:xc}=Object.prototype,{propertyIsEnumerable:my}=Object,Nt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),gy=Ec,bc={concatArrays:!1,ignoreUndefined:!1},rn=e=>{let t=[];for(let r in e)xc.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){let r=Object.getOwnPropertySymbols(e);for(let n of r)my.call(e,n)&&t.push(n)}return t};function _t(e){return Array.isArray(e)?yy(e):tn(e)?wy(e):e}function yy(e){let t=e.slice(0,0);return rn(e).forEach(r=>{Nt(t,r,_t(e[r]))}),t}function wy(e){let t=Object.getPrototypeOf(e)===null?Object.create(null):{};return rn(e).forEach(r=>{Nt(t,r,_t(e[r]))}),t}var Sc=(e,t,r,n)=>(r.forEach(o=>{typeof t[o]>"u"&&n.ignoreUndefined||(o in e&&e[o]!==Object.getPrototypeOf(e)?Nt(e,o,Jo(e[o],t[o],n)):Nt(e,o,_t(t[o])))}),e),by=(e,t,r)=>{let n=e.slice(0,0),o=0;return[e,t].forEach(s=>{let i=[];for(let a=0;a<s.length;a++)xc.call(s,a)&&(i.push(String(a)),s===e?Nt(n,o++,s[a]):Nt(n,o++,_t(s[a])));n=Sc(n,s,rn(s).filter(a=>!i.includes(a)),r)}),n};function Jo(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?by(e,t,r):!tn(t)||!tn(e)?_t(t):Sc(e,t,rn(t),r)}Pc.exports=function(...e){let t=Jo(_t(bc),this!==gy&&this||{},bc),r={_:{}};for(let n of e)if(n!==void 0){if(!tn(n))throw new TypeError("`"+n+"` is not an Option Object");r=Jo(r,{_:n},t)}return r._}});var Qo=E((_x,vc)=>{"use strict";var xy=typeof navigator<"u"&&navigator.product==="ReactNative";function Sy(){return xy?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:""}var ir=self.URL,Tc=Sy(),Xo=class{constructor(t="",r=Tc){this.super=new ir(t,r),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(t){this.super.hash=t}set host(t){this.super.host=t}set hostname(t){this.super.hostname=t}set href(t){this.super.href=t}set password(t){this.super.password=t}set pathname(t){this.super.pathname=t}set port(t){this.super.port=t}set protocol(t){this.super.protocol=t}set search(t){this.super.search=t}set username(t){this.super.username=t}static createObjectURL(t){return ir.createObjectURL(t)}static revokeObjectURL(t){ir.revokeObjectURL(t)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function Ey(e){if(typeof e=="string")return new ir(e).toString();if(!(e instanceof ir)){let t=e.username&&e.password?`${e.username}:${e.password}@`:"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",o=e.protocol?e.protocol+"//":"",s=e.host||"",i=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",l=e.pathname||"",d=e.path||l+a;return`${o}${t||r}${s||i+n}${d}${c}`}}vc.exports={URLWithLegacySupport:Xo,URLSearchParams:self.URLSearchParams,defaultBase:Tc,format:Ey}});var Ic=E((Dx,Cc)=>{"use strict";var{URLWithLegacySupport:Ac,format:Py}=Qo();Cc.exports=(e,t={},r={},n)=>{let o=t.protocol?t.protocol.replace(":",""):"http";o=(r[o]||n||o)+":";let s;try{s=new Ac(e)}catch{s={}}let i=Object.assign({},t,{protocol:o||s.protocol,host:t.host||s.host});return new Ac(e,Py(i)).toString()}});var Uc=E((Rx,kc)=>{"use strict";var{URLWithLegacySupport:Ty,format:vy,URLSearchParams:Ay,defaultBase:Cy}=Qo(),Iy=Ic();kc.exports={URL:Ty,URLSearchParams:Ay,format:vy,relative:Iy,defaultBase:Cy}});var Yo=E((Lx,Zo)=>{function Bc(e){let t=new globalThis.AbortController;function r(){t.abort();for(let n of e)!n||!n.removeEventListener||n.removeEventListener("abort",r)}for(let n of e)if(!(!n||!n.addEventListener)){if(n.aborted){r();break}n.addEventListener("abort",r)}return t.signal}Zo.exports=Bc;Zo.exports.anySignal=Bc});var _c=E((Ox,Nc)=>{"use strict";async function*ky(e,t={}){let r=e.getReader();try{for(;;){let n=await r.read();if(n.done)return;yield n.value}}finally{t.preventCancel!==!0&&r.cancel(),r.releaseLock()}}Nc.exports=ky});var Rc=E(($x,Dc)=>{"use strict";var Uy=async e=>{let t=[];for await(let r of e)t.push(r);return t};Dc.exports=Uy});var nn=E((Fx,jc)=>{"use strict";var{fetch:By,Request:Ny,Headers:_y}=gc(),{TimeoutError:es,HTTPError:Fc}=Vo(),Lc=Ko().bind({ignoreUndefined:!0}),{URL:Oc,URLSearchParams:$c}=Uc(),Dy=Yo(),Ry=_c(),{isBrowser:Ly,isWebWorker:Oy}=zo(),$y=Rc(),Fy=(e,t,r)=>{if(t===void 0)return e;let n=Date.now(),o=()=>Date.now()-n>=t;return new Promise((s,i)=>{let a=setTimeout(()=>{o()&&(i(new es),r.abort())},t),c=l=>m=>{if(clearTimeout(a),o()){i(new es);return}l(m)};e.then(c(s),c(i))})},zy={throwHttpErrors:!0,credentials:"same-origin"},Q=class{constructor(t={}){this.opts=Lc(zy,t)}async fetch(t,r={}){let n=Lc(this.opts,r),o=new _y(n.headers);if(typeof t!="string"&&!(t instanceof Oc||t instanceof Ny))throw new TypeError("`resource` must be a string, URL, or Request");let s=new Oc(t.toString(),n.base),{searchParams:i,transformSearchParams:a,json:c}=n;i&&(typeof a=="function"?s.search=a(new $c(n.searchParams)):s.search=new $c(n.searchParams)),c&&(n.body=JSON.stringify(n.json),o.set("content-type","application/json"));let l=new AbortController,d=Dy([l.signal,n.signal]);globalThis.ReadableStream!=null&&n.body instanceof globalThis.ReadableStream&&(Ly||Oy)&&(n.body=new Blob(await $y(Ry(n.body))));let m=await Fy(By(s.toString(),{...n,signal:d,timeout:void 0,headers:o,duplex:"half"}),n.timeout,l);if(!m.ok&&n.throwHttpErrors)throw n.handleError&&await n.handleError(m),new Fc(m);return m.iterator=async function*(){yield*zc(m.body)},m.ndjson=async function*(){for await(let x of jy(m.iterator()))r.transform?yield r.transform(x):yield x},m}post(t,r={}){return this.fetch(t,{...r,method:"POST"})}get(t,r={}){return this.fetch(t,{...r,method:"GET"})}put(t,r={}){return this.fetch(t,{...r,method:"PUT"})}delete(t,r={}){return this.fetch(t,{...r,method:"DELETE"})}options(t,r={}){return this.fetch(t,{...r,method:"OPTIONS"})}},jy=async function*(e){let t=new TextDecoder,r="";for await(let n of e){r+=t.decode(n,{stream:!0});let o=r.split(/\r?\n/);for(let s=0;s<o.length-1;s++){let i=o[s].trim();i.length>0&&(yield JSON.parse(i))}r=o[o.length-1]}r+=t.decode(),r=r.trim(),r.length!==0&&(yield JSON.parse(r))},zc=e=>{if(My(e))return e;if(Vy(e)){let t=e[Symbol.asyncIterator]();return{[Symbol.asyncIterator](){return{next:t.next.bind(t),return(r){return e.destroy(),typeof t.return=="function"?t.return():Promise.resolve({done:!0,value:r})}}}}}if(qy(e)){let t=e.getReader();return async function*(){try{for(;;){let{done:r,value:n}=await t.read();if(r)return;n&&(yield n)}}finally{t.releaseLock()}}()}throw new TypeError("Body can't be converted to AsyncIterable")},My=e=>typeof e=="object"&&e!==null&&typeof e[Symbol.asyncIterator]=="function",qy=e=>e&&typeof e.getReader=="function",Vy=e=>Object.prototype.hasOwnProperty.call(e,"readable")&&Object.prototype.hasOwnProperty.call(e,"writable");Q.HTTPError=Fc;Q.TimeoutError=es;Q.streamToAsyncIterator=zc;Q.post=(e,t)=>new Q(t).post(e,t);Q.get=(e,t)=>new Q(t).get(e,t);Q.put=(e,t)=>new Q(t).put(e,t);Q.delete=(e,t)=>new Q(t).delete(e,t);Q.options=(e,t)=>new Q(t).options(e,t);jc.exports=Q});var vu=E((fE,Tu)=>{"use strict";Tu.exports=kw;function kw(e,t){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(d){if(s)if(s=!1,d)c(d);else{for(var m=new Array(arguments.length-1),x=0;x<m.length;)m[x++]=arguments[x];a.apply(null,m)}};try{e.apply(t||null,r)}catch(l){s&&(s=!1,c(l))}})}});var ku=E(Iu=>{"use strict";var pn=Iu;pn.length=function(t){var r=t.length;if(!r)return 0;for(var n=0;--r%4>1&&t.charAt(r)==="=";)++n;return Math.ceil(t.length*3)/4-n};var Lt=new Array(64),Cu=new Array(123);for(Ie=0;Ie<64;)Cu[Lt[Ie]=Ie<26?Ie+65:Ie<52?Ie+71:Ie<62?Ie-4:Ie-59|43]=Ie++;var Ie;pn.encode=function(t,r,n){for(var o=null,s=[],i=0,a=0,c;r<n;){var l=t[r++];switch(a){case 0:s[i++]=Lt[l>>2],c=(l&3)<<4,a=1;break;case 1:s[i++]=Lt[c|l>>4],c=(l&15)<<2,a=2;break;case 2:s[i++]=Lt[c|l>>6],s[i++]=Lt[l&63],a=0;break}i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),i=0)}return a&&(s[i++]=Lt[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 Au="invalid encoding";pn.decode=function(t,r,n){for(var o=n,s=0,i,a=0;a<t.length;){var c=t.charCodeAt(a++);if(c===61&&s>1)break;if((c=Cu[c])===void 0)throw Error(Au);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(Au);return n-o};pn.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Bu=E((pE,Uu)=>{"use strict";Uu.exports=dn;function dn(){this._listeners={}}dn.prototype.on=function(t,r,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:r,ctx:n||this}),this};dn.prototype.off=function(t,r){if(t===void 0)this._listeners={};else if(r===void 0)this._listeners[t]=[];else for(var n=this._listeners[t],o=0;o<n.length;)n[o].fn===r?n.splice(o,1):++o;return this};dn.prototype.emit=function(t){var r=this._listeners[t];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 $u=E((dE,Ou)=>{"use strict";Ou.exports=Nu(Nu);function Nu(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=r[3]===128;function o(c,l,d){t[0]=c,l[d]=r[0],l[d+1]=r[1],l[d+2]=r[2],l[d+3]=r[3]}function s(c,l,d){t[0]=c,l[d]=r[3],l[d+1]=r[2],l[d+2]=r[1],l[d+3]=r[0]}e.writeFloatLE=n?o:s,e.writeFloatBE=n?s:o;function i(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],t[0]}function a(c,l){return r[3]=c[l],r[2]=c[l+1],r[1]=c[l+2],r[0]=c[l+3],t[0]}e.readFloatLE=n?i:a,e.readFloatBE=n?a:i}():function(){function t(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),l=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|l)>>>0,s,i)}}e.writeFloatLE=t.bind(null,_u),e.writeFloatBE=t.bind(null,Du);function r(n,o,s){var i=n(o,s),a=(i>>31)*2+1,c=i>>>23&255,l=i&8388607;return c===255?l?NaN:a*(1/0):c===0?a*1401298464324817e-60*l:a*Math.pow(2,c-150)*(l+8388608)}e.readFloatLE=r.bind(null,Ru),e.readFloatBE=r.bind(null,Lu)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=r[7]===128;function o(c,l,d){t[0]=c,l[d]=r[0],l[d+1]=r[1],l[d+2]=r[2],l[d+3]=r[3],l[d+4]=r[4],l[d+5]=r[5],l[d+6]=r[6],l[d+7]=r[7]}function s(c,l,d){t[0]=c,l[d]=r[7],l[d+1]=r[6],l[d+2]=r[5],l[d+3]=r[4],l[d+4]=r[3],l[d+5]=r[2],l[d+6]=r[1],l[d+7]=r[0]}e.writeDoubleLE=n?o:s,e.writeDoubleBE=n?s:o;function i(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],r[4]=c[l+4],r[5]=c[l+5],r[6]=c[l+6],r[7]=c[l+7],t[0]}function a(c,l){return r[7]=c[l],r[6]=c[l+1],r[5]=c[l+2],r[4]=c[l+3],r[3]=c[l+4],r[2]=c[l+5],r[1]=c[l+6],r[0]=c[l+7],t[0]}e.readDoubleLE=n?i:a,e.readDoubleBE=n?a:i}():function(){function t(n,o,s,i,a,c){var l=i<0?1:0;if(l&&(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((l<<31|2146435072)>>>0,a,c+s);else{var d;if(i<22250738585072014e-324)d=i/5e-324,n(d>>>0,a,c+o),n((l<<31|d/4294967296)>>>0,a,c+s);else{var m=Math.floor(Math.log(i)/Math.LN2);m===1024&&(m=1023),d=i*Math.pow(2,-m),n(d*4503599627370496>>>0,a,c+o),n((l<<31|m+1023<<20|d*1048576&1048575)>>>0,a,c+s)}}}e.writeDoubleLE=t.bind(null,_u,0,4),e.writeDoubleBE=t.bind(null,Du,4,0);function r(n,o,s,i,a){var c=n(i,a+o),l=n(i,a+s),d=(l>>31)*2+1,m=l>>>20&2047,x=4294967296*(l&1048575)+c;return m===2047?x?NaN:d*(1/0):m===0?d*5e-324*x:d*Math.pow(2,m-1075)*(x+4503599627370496)}e.readDoubleLE=r.bind(null,Ru,0,4),e.readDoubleBE=r.bind(null,Lu,4,0)}(),e}function _u(e,t,r){t[r]=e&255,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function Du(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=e&255}function Ru(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Lu(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var Fu=E((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(e){}return null}});var ju=E(zu=>{"use strict";var ds=zu;ds.length=function(t){for(var r=0,n=0,o=0;o<t.length;++o)n=t.charCodeAt(o),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(t.charCodeAt(o+1)&64512)===56320?(++o,r+=4):r+=3;return r};ds.read=function(t,r,n){var o=n-r;if(o<1)return"";for(var s=null,i=[],a=0,c;r<n;)c=t[r++],c<128?i[a++]=c:c>191&&c<224?i[a++]=(c&31)<<6|t[r++]&63:c>239&&c<365?(c=((c&7)<<18|(t[r++]&63)<<12|(t[r++]&63)<<6|t[r++]&63)-65536,i[a++]=55296+(c>>10),i[a++]=56320+(c&1023)):i[a++]=(c&15)<<12|(t[r++]&63)<<6|t[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))};ds.write=function(t,r,n){for(var o=n,s,i,a=0;a<t.length;++a)s=t.charCodeAt(a),s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=s&63|128):(s&64512)===55296&&((i=t.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 qu=E((mE,Mu)=>{"use strict";Mu.exports=Uw;function Uw(e,t,r){var n=r||8192,o=n>>>1,s=null,i=n;return function(c){if(c<1||c>o)return e(c);i+c>n&&(s=e(n),i=0);var l=t.call(s,i,i+=c);return i&7&&(i=(i|7)+1),l}}});var Hu=E((gE,Vu)=>{"use strict";Vu.exports=G;var mr=tt();function G(e,t){this.lo=e>>>0,this.hi=t>>>0}var ut=G.zero=new G(0,0);ut.toNumber=function(){return 0};ut.zzEncode=ut.zzDecode=function(){return this};ut.length=function(){return 1};var Bw=G.zeroHash="\0\0\0\0\0\0\0\0";G.fromNumber=function(t){if(t===0)return ut;var r=t<0;r&&(t=-t);var n=t>>>0,o=(t-n)/4294967296>>>0;return r&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new G(n,o)};G.from=function(t){if(typeof t=="number")return G.fromNumber(t);if(mr.isString(t))if(mr.Long)t=mr.Long.fromString(t);else return G.fromNumber(parseInt(t,10));return t.low||t.high?new G(t.low>>>0,t.high>>>0):ut};G.prototype.toNumber=function(t){if(!t&&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};G.prototype.toLong=function(t){return mr.Long?new mr.Long(this.lo|0,this.hi|0,Boolean(t)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(t)}};var et=String.prototype.charCodeAt;G.fromHash=function(t){return t===Bw?ut:new G((et.call(t,0)|et.call(t,1)<<8|et.call(t,2)<<16|et.call(t,3)<<24)>>>0,(et.call(t,4)|et.call(t,5)<<8|et.call(t,6)<<16|et.call(t,7)<<24)>>>0)};G.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)};G.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};G.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};G.prototype.length=function(){var t=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?t<16384?t<128?1:2:t<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var tt=E(hs=>{"use strict";var b=hs;b.asPromise=vu();b.base64=ku();b.EventEmitter=Bu();b.float=$u();b.inquire=Fu();b.utf8=ju();b.pool=qu();b.LongBits=Hu();b.isNode=Boolean(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);b.global=b.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||hs;b.emptyArray=Object.freeze?Object.freeze([]):[];b.emptyObject=Object.freeze?Object.freeze({}):{};b.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};b.isString=function(t){return typeof t=="string"||t instanceof String};b.isObject=function(t){return t&&typeof t=="object"};b.isset=b.isSet=function(t,r){var n=t[r];return n!=null&&t.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};b.Buffer=function(){try{var e=b.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();b._Buffer_from=null;b._Buffer_allocUnsafe=null;b.newBuffer=function(t){return typeof t=="number"?b.Buffer?b._Buffer_allocUnsafe(t):new b.Array(t):b.Buffer?b._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};b.Array=typeof Uint8Array<"u"?Uint8Array:Array;b.Long=b.global.dcodeIO&&b.global.dcodeIO.Long||b.global.Long||b.inquire("long");b.key2Re=/^true|false|0|1$/;b.key32Re=/^-?(?:0|[1-9][0-9]*)$/;b.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;b.longToHash=function(t){return t?b.LongBits.from(t).toHash():b.LongBits.zeroHash};b.longFromHash=function(t,r){var n=b.LongBits.fromHash(t);return b.Long?b.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))};function Gu(e,t,r){for(var n=Object.keys(t),o=0;o<n.length;++o)(e[n[o]]===void 0||!r)&&(e[n[o]]=t[n[o]]);return e}b.merge=Gu;b.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Wu(e){function t(r,n){if(!(this instanceof t))return new t(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&Gu(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}b.newError=Wu;b.ProtocolError=Wu("ProtocolError");b.oneOfGetter=function(t){for(var r={},n=0;n<t.length;++n)r[t[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]}};b.oneOfSetter=function(t){return function(r){for(var n=0;n<t.length;++n)t[n]!==r&&delete this[t[n]]}};b.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};b._configure=function(){var e=b.Buffer;if(!e){b._Buffer_from=b._Buffer_allocUnsafe=null;return}b._Buffer_from=e.from!==Uint8Array.from&&e.from||function(r,n){return new e(r,n)},b._Buffer_allocUnsafe=e.allocUnsafe||function(r){return new e(r)}}});var Ss=E((wE,Qu)=>{"use strict";Qu.exports=k;var xe=tt(),ms,hn=xe.LongBits,Ju=xe.base64,Ku=xe.utf8;function gr(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function ys(){}function Nw(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function k(){this.len=0,this.head=new gr(ys,0,0),this.tail=this.head,this.states=null}var Xu=function(){return xe.Buffer?function(){return(k.create=function(){return new ms})()}:function(){return new k}};k.create=Xu();k.alloc=function(t){return new xe.Array(t)};xe.Array!==Array&&(k.alloc=xe.pool(k.alloc,xe.Array.prototype.subarray));k.prototype._push=function(t,r,n){return this.tail=this.tail.next=new gr(t,r,n),this.len+=r,this};function ws(e,t,r){t[r]=e&255}function _w(e,t,r){for(;e>127;)t[r++]=e&127|128,e>>>=7;t[r]=e}function bs(e,t){this.len=e,this.next=void 0,this.val=t}bs.prototype=Object.create(gr.prototype);bs.prototype.fn=_w;k.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new bs((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};k.prototype.int32=function(t){return t<0?this._push(xs,10,hn.fromNumber(t)):this.uint32(t)};k.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function xs(e,t,r){for(;e.hi;)t[r++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=e.lo&127|128,e.lo=e.lo>>>7;t[r++]=e.lo}k.prototype.uint64=function(t){var r=hn.from(t);return this._push(xs,r.length(),r)};k.prototype.int64=k.prototype.uint64;k.prototype.sint64=function(t){var r=hn.from(t).zzEncode();return this._push(xs,r.length(),r)};k.prototype.bool=function(t){return this._push(ws,1,t?1:0)};function gs(e,t,r){t[r]=e&255,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}k.prototype.fixed32=function(t){return this._push(gs,4,t>>>0)};k.prototype.sfixed32=k.prototype.fixed32;k.prototype.fixed64=function(t){var r=hn.from(t);return this._push(gs,4,r.lo)._push(gs,4,r.hi)};k.prototype.sfixed64=k.prototype.fixed64;k.prototype.float=function(t){return this._push(xe.float.writeFloatLE,4,t)};k.prototype.double=function(t){return this._push(xe.float.writeDoubleLE,8,t)};var Dw=xe.Array.prototype.set?function(t,r,n){r.set(t,n)}:function(t,r,n){for(var o=0;o<t.length;++o)r[n+o]=t[o]};k.prototype.bytes=function(t){var r=t.length>>>0;if(!r)return this._push(ws,1,0);if(xe.isString(t)){var n=k.alloc(r=Ju.length(t));Ju.decode(t,n,0),t=n}return this.uint32(r)._push(Dw,r,t)};k.prototype.string=function(t){var r=Ku.length(t);return r?this.uint32(r)._push(Ku.write,r,t):this._push(ws,1,0)};k.prototype.fork=function(){return this.states=new Nw(this),this.head=this.tail=new gr(ys,0,0),this.len=0,this};k.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 gr(ys,0,0),this.len=0),this};k.prototype.ldelim=function(){var t=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=r,this.len+=n),this};k.prototype.finish=function(){for(var t=this.head.next,r=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,r,n),n+=t.len,t=t.next;return r};k._configure=function(e){ms=e,k.create=Xu(),ms._configure()}});var ef=E((bE,Yu)=>{"use strict";Yu.exports=De;var Zu=Ss();(De.prototype=Object.create(Zu.prototype)).constructor=De;var rt=tt();function De(){Zu.call(this)}De._configure=function(){De.alloc=rt._Buffer_allocUnsafe,De.writeBytesBuffer=rt.Buffer&&rt.Buffer.prototype instanceof Uint8Array&&rt.Buffer.prototype.set.name==="set"?function(t,r,n){r.set(t,n)}:function(t,r,n){if(t.copy)t.copy(r,n,0,t.length);else for(var o=0;o<t.length;)r[n++]=t[o++]}};De.prototype.bytes=function(t){rt.isString(t)&&(t=rt._Buffer_from(t,"base64"));var r=t.length>>>0;return this.uint32(r),r&&this._push(De.writeBytesBuffer,r,t),this};function Rw(e,t,r){e.length<40?rt.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}De.prototype.string=function(t){var r=rt.Buffer.byteLength(t);return this.uint32(r),r&&this._push(Rw,r,t),this};De._configure()});var Ts=E((xE,sf)=>{"use strict";sf.exports=$;var Re=tt(),Ps,nf=Re.LongBits,Lw=Re.utf8;function ke(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function $(e){this.buf=e,this.pos=0,this.len=e.length}var tf=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new $(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new $(t);throw Error("illegal buffer")},of=function(){return Re.Buffer?function(r){return($.create=function(o){return Re.Buffer.isBuffer(o)?new Ps(o):tf(o)})(r)}:tf};$.create=of();$.prototype._slice=Re.Array.prototype.subarray||Re.Array.prototype.slice;$.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,ke(this,10);return t}}();$.prototype.int32=function(){return this.uint32()|0};$.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Es(){var e=new nf(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 ke(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 ke(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")}$.prototype.bool=function(){return this.uint32()!==0};function mn(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}$.prototype.fixed32=function(){if(this.pos+4>this.len)throw ke(this,4);return mn(this.buf,this.pos+=4)};$.prototype.sfixed32=function(){if(this.pos+4>this.len)throw ke(this,4);return mn(this.buf,this.pos+=4)|0};function rf(){if(this.pos+8>this.len)throw ke(this,8);return new nf(mn(this.buf,this.pos+=4),mn(this.buf,this.pos+=4))}$.prototype.float=function(){if(this.pos+4>this.len)throw ke(this,4);var t=Re.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};$.prototype.double=function(){if(this.pos+8>this.len)throw ke(this,4);var t=Re.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};$.prototype.bytes=function(){var t=this.uint32(),r=this.pos,n=this.pos+t;if(n>this.len)throw ke(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};$.prototype.string=function(){var t=this.bytes();return Lw.read(t,0,t.length)};$.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw ke(this,t);this.pos+=t}else do if(this.pos>=this.len)throw ke(this);while(this.buf[this.pos++]&128);return this};$.prototype.skipType=function(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};$._configure=function(e){Ps=e,$.create=of(),Ps._configure();var t=Re.Long?"toLong":"toNumber";Re.merge($.prototype,{int64:function(){return Es.call(this)[t](!1)},uint64:function(){return Es.call(this)[t](!0)},sint64:function(){return Es.call(this).zzDecode()[t](!1)},fixed64:function(){return rf.call(this)[t](!0)},sfixed64:function(){return rf.call(this)[t](!1)}})}});var ff=E((SE,uf)=>{"use strict";uf.exports=ft;var cf=Ts();(ft.prototype=Object.create(cf.prototype)).constructor=ft;var af=tt();function ft(e){cf.call(this,e)}ft._configure=function(){af.Buffer&&(ft.prototype._slice=af.Buffer.prototype.slice)};ft.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};ft._configure()});var pf=E((EE,lf)=>{"use strict";lf.exports=yr;var vs=tt();(yr.prototype=Object.create(vs.EventEmitter.prototype)).constructor=yr;function yr(e,t,r){if(typeof e!="function")throw TypeError("rpcImpl must be a function");vs.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}yr.prototype.rpcCall=function e(t,r,n,o,s){if(!o)throw TypeError("request must be specified");var i=this;if(!s)return vs.asPromise(e,i,t,r,n,o);if(!i.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return i.rpcImpl(t,r[i.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,l){if(c)return i.emit("error",c,t),s(c);if(l===null){i.end(!0);return}if(!(l instanceof n))try{l=n[i.responseDelimited?"decodeDelimited":"decode"](l)}catch(d){return i.emit("error",d,t),s(d)}return i.emit("data",l,t),s(null,l)})}catch(a){i.emit("error",a,t),setTimeout(function(){s(a)},0);return}};yr.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var hf=E(df=>{"use strict";var Ow=df;Ow.Service=pf()});var gf=E((TE,mf)=>{"use strict";mf.exports={}});var bf=E(wf=>{"use strict";var re=wf;re.build="minimal";re.Writer=Ss();re.BufferWriter=ef();re.Reader=Ts();re.BufferReader=ff();re.util=tt();re.rpc=hf();re.roots=gf();re.configure=yf;function yf(){re.util._configure(),re.Writer._configure(re.BufferWriter),re.Reader._configure(re.BufferReader)}yf()});var Sf=E((AE,xf)=>{"use strict";xf.exports=bf()});var gl=E((xP,ml)=>{ml.exports=e=>{if(e[Symbol.asyncIterator])return e;if(e.getReader)return async function*(){let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)return;yield n}}finally{t.releaseLock()}}();throw new Error("unknown stream")}});var ud=E(()=>{});var ld=E(($5,fd)=>{"use strict";var cb=nn(),ub=(e,t)=>({path:decodeURIComponent(new URL(e).pathname.split("/").pop()||""),content:fb(e,t)});async function*fb(e,t){yield*(await new cb().get(e,t)).iterator()}fd.exports=ub});var db={};q(db,{CID:()=>h,create:()=>lb,globSource:()=>pb,multiaddr:()=>_,urlSource:()=>dd.default});var xd=e=>Promise.reject(new Error(`No base found for "${e}"`)),Sr=class{constructor(t){this._basesByName={},this._basesByPrefix={},this._loadBase=t.loadBase||xd;for(let r of t.bases)this.addBase(r)}addBase(t){if(this._basesByName[t.name]||this._basesByPrefix[t.prefix])throw new Error(`Codec already exists for codec "${t.name}"`);this._basesByName[t.name]=t,this._basesByPrefix[t.prefix]=t}removeBase(t){delete this._basesByName[t.name],delete this._basesByPrefix[t.prefix]}async getBase(t){if(this._basesByName[t])return this._basesByName[t];if(this._basesByPrefix[t])return this._basesByPrefix[t];let r=await this._loadBase(t);return this._basesByName[r.name]==null&&this._basesByPrefix[r.prefix]==null&&this.addBase(r),r}listBases(){return Object.values(this._basesByName)}};var Sd=e=>Promise.reject(new Error(`No codec found for "${e}"`)),Er=class{constructor(t){this._codecsByName={},this._codecsByCode={},this._loadCodec=t.loadCodec||Sd;for(let r of t.codecs)this.addCodec(r)}addCodec(t){if(this._codecsByName[t.name]||this._codecsByCode[t.code])throw new Error(`Resolver already exists for codec "${t.name}"`);this._codecsByName[t.name]=t,this._codecsByCode[t.code]=t}removeCodec(t){delete this._codecsByName[t.name],delete this._codecsByCode[t.code]}async getCodec(t){let r=typeof t=="string"?this._codecsByName:this._codecsByCode;if(r[t])return r[t];let n=await this._loadCodec(t);return r[t]==null&&this.addCodec(n),n}listCodecs(){return Object.values(this._codecsByName)}};var Ed=e=>Promise.reject(new Error(`No hasher found for "${e}"`)),Pr=class{constructor(t){this._hashersByName={},this._hashersByCode={},this._loadHasher=t.loadHasher||Ed;for(let r of t.hashers)this.addHasher(r)}addHasher(t){if(this._hashersByName[t.name]||this._hashersByCode[t.code])throw new Error(`Resolver already exists for codec "${t.name}"`);this._hashersByName[t.name]=t,this._hashersByCode[t.code]=t}removeHasher(t){delete this._hashersByName[t.name],delete this._hashersByCode[t.code]}async getHasher(t){let r=typeof t=="string"?this._hashersByName:this._hashersByCode;if(r[t])return r[t];let n=await this._loadHasher(t);return r[t]==null&&this.addHasher(n),n}listHashers(){return Object.values(this._hashersByName)}};var Vn={};q(Vn,{code:()=>yh,createLink:()=>ni,createNode:()=>ri,decode:()=>bh,encode:()=>wh,name:()=>gh,prepare:()=>Mn,validate:()=>qn});var Pd=Os,Rs=128,Td=127,vd=~Td,Ad=Math.pow(2,31);function Os(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Ad;)t[r++]=e&255|Rs,e/=128;for(;e&vd;)t[r++]=e&255|Rs,e>>>=7;return t[r]=e|0,Os.bytes=r-n+1,t}var Cd=Nn,Id=128,Ls=127;function Nn(e,n){var r=0,n=n||0,o=0,s=n,i,a=e.length;do{if(s>=a)throw Nn.bytes=0,new RangeError("Could not decode varint");i=e[s++],r+=o<28?(i&Ls)<<o:(i&Ls)*Math.pow(2,o),o+=7}while(i>=Id);return Nn.bytes=s-n,r}var kd=Math.pow(2,7),Ud=Math.pow(2,14),Bd=Math.pow(2,21),Nd=Math.pow(2,28),_d=Math.pow(2,35),Dd=Math.pow(2,42),Rd=Math.pow(2,49),Ld=Math.pow(2,56),Od=Math.pow(2,63),$d=function(e){return e<kd?1:e<Ud?2:e<Bd?3:e<Nd?4:e<_d?5:e<Dd?6:e<Rd?7:e<Ld?8:e<Od?9:10},Fd={encode:Pd,decode:Cd,encodingLength:$d},zd=Fd,Mt=zd;var qt=(e,t=0)=>[Mt.decode(e,t),Mt.decode.bytes],pt=(e,t,r=0)=>(Mt.encode(e,t,r),t),dt=e=>Mt.encodingLength(e);var xb=new Uint8Array(0);var $s=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},Pe=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};var Fs=e=>new TextEncoder().encode(e),zs=e=>new TextDecoder().decode(e);var Ge=(e,t)=>{let r=t.byteLength,n=dt(e),o=n+dt(r),s=new Uint8Array(o+r);return pt(e,s,0),pt(r,s,n),s.set(t,o),new ht(e,r,t,s)},Le=e=>{let t=Pe(e),[r,n]=qt(t),[o,s]=qt(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new ht(r,o,i,t)},Ms=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&$s(e.bytes,r.bytes)}},ht=class{constructor(t,r,n,o){this.code=t,this.size=r,this.digest=n,this.bytes=o}};var On={};q(On,{base58btc:()=>R,base58flickr:()=>Gd});function jd(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var s=e.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function m(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var B=0,D=0,M=0,Z=T.length;M!==Z&&T[M]===0;)M++,B++;for(var fe=(Z-M)*d+1>>>0,W=new Uint8Array(fe);M!==Z;){for(var Ee=T[M],le=0,ne=fe-1;(Ee!==0||le<D)&&ne!==-1;ne--,le++)Ee+=256*W[ne]>>>0,W[ne]=Ee%a>>>0,Ee=Ee/a>>>0;if(Ee!==0)throw new Error("Non-zero carry");D=le,M++}for(var pe=fe-D;pe!==fe&&W[pe]===0;)pe++;for(var lt=c.repeat(B);pe<fe;++pe)lt+=e.charAt(W[pe]);return lt}function x(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var B=0;if(T[B]!==" "){for(var D=0,M=0;T[B]===c;)D++,B++;for(var Z=(T.length-B)*l+1>>>0,fe=new Uint8Array(Z);T[B];){var W=r[T.charCodeAt(B)];if(W===255)return;for(var Ee=0,le=Z-1;(W!==0||Ee<M)&&le!==-1;le--,Ee++)W+=a*fe[le]>>>0,fe[le]=W%256>>>0,W=W/256>>>0;if(W!==0)throw new Error("Non-zero carry");M=Ee,B++}if(T[B]!==" "){for(var ne=Z-M;ne!==Z&&fe[ne]===0;)ne++;for(var pe=new Uint8Array(D+(Z-ne)),lt=D;ne!==Z;)pe[lt++]=fe[ne++];return pe}}}function P(T){var B=x(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:m,decodeUnsafe:x,decode:P}}var Md=jd,qd=Md,qs=qd;var _n=class{constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Dn=class{constructor(t,r,n){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Vs(this,t)}},Rn=class{constructor(t){this.decoders=t}or(t){return Vs(this,t)}decode(t){let r=t[0],n=this.decoders[r];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Vs=(e,t)=>new Rn({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Ln=class{constructor(t,r,n,o){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new _n(t,r,n),this.decoder=new Dn(t,r,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},mt=({name:e,prefix:t,encode:r,decode:n})=>new Ln(e,t,r,n),Je=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:o}=qs(r,t);return mt({prefix:e,name:t,encode:n,decode:s=>Pe(o(s))})},Vd=(e,t,r,n)=>{let o={};for(let d=0;d<t.length;++d)o[t[d]]=d;let s=e.length;for(;e[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),a=0,c=0,l=0;for(let d=0;d<s;++d){let m=o[e[d]];if(m===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|m,a+=r,a>=8&&(a-=8,i[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return i},Hd=(e,t,r)=>{let n=t[t.length-1]==="=",o=(1<<r)-1,s="",i=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],i+=8;i>r;)i-=r,s+=t[o&a>>i];if(i&&(s+=t[o&a<<r-i]),n)for(;s.length*r&7;)s+="=";return s},O=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>mt({prefix:t,name:e,encode(o){return Hd(o,n,r)},decode(o){return Vd(o,n,r,e)}});var R=Je({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Gd=Je({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var $n={};q($n,{base32:()=>ee,base32hex:()=>Xd,base32hexpad:()=>Zd,base32hexpadupper:()=>Yd,base32hexupper:()