Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ipfs-unixfs

Package Overview
Dependencies
Maintainers
4
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-unixfs - npm Package Compare versions

Comparing version 9.0.0 to 9.0.1

2

dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.IpfsUnixfs = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var IpfsUnixfs=(()=>{var pt=Object.create;var q=Object.defineProperty;var yt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var gt=Object.getPrototypeOf,bt=Object.prototype.hasOwnProperty;var d=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),mt=(i,t)=>{for(var e in t)q(i,e,{get:t[e],enumerable:!0})},ae=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of dt(t))!bt.call(i,n)&&n!==e&&q(i,n,{get:()=>t[n],enumerable:!(r=yt(t,n))||r.enumerable});return i};var ue=(i,t,e)=>(e=i!=null?pt(gt(i)):{},ae(t||!i||!i.__esModule?q(e,"default",{value:i,enumerable:!0}):e,i)),wt=i=>ae(q({},"__esModule",{value:!0}),i);var ce=d((At,le)=>{"use strict";function fe(i,t){for(let e in t)Object.defineProperty(i,e,{value:t[e],enumerable:!0,configurable:!0});return i}function _t(i,t,e){if(!i||typeof i=="string")throw new TypeError("Please pass an Error to err-code");e||(e={}),typeof t=="object"&&(e=t,t=""),t&&(e.code=t);try{return fe(i,e)}catch{e.message=i.message,e.stack=i.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(i)),fe(new n,e)}}le.exports=_t});var pe=d((jt,he)=>{"use strict";he.exports=St;function St(i,t){for(var e=new Array(arguments.length-1),r=0,n=2,o=!0;n<arguments.length;)e[r++]=arguments[n++];return new Promise(function(f,a){e[r]=function(h){if(o)if(o=!1,h)a(h);else{for(var w=new Array(arguments.length-1),N=0;N<w.length;)w[N++]=arguments[N];f.apply(null,w)}};try{i.apply(t||null,e)}catch(u){o&&(o=!1,a(u))}})}});var be=d(ge=>{"use strict";var C=ge;C.length=function(t){var e=t.length;if(!e)return 0;for(var r=0;--e%4>1&&t.charAt(e)==="=";)++r;return Math.ceil(t.length*3)/4-r};var v=new Array(64),de=new Array(123);for(S=0;S<64;)de[v[S]=S<26?S+65:S<52?S+71:S<62?S-4:S-59|43]=S++;var S;C.encode=function(t,e,r){for(var n=null,o=[],s=0,f=0,a;e<r;){var u=t[e++];switch(f){case 0:o[s++]=v[u>>2],a=(u&3)<<4,f=1;break;case 1:o[s++]=v[a|u>>4],a=(u&15)<<2,f=2;break;case 2:o[s++]=v[a|u>>6],o[s++]=v[u&63],f=0;break}s>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,o)),s=0)}return f&&(o[s++]=v[a],o[s++]=61,f===1&&(o[s++]=61)),n?(s&&n.push(String.fromCharCode.apply(String,o.slice(0,s))),n.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var ye="invalid encoding";C.decode=function(t,e,r){for(var n=r,o=0,s,f=0;f<t.length;){var a=t.charCodeAt(f++);if(a===61&&o>1)break;if((a=de[a])===void 0)throw Error(ye);switch(o){case 0:s=a,o=1;break;case 1:e[r++]=s<<2|(a&48)>>4,s=a,o=2;break;case 2:e[r++]=(s&15)<<4|(a&60)>>2,s=a,o=3;break;case 3:e[r++]=(s&3)<<6|a,o=0;break}}if(o===1)throw Error(ye);return r-n};C.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var we=d((Pt,me)=>{"use strict";me.exports=R;function R(){this._listeners={}}R.prototype.on=function(t,e,r){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:r||this}),this};R.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var r=this._listeners[t],n=0;n<r.length;)r[n].fn===e?r.splice(n,1):++n;return this};R.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<e.length;)e[n].fn.apply(e[n++].ctx,r)}return this}});var Be=d((It,Oe)=>{"use strict";Oe.exports=_e(_e);function _e(i){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),r=e[3]===128;function n(a,u,h){t[0]=a,u[h]=e[0],u[h+1]=e[1],u[h+2]=e[2],u[h+3]=e[3]}function o(a,u,h){t[0]=a,u[h]=e[3],u[h+1]=e[2],u[h+2]=e[1],u[h+3]=e[0]}i.writeFloatLE=r?n:o,i.writeFloatBE=r?o:n;function s(a,u){return e[0]=a[u],e[1]=a[u+1],e[2]=a[u+2],e[3]=a[u+3],t[0]}function f(a,u){return e[3]=a[u],e[2]=a[u+1],e[1]=a[u+2],e[0]=a[u+3],t[0]}i.readFloatLE=r?s:f,i.readFloatBE=r?f:s}():function(){function t(r,n,o,s){var f=n<0?1:0;if(f&&(n=-n),n===0)r(1/n>0?0:2147483648,o,s);else if(isNaN(n))r(2143289344,o,s);else if(n>34028234663852886e22)r((f<<31|2139095040)>>>0,o,s);else if(n<11754943508222875e-54)r((f<<31|Math.round(n/1401298464324817e-60))>>>0,o,s);else{var a=Math.floor(Math.log(n)/Math.LN2),u=Math.round(n*Math.pow(2,-a)*8388608)&8388607;r((f<<31|a+127<<23|u)>>>0,o,s)}}i.writeFloatLE=t.bind(null,Se),i.writeFloatBE=t.bind(null,ke);function e(r,n,o){var s=r(n,o),f=(s>>31)*2+1,a=s>>>23&255,u=s&8388607;return a===255?u?NaN:f*(1/0):a===0?f*1401298464324817e-60*u:f*Math.pow(2,a-150)*(u+8388608)}i.readFloatLE=e.bind(null,Te),i.readFloatBE=e.bind(null,ze)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),r=e[7]===128;function n(a,u,h){t[0]=a,u[h]=e[0],u[h+1]=e[1],u[h+2]=e[2],u[h+3]=e[3],u[h+4]=e[4],u[h+5]=e[5],u[h+6]=e[6],u[h+7]=e[7]}function o(a,u,h){t[0]=a,u[h]=e[7],u[h+1]=e[6],u[h+2]=e[5],u[h+3]=e[4],u[h+4]=e[3],u[h+5]=e[2],u[h+6]=e[1],u[h+7]=e[0]}i.writeDoubleLE=r?n:o,i.writeDoubleBE=r?o:n;function s(a,u){return e[0]=a[u],e[1]=a[u+1],e[2]=a[u+2],e[3]=a[u+3],e[4]=a[u+4],e[5]=a[u+5],e[6]=a[u+6],e[7]=a[u+7],t[0]}function f(a,u){return e[7]=a[u],e[6]=a[u+1],e[5]=a[u+2],e[4]=a[u+3],e[3]=a[u+4],e[2]=a[u+5],e[1]=a[u+6],e[0]=a[u+7],t[0]}i.readDoubleLE=r?s:f,i.readDoubleBE=r?f:s}():function(){function t(r,n,o,s,f,a){var u=s<0?1:0;if(u&&(s=-s),s===0)r(0,f,a+n),r(1/s>0?0:2147483648,f,a+o);else if(isNaN(s))r(0,f,a+n),r(2146959360,f,a+o);else if(s>17976931348623157e292)r(0,f,a+n),r((u<<31|2146435072)>>>0,f,a+o);else{var h;if(s<22250738585072014e-324)h=s/5e-324,r(h>>>0,f,a+n),r((u<<31|h/4294967296)>>>0,f,a+o);else{var w=Math.floor(Math.log(s)/Math.LN2);w===1024&&(w=1023),h=s*Math.pow(2,-w),r(h*4503599627370496>>>0,f,a+n),r((u<<31|w+1023<<20|h*1048576&1048575)>>>0,f,a+o)}}}i.writeDoubleLE=t.bind(null,Se,0,4),i.writeDoubleBE=t.bind(null,ke,4,0);function e(r,n,o,s,f){var a=r(s,f+n),u=r(s,f+o),h=(u>>31)*2+1,w=u>>>20&2047,N=4294967296*(u&1048575)+a;return w===2047?N?NaN:h*(1/0):w===0?h*5e-324*N:h*Math.pow(2,w-1075)*(N+4503599627370496)}i.readDoubleLE=e.bind(null,Te,0,4),i.readDoubleBE=e.bind(null,ze,4,0)}(),i}function Se(i,t,e){t[e]=i&255,t[e+1]=i>>>8&255,t[e+2]=i>>>16&255,t[e+3]=i>>>24}function ke(i,t,e){t[e]=i>>>24,t[e+1]=i>>>16&255,t[e+2]=i>>>8&255,t[e+3]=i&255}function Te(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16|i[t+3]<<24)>>>0}function ze(i,t){return(i[t]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3])>>>0}});var De=d((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(i){}return null}});var Ee=d(Le=>{"use strict";var J=Le;J.length=function(t){for(var e=0,r=0,n=0;n<t.length;++n)r=t.charCodeAt(n),r<128?e+=1:r<2048?e+=2:(r&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e};J.read=function(t,e,r){var n=r-e;if(n<1)return"";for(var o=null,s=[],f=0,a;e<r;)a=t[e++],a<128?s[f++]=a:a>191&&a<224?s[f++]=(a&31)<<6|t[e++]&63:a>239&&a<365?(a=((a&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,s[f++]=55296+(a>>10),s[f++]=56320+(a&1023)):s[f++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,f>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),f=0);return o?(f&&o.push(String.fromCharCode.apply(String,s.slice(0,f))),o.join("")):String.fromCharCode.apply(String,s.slice(0,f))};J.write=function(t,e,r){for(var n=r,o,s,f=0;f<t.length;++f)o=t.charCodeAt(f),o<128?e[r++]=o:o<2048?(e[r++]=o>>6|192,e[r++]=o&63|128):(o&64512)===55296&&((s=t.charCodeAt(f+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++f,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 r-n}});var Fe=d((Ct,Ne)=>{"use strict";Ne.exports=kt;function kt(i,t,e){var r=e||8192,n=r>>>1,o=null,s=r;return function(a){if(a<1||a>n)return i(a);s+a>r&&(o=i(r),s=0);var u=t.call(o,s,s+=a);return s&7&&(s=(s|7)+1),u}}});var ve=d((Rt,xe)=>{"use strict";xe.exports=g;var j=L();function g(i,t){this.lo=i>>>0,this.hi=t>>>0}var F=g.zero=new g(0,0);F.toNumber=function(){return 0};F.zzEncode=F.zzDecode=function(){return this};F.length=function(){return 1};var Tt=g.zeroHash="\0\0\0\0\0\0\0\0";g.fromNumber=function(t){if(t===0)return F;var e=t<0;e&&(t=-t);var r=t>>>0,n=(t-r)/4294967296>>>0;return e&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new g(r,n)};g.from=function(t){if(typeof t=="number")return g.fromNumber(t);if(j.isString(t))if(j.Long)t=j.Long.fromString(t);else return g.fromNumber(parseInt(t,10));return t.low||t.high?new g(t.low>>>0,t.high>>>0):F};g.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,r=~this.hi>>>0;return e||(r=r+1>>>0),-(e+r*4294967296)}return this.lo+this.hi*4294967296};g.prototype.toLong=function(t){return j.Long?new j.Long(this.lo|0,this.hi|0,Boolean(t)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(t)}};var D=String.prototype.charCodeAt;g.fromHash=function(t){return t===Tt?F:new g((D.call(t,0)|D.call(t,1)<<8|D.call(t,2)<<16|D.call(t,3)<<24)>>>0,(D.call(t,4)|D.call(t,5)<<8|D.call(t,6)<<16|D.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,e=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return r===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:r<128?9:10}});var L=d($=>{"use strict";var l=$;l.asPromise=pe();l.base64=be();l.EventEmitter=we();l.float=Be();l.inquire=De();l.utf8=Ee();l.pool=Fe();l.LongBits=ve();l.isNode=Boolean(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);l.global=l.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||$;l.emptyArray=Object.freeze?Object.freeze([]):[];l.emptyObject=Object.freeze?Object.freeze({}):{};l.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};l.isString=function(t){return typeof t=="string"||t instanceof String};l.isObject=function(t){return t&&typeof t=="object"};l.isset=l.isSet=function(t,e){var r=t[e];return r!=null&&t.hasOwnProperty(e)?typeof r!="object"||(Array.isArray(r)?r.length:Object.keys(r).length)>0:!1};l.Buffer=function(){try{var i=l.inquire("buffer").Buffer;return i.prototype.utf8Write?i:null}catch{return null}}();l._Buffer_from=null;l._Buffer_allocUnsafe=null;l.newBuffer=function(t){return typeof t=="number"?l.Buffer?l._Buffer_allocUnsafe(t):new l.Array(t):l.Buffer?l._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};l.Array=typeof Uint8Array<"u"?Uint8Array:Array;l.Long=l.global.dcodeIO&&l.global.dcodeIO.Long||l.global.Long||l.inquire("long");l.key2Re=/^true|false|0|1$/;l.key32Re=/^-?(?:0|[1-9][0-9]*)$/;l.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;l.longToHash=function(t){return t?l.LongBits.from(t).toHash():l.LongBits.zeroHash};l.longFromHash=function(t,e){var r=l.LongBits.fromHash(t);return l.Long?l.Long.fromBits(r.lo,r.hi,e):r.toNumber(Boolean(e))};function Ae(i,t,e){for(var r=Object.keys(t),n=0;n<r.length;++n)(i[r[n]]===void 0||!e)&&(i[r[n]]=t[r[n]]);return i}l.merge=Ae;l.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function je(i){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),r&&Ae(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get(){return i},set:void 0,enumerable:!1,configurable:!0},toString:{value(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}l.newError=je;l.ProtocolError=je("ProtocolError");l.oneOfGetter=function(t){for(var e={},r=0;r<t.length;++r)e[t[r]]=1;return function(){for(var n=Object.keys(this),o=n.length-1;o>-1;--o)if(e[n[o]]===1&&this[n[o]]!==void 0&&this[n[o]]!==null)return n[o]}};l.oneOfSetter=function(t){return function(e){for(var r=0;r<t.length;++r)t[r]!==e&&delete this[t[r]]}};l.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};l._configure=function(){var i=l.Buffer;if(!i){l._Buffer_from=l._Buffer_allocUnsafe=null;return}l._Buffer_from=i.from!==Uint8Array.from&&i.from||function(e,r){return new i(e,r)},l._Buffer_allocUnsafe=i.allocUnsafe||function(e){return new i(e)}}});var ee=d((Ht,qe)=>{"use strict";qe.exports=p;var _=L(),Z,U=_.LongBits,Me=_.base64,Pe=_.utf8;function M(i,t,e){this.fn=i,this.len=t,this.next=void 0,this.val=e}function G(){}function zt(i){this.head=i.head,this.tail=i.tail,this.len=i.len,this.next=i.states}function p(){this.len=0,this.head=new M(G,0,0),this.tail=this.head,this.states=null}var Ie=function(){return _.Buffer?function(){return(p.create=function(){return new Z})()}:function(){return new p}};p.create=Ie();p.alloc=function(t){return new _.Array(t)};_.Array!==Array&&(p.alloc=_.pool(p.alloc,_.Array.prototype.subarray));p.prototype._push=function(t,e,r){return this.tail=this.tail.next=new M(t,e,r),this.len+=e,this};function X(i,t,e){t[e]=i&255}function Ot(i,t,e){for(;i>127;)t[e++]=i&127|128,i>>>=7;t[e]=i}function K(i,t){this.len=i,this.next=void 0,this.val=t}K.prototype=Object.create(M.prototype);K.prototype.fn=Ot;p.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new K((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};p.prototype.int32=function(t){return t<0?this._push(Q,10,U.fromNumber(t)):this.uint32(t)};p.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Q(i,t,e){for(;i.hi;)t[e++]=i.lo&127|128,i.lo=(i.lo>>>7|i.hi<<25)>>>0,i.hi>>>=7;for(;i.lo>127;)t[e++]=i.lo&127|128,i.lo=i.lo>>>7;t[e++]=i.lo}p.prototype.uint64=function(t){var e=U.from(t);return this._push(Q,e.length(),e)};p.prototype.int64=p.prototype.uint64;p.prototype.sint64=function(t){var e=U.from(t).zzEncode();return this._push(Q,e.length(),e)};p.prototype.bool=function(t){return this._push(X,1,t?1:0)};function Y(i,t,e){t[e]=i&255,t[e+1]=i>>>8&255,t[e+2]=i>>>16&255,t[e+3]=i>>>24}p.prototype.fixed32=function(t){return this._push(Y,4,t>>>0)};p.prototype.sfixed32=p.prototype.fixed32;p.prototype.fixed64=function(t){var e=U.from(t);return this._push(Y,4,e.lo)._push(Y,4,e.hi)};p.prototype.sfixed64=p.prototype.fixed64;p.prototype.float=function(t){return this._push(_.float.writeFloatLE,4,t)};p.prototype.double=function(t){return this._push(_.float.writeDoubleLE,8,t)};var Bt=_.Array.prototype.set?function(t,e,r){e.set(t,r)}:function(t,e,r){for(var n=0;n<t.length;++n)e[r+n]=t[n]};p.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(X,1,0);if(_.isString(t)){var r=p.alloc(e=Me.length(t));Me.decode(t,r,0),t=r}return this.uint32(e)._push(Bt,e,t)};p.prototype.string=function(t){var e=Pe.length(t);return e?this.uint32(e)._push(Pe.write,e,t):this._push(X,1,0)};p.prototype.fork=function(){return this.states=new zt(this),this.head=this.tail=new M(G,0,0),this.len=0,this};p.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 M(G,0,0),this.len=0),this};p.prototype.ldelim=function(){var t=this.head,e=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=t.next,this.tail=e,this.len+=r),this};p.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),r=0;t;)t.fn(t.val,e,r),r+=t.len,t=t.next;return e};p._configure=function(i){Z=i,p.create=Ie(),Z._configure()}});var Ue=d((Wt,Re)=>{"use strict";Re.exports=T;var Ce=ee();(T.prototype=Object.create(Ce.prototype)).constructor=T;var E=L();function T(){Ce.call(this)}T._configure=function(){T.alloc=E._Buffer_allocUnsafe,T.writeBytesBuffer=E.Buffer&&E.Buffer.prototype instanceof Uint8Array&&E.Buffer.prototype.set.name==="set"?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var n=0;n<t.length;)e[r++]=t[n++]}};T.prototype.bytes=function(t){E.isString(t)&&(t=E._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(T.writeBytesBuffer,e,t),this};function Dt(i,t,e){i.length<40?E.utf8.write(i,t,e):t.utf8Write?t.utf8Write(i,e):t.write(i,e)}T.prototype.string=function(t){var e=E.Buffer.byteLength(t);return this.uint32(e),e&&this._push(Dt,e,t),this};T._configure()});var ie=d((Vt,$e)=>{"use strict";$e.exports=y;var z=L(),re,Ve=z.LongBits,Lt=z.utf8;function k(i,t){return RangeError("index out of range: "+i.pos+" + "+(t||1)+" > "+i.len)}function y(i){this.buf=i,this.pos=0,this.len=i.length}var He=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new y(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new y(t);throw Error("illegal buffer")},Je=function(){return z.Buffer?function(e){return(y.create=function(n){return z.Buffer.isBuffer(n)?new re(n):He(n)})(e)}:He};y.create=Je();y.prototype._slice=z.Array.prototype.subarray||z.Array.prototype.slice;y.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,k(this,10);return t}}();y.prototype.int32=function(){return this.uint32()|0};y.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function te(){var i=new Ve(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(i.lo=(i.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return i;if(i.lo=(i.lo|(this.buf[this.pos]&127)<<28)>>>0,i.hi=(i.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return i;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw k(this);if(i.lo=(i.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return i}return i.lo=(i.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,i}if(this.len-this.pos>4){for(;t<5;++t)if(i.hi=(i.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return i}else for(;t<5;++t){if(this.pos>=this.len)throw k(this);if(i.hi=(i.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return i}throw Error("invalid varint encoding")}y.prototype.bool=function(){return this.uint32()!==0};function H(i,t){return(i[t-4]|i[t-3]<<8|i[t-2]<<16|i[t-1]<<24)>>>0}y.prototype.fixed32=function(){if(this.pos+4>this.len)throw k(this,4);return H(this.buf,this.pos+=4)};y.prototype.sfixed32=function(){if(this.pos+4>this.len)throw k(this,4);return H(this.buf,this.pos+=4)|0};function We(){if(this.pos+8>this.len)throw k(this,8);return new Ve(H(this.buf,this.pos+=4),H(this.buf,this.pos+=4))}y.prototype.float=function(){if(this.pos+4>this.len)throw k(this,4);var t=z.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};y.prototype.double=function(){if(this.pos+8>this.len)throw k(this,4);var t=z.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};y.prototype.bytes=function(){var t=this.uint32(),e=this.pos,r=this.pos+t;if(r>this.len)throw k(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,r):e===r?new this.buf.constructor(0):this._slice.call(this.buf,e,r)};y.prototype.string=function(){var t=this.bytes();return Lt.read(t,0,t.length)};y.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw k(this,t);this.pos+=t}else do if(this.pos>=this.len)throw k(this);while(this.buf[this.pos++]&128);return this};y.prototype.skipType=function(i){switch(i){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(i=this.uint32()&7)!==4;)this.skipType(i);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+i+" at offset "+this.pos)}return this};y._configure=function(i){re=i,y.create=Je(),re._configure();var t=z.Long?"toLong":"toNumber";z.merge(y.prototype,{int64:function(){return te.call(this)[t](!1)},uint64:function(){return te.call(this)[t](!0)},sint64:function(){return te.call(this).zzDecode()[t](!1)},fixed64:function(){return We.call(this)[t](!0)},sfixed64:function(){return We.call(this)[t](!1)}})}});var Xe=d((Jt,Ge)=>{"use strict";Ge.exports=x;var Ye=ie();(x.prototype=Object.create(Ye.prototype)).constructor=x;var Ze=L();function x(i){Ye.call(this,i)}x._configure=function(){Ze.Buffer&&(x.prototype._slice=Ze.Buffer.prototype.slice)};x.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))};x._configure()});var Qe=d(($t,Ke)=>{"use strict";Ke.exports=P;var ne=L();(P.prototype=Object.create(ne.EventEmitter.prototype)).constructor=P;function P(i,t,e){if(typeof i!="function")throw TypeError("rpcImpl must be a function");ne.EventEmitter.call(this),this.rpcImpl=i,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(e)}P.prototype.rpcCall=function i(t,e,r,n,o){if(!n)throw TypeError("request must be specified");var s=this;if(!o)return ne.asPromise(i,s,t,e,r,n);if(!s.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return s.rpcImpl(t,e[s.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(a,u){if(a)return s.emit("error",a,t),o(a);if(u===null){s.end(!0);return}if(!(u instanceof r))try{u=r[s.responseDelimited?"decodeDelimited":"decode"](u)}catch(h){return s.emit("error",h,t),o(h)}return s.emit("data",u,t),o(null,u)})}catch(f){s.emit("error",f,t),setTimeout(function(){o(f)},0);return}};P.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var tt=d(et=>{"use strict";var Et=et;Et.Service=Qe()});var it=d((Yt,rt)=>{"use strict";rt.exports={}});var st=d(ot=>{"use strict";var m=ot;m.build="minimal";m.Writer=ee();m.BufferWriter=Ue();m.Reader=ie();m.BufferReader=Xe();m.util=L();m.rpc=tt();m.roots=it();m.configure=nt;function nt(){m.util._configure(),m.Writer._configure(m.BufferWriter),m.Reader._configure(m.BufferReader)}nt()});var ut=d((Xt,at)=>{"use strict";at.exports=st()});var xt={};mt(xt,{UnixFS:()=>I,parseMode:()=>W,parseMtime:()=>se});var V=ue(ce(),1);var O=ue(ut(),1),A=O.default.Reader,oe=O.default.Writer,c=O.default.util,b=O.default.roots["ipfs-unixfs"]||(O.default.roots["ipfs-unixfs"]={}),ft=b.Data=(()=>{function i(t){if(this.blocksizes=[],t)for(var e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return i.prototype.Type=0,i.prototype.Data=c.newBuffer([]),i.prototype.filesize=c.Long?c.Long.fromBits(0,0,!0):0,i.prototype.blocksizes=c.emptyArray,i.prototype.hashType=c.Long?c.Long.fromBits(0,0,!0):0,i.prototype.fanout=c.Long?c.Long.fromBits(0,0,!0):0,i.prototype.mode=0,i.prototype.mtime=null,i.encode=function(e,r){if(r||(r=oe.create()),r.uint32(8).int32(e.Type),e.Data!=null&&Object.hasOwnProperty.call(e,"Data")&&r.uint32(18).bytes(e.Data),e.filesize!=null&&Object.hasOwnProperty.call(e,"filesize")&&r.uint32(24).uint64(e.filesize),e.blocksizes!=null&&e.blocksizes.length)for(var n=0;n<e.blocksizes.length;++n)r.uint32(32).uint64(e.blocksizes[n]);return e.hashType!=null&&Object.hasOwnProperty.call(e,"hashType")&&r.uint32(40).uint64(e.hashType),e.fanout!=null&&Object.hasOwnProperty.call(e,"fanout")&&r.uint32(48).uint64(e.fanout),e.mode!=null&&Object.hasOwnProperty.call(e,"mode")&&r.uint32(56).uint32(e.mode),e.mtime!=null&&Object.hasOwnProperty.call(e,"mtime")&&b.UnixTime.encode(e.mtime,r.uint32(66).fork()).ldelim(),r},i.decode=function(e,r){e instanceof A||(e=A.create(e));for(var n=r===void 0?e.len:e.pos+r,o=new b.Data;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.Type=e.int32();break;case 2:o.Data=e.bytes();break;case 3:o.filesize=e.uint64();break;case 4:if(o.blocksizes&&o.blocksizes.length||(o.blocksizes=[]),(s&7)===2)for(var f=e.uint32()+e.pos;e.pos<f;)o.blocksizes.push(e.uint64());else o.blocksizes.push(e.uint64());break;case 5:o.hashType=e.uint64();break;case 6:o.fanout=e.uint64();break;case 7:o.mode=e.uint32();break;case 8:o.mtime=b.UnixTime.decode(e,e.uint32());break;default:e.skipType(s&7);break}}if(!o.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:o});return o},i.fromObject=function(e){if(e instanceof b.Data)return e;var r=new b.Data;switch(e.Type){case"Raw":case 0:r.Type=0;break;case"Directory":case 1:r.Type=1;break;case"File":case 2:r.Type=2;break;case"Metadata":case 3:r.Type=3;break;case"Symlink":case 4:r.Type=4;break;case"HAMTShard":case 5:r.Type=5;break}if(e.Data!=null&&(typeof e.Data=="string"?c.base64.decode(e.Data,r.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(r.Data=e.Data)),e.filesize!=null&&(c.Long?(r.filesize=c.Long.fromValue(e.filesize)).unsigned=!0:typeof e.filesize=="string"?r.filesize=parseInt(e.filesize,10):typeof e.filesize=="number"?r.filesize=e.filesize:typeof e.filesize=="object"&&(r.filesize=new c.LongBits(e.filesize.low>>>0,e.filesize.high>>>0).toNumber(!0))),e.blocksizes){if(!Array.isArray(e.blocksizes))throw TypeError(".Data.blocksizes: array expected");r.blocksizes=[];for(var n=0;n<e.blocksizes.length;++n)c.Long?(r.blocksizes[n]=c.Long.fromValue(e.blocksizes[n])).unsigned=!0:typeof e.blocksizes[n]=="string"?r.blocksizes[n]=parseInt(e.blocksizes[n],10):typeof e.blocksizes[n]=="number"?r.blocksizes[n]=e.blocksizes[n]:typeof e.blocksizes[n]=="object"&&(r.blocksizes[n]=new c.LongBits(e.blocksizes[n].low>>>0,e.blocksizes[n].high>>>0).toNumber(!0))}if(e.hashType!=null&&(c.Long?(r.hashType=c.Long.fromValue(e.hashType)).unsigned=!0:typeof e.hashType=="string"?r.hashType=parseInt(e.hashType,10):typeof e.hashType=="number"?r.hashType=e.hashType:typeof e.hashType=="object"&&(r.hashType=new c.LongBits(e.hashType.low>>>0,e.hashType.high>>>0).toNumber(!0))),e.fanout!=null&&(c.Long?(r.fanout=c.Long.fromValue(e.fanout)).unsigned=!0:typeof e.fanout=="string"?r.fanout=parseInt(e.fanout,10):typeof e.fanout=="number"?r.fanout=e.fanout:typeof e.fanout=="object"&&(r.fanout=new c.LongBits(e.fanout.low>>>0,e.fanout.high>>>0).toNumber(!0))),e.mode!=null&&(r.mode=e.mode>>>0),e.mtime!=null){if(typeof e.mtime!="object")throw TypeError(".Data.mtime: object expected");r.mtime=b.UnixTime.fromObject(e.mtime)}return r},i.toObject=function(e,r){r||(r={});var n={};if((r.arrays||r.defaults)&&(n.blocksizes=[]),r.defaults){if(n.Type=r.enums===String?"Raw":0,r.bytes===String?n.Data="":(n.Data=[],r.bytes!==Array&&(n.Data=c.newBuffer(n.Data))),c.Long){var o=new c.Long(0,0,!0);n.filesize=r.longs===String?o.toString():r.longs===Number?o.toNumber():o}else n.filesize=r.longs===String?"0":0;if(c.Long){var o=new c.Long(0,0,!0);n.hashType=r.longs===String?o.toString():r.longs===Number?o.toNumber():o}else n.hashType=r.longs===String?"0":0;if(c.Long){var o=new c.Long(0,0,!0);n.fanout=r.longs===String?o.toString():r.longs===Number?o.toNumber():o}else n.fanout=r.longs===String?"0":0;n.mode=0,n.mtime=null}if(e.Type!=null&&e.hasOwnProperty("Type")&&(n.Type=r.enums===String?b.Data.DataType[e.Type]:e.Type),e.Data!=null&&e.hasOwnProperty("Data")&&(n.Data=r.bytes===String?c.base64.encode(e.Data,0,e.Data.length):r.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),e.filesize!=null&&e.hasOwnProperty("filesize")&&(typeof e.filesize=="number"?n.filesize=r.longs===String?String(e.filesize):e.filesize:n.filesize=r.longs===String?c.Long.prototype.toString.call(e.filesize):r.longs===Number?new c.LongBits(e.filesize.low>>>0,e.filesize.high>>>0).toNumber(!0):e.filesize),e.blocksizes&&e.blocksizes.length){n.blocksizes=[];for(var s=0;s<e.blocksizes.length;++s)typeof e.blocksizes[s]=="number"?n.blocksizes[s]=r.longs===String?String(e.blocksizes[s]):e.blocksizes[s]:n.blocksizes[s]=r.longs===String?c.Long.prototype.toString.call(e.blocksizes[s]):r.longs===Number?new c.LongBits(e.blocksizes[s].low>>>0,e.blocksizes[s].high>>>0).toNumber(!0):e.blocksizes[s]}return e.hashType!=null&&e.hasOwnProperty("hashType")&&(typeof e.hashType=="number"?n.hashType=r.longs===String?String(e.hashType):e.hashType:n.hashType=r.longs===String?c.Long.prototype.toString.call(e.hashType):r.longs===Number?new c.LongBits(e.hashType.low>>>0,e.hashType.high>>>0).toNumber(!0):e.hashType),e.fanout!=null&&e.hasOwnProperty("fanout")&&(typeof e.fanout=="number"?n.fanout=r.longs===String?String(e.fanout):e.fanout:n.fanout=r.longs===String?c.Long.prototype.toString.call(e.fanout):r.longs===Number?new c.LongBits(e.fanout.low>>>0,e.fanout.high>>>0).toNumber(!0):e.fanout),e.mode!=null&&e.hasOwnProperty("mode")&&(n.mode=e.mode),e.mtime!=null&&e.hasOwnProperty("mtime")&&(n.mtime=b.UnixTime.toObject(e.mtime,r)),n},i.prototype.toJSON=function(){return this.constructor.toObject(this,O.default.util.toJSONOptions)},i.DataType=function(){let t={},e=Object.create(t);return e[t[0]="Raw"]=0,e[t[1]="Directory"]=1,e[t[2]="File"]=2,e[t[3]="Metadata"]=3,e[t[4]="Symlink"]=4,e[t[5]="HAMTShard"]=5,e}(),i})(),Kt=b.UnixTime=(()=>{function i(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return i.prototype.Seconds=c.Long?c.Long.fromBits(0,0,!1):0,i.prototype.FractionalNanoseconds=0,i.encode=function(e,r){return r||(r=oe.create()),r.uint32(8).int64(e.Seconds),e.FractionalNanoseconds!=null&&Object.hasOwnProperty.call(e,"FractionalNanoseconds")&&r.uint32(21).fixed32(e.FractionalNanoseconds),r},i.decode=function(e,r){e instanceof A||(e=A.create(e));for(var n=r===void 0?e.len:e.pos+r,o=new b.UnixTime;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.Seconds=e.int64();break;case 2:o.FractionalNanoseconds=e.fixed32();break;default:e.skipType(s&7);break}}if(!o.hasOwnProperty("Seconds"))throw c.ProtocolError("missing required 'Seconds'",{instance:o});return o},i.fromObject=function(e){if(e instanceof b.UnixTime)return e;var r=new b.UnixTime;return e.Seconds!=null&&(c.Long?(r.Seconds=c.Long.fromValue(e.Seconds)).unsigned=!1:typeof e.Seconds=="string"?r.Seconds=parseInt(e.Seconds,10):typeof e.Seconds=="number"?r.Seconds=e.Seconds:typeof e.Seconds=="object"&&(r.Seconds=new c.LongBits(e.Seconds.low>>>0,e.Seconds.high>>>0).toNumber())),e.FractionalNanoseconds!=null&&(r.FractionalNanoseconds=e.FractionalNanoseconds>>>0),r},i.toObject=function(e,r){r||(r={});var n={};if(r.defaults){if(c.Long){var o=new c.Long(0,0,!1);n.Seconds=r.longs===String?o.toString():r.longs===Number?o.toNumber():o}else n.Seconds=r.longs===String?"0":0;n.FractionalNanoseconds=0}return e.Seconds!=null&&e.hasOwnProperty("Seconds")&&(typeof e.Seconds=="number"?n.Seconds=r.longs===String?String(e.Seconds):e.Seconds:n.Seconds=r.longs===String?c.Long.prototype.toString.call(e.Seconds):r.longs===Number?new c.LongBits(e.Seconds.low>>>0,e.Seconds.high>>>0).toNumber():e.Seconds),e.FractionalNanoseconds!=null&&e.hasOwnProperty("FractionalNanoseconds")&&(n.FractionalNanoseconds=e.FractionalNanoseconds),n},i.prototype.toJSON=function(){return this.constructor.toObject(this,O.default.util.toJSONOptions)},i})(),Qt=b.Metadata=(()=>{function i(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return i.prototype.MimeType="",i.encode=function(e,r){return r||(r=oe.create()),e.MimeType!=null&&Object.hasOwnProperty.call(e,"MimeType")&&r.uint32(10).string(e.MimeType),r},i.decode=function(e,r){e instanceof A||(e=A.create(e));for(var n=r===void 0?e.len:e.pos+r,o=new b.Metadata;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.MimeType=e.string();break;default:e.skipType(s&7);break}}return o},i.fromObject=function(e){if(e instanceof b.Metadata)return e;var r=new b.Metadata;return e.MimeType!=null&&(r.MimeType=String(e.MimeType)),r},i.toObject=function(e,r){r||(r={});var n={};return r.defaults&&(n.MimeType=""),e.MimeType!=null&&e.hasOwnProperty("MimeType")&&(n.MimeType=e.MimeType),n},i.prototype.toJSON=function(){return this.constructor.toObject(this,O.default.util.toJSONOptions)},i})();var B=ft,lt=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],Ft=["directory","hamt-sharded-directory"],ct=parseInt("0644",8),ht=parseInt("0755",8);function W(i){if(i!=null)return typeof i=="number"?i&4095:(i=i.toString(),i.substring(0,1)==="0"?parseInt(i,8)&4095:parseInt(i,10)&4095)}function se(i){if(i==null)return;let t;if(i.secs!=null&&(t={secs:i.secs,nsecs:i.nsecs}),i.Seconds!=null&&(t={secs:i.Seconds,nsecs:i.FractionalNanoseconds}),Array.isArray(i)&&(t={secs:i[0],nsecs:i[1]}),i instanceof Date){let e=i.getTime(),r=Math.floor(e/1e3);t={secs:r,nsecs:(e-r*1e3)*1e3}}if(Object.prototype.hasOwnProperty.call(t,"secs")){if(t!=null&&t.nsecs!=null&&(t.nsecs<0||t.nsecs>999999999))throw(0,V.default)(new Error("mtime-nsecs must be within the range [0,999999999]"),"ERR_INVALID_MTIME_NSECS");return t}}var I=class{static unmarshal(t){let e=B.decode(t),r=B.toObject(e,{defaults:!1,arrays:!0,longs:Number,objects:!1}),n=new I({type:lt[r.Type],data:r.Data,blockSizes:r.blocksizes,mode:r.mode,mtime:r.mtime?{secs:r.mtime.Seconds,nsecs:r.mtime.FractionalNanoseconds}:void 0});return n._originalMode=r.mode||0,n}constructor(t={type:"file"}){let{type:e,data:r,blockSizes:n,hashType:o,fanout:s,mtime:f,mode:a}=t;if(e&&!lt.includes(e))throw(0,V.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE");this.type=e||"file",this.data=r,this.hashType=o,this.fanout=s,this.blockSizes=n||[],this._originalMode=0,this.mode=W(a),f&&(this.mtime=se(f),this.mtime&&!this.mtime.nsecs&&(this.mtime.nsecs=0))}set mode(t){this._mode=this.isDirectory()?ht:ct;let e=W(t);e!==void 0&&(this._mode=e)}get mode(){return this._mode}isDirectory(){return Boolean(this.type&&Ft.includes(this.type))}addBlockSize(t){this.blockSizes.push(t)}removeBlockSize(t){this.blockSizes.splice(t,1)}fileSize(){if(this.isDirectory())return 0;let t=0;return this.blockSizes.forEach(e=>{t+=e}),this.data&&(t+=this.data.length),t}marshal(){let t;switch(this.type){case"raw":t=B.DataType.Raw;break;case"directory":t=B.DataType.Directory;break;case"file":t=B.DataType.File;break;case"metadata":t=B.DataType.Metadata;break;case"symlink":t=B.DataType.Symlink;break;case"hamt-sharded-directory":t=B.DataType.HAMTShard;break;default:throw(0,V.default)(new Error("Type: "+t+" is not valid"),"ERR_INVALID_TYPE")}let e=this.data;(!this.data||!this.data.length)&&(e=void 0);let r;this.mode!=null&&(r=this._originalMode&4294963200|(W(this.mode)||0),r===ct&&!this.isDirectory()&&(r=void 0),r===ht&&this.isDirectory()&&(r=void 0));let n;if(this.mtime!=null){let s=se(this.mtime);s&&(n={Seconds:s.secs,FractionalNanoseconds:s.nsecs},n.FractionalNanoseconds===0&&delete n.FractionalNanoseconds)}let o={Type:t,Data:e,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:r,mtime:n};return B.encode(o).finish()}};return wt(xt);})();
"use strict";var IpfsUnixfs=(()=>{var pt=Object.create;var q=Object.defineProperty;var yt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var gt=Object.getPrototypeOf,bt=Object.prototype.hasOwnProperty;var d=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),mt=(i,t)=>{for(var e in t)q(i,e,{get:t[e],enumerable:!0})},ae=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of dt(t))!bt.call(i,n)&&n!==e&&q(i,n,{get:()=>t[n],enumerable:!(r=yt(t,n))||r.enumerable});return i};var ue=(i,t,e)=>(e=i!=null?pt(gt(i)):{},ae(t||!i||!i.__esModule?q(e,"default",{value:i,enumerable:!0}):e,i)),wt=i=>ae(q({},"__esModule",{value:!0}),i);var ce=d((At,le)=>{"use strict";function fe(i,t){for(let e in t)Object.defineProperty(i,e,{value:t[e],enumerable:!0,configurable:!0});return i}function _t(i,t,e){if(!i||typeof i=="string")throw new TypeError("Please pass an Error to err-code");e||(e={}),typeof t=="object"&&(e=t,t=""),t&&(e.code=t);try{return fe(i,e)}catch{e.message=i.message,e.stack=i.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(i)),fe(new n,e)}}le.exports=_t});var pe=d((jt,he)=>{"use strict";he.exports=St;function St(i,t){for(var e=new Array(arguments.length-1),r=0,n=2,o=!0;n<arguments.length;)e[r++]=arguments[n++];return new Promise(function(f,a){e[r]=function(h){if(o)if(o=!1,h)a(h);else{for(var w=new Array(arguments.length-1),N=0;N<w.length;)w[N++]=arguments[N];f.apply(null,w)}};try{i.apply(t||null,e)}catch(u){o&&(o=!1,a(u))}})}});var be=d(ge=>{"use strict";var C=ge;C.length=function(t){var e=t.length;if(!e)return 0;for(var r=0;--e%4>1&&t.charAt(e)==="=";)++r;return Math.ceil(t.length*3)/4-r};var v=new Array(64),de=new Array(123);for(S=0;S<64;)de[v[S]=S<26?S+65:S<52?S+71:S<62?S-4:S-59|43]=S++;var S;C.encode=function(t,e,r){for(var n=null,o=[],s=0,f=0,a;e<r;){var u=t[e++];switch(f){case 0:o[s++]=v[u>>2],a=(u&3)<<4,f=1;break;case 1:o[s++]=v[a|u>>4],a=(u&15)<<2,f=2;break;case 2:o[s++]=v[a|u>>6],o[s++]=v[u&63],f=0;break}s>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,o)),s=0)}return f&&(o[s++]=v[a],o[s++]=61,f===1&&(o[s++]=61)),n?(s&&n.push(String.fromCharCode.apply(String,o.slice(0,s))),n.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var ye="invalid encoding";C.decode=function(t,e,r){for(var n=r,o=0,s,f=0;f<t.length;){var a=t.charCodeAt(f++);if(a===61&&o>1)break;if((a=de[a])===void 0)throw Error(ye);switch(o){case 0:s=a,o=1;break;case 1:e[r++]=s<<2|(a&48)>>4,s=a,o=2;break;case 2:e[r++]=(s&15)<<4|(a&60)>>2,s=a,o=3;break;case 3:e[r++]=(s&3)<<6|a,o=0;break}}if(o===1)throw Error(ye);return r-n};C.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var we=d((Pt,me)=>{"use strict";me.exports=R;function R(){this._listeners={}}R.prototype.on=function(t,e,r){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:r||this}),this};R.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var r=this._listeners[t],n=0;n<r.length;)r[n].fn===e?r.splice(n,1):++n;return this};R.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<e.length;)e[n].fn.apply(e[n++].ctx,r)}return this}});var Be=d((It,Oe)=>{"use strict";Oe.exports=_e(_e);function _e(i){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),r=e[3]===128;function n(a,u,h){t[0]=a,u[h]=e[0],u[h+1]=e[1],u[h+2]=e[2],u[h+3]=e[3]}function o(a,u,h){t[0]=a,u[h]=e[3],u[h+1]=e[2],u[h+2]=e[1],u[h+3]=e[0]}i.writeFloatLE=r?n:o,i.writeFloatBE=r?o:n;function s(a,u){return e[0]=a[u],e[1]=a[u+1],e[2]=a[u+2],e[3]=a[u+3],t[0]}function f(a,u){return e[3]=a[u],e[2]=a[u+1],e[1]=a[u+2],e[0]=a[u+3],t[0]}i.readFloatLE=r?s:f,i.readFloatBE=r?f:s}():function(){function t(r,n,o,s){var f=n<0?1:0;if(f&&(n=-n),n===0)r(1/n>0?0:2147483648,o,s);else if(isNaN(n))r(2143289344,o,s);else if(n>34028234663852886e22)r((f<<31|2139095040)>>>0,o,s);else if(n<11754943508222875e-54)r((f<<31|Math.round(n/1401298464324817e-60))>>>0,o,s);else{var a=Math.floor(Math.log(n)/Math.LN2),u=Math.round(n*Math.pow(2,-a)*8388608)&8388607;r((f<<31|a+127<<23|u)>>>0,o,s)}}i.writeFloatLE=t.bind(null,Se),i.writeFloatBE=t.bind(null,ke);function e(r,n,o){var s=r(n,o),f=(s>>31)*2+1,a=s>>>23&255,u=s&8388607;return a===255?u?NaN:f*(1/0):a===0?f*1401298464324817e-60*u:f*Math.pow(2,a-150)*(u+8388608)}i.readFloatLE=e.bind(null,Te),i.readFloatBE=e.bind(null,ze)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),r=e[7]===128;function n(a,u,h){t[0]=a,u[h]=e[0],u[h+1]=e[1],u[h+2]=e[2],u[h+3]=e[3],u[h+4]=e[4],u[h+5]=e[5],u[h+6]=e[6],u[h+7]=e[7]}function o(a,u,h){t[0]=a,u[h]=e[7],u[h+1]=e[6],u[h+2]=e[5],u[h+3]=e[4],u[h+4]=e[3],u[h+5]=e[2],u[h+6]=e[1],u[h+7]=e[0]}i.writeDoubleLE=r?n:o,i.writeDoubleBE=r?o:n;function s(a,u){return e[0]=a[u],e[1]=a[u+1],e[2]=a[u+2],e[3]=a[u+3],e[4]=a[u+4],e[5]=a[u+5],e[6]=a[u+6],e[7]=a[u+7],t[0]}function f(a,u){return e[7]=a[u],e[6]=a[u+1],e[5]=a[u+2],e[4]=a[u+3],e[3]=a[u+4],e[2]=a[u+5],e[1]=a[u+6],e[0]=a[u+7],t[0]}i.readDoubleLE=r?s:f,i.readDoubleBE=r?f:s}():function(){function t(r,n,o,s,f,a){var u=s<0?1:0;if(u&&(s=-s),s===0)r(0,f,a+n),r(1/s>0?0:2147483648,f,a+o);else if(isNaN(s))r(0,f,a+n),r(2146959360,f,a+o);else if(s>17976931348623157e292)r(0,f,a+n),r((u<<31|2146435072)>>>0,f,a+o);else{var h;if(s<22250738585072014e-324)h=s/5e-324,r(h>>>0,f,a+n),r((u<<31|h/4294967296)>>>0,f,a+o);else{var w=Math.floor(Math.log(s)/Math.LN2);w===1024&&(w=1023),h=s*Math.pow(2,-w),r(h*4503599627370496>>>0,f,a+n),r((u<<31|w+1023<<20|h*1048576&1048575)>>>0,f,a+o)}}}i.writeDoubleLE=t.bind(null,Se,0,4),i.writeDoubleBE=t.bind(null,ke,4,0);function e(r,n,o,s,f){var a=r(s,f+n),u=r(s,f+o),h=(u>>31)*2+1,w=u>>>20&2047,N=4294967296*(u&1048575)+a;return w===2047?N?NaN:h*(1/0):w===0?h*5e-324*N:h*Math.pow(2,w-1075)*(N+4503599627370496)}i.readDoubleLE=e.bind(null,Te,0,4),i.readDoubleBE=e.bind(null,ze,4,0)}(),i}function Se(i,t,e){t[e]=i&255,t[e+1]=i>>>8&255,t[e+2]=i>>>16&255,t[e+3]=i>>>24}function ke(i,t,e){t[e]=i>>>24,t[e+1]=i>>>16&255,t[e+2]=i>>>8&255,t[e+3]=i&255}function Te(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16|i[t+3]<<24)>>>0}function ze(i,t){return(i[t]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3])>>>0}});var De=d((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(i){}return null}});var Ee=d(Le=>{"use strict";var J=Le;J.length=function(t){for(var e=0,r=0,n=0;n<t.length;++n)r=t.charCodeAt(n),r<128?e+=1:r<2048?e+=2:(r&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e};J.read=function(t,e,r){var n=r-e;if(n<1)return"";for(var o=null,s=[],f=0,a;e<r;)a=t[e++],a<128?s[f++]=a:a>191&&a<224?s[f++]=(a&31)<<6|t[e++]&63:a>239&&a<365?(a=((a&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,s[f++]=55296+(a>>10),s[f++]=56320+(a&1023)):s[f++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,f>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),f=0);return o?(f&&o.push(String.fromCharCode.apply(String,s.slice(0,f))),o.join("")):String.fromCharCode.apply(String,s.slice(0,f))};J.write=function(t,e,r){for(var n=r,o,s,f=0;f<t.length;++f)o=t.charCodeAt(f),o<128?e[r++]=o:o<2048?(e[r++]=o>>6|192,e[r++]=o&63|128):(o&64512)===55296&&((s=t.charCodeAt(f+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++f,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 r-n}});var Fe=d((Ct,Ne)=>{"use strict";Ne.exports=kt;function kt(i,t,e){var r=e||8192,n=r>>>1,o=null,s=r;return function(a){if(a<1||a>n)return i(a);s+a>r&&(o=i(r),s=0);var u=t.call(o,s,s+=a);return s&7&&(s=(s|7)+1),u}}});var ve=d((Rt,xe)=>{"use strict";xe.exports=g;var j=L();function g(i,t){this.lo=i>>>0,this.hi=t>>>0}var F=g.zero=new g(0,0);F.toNumber=function(){return 0};F.zzEncode=F.zzDecode=function(){return this};F.length=function(){return 1};var Tt=g.zeroHash="\0\0\0\0\0\0\0\0";g.fromNumber=function(t){if(t===0)return F;var e=t<0;e&&(t=-t);var r=t>>>0,n=(t-r)/4294967296>>>0;return e&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new g(r,n)};g.from=function(t){if(typeof t=="number")return g.fromNumber(t);if(j.isString(t))if(j.Long)t=j.Long.fromString(t);else return g.fromNumber(parseInt(t,10));return t.low||t.high?new g(t.low>>>0,t.high>>>0):F};g.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,r=~this.hi>>>0;return e||(r=r+1>>>0),-(e+r*4294967296)}return this.lo+this.hi*4294967296};g.prototype.toLong=function(t){return j.Long?new j.Long(this.lo|0,this.hi|0,Boolean(t)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(t)}};var D=String.prototype.charCodeAt;g.fromHash=function(t){return t===Tt?F:new g((D.call(t,0)|D.call(t,1)<<8|D.call(t,2)<<16|D.call(t,3)<<24)>>>0,(D.call(t,4)|D.call(t,5)<<8|D.call(t,6)<<16|D.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,e=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return r===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:r<128?9:10}});var L=d($=>{"use strict";var l=$;l.asPromise=pe();l.base64=be();l.EventEmitter=we();l.float=Be();l.inquire=De();l.utf8=Ee();l.pool=Fe();l.LongBits=ve();l.isNode=Boolean(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);l.global=l.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||$;l.emptyArray=Object.freeze?Object.freeze([]):[];l.emptyObject=Object.freeze?Object.freeze({}):{};l.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};l.isString=function(t){return typeof t=="string"||t instanceof String};l.isObject=function(t){return t&&typeof t=="object"};l.isset=l.isSet=function(t,e){var r=t[e];return r!=null&&t.hasOwnProperty(e)?typeof r!="object"||(Array.isArray(r)?r.length:Object.keys(r).length)>0:!1};l.Buffer=function(){try{var i=l.inquire("buffer").Buffer;return i.prototype.utf8Write?i:null}catch{return null}}();l._Buffer_from=null;l._Buffer_allocUnsafe=null;l.newBuffer=function(t){return typeof t=="number"?l.Buffer?l._Buffer_allocUnsafe(t):new l.Array(t):l.Buffer?l._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};l.Array=typeof Uint8Array<"u"?Uint8Array:Array;l.Long=l.global.dcodeIO&&l.global.dcodeIO.Long||l.global.Long||l.inquire("long");l.key2Re=/^true|false|0|1$/;l.key32Re=/^-?(?:0|[1-9][0-9]*)$/;l.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;l.longToHash=function(t){return t?l.LongBits.from(t).toHash():l.LongBits.zeroHash};l.longFromHash=function(t,e){var r=l.LongBits.fromHash(t);return l.Long?l.Long.fromBits(r.lo,r.hi,e):r.toNumber(Boolean(e))};function Ae(i,t,e){for(var r=Object.keys(t),n=0;n<r.length;++n)(i[r[n]]===void 0||!e)&&(i[r[n]]=t[r[n]]);return i}l.merge=Ae;l.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function je(i){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),r&&Ae(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return i},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}l.newError=je;l.ProtocolError=je("ProtocolError");l.oneOfGetter=function(t){for(var e={},r=0;r<t.length;++r)e[t[r]]=1;return function(){for(var n=Object.keys(this),o=n.length-1;o>-1;--o)if(e[n[o]]===1&&this[n[o]]!==void 0&&this[n[o]]!==null)return n[o]}};l.oneOfSetter=function(t){return function(e){for(var r=0;r<t.length;++r)t[r]!==e&&delete this[t[r]]}};l.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};l._configure=function(){var i=l.Buffer;if(!i){l._Buffer_from=l._Buffer_allocUnsafe=null;return}l._Buffer_from=i.from!==Uint8Array.from&&i.from||function(e,r){return new i(e,r)},l._Buffer_allocUnsafe=i.allocUnsafe||function(e){return new i(e)}}});var ee=d((Ht,qe)=>{"use strict";qe.exports=p;var _=L(),Z,U=_.LongBits,Me=_.base64,Pe=_.utf8;function M(i,t,e){this.fn=i,this.len=t,this.next=void 0,this.val=e}function G(){}function zt(i){this.head=i.head,this.tail=i.tail,this.len=i.len,this.next=i.states}function p(){this.len=0,this.head=new M(G,0,0),this.tail=this.head,this.states=null}var Ie=function(){return _.Buffer?function(){return(p.create=function(){return new Z})()}:function(){return new p}};p.create=Ie();p.alloc=function(t){return new _.Array(t)};_.Array!==Array&&(p.alloc=_.pool(p.alloc,_.Array.prototype.subarray));p.prototype._push=function(t,e,r){return this.tail=this.tail.next=new M(t,e,r),this.len+=e,this};function X(i,t,e){t[e]=i&255}function Ot(i,t,e){for(;i>127;)t[e++]=i&127|128,i>>>=7;t[e]=i}function K(i,t){this.len=i,this.next=void 0,this.val=t}K.prototype=Object.create(M.prototype);K.prototype.fn=Ot;p.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new K((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};p.prototype.int32=function(t){return t<0?this._push(Q,10,U.fromNumber(t)):this.uint32(t)};p.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Q(i,t,e){for(;i.hi;)t[e++]=i.lo&127|128,i.lo=(i.lo>>>7|i.hi<<25)>>>0,i.hi>>>=7;for(;i.lo>127;)t[e++]=i.lo&127|128,i.lo=i.lo>>>7;t[e++]=i.lo}p.prototype.uint64=function(t){var e=U.from(t);return this._push(Q,e.length(),e)};p.prototype.int64=p.prototype.uint64;p.prototype.sint64=function(t){var e=U.from(t).zzEncode();return this._push(Q,e.length(),e)};p.prototype.bool=function(t){return this._push(X,1,t?1:0)};function Y(i,t,e){t[e]=i&255,t[e+1]=i>>>8&255,t[e+2]=i>>>16&255,t[e+3]=i>>>24}p.prototype.fixed32=function(t){return this._push(Y,4,t>>>0)};p.prototype.sfixed32=p.prototype.fixed32;p.prototype.fixed64=function(t){var e=U.from(t);return this._push(Y,4,e.lo)._push(Y,4,e.hi)};p.prototype.sfixed64=p.prototype.fixed64;p.prototype.float=function(t){return this._push(_.float.writeFloatLE,4,t)};p.prototype.double=function(t){return this._push(_.float.writeDoubleLE,8,t)};var Bt=_.Array.prototype.set?function(t,e,r){e.set(t,r)}:function(t,e,r){for(var n=0;n<t.length;++n)e[r+n]=t[n]};p.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(X,1,0);if(_.isString(t)){var r=p.alloc(e=Me.length(t));Me.decode(t,r,0),t=r}return this.uint32(e)._push(Bt,e,t)};p.prototype.string=function(t){var e=Pe.length(t);return e?this.uint32(e)._push(Pe.write,e,t):this._push(X,1,0)};p.prototype.fork=function(){return this.states=new zt(this),this.head=this.tail=new M(G,0,0),this.len=0,this};p.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 M(G,0,0),this.len=0),this};p.prototype.ldelim=function(){var t=this.head,e=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=t.next,this.tail=e,this.len+=r),this};p.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),r=0;t;)t.fn(t.val,e,r),r+=t.len,t=t.next;return e};p._configure=function(i){Z=i,p.create=Ie(),Z._configure()}});var Ue=d((Wt,Re)=>{"use strict";Re.exports=T;var Ce=ee();(T.prototype=Object.create(Ce.prototype)).constructor=T;var E=L();function T(){Ce.call(this)}T._configure=function(){T.alloc=E._Buffer_allocUnsafe,T.writeBytesBuffer=E.Buffer&&E.Buffer.prototype instanceof Uint8Array&&E.Buffer.prototype.set.name==="set"?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var n=0;n<t.length;)e[r++]=t[n++]}};T.prototype.bytes=function(t){E.isString(t)&&(t=E._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(T.writeBytesBuffer,e,t),this};function Dt(i,t,e){i.length<40?E.utf8.write(i,t,e):t.utf8Write?t.utf8Write(i,e):t.write(i,e)}T.prototype.string=function(t){var e=E.Buffer.byteLength(t);return this.uint32(e),e&&this._push(Dt,e,t),this};T._configure()});var ie=d((Vt,$e)=>{"use strict";$e.exports=y;var z=L(),re,Ve=z.LongBits,Lt=z.utf8;function k(i,t){return RangeError("index out of range: "+i.pos+" + "+(t||1)+" > "+i.len)}function y(i){this.buf=i,this.pos=0,this.len=i.length}var He=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new y(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new y(t);throw Error("illegal buffer")},Je=function(){return z.Buffer?function(e){return(y.create=function(n){return z.Buffer.isBuffer(n)?new re(n):He(n)})(e)}:He};y.create=Je();y.prototype._slice=z.Array.prototype.subarray||z.Array.prototype.slice;y.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,k(this,10);return t}}();y.prototype.int32=function(){return this.uint32()|0};y.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function te(){var i=new Ve(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(i.lo=(i.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return i;if(i.lo=(i.lo|(this.buf[this.pos]&127)<<28)>>>0,i.hi=(i.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return i;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw k(this);if(i.lo=(i.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return i}return i.lo=(i.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,i}if(this.len-this.pos>4){for(;t<5;++t)if(i.hi=(i.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return i}else for(;t<5;++t){if(this.pos>=this.len)throw k(this);if(i.hi=(i.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return i}throw Error("invalid varint encoding")}y.prototype.bool=function(){return this.uint32()!==0};function H(i,t){return(i[t-4]|i[t-3]<<8|i[t-2]<<16|i[t-1]<<24)>>>0}y.prototype.fixed32=function(){if(this.pos+4>this.len)throw k(this,4);return H(this.buf,this.pos+=4)};y.prototype.sfixed32=function(){if(this.pos+4>this.len)throw k(this,4);return H(this.buf,this.pos+=4)|0};function We(){if(this.pos+8>this.len)throw k(this,8);return new Ve(H(this.buf,this.pos+=4),H(this.buf,this.pos+=4))}y.prototype.float=function(){if(this.pos+4>this.len)throw k(this,4);var t=z.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};y.prototype.double=function(){if(this.pos+8>this.len)throw k(this,4);var t=z.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};y.prototype.bytes=function(){var t=this.uint32(),e=this.pos,r=this.pos+t;if(r>this.len)throw k(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,r):e===r?new this.buf.constructor(0):this._slice.call(this.buf,e,r)};y.prototype.string=function(){var t=this.bytes();return Lt.read(t,0,t.length)};y.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw k(this,t);this.pos+=t}else do if(this.pos>=this.len)throw k(this);while(this.buf[this.pos++]&128);return this};y.prototype.skipType=function(i){switch(i){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(i=this.uint32()&7)!==4;)this.skipType(i);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+i+" at offset "+this.pos)}return this};y._configure=function(i){re=i,y.create=Je(),re._configure();var t=z.Long?"toLong":"toNumber";z.merge(y.prototype,{int64:function(){return te.call(this)[t](!1)},uint64:function(){return te.call(this)[t](!0)},sint64:function(){return te.call(this).zzDecode()[t](!1)},fixed64:function(){return We.call(this)[t](!0)},sfixed64:function(){return We.call(this)[t](!1)}})}});var Xe=d((Jt,Ge)=>{"use strict";Ge.exports=x;var Ye=ie();(x.prototype=Object.create(Ye.prototype)).constructor=x;var Ze=L();function x(i){Ye.call(this,i)}x._configure=function(){Ze.Buffer&&(x.prototype._slice=Ze.Buffer.prototype.slice)};x.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))};x._configure()});var Qe=d(($t,Ke)=>{"use strict";Ke.exports=P;var ne=L();(P.prototype=Object.create(ne.EventEmitter.prototype)).constructor=P;function P(i,t,e){if(typeof i!="function")throw TypeError("rpcImpl must be a function");ne.EventEmitter.call(this),this.rpcImpl=i,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(e)}P.prototype.rpcCall=function i(t,e,r,n,o){if(!n)throw TypeError("request must be specified");var s=this;if(!o)return ne.asPromise(i,s,t,e,r,n);if(!s.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return s.rpcImpl(t,e[s.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(a,u){if(a)return s.emit("error",a,t),o(a);if(u===null){s.end(!0);return}if(!(u instanceof r))try{u=r[s.responseDelimited?"decodeDelimited":"decode"](u)}catch(h){return s.emit("error",h,t),o(h)}return s.emit("data",u,t),o(null,u)})}catch(f){s.emit("error",f,t),setTimeout(function(){o(f)},0);return}};P.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var tt=d(et=>{"use strict";var Et=et;Et.Service=Qe()});var it=d((Yt,rt)=>{"use strict";rt.exports={}});var st=d(ot=>{"use strict";var m=ot;m.build="minimal";m.Writer=ee();m.BufferWriter=Ue();m.Reader=ie();m.BufferReader=Xe();m.util=L();m.rpc=tt();m.roots=it();m.configure=nt;function nt(){m.util._configure(),m.Writer._configure(m.BufferWriter),m.Reader._configure(m.BufferReader)}nt()});var ut=d((Xt,at)=>{"use strict";at.exports=st()});var xt={};mt(xt,{UnixFS:()=>I,parseMode:()=>W,parseMtime:()=>se});var V=ue(ce(),1);var O=ue(ut(),1),A=O.default.Reader,oe=O.default.Writer,c=O.default.util,b=O.default.roots["ipfs-unixfs"]||(O.default.roots["ipfs-unixfs"]={}),ft=b.Data=(()=>{function i(t){if(this.blocksizes=[],t)for(var e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return i.prototype.Type=0,i.prototype.Data=c.newBuffer([]),i.prototype.filesize=c.Long?c.Long.fromBits(0,0,!0):0,i.prototype.blocksizes=c.emptyArray,i.prototype.hashType=c.Long?c.Long.fromBits(0,0,!0):0,i.prototype.fanout=c.Long?c.Long.fromBits(0,0,!0):0,i.prototype.mode=0,i.prototype.mtime=null,i.encode=function(e,r){if(r||(r=oe.create()),r.uint32(8).int32(e.Type),e.Data!=null&&Object.hasOwnProperty.call(e,"Data")&&r.uint32(18).bytes(e.Data),e.filesize!=null&&Object.hasOwnProperty.call(e,"filesize")&&r.uint32(24).uint64(e.filesize),e.blocksizes!=null&&e.blocksizes.length)for(var n=0;n<e.blocksizes.length;++n)r.uint32(32).uint64(e.blocksizes[n]);return e.hashType!=null&&Object.hasOwnProperty.call(e,"hashType")&&r.uint32(40).uint64(e.hashType),e.fanout!=null&&Object.hasOwnProperty.call(e,"fanout")&&r.uint32(48).uint64(e.fanout),e.mode!=null&&Object.hasOwnProperty.call(e,"mode")&&r.uint32(56).uint32(e.mode),e.mtime!=null&&Object.hasOwnProperty.call(e,"mtime")&&b.UnixTime.encode(e.mtime,r.uint32(66).fork()).ldelim(),r},i.decode=function(e,r){e instanceof A||(e=A.create(e));for(var n=r===void 0?e.len:e.pos+r,o=new b.Data;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.Type=e.int32();break;case 2:o.Data=e.bytes();break;case 3:o.filesize=e.uint64();break;case 4:if(o.blocksizes&&o.blocksizes.length||(o.blocksizes=[]),(s&7)===2)for(var f=e.uint32()+e.pos;e.pos<f;)o.blocksizes.push(e.uint64());else o.blocksizes.push(e.uint64());break;case 5:o.hashType=e.uint64();break;case 6:o.fanout=e.uint64();break;case 7:o.mode=e.uint32();break;case 8:o.mtime=b.UnixTime.decode(e,e.uint32());break;default:e.skipType(s&7);break}}if(!o.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:o});return o},i.fromObject=function(e){if(e instanceof b.Data)return e;var r=new b.Data;switch(e.Type){case"Raw":case 0:r.Type=0;break;case"Directory":case 1:r.Type=1;break;case"File":case 2:r.Type=2;break;case"Metadata":case 3:r.Type=3;break;case"Symlink":case 4:r.Type=4;break;case"HAMTShard":case 5:r.Type=5;break}if(e.Data!=null&&(typeof e.Data=="string"?c.base64.decode(e.Data,r.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(r.Data=e.Data)),e.filesize!=null&&(c.Long?(r.filesize=c.Long.fromValue(e.filesize)).unsigned=!0:typeof e.filesize=="string"?r.filesize=parseInt(e.filesize,10):typeof e.filesize=="number"?r.filesize=e.filesize:typeof e.filesize=="object"&&(r.filesize=new c.LongBits(e.filesize.low>>>0,e.filesize.high>>>0).toNumber(!0))),e.blocksizes){if(!Array.isArray(e.blocksizes))throw TypeError(".Data.blocksizes: array expected");r.blocksizes=[];for(var n=0;n<e.blocksizes.length;++n)c.Long?(r.blocksizes[n]=c.Long.fromValue(e.blocksizes[n])).unsigned=!0:typeof e.blocksizes[n]=="string"?r.blocksizes[n]=parseInt(e.blocksizes[n],10):typeof e.blocksizes[n]=="number"?r.blocksizes[n]=e.blocksizes[n]:typeof e.blocksizes[n]=="object"&&(r.blocksizes[n]=new c.LongBits(e.blocksizes[n].low>>>0,e.blocksizes[n].high>>>0).toNumber(!0))}if(e.hashType!=null&&(c.Long?(r.hashType=c.Long.fromValue(e.hashType)).unsigned=!0:typeof e.hashType=="string"?r.hashType=parseInt(e.hashType,10):typeof e.hashType=="number"?r.hashType=e.hashType:typeof e.hashType=="object"&&(r.hashType=new c.LongBits(e.hashType.low>>>0,e.hashType.high>>>0).toNumber(!0))),e.fanout!=null&&(c.Long?(r.fanout=c.Long.fromValue(e.fanout)).unsigned=!0:typeof e.fanout=="string"?r.fanout=parseInt(e.fanout,10):typeof e.fanout=="number"?r.fanout=e.fanout:typeof e.fanout=="object"&&(r.fanout=new c.LongBits(e.fanout.low>>>0,e.fanout.high>>>0).toNumber(!0))),e.mode!=null&&(r.mode=e.mode>>>0),e.mtime!=null){if(typeof e.mtime!="object")throw TypeError(".Data.mtime: object expected");r.mtime=b.UnixTime.fromObject(e.mtime)}return r},i.toObject=function(e,r){r||(r={});var n={};if((r.arrays||r.defaults)&&(n.blocksizes=[]),r.defaults){if(n.Type=r.enums===String?"Raw":0,r.bytes===String?n.Data="":(n.Data=[],r.bytes!==Array&&(n.Data=c.newBuffer(n.Data))),c.Long){var o=new c.Long(0,0,!0);n.filesize=r.longs===String?o.toString():r.longs===Number?o.toNumber():o}else n.filesize=r.longs===String?"0":0;if(c.Long){var o=new c.Long(0,0,!0);n.hashType=r.longs===String?o.toString():r.longs===Number?o.toNumber():o}else n.hashType=r.longs===String?"0":0;if(c.Long){var o=new c.Long(0,0,!0);n.fanout=r.longs===String?o.toString():r.longs===Number?o.toNumber():o}else n.fanout=r.longs===String?"0":0;n.mode=0,n.mtime=null}if(e.Type!=null&&e.hasOwnProperty("Type")&&(n.Type=r.enums===String?b.Data.DataType[e.Type]:e.Type),e.Data!=null&&e.hasOwnProperty("Data")&&(n.Data=r.bytes===String?c.base64.encode(e.Data,0,e.Data.length):r.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),e.filesize!=null&&e.hasOwnProperty("filesize")&&(typeof e.filesize=="number"?n.filesize=r.longs===String?String(e.filesize):e.filesize:n.filesize=r.longs===String?c.Long.prototype.toString.call(e.filesize):r.longs===Number?new c.LongBits(e.filesize.low>>>0,e.filesize.high>>>0).toNumber(!0):e.filesize),e.blocksizes&&e.blocksizes.length){n.blocksizes=[];for(var s=0;s<e.blocksizes.length;++s)typeof e.blocksizes[s]=="number"?n.blocksizes[s]=r.longs===String?String(e.blocksizes[s]):e.blocksizes[s]:n.blocksizes[s]=r.longs===String?c.Long.prototype.toString.call(e.blocksizes[s]):r.longs===Number?new c.LongBits(e.blocksizes[s].low>>>0,e.blocksizes[s].high>>>0).toNumber(!0):e.blocksizes[s]}return e.hashType!=null&&e.hasOwnProperty("hashType")&&(typeof e.hashType=="number"?n.hashType=r.longs===String?String(e.hashType):e.hashType:n.hashType=r.longs===String?c.Long.prototype.toString.call(e.hashType):r.longs===Number?new c.LongBits(e.hashType.low>>>0,e.hashType.high>>>0).toNumber(!0):e.hashType),e.fanout!=null&&e.hasOwnProperty("fanout")&&(typeof e.fanout=="number"?n.fanout=r.longs===String?String(e.fanout):e.fanout:n.fanout=r.longs===String?c.Long.prototype.toString.call(e.fanout):r.longs===Number?new c.LongBits(e.fanout.low>>>0,e.fanout.high>>>0).toNumber(!0):e.fanout),e.mode!=null&&e.hasOwnProperty("mode")&&(n.mode=e.mode),e.mtime!=null&&e.hasOwnProperty("mtime")&&(n.mtime=b.UnixTime.toObject(e.mtime,r)),n},i.prototype.toJSON=function(){return this.constructor.toObject(this,O.default.util.toJSONOptions)},i.DataType=function(){let t={},e=Object.create(t);return e[t[0]="Raw"]=0,e[t[1]="Directory"]=1,e[t[2]="File"]=2,e[t[3]="Metadata"]=3,e[t[4]="Symlink"]=4,e[t[5]="HAMTShard"]=5,e}(),i})(),Kt=b.UnixTime=(()=>{function i(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return i.prototype.Seconds=c.Long?c.Long.fromBits(0,0,!1):0,i.prototype.FractionalNanoseconds=0,i.encode=function(e,r){return r||(r=oe.create()),r.uint32(8).int64(e.Seconds),e.FractionalNanoseconds!=null&&Object.hasOwnProperty.call(e,"FractionalNanoseconds")&&r.uint32(21).fixed32(e.FractionalNanoseconds),r},i.decode=function(e,r){e instanceof A||(e=A.create(e));for(var n=r===void 0?e.len:e.pos+r,o=new b.UnixTime;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.Seconds=e.int64();break;case 2:o.FractionalNanoseconds=e.fixed32();break;default:e.skipType(s&7);break}}if(!o.hasOwnProperty("Seconds"))throw c.ProtocolError("missing required 'Seconds'",{instance:o});return o},i.fromObject=function(e){if(e instanceof b.UnixTime)return e;var r=new b.UnixTime;return e.Seconds!=null&&(c.Long?(r.Seconds=c.Long.fromValue(e.Seconds)).unsigned=!1:typeof e.Seconds=="string"?r.Seconds=parseInt(e.Seconds,10):typeof e.Seconds=="number"?r.Seconds=e.Seconds:typeof e.Seconds=="object"&&(r.Seconds=new c.LongBits(e.Seconds.low>>>0,e.Seconds.high>>>0).toNumber())),e.FractionalNanoseconds!=null&&(r.FractionalNanoseconds=e.FractionalNanoseconds>>>0),r},i.toObject=function(e,r){r||(r={});var n={};if(r.defaults){if(c.Long){var o=new c.Long(0,0,!1);n.Seconds=r.longs===String?o.toString():r.longs===Number?o.toNumber():o}else n.Seconds=r.longs===String?"0":0;n.FractionalNanoseconds=0}return e.Seconds!=null&&e.hasOwnProperty("Seconds")&&(typeof e.Seconds=="number"?n.Seconds=r.longs===String?String(e.Seconds):e.Seconds:n.Seconds=r.longs===String?c.Long.prototype.toString.call(e.Seconds):r.longs===Number?new c.LongBits(e.Seconds.low>>>0,e.Seconds.high>>>0).toNumber():e.Seconds),e.FractionalNanoseconds!=null&&e.hasOwnProperty("FractionalNanoseconds")&&(n.FractionalNanoseconds=e.FractionalNanoseconds),n},i.prototype.toJSON=function(){return this.constructor.toObject(this,O.default.util.toJSONOptions)},i})(),Qt=b.Metadata=(()=>{function i(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r)t[e[r]]!=null&&(this[e[r]]=t[e[r]])}return i.prototype.MimeType="",i.encode=function(e,r){return r||(r=oe.create()),e.MimeType!=null&&Object.hasOwnProperty.call(e,"MimeType")&&r.uint32(10).string(e.MimeType),r},i.decode=function(e,r){e instanceof A||(e=A.create(e));for(var n=r===void 0?e.len:e.pos+r,o=new b.Metadata;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.MimeType=e.string();break;default:e.skipType(s&7);break}}return o},i.fromObject=function(e){if(e instanceof b.Metadata)return e;var r=new b.Metadata;return e.MimeType!=null&&(r.MimeType=String(e.MimeType)),r},i.toObject=function(e,r){r||(r={});var n={};return r.defaults&&(n.MimeType=""),e.MimeType!=null&&e.hasOwnProperty("MimeType")&&(n.MimeType=e.MimeType),n},i.prototype.toJSON=function(){return this.constructor.toObject(this,O.default.util.toJSONOptions)},i})();var B=ft,lt=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],Ft=["directory","hamt-sharded-directory"],ct=parseInt("0644",8),ht=parseInt("0755",8);function W(i){if(i!=null)return typeof i=="number"?i&4095:(i=i.toString(),i.substring(0,1)==="0"?parseInt(i,8)&4095:parseInt(i,10)&4095)}function se(i){if(i==null)return;let t;if(i.secs!=null&&(t={secs:i.secs,nsecs:i.nsecs}),i.Seconds!=null&&(t={secs:i.Seconds,nsecs:i.FractionalNanoseconds}),Array.isArray(i)&&(t={secs:i[0],nsecs:i[1]}),i instanceof Date){let e=i.getTime(),r=Math.floor(e/1e3);t={secs:r,nsecs:(e-r*1e3)*1e3}}if(Object.prototype.hasOwnProperty.call(t,"secs")){if(t!=null&&t.nsecs!=null&&(t.nsecs<0||t.nsecs>999999999))throw(0,V.default)(new Error("mtime-nsecs must be within the range [0,999999999]"),"ERR_INVALID_MTIME_NSECS");return t}}var I=class{static unmarshal(t){let e=B.decode(t),r=B.toObject(e,{defaults:!1,arrays:!0,longs:Number,objects:!1}),n=new I({type:lt[r.Type],data:r.Data,blockSizes:r.blocksizes,mode:r.mode,mtime:r.mtime?{secs:r.mtime.Seconds,nsecs:r.mtime.FractionalNanoseconds}:void 0});return n._originalMode=r.mode||0,n}constructor(t={type:"file"}){let{type:e,data:r,blockSizes:n,hashType:o,fanout:s,mtime:f,mode:a}=t;if(e&&!lt.includes(e))throw(0,V.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE");this.type=e||"file",this.data=r,this.hashType=o,this.fanout=s,this.blockSizes=n||[],this._originalMode=0,this.mode=W(a),f&&(this.mtime=se(f),this.mtime&&!this.mtime.nsecs&&(this.mtime.nsecs=0))}set mode(t){this._mode=this.isDirectory()?ht:ct;let e=W(t);e!==void 0&&(this._mode=e)}get mode(){return this._mode}isDirectory(){return Boolean(this.type&&Ft.includes(this.type))}addBlockSize(t){this.blockSizes.push(t)}removeBlockSize(t){this.blockSizes.splice(t,1)}fileSize(){if(this.isDirectory())return 0;let t=0;return this.blockSizes.forEach(e=>{t+=e}),this.data&&(t+=this.data.length),t}marshal(){let t;switch(this.type){case"raw":t=B.DataType.Raw;break;case"directory":t=B.DataType.Directory;break;case"file":t=B.DataType.File;break;case"metadata":t=B.DataType.Metadata;break;case"symlink":t=B.DataType.Symlink;break;case"hamt-sharded-directory":t=B.DataType.HAMTShard;break;default:throw(0,V.default)(new Error("Type: "+t+" is not valid"),"ERR_INVALID_TYPE")}let e=this.data;(!this.data||!this.data.length)&&(e=void 0);let r;this.mode!=null&&(r=this._originalMode&4294963200|(W(this.mode)||0),r===ct&&!this.isDirectory()&&(r=void 0),r===ht&&this.isDirectory()&&(r=void 0));let n;if(this.mtime!=null){let s=se(this.mtime);s&&(n={Seconds:s.secs,FractionalNanoseconds:s.nsecs},n.FractionalNanoseconds===0&&delete n.FractionalNanoseconds)}let o={Type:t,Data:e,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:r,mtime:n};return B.encode(o).finish()}};return wt(xt);})();
return IpfsUnixfs}));
{
"name": "ipfs-unixfs",
"version": "9.0.0",
"version": "9.0.1",
"description": "JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG)",

@@ -164,3 +164,3 @@ "license": "Apache-2.0 OR MIT",

"devDependencies": {
"aegir": "^37.5.0",
"aegir": "^38.1.2",
"protobufjs-cli": "^1.0.0",

@@ -167,0 +167,0 @@ "uint8arrays": "^4.0.2"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc