ipfs-unixfs
Advanced tools
Comparing version 11.1.0 to 11.1.1
(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 ue=Object.create;var O=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var y=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),he=(r,t)=>{for(var e in t)O(r,e,{get:t[e],enumerable:!0})},ct=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ce(t))!le.call(r,n)&&n!==e&&O(r,n,{get:()=>t[n],enumerable:!(i=ae(t,n))||i.enumerable});return r};var D=(r,t,e)=>(e=r!=null?ue(fe(r)):{},ct(t||!r||!r.__esModule?O(e,"default",{value:r,enumerable:!0}):e,r)),de=r=>ct(O({},"__esModule",{value:!0}),r);var ht=y((De,lt)=>{"use strict";function ft(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function pe(r,t,e){if(!r||typeof r=="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 ft(r,e)}catch{e.message=r.message,e.stack=r.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(r)),ft(new n,e)}}lt.exports=pe});var pt=y((Me,dt)=>{"use strict";dt.exports=ye;function ye(r,t){for(var e=new Array(arguments.length-1),i=0,n=2,o=!0;n<arguments.length;)e[i++]=arguments[n++];return new Promise(function(c,s){e[i]=function(l){if(o)if(o=!1,l)s(l);else{for(var m=new Array(arguments.length-1),x=0;x<m.length;)m[x++]=arguments[x];c.apply(null,m)}};try{r.apply(t||null,e)}catch(a){o&&(o=!1,s(a))}})}});var _t=y(gt=>{"use strict";var C=gt;C.length=function(t){var e=t.length;if(!e)return 0;for(var i=0;--e%4>1&&t.charAt(e)==="=";)++i;return Math.ceil(t.length*3)/4-i};var M=new Array(64),mt=new Array(123);for(_=0;_<64;)mt[M[_]=_<26?_+65:_<52?_+71:_<62?_-4:_-59|43]=_++;var _;C.encode=function(t,e,i){for(var n=null,o=[],u=0,c=0,s;e<i;){var a=t[e++];switch(c){case 0:o[u++]=M[a>>2],s=(a&3)<<4,c=1;break;case 1:o[u++]=M[s|a>>4],s=(a&15)<<2,c=2;break;case 2:o[u++]=M[s|a>>6],o[u++]=M[a&63],c=0;break}u>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,o)),u=0)}return c&&(o[u++]=M[s],o[u++]=61,c===1&&(o[u++]=61)),n?(u&&n.push(String.fromCharCode.apply(String,o.slice(0,u))),n.join("")):String.fromCharCode.apply(String,o.slice(0,u))};var yt="invalid encoding";C.decode=function(t,e,i){for(var n=i,o=0,u,c=0;c<t.length;){var s=t.charCodeAt(c++);if(s===61&&o>1)break;if((s=mt[s])===void 0)throw Error(yt);switch(o){case 0:u=s,o=1;break;case 1:e[i++]=u<<2|(s&48)>>4,u=s,o=2;break;case 2:e[i++]=(u&15)<<4|(s&60)>>2,u=s,o=3;break;case 3:e[i++]=(u&3)<<6|s,o=0;break}}if(o===1)throw Error(yt);return i-n};C.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var bt=y((Te,wt)=>{"use strict";wt.exports=H;function H(){this._listeners={}}H.prototype.on=function(t,e,i){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:i||this}),this};H.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var i=this._listeners[t],n=0;n<i.length;)i[n].fn===e?i.splice(n,1):++n;return this};H.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var i=[],n=1;n<arguments.length;)i.push(arguments[n++]);for(n=0;n<e.length;)e[n].fn.apply(e[n++].ctx,i)}return this}});var Ft=y((ze,At)=>{"use strict";At.exports=kt(kt);function kt(r){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),i=e[3]===128;function n(s,a,l){t[0]=s,a[l]=e[0],a[l+1]=e[1],a[l+2]=e[2],a[l+3]=e[3]}function o(s,a,l){t[0]=s,a[l]=e[3],a[l+1]=e[2],a[l+2]=e[1],a[l+3]=e[0]}r.writeFloatLE=i?n:o,r.writeFloatBE=i?o:n;function u(s,a){return e[0]=s[a],e[1]=s[a+1],e[2]=s[a+2],e[3]=s[a+3],t[0]}function c(s,a){return e[3]=s[a],e[2]=s[a+1],e[1]=s[a+2],e[0]=s[a+3],t[0]}r.readFloatLE=i?u:c,r.readFloatBE=i?c:u}():function(){function t(i,n,o,u){var c=n<0?1:0;if(c&&(n=-n),n===0)i(1/n>0?0:2147483648,o,u);else if(isNaN(n))i(2143289344,o,u);else if(n>34028234663852886e22)i((c<<31|2139095040)>>>0,o,u);else if(n<11754943508222875e-54)i((c<<31|Math.round(n/1401298464324817e-60))>>>0,o,u);else{var s=Math.floor(Math.log(n)/Math.LN2),a=Math.round(n*Math.pow(2,-s)*8388608)&8388607;i((c<<31|s+127<<23|a)>>>0,o,u)}}r.writeFloatLE=t.bind(null,Bt),r.writeFloatBE=t.bind(null,Et);function e(i,n,o){var u=i(n,o),c=(u>>31)*2+1,s=u>>>23&255,a=u&8388607;return s===255?a?NaN:c*(1/0):s===0?c*1401298464324817e-60*a:c*Math.pow(2,s-150)*(a+8388608)}r.readFloatLE=e.bind(null,St),r.readFloatBE=e.bind(null,xt)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),i=e[7]===128;function n(s,a,l){t[0]=s,a[l]=e[0],a[l+1]=e[1],a[l+2]=e[2],a[l+3]=e[3],a[l+4]=e[4],a[l+5]=e[5],a[l+6]=e[6],a[l+7]=e[7]}function o(s,a,l){t[0]=s,a[l]=e[7],a[l+1]=e[6],a[l+2]=e[5],a[l+3]=e[4],a[l+4]=e[3],a[l+5]=e[2],a[l+6]=e[1],a[l+7]=e[0]}r.writeDoubleLE=i?n:o,r.writeDoubleBE=i?o:n;function u(s,a){return e[0]=s[a],e[1]=s[a+1],e[2]=s[a+2],e[3]=s[a+3],e[4]=s[a+4],e[5]=s[a+5],e[6]=s[a+6],e[7]=s[a+7],t[0]}function c(s,a){return e[7]=s[a],e[6]=s[a+1],e[5]=s[a+2],e[4]=s[a+3],e[3]=s[a+4],e[2]=s[a+5],e[1]=s[a+6],e[0]=s[a+7],t[0]}r.readDoubleLE=i?u:c,r.readDoubleBE=i?c:u}():function(){function t(i,n,o,u,c,s){var a=u<0?1:0;if(a&&(u=-u),u===0)i(0,c,s+n),i(1/u>0?0:2147483648,c,s+o);else if(isNaN(u))i(0,c,s+n),i(2146959360,c,s+o);else if(u>17976931348623157e292)i(0,c,s+n),i((a<<31|2146435072)>>>0,c,s+o);else{var l;if(u<22250738585072014e-324)l=u/5e-324,i(l>>>0,c,s+n),i((a<<31|l/4294967296)>>>0,c,s+o);else{var m=Math.floor(Math.log(u)/Math.LN2);m===1024&&(m=1023),l=u*Math.pow(2,-m),i(l*4503599627370496>>>0,c,s+n),i((a<<31|m+1023<<20|l*1048576&1048575)>>>0,c,s+o)}}}r.writeDoubleLE=t.bind(null,Bt,0,4),r.writeDoubleBE=t.bind(null,Et,4,0);function e(i,n,o,u,c){var s=i(u,c+n),a=i(u,c+o),l=(a>>31)*2+1,m=a>>>20&2047,x=4294967296*(a&1048575)+s;return m===2047?x?NaN:l*(1/0):m===0?l*5e-324*x:l*Math.pow(2,m-1075)*(x+4503599627370496)}r.readDoubleLE=e.bind(null,St,0,4),r.readDoubleBE=e.bind(null,xt,4,0)}(),r}function Bt(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function Et(r,t,e){t[e]=r>>>24,t[e+1]=r>>>16&255,t[e+2]=r>>>8&255,t[e+3]=r&255}function St(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0}function xt(r,t){return(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}});var Lt=y((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(r){}return null}});var Mt=y(Dt=>{"use strict";var G=Dt;G.length=function(t){for(var e=0,i=0,n=0;n<t.length;++n)i=t.charCodeAt(n),i<128?e+=1:i<2048?e+=2:(i&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e};G.read=function(t,e,i){var n=i-e;if(n<1)return"";for(var o=null,u=[],c=0,s;e<i;)s=t[e++],s<128?u[c++]=s:s>191&&s<224?u[c++]=(s&31)<<6|t[e++]&63:s>239&&s<365?(s=((s&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,u[c++]=55296+(s>>10),u[c++]=56320+(s&1023)):u[c++]=(s&15)<<12|(t[e++]&63)<<6|t[e++]&63,c>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,u)),c=0);return o?(c&&o.push(String.fromCharCode.apply(String,u.slice(0,c))),o.join("")):String.fromCharCode.apply(String,u.slice(0,c))};G.write=function(t,e,i){for(var n=i,o,u,c=0;c<t.length;++c)o=t.charCodeAt(c),o<128?e[i++]=o:o<2048?(e[i++]=o>>6|192,e[i++]=o&63|128):(o&64512)===55296&&((u=t.charCodeAt(c+1))&64512)===56320?(o=65536+((o&1023)<<10)+(u&1023),++c,e[i++]=o>>18|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128,e[i++]=o&63|128):(e[i++]=o>>12|224,e[i++]=o>>6&63|128,e[i++]=o&63|128);return i-n}});var Tt=y((Ie,vt)=>{"use strict";vt.exports=me;function me(r,t,e){var i=e||8192,n=i>>>1,o=null,u=i;return function(s){if(s<1||s>n)return r(s);u+s>i&&(o=r(i),u=0);var a=t.call(o,u,u+=s);return u&7&&(u=(u|7)+1),a}}});var Nt=y((Re,zt)=>{"use strict";zt.exports=p;var T=F();function p(r,t){this.lo=r>>>0,this.hi=t>>>0}var A=p.zero=new p(0,0);A.toNumber=function(){return 0};A.zzEncode=A.zzDecode=function(){return this};A.length=function(){return 1};var ge=p.zeroHash="\0\0\0\0\0\0\0\0";p.fromNumber=function(t){if(t===0)return A;var e=t<0;e&&(t=-t);var i=t>>>0,n=(t-i)/4294967296>>>0;return e&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new p(i,n)};p.from=function(t){if(typeof t=="number")return p.fromNumber(t);if(T.isString(t))if(T.Long)t=T.Long.fromString(t);else return p.fromNumber(parseInt(t,10));return t.low||t.high?new p(t.low>>>0,t.high>>>0):A};p.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,i=~this.hi>>>0;return e||(i=i+1>>>0),-(e+i*4294967296)}return this.lo+this.hi*4294967296};p.prototype.toLong=function(t){return T.Long?new T.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var E=String.prototype.charCodeAt;p.fromHash=function(t){return t===ge?A:new p((E.call(t,0)|E.call(t,1)<<8|E.call(t,2)<<16|E.call(t,3)<<24)>>>0,(E.call(t,4)|E.call(t,5)<<8|E.call(t,6)<<16|E.call(t,7)<<24)>>>0)};p.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)};p.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};p.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};p.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:i<128?9:10}});var F=y($=>{"use strict";var f=$;f.asPromise=pt();f.base64=_t();f.EventEmitter=bt();f.float=Ft();f.inquire=Lt();f.utf8=Mt();f.pool=Tt();f.LongBits=Nt();f.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);f.global=f.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||$;f.emptyArray=Object.freeze?Object.freeze([]):[];f.emptyObject=Object.freeze?Object.freeze({}):{};f.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};f.isString=function(t){return typeof t=="string"||t instanceof String};f.isObject=function(t){return t&&typeof t=="object"};f.isset=f.isSet=function(t,e){var i=t[e];return i!=null&&t.hasOwnProperty(e)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};f.Buffer=function(){try{var r=f.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();f._Buffer_from=null;f._Buffer_allocUnsafe=null;f.newBuffer=function(t){return typeof t=="number"?f.Buffer?f._Buffer_allocUnsafe(t):new f.Array(t):f.Buffer?f._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};f.Array=typeof Uint8Array<"u"?Uint8Array:Array;f.Long=f.global.dcodeIO&&f.global.dcodeIO.Long||f.global.Long||f.inquire("long");f.key2Re=/^true|false|0|1$/;f.key32Re=/^-?(?:0|[1-9][0-9]*)$/;f.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;f.longToHash=function(t){return t?f.LongBits.from(t).toHash():f.LongBits.zeroHash};f.longFromHash=function(t,e){var i=f.LongBits.fromHash(t);return f.Long?f.Long.fromBits(i.lo,i.hi,e):i.toNumber(!!e)};function It(r,t,e){for(var i=Object.keys(t),n=0;n<i.length;++n)(r[i[n]]===void 0||!e)&&(r[i[n]]=t[i[n]]);return r}f.merge=It;f.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Rt(r){function t(e,i){if(!(this instanceof t))return new t(e,i);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),i&&It(this,i)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}f.newError=Rt;f.ProtocolError=Rt("ProtocolError");f.oneOfGetter=function(t){for(var e={},i=0;i<t.length;++i)e[t[i]]=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]}};f.oneOfSetter=function(t){return function(e){for(var i=0;i<t.length;++i)t[i]!==e&&delete this[t[i]]}};f.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};f._configure=function(){var r=f.Buffer;if(!r){f._Buffer_from=f._Buffer_allocUnsafe=null;return}f._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,i){return new r(e,i)},f._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}}});var J=y((Ce,Pt)=>{"use strict";Pt.exports=d;var w=F(),Z,Ht=w.LongBits,_e=w.utf8;function b(r,t){return RangeError("index out of range: "+r.pos+" + "+(t||1)+" > "+r.len)}function d(r){this.buf=r,this.pos=0,this.len=r.length}var Ot=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new d(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new d(t);throw Error("illegal buffer")},qt=function(){return w.Buffer?function(e){return(d.create=function(n){return w.Buffer.isBuffer(n)?new Z(n):Ot(n)})(e)}:Ot};d.create=qt();d.prototype._slice=w.Array.prototype.subarray||w.Array.prototype.slice;d.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,b(this,10);return t}}();d.prototype.int32=function(){return this.uint32()|0};d.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function j(){var r=new Ht(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw b(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,r}if(this.len-this.pos>4){for(;t<5;++t)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;t<5;++t){if(this.pos>=this.len)throw b(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}d.prototype.bool=function(){return this.uint32()!==0};function q(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}d.prototype.fixed32=function(){if(this.pos+4>this.len)throw b(this,4);return q(this.buf,this.pos+=4)};d.prototype.sfixed32=function(){if(this.pos+4>this.len)throw b(this,4);return q(this.buf,this.pos+=4)|0};function Ct(){if(this.pos+8>this.len)throw b(this,8);return new Ht(q(this.buf,this.pos+=4),q(this.buf,this.pos+=4))}d.prototype.float=function(){if(this.pos+4>this.len)throw b(this,4);var t=w.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};d.prototype.double=function(){if(this.pos+8>this.len)throw b(this,4);var t=w.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};d.prototype.bytes=function(){var t=this.uint32(),e=this.pos,i=this.pos+t;if(i>this.len)throw b(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(e,i);if(e===i){var n=w.Buffer;return n?n.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,e,i)};d.prototype.string=function(){var t=this.bytes();return _e.read(t,0,t.length)};d.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw b(this,t);this.pos+=t}else do if(this.pos>=this.len)throw b(this);while(this.buf[this.pos++]&128);return this};d.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};d._configure=function(r){Z=r,d.create=qt(),Z._configure();var t=w.Long?"toLong":"toNumber";w.merge(d.prototype,{int64:function(){return j.call(this)[t](!1)},uint64:function(){return j.call(this)[t](!0)},sint64:function(){return j.call(this).zzDecode()[t](!1)},fixed64:function(){return Ct.call(this)[t](!0)},sfixed64:function(){return Ct.call(this)[t](!1)}})}});var $t=y((He,Gt)=>{"use strict";Gt.exports=L;var Wt=J();(L.prototype=Object.create(Wt.prototype)).constructor=L;var Ut=F();function L(r){Wt.call(this,r)}L._configure=function(){Ut.Buffer&&(L.prototype._slice=Ut.Buffer.prototype.slice)};L.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))};L._configure()});var et=y((qe,Vt)=>{"use strict";Vt.exports=h;var g=F(),V,P=g.LongBits,jt=g.base64,Zt=g.utf8;function z(r,t,e){this.fn=r,this.len=t,this.next=void 0,this.val=e}function K(){}function we(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function h(){this.len=0,this.head=new z(K,0,0),this.tail=this.head,this.states=null}var Jt=function(){return g.Buffer?function(){return(h.create=function(){return new V})()}:function(){return new h}};h.create=Jt();h.alloc=function(t){return new g.Array(t)};g.Array!==Array&&(h.alloc=g.pool(h.alloc,g.Array.prototype.subarray));h.prototype._push=function(t,e,i){return this.tail=this.tail.next=new z(t,e,i),this.len+=e,this};function Q(r,t,e){t[e]=r&255}function be(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}function Y(r,t){this.len=r,this.next=void 0,this.val=t}Y.prototype=Object.create(z.prototype);Y.prototype.fn=be;h.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Y((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};h.prototype.int32=function(t){return t<0?this._push(tt,10,P.fromNumber(t)):this.uint32(t)};h.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function tt(r,t,e){for(;r.hi;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}h.prototype.uint64=function(t){var e=P.from(t);return this._push(tt,e.length(),e)};h.prototype.int64=h.prototype.uint64;h.prototype.sint64=function(t){var e=P.from(t).zzEncode();return this._push(tt,e.length(),e)};h.prototype.bool=function(t){return this._push(Q,1,t?1:0)};function X(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}h.prototype.fixed32=function(t){return this._push(X,4,t>>>0)};h.prototype.sfixed32=h.prototype.fixed32;h.prototype.fixed64=function(t){var e=P.from(t);return this._push(X,4,e.lo)._push(X,4,e.hi)};h.prototype.sfixed64=h.prototype.fixed64;h.prototype.float=function(t){return this._push(g.float.writeFloatLE,4,t)};h.prototype.double=function(t){return this._push(g.float.writeDoubleLE,8,t)};var ke=g.Array.prototype.set?function(t,e,i){e.set(t,i)}:function(t,e,i){for(var n=0;n<t.length;++n)e[i+n]=t[n]};h.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(Q,1,0);if(g.isString(t)){var i=h.alloc(e=jt.length(t));jt.decode(t,i,0),t=i}return this.uint32(e)._push(ke,e,t)};h.prototype.string=function(t){var e=Zt.length(t);return e?this.uint32(e)._push(Zt.write,e,t):this._push(Q,1,0)};h.prototype.fork=function(){return this.states=new we(this),this.head=this.tail=new z(K,0,0),this.len=0,this};h.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 z(K,0,0),this.len=0),this};h.prototype.ldelim=function(){var t=this.head,e=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=t.next,this.tail=e,this.len+=i),this};h.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),i=0;t;)t.fn(t.val,e,i),i+=t.len,t=t.next;return e};h._configure=function(r){V=r,h.create=Jt(),V._configure()}});var Qt=y((Pe,Kt)=>{"use strict";Kt.exports=B;var Xt=et();(B.prototype=Object.create(Xt.prototype)).constructor=B;var S=F();function B(){Xt.call(this)}B._configure=function(){B.alloc=S._Buffer_allocUnsafe,B.writeBytesBuffer=S.Buffer&&S.Buffer.prototype instanceof Uint8Array&&S.Buffer.prototype.set.name==="set"?function(t,e,i){e.set(t,i)}:function(t,e,i){if(t.copy)t.copy(e,i,0,t.length);else for(var n=0;n<t.length;)e[i++]=t[n++]}};B.prototype.bytes=function(t){S.isString(t)&&(t=S._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(B.writeBytesBuffer,e,t),this};function Be(r,t,e){r.length<40?S.utf8.write(r,t,e):t.utf8Write?t.utf8Write(r,e):t.write(r,e)}B.prototype.string=function(t){var e=S.Buffer.byteLength(t);return this.uint32(e),e&&this._push(Be,e,t),this};B._configure()});var Fe={};he(Fe,{UnixFS:()=>at});var ut=D(ht(),1);var rt=D(J(),1),Yt=D($t(),1),te=D(F(),1),it=D(et(),1),ee=D(Qt(),1);function Ee(){te.default._configure(),rt.default._configure(Yt.default),it.default._configure(ee.default)}Ee();var re=["uint64","int64","sint64","fixed64","sfixed64"];function Se(r){for(let t of re){if(r[t]==null)continue;let e=r[t];r[t]=function(){return BigInt(e.call(this).toString())}}return r}function nt(r){return Se(new rt.default(r))}function xe(r){for(let t of re){if(r[t]==null)continue;let e=r[t];r[t]=function(i){return e.call(this,i.toString())}}return r}function ot(){return xe(it.default.create())}function N(r,t){let e=nt(r instanceof Uint8Array?r:r.subarray());return t.decode(e)}function I(r,t){let e=ot();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var v;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(v||(v={}));function U(r,t,e,i){return{name:r,type:t,encode:e,decode:i}}function st(r){function t(n){if(r[n.toString()]==null)throw new Error("Invalid enum value");return r[n]}let e=function(o,u){let c=t(o);u.int32(c)},i=function(o){let u=o.int32();return t(u)};return U("enum",v.VARINT,e,i)}function R(r,t){return U("message",v.LENGTH_DELIMITED,r,t)}var k;(function(r){let t;(function(n){n.Raw="Raw",n.Directory="Directory",n.File="File",n.Metadata="Metadata",n.Symlink="Symlink",n.HAMTShard="HAMTShard"})(t=r.DataType||(r.DataType={}));let e;(function(n){n[n.Raw=0]="Raw",n[n.Directory=1]="Directory",n[n.File=2]="File",n[n.Metadata=3]="Metadata",n[n.Symlink=4]="Symlink",n[n.HAMTShard=5]="HAMTShard"})(e||(e={})),function(n){n.codec=()=>st(e)}(t=r.DataType||(r.DataType={}));let i;r.codec=()=>(i==null&&(i=R((n,o,u={})=>{if(u.lengthDelimited!==!1&&o.fork(),n.Type!=null&&(o.uint32(8),r.DataType.codec().encode(n.Type,o)),n.Data!=null&&(o.uint32(18),o.bytes(n.Data)),n.filesize!=null&&(o.uint32(24),o.uint64(n.filesize)),n.blocksizes!=null)for(let c of n.blocksizes)o.uint32(32),o.uint64(c);n.hashType!=null&&(o.uint32(40),o.uint64(n.hashType)),n.fanout!=null&&(o.uint32(48),o.uint64(n.fanout)),n.mode!=null&&(o.uint32(56),o.uint32(n.mode)),n.mtime!=null&&(o.uint32(66),W.codec().encode(n.mtime,o)),u.lengthDelimited!==!1&&o.ldelim()},(n,o)=>{let u={blocksizes:[]},c=o==null?n.len:n.pos+o;for(;n.pos<c;){let s=n.uint32();switch(s>>>3){case 1:u.Type=r.DataType.codec().decode(n);break;case 2:u.Data=n.bytes();break;case 3:u.filesize=n.uint64();break;case 4:u.blocksizes.push(n.uint64());break;case 5:u.hashType=n.uint64();break;case 6:u.fanout=n.uint64();break;case 7:u.mode=n.uint32();break;case 8:u.mtime=W.codec().decode(n,n.uint32());break;default:n.skipType(s&7);break}}return u})),i),r.encode=n=>I(n,r.codec()),r.decode=n=>N(n,r.codec())})(k||(k={}));var W;(function(r){let t;r.codec=()=>(t==null&&(t=R((e,i,n={})=>{n.lengthDelimited!==!1&&i.fork(),e.Seconds!=null&&(i.uint32(8),i.int64(e.Seconds)),e.FractionalNanoseconds!=null&&(i.uint32(21),i.fixed32(e.FractionalNanoseconds)),n.lengthDelimited!==!1&&i.ldelim()},(e,i)=>{let n={},o=i==null?e.len:e.pos+i;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:n.Seconds=e.int64();break;case 2:n.FractionalNanoseconds=e.fixed32();break;default:e.skipType(u&7);break}}return n})),t),r.encode=e=>I(e,r.codec()),r.decode=e=>N(e,r.codec())})(W||(W={}));var ie;(function(r){let t;r.codec=()=>(t==null&&(t=R((e,i,n={})=>{n.lengthDelimited!==!1&&i.fork(),e.MimeType!=null&&(i.uint32(10),i.string(e.MimeType)),n.lengthDelimited!==!1&&i.ldelim()},(e,i)=>{let n={},o=i==null?e.len:e.pos+i;for(;e.pos<o;){let u=e.uint32();switch(u>>>3){case 1:n.MimeType=e.string();break;default:e.skipType(u&7);break}}return n})),t),r.encode=e=>I(e,r.codec()),r.decode=e=>N(e,r.codec())})(ie||(ie={}));var ne={Raw:"raw",Directory:"directory",File:"file",Metadata:"metadata",Symlink:"symlink",HAMTShard:"hamt-sharded-directory"},Ae=["directory","hamt-sharded-directory"],oe=parseInt("0644",8),se=parseInt("0755",8),at=class r{static unmarshal(t){let e=k.decode(t),i=new r({type:ne[e.Type!=null?e.Type.toString():"File"],data:e.Data,blockSizes:e.blocksizes,mode:e.mode,mtime:e.mtime!=null?{secs:e.mtime.Seconds??0n,nsecs:e.mtime.FractionalNanoseconds}:void 0,fanout:e.fanout});return i._originalMode=e.mode??0,i}type;data;blockSizes;hashType;fanout;mtime;_mode;_originalMode;constructor(t={type:"file"}){let{type:e,data:i,blockSizes:n,hashType:o,fanout:u,mtime:c,mode:s}=t;if(e!=null&&!Object.values(ne).includes(e))throw(0,ut.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE");this.type=e??"file",this.data=i,this.hashType=o,this.fanout=u,this.blockSizes=n??[],this._originalMode=0,this.mode=s,this.mtime=c}set mode(t){t==null?this._mode=this.isDirectory()?se:oe:this._mode=t&4095}get mode(){return this._mode}isDirectory(){return Ae.includes(this.type)}addBlockSize(t){this.blockSizes.push(t)}removeBlockSize(t){this.blockSizes.splice(t,1)}fileSize(){if(this.isDirectory())return 0n;let t=0n;return this.blockSizes.forEach(e=>{t+=e}),this.data!=null&&(t+=BigInt(this.data.length)),t}marshal(){let t;switch(this.type){case"raw":t=k.DataType.Raw;break;case"directory":t=k.DataType.Directory;break;case"file":t=k.DataType.File;break;case"metadata":t=k.DataType.Metadata;break;case"symlink":t=k.DataType.Symlink;break;case"hamt-sharded-directory":t=k.DataType.HAMTShard;break;default:throw(0,ut.default)(new Error(`Type: ${t} is not valid`),"ERR_INVALID_TYPE")}let e=this.data;(this.data==null||this.data.length===0)&&(e=void 0);let i;this.mode!=null&&(i=this._originalMode&4294963200|(this.mode??0),i===oe&&!this.isDirectory()&&(i=void 0),i===se&&this.isDirectory()&&(i=void 0));let n;return this.mtime!=null&&(n={Seconds:this.mtime.secs,FractionalNanoseconds:this.mtime.nsecs}),k.encode({Type:t,Data:e,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:i,mtime:n})}};return de(Fe);})(); | ||
"use strict";var IpfsUnixfs=(()=>{var Fe=Object.create;var et=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var ve=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty;var Ue=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),p=(r,t)=>{for(var e in t)et(r,e,{get:t[e],enumerable:!0})},qt=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ve(t))!Me.call(r,n)&&n!==e&&et(r,n,{get:()=>t[n],enumerable:!(i=ze(t,n))||i.enumerable});return r};var Le=(r,t,e)=>(e=r!=null?Fe(Ce(r)):{},qt(t||!r||!r.__esModule?et(e,"default",{value:r,enumerable:!0}):e,r)),Re=r=>qt(et({},"__esModule",{value:!0}),r);var Xt=Ue((on,Jt)=>{"use strict";function Ht(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function Oe(r,t,e){if(!r||typeof r=="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 Ht(r,e)}catch{e.message=r.message,e.stack=r.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(r)),Ht(new n,e)}}Jt.exports=Oe});var rn={};p(rn,{UnixFS:()=>Gt});var _t=Le(Xt(),1);var ct=new Float32Array([-0]),T=new Uint8Array(ct.buffer);function Wt(r,t,e){ct[0]=r,t[e]=T[0],t[e+1]=T[1],t[e+2]=T[2],t[e+3]=T[3]}function Qt(r,t){return T[0]=r[t],T[1]=r[t+1],T[2]=r[t+2],T[3]=r[t+3],ct[0]}var ht=new Float64Array([-0]),l=new Uint8Array(ht.buffer);function Kt(r,t,e){ht[0]=r,t[e]=l[0],t[e+1]=l[1],t[e+2]=l[2],t[e+3]=l[3],t[e+4]=l[4],t[e+5]=l[5],t[e+6]=l[6],t[e+7]=l[7]}function Zt(r,t){return l[0]=r[t],l[1]=r[t+1],l[2]=r[t+2],l[3]=r[t+3],l[4]=r[t+4],l[5]=r[t+5],l[6]=r[t+6],l[7]=r[t+7],ht[0]}var Ve=BigInt(Number.MAX_SAFE_INTEGER),Pe=BigInt(Number.MIN_SAFE_INTEGER),d=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,i=~this.hi>>>0;return e===0&&(i=i+1>>>0),-(e+i*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,i=~this.hi>>>0;return e===0&&(i=i+1>>>0),-(BigInt(e)+(BigInt(i)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:i<128?9:10}static fromBigInt(t){if(t===0n)return z;if(t<Ve&&t>Pe)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let i=t>>32n,n=t-(i<<32n);return e&&(i=~i|0n,n=~n|0n,++n>jt&&(n=0n,++i>jt&&(i=0n))),new r(Number(n),Number(i))}static fromNumber(t){if(t===0)return z;let e=t<0;e&&(t=-t);let i=t>>>0,n=(t-i)/4294967296>>>0;return e&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new r(i,n)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):z}},z=new d(0,0);z.toBigInt=function(){return 0n};z.zzEncode=z.zzDecode=function(){return this};z.length=function(){return 1};var jt=4294967296n;function Yt(r){let t=0,e=0;for(let i=0;i<r.length;++i)e=r.charCodeAt(i),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(i+1)&64512)===56320?(++i,t+=4):t+=3;return t}function te(r,t,e){if(e-t<1)return"";let n,o=[],s=0,a;for(;t<e;)a=r[t++],a<128?o[s++]=a:a>191&&a<224?o[s++]=(a&31)<<6|r[t++]&63:a>239&&a<365?(a=((a&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,o[s++]=55296+(a>>10),o[s++]=56320+(a&1023)):o[s++]=(a&15)<<12|(r[t++]&63)<<6|r[t++]&63,s>8191&&((n??(n=[])).push(String.fromCharCode.apply(String,o)),s=0);return n!=null?(s>0&&n.push(String.fromCharCode.apply(String,o.slice(0,s))),n.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function ft(r,t,e){let i=e,n,o;for(let s=0;s<r.length;++s)n=r.charCodeAt(s),n<128?t[e++]=n:n<2048?(t[e++]=n>>6|192,t[e++]=n&63|128):(n&64512)===55296&&((o=r.charCodeAt(s+1))&64512)===56320?(n=65536+((n&1023)<<10)+(o&1023),++s,t[e++]=n>>18|240,t[e++]=n>>12&63|128,t[e++]=n>>6&63|128,t[e++]=n&63|128):(t[e++]=n>>12|224,t[e++]=n>>6&63|128,t[e++]=n&63|128);return e-i}function y(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function rt(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var lt=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;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,y(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw y(this,4);return rt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw y(this,4);return rt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw y(this,4);let t=Qt(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw y(this,4);let t=Zt(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,i=this.pos+t;if(i>this.len)throw y(this,t);return this.pos+=t,e===i?new Uint8Array(0):this.buf.subarray(e,i)}string(){let t=this.bytes();return te(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw y(this,t);this.pos+=t}else do if(this.pos>=this.len)throw y(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new d(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw y(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw y(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw y(this,8);let t=rt(this.buf,this.pos+=4),e=rt(this.buf,this.pos+=4);return new d(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){return this.readLongVarint().toNumber(!0)}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function ut(r){return new lt(r instanceof Uint8Array?r:r.subarray())}function G(r,t){let e=ut(r);return t.decode(e)}function nt(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function v(r=0){return globalThis.Buffer?.allocUnsafe!=null?nt(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}var gt={};p(gt,{base10:()=>Je});function $e(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),i=0;i<e.length;i++)e[i]=255;for(var n=0;n<r.length;n++){var o=r.charAt(n),s=o.charCodeAt(0);if(e[s]!==255)throw new TypeError(o+" is ambiguous");e[s]=n}var a=r.length,f=r.charAt(0),U=Math.log(a)/Math.log(256),m=Math.log(256)/Math.log(a);function L(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var u=0,F=0,g=0,S=c.length;g!==S&&c[g]===0;)g++,u++;for(var E=(S-g)*m+1>>>0,b=new Uint8Array(E);g!==S;){for(var A=c[g],B=0,x=E-1;(A!==0||B<F)&&x!==-1;x--,B++)A+=256*b[x]>>>0,b[x]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");F=B,g++}for(var k=E-F;k!==E&&b[k]===0;)k++;for(var tt=f.repeat(u);k<E;++k)tt+=r.charAt(b[k]);return tt}function Y(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var u=0;if(c[u]!==" "){for(var F=0,g=0;c[u]===f;)F++,u++;for(var S=(c.length-u)*U+1>>>0,E=new Uint8Array(S);c[u];){var b=e[c.charCodeAt(u)];if(b===255)return;for(var A=0,B=S-1;(b!==0||A<g)&&B!==-1;B--,A++)b+=a*E[B]>>>0,E[B]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");g=A,u++}if(c[u]!==" "){for(var x=S-g;x!==S&&E[x]===0;)x++;for(var k=new Uint8Array(F+(S-x)),tt=F;x!==S;)k[tt++]=E[x++];return k}}}function Ne(c){var u=Y(c);if(u)return u;throw new Error(`Non-${t} character`)}return{encode:L,decodeUnsafe:Y,decode:Ne}}var _e=$e,Ge=_e,re=Ge;var gn=new Uint8Array(0);var ne=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},D=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")};var ie=r=>new TextEncoder().encode(r),oe=r=>new TextDecoder().decode(r);var dt=class{constructor(t,e,i){this.name=t,this.prefix=e,this.baseEncode=i}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},pt=class{constructor(t,e,i){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=i}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 ae(this,t)}},mt=class{constructor(t){this.decoders=t}or(t){return ae(this,t)}decode(t){let e=t[0],i=this.decoders[e];if(i)return i.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},ae=(r,t)=>new mt({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),bt=class{constructor(t,e,i,n){this.name=t,this.prefix=e,this.baseEncode=i,this.baseDecode=n,this.encoder=new dt(t,e,i),this.decoder=new pt(t,e,n)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},R=({name:r,prefix:t,encode:e,decode:i})=>new bt(r,t,e,i),N=({prefix:r,name:t,alphabet:e})=>{let{encode:i,decode:n}=re(e,t);return R({prefix:r,name:t,encode:i,decode:o=>D(n(o))})},qe=(r,t,e,i)=>{let n={};for(let m=0;m<t.length;++m)n[t[m]]=m;let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*e/8|0),a=0,f=0,U=0;for(let m=0;m<o;++m){let L=n[r[m]];if(L===void 0)throw new SyntaxError(`Non-${i} character`);f=f<<e|L,a+=e,a>=8&&(a-=8,s[U++]=255&f>>a)}if(a>=e||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return s},He=(r,t,e)=>{let i=t[t.length-1]==="=",n=(1<<e)-1,o="",s=0,a=0;for(let f=0;f<r.length;++f)for(a=a<<8|r[f],s+=8;s>e;)s-=e,o+=t[n&a>>s];if(s&&(o+=t[n&a<<e-s]),i)for(;o.length*e&7;)o+="=";return o},h=({name:r,prefix:t,bitsPerChar:e,alphabet:i})=>R({prefix:t,name:r,encode(n){return He(n,i,e)},decode(n){return qe(n,i,e,r)}});var Je=N({prefix:"9",name:"base10",alphabet:"0123456789"});var xt={};p(xt,{base16:()=>Xe,base16upper:()=>We});var Xe=h({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),We=h({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var yt={};p(yt,{base2:()=>Qe});var Qe=h({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var wt={};p(wt,{base256emoji:()=>tr});var ce=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Ke=ce.reduce((r,t,e)=>(r[e]=t,r),[]),Ze=ce.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function je(r){return r.reduce((t,e)=>(t+=Ke[e],t),"")}function Ye(r){let t=[];for(let e of r){let i=Ze[e.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}var tr=R({prefix:"\u{1F680}",name:"base256emoji",encode:je,decode:Ye});var St={};p(St,{base32:()=>O,base32hex:()=>ir,base32hexpad:()=>sr,base32hexpadupper:()=>ar,base32hexupper:()=>or,base32pad:()=>rr,base32padupper:()=>nr,base32upper:()=>er,base32z:()=>cr});var O=h({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),er=h({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rr=h({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nr=h({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ir=h({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),or=h({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sr=h({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ar=h({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),cr=h({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Et={};p(Et,{base36:()=>hr,base36upper:()=>fr});var hr=N({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fr=N({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var At={};p(At,{base58btc:()=>I,base58flickr:()=>lr});var I=N({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),lr=N({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var It={};p(It,{base64:()=>ur,base64pad:()=>dr,base64url:()=>pr,base64urlpad:()=>mr});var ur=h({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),dr=h({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pr=h({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mr=h({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var kt={};p(kt,{base8:()=>br});var br=h({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Dt={};p(Dt,{identity:()=>gr});var gr=R({prefix:"\0",name:"identity",encode:r=>oe(r),decode:r=>ie(r)});var vn=new TextEncoder,Cn=new TextDecoder;var Tt={};p(Tt,{identity:()=>Pr});var wr=le,he=128,Sr=127,Er=~Sr,Ar=Math.pow(2,31);function le(r,t,e){t=t||[],e=e||0;for(var i=e;r>=Ar;)t[e++]=r&255|he,r/=128;for(;r&Er;)t[e++]=r&255|he,r>>>=7;return t[e]=r|0,le.bytes=e-i+1,t}var Ir=Bt,kr=128,fe=127;function Bt(r,i){var e=0,i=i||0,n=0,o=i,s,a=r.length;do{if(o>=a)throw Bt.bytes=0,new RangeError("Could not decode varint");s=r[o++],e+=n<28?(s&fe)<<n:(s&fe)*Math.pow(2,n),n+=7}while(s>=kr);return Bt.bytes=o-i,e}var Dr=Math.pow(2,7),Br=Math.pow(2,14),Tr=Math.pow(2,21),Nr=Math.pow(2,28),Fr=Math.pow(2,35),zr=Math.pow(2,42),vr=Math.pow(2,49),Cr=Math.pow(2,56),Mr=Math.pow(2,63),Ur=function(r){return r<Dr?1:r<Br?2:r<Tr?3:r<Nr?4:r<Fr?5:r<zr?6:r<vr?7:r<Cr?8:r<Mr?9:10},Lr={encode:wr,decode:Ir,encodingLength:Ur},Rr=Lr,q=Rr;var H=(r,t=0)=>[q.decode(r,t),q.decode.bytes],V=(r,t,e=0)=>(q.encode(r,t,e),t),P=r=>q.encodingLength(r);var C=(r,t)=>{let e=t.byteLength,i=P(r),n=i+P(e),o=new Uint8Array(n+e);return V(r,o,0),V(e,o,i),o.set(t,n),new $(r,e,t,o)},ue=r=>{let t=D(r),[e,i]=H(t),[n,o]=H(t.subarray(i)),s=t.subarray(i+o);if(s.byteLength!==n)throw new Error("Incorrect length");return new $(e,n,s,t)},de=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&ne(r.bytes,e.bytes)}},$=class{constructor(t,e,i,n){this.code=t,this.size=e,this.digest=i,this.bytes=n}};var pe=0,Or="identity",me=D,Vr=r=>C(pe,me(r)),Pr={code:pe,name:Or,encode:me,digest:Vr};var zt={};p(zt,{sha256:()=>$r,sha512:()=>_r});var Ft=({name:r,code:t,encode:e})=>new Nt(r,t,e),Nt=class{constructor(t,e,i){this.name=t,this.code=e,this.encode=i}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?C(this.code,e):e.then(i=>C(this.code,i))}else throw Error("Unknown type, must be binary type")}};var ge=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),$r=Ft({name:"sha2-256",code:18,encode:ge("SHA-256")}),_r=Ft({name:"sha2-512",code:19,encode:ge("SHA-512")});var xe=(r,t)=>{let{bytes:e,version:i}=r;switch(i){case 0:return qr(e,vt(r),t||I.encoder);default:return Hr(e,vt(r),t||O.encoder)}};var ye=new WeakMap,vt=r=>{let t=ye.get(r);if(t==null){let e=new Map;return ye.set(r,e),e}return t},ot=class r{constructor(t,e,i,n){this.code=e,this.version=t,this.multihash=i,this.bytes=n,this["/"]=n}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==X)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Jr)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,i=C(t,e);return r.createV1(this.code,i)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let i=e;return i&&t.code===i.code&&t.version===i.version&&de(t.multihash,i.multihash)}toString(t){return xe(this,t)}toJSON(){return{"/":xe(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:i,code:n,multihash:o,bytes:s}=e;return new r(i,n,o,s||we(i,n,o.bytes))}else if(e[Xr]===!0){let{version:i,multihash:n,code:o}=e,s=ue(n);return r.create(i,o,s)}else return null}static create(t,e,i){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(i.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==X)throw new Error(`Version 0 CID must use dag-pb (code: ${X}) block encoding`);return new r(t,e,i,i.bytes)}case 1:{let n=we(t,e,i.bytes);return new r(t,e,i,n)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,X,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,i]=r.decodeFirst(t);if(i.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),i=e.size-e.multihashSize,n=D(t.subarray(i,i+e.multihashSize));if(n.byteLength!==e.multihashSize)throw new Error("Incorrect length");let o=n.subarray(e.multihashSize-e.digestSize),s=new $(e.multihashCode,e.digestSize,o,n);return[e.version===0?r.createV0(s):r.createV1(e.codec,s),t.subarray(e.size)]}static inspectBytes(t){let e=0,i=()=>{let[L,Y]=H(t.subarray(e));return e+=Y,L},n=i(),o=X;if(n===18?(n=0,e=0):o=i(),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let s=e,a=i(),f=i(),U=e+f,m=U-s;return{version:n,codec:o,multihashCode:a,digestSize:f,multihashSize:m,size:U}}static parse(t,e){let[i,n]=Gr(t,e),o=r.decode(n);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return vt(o).set(i,t),o}},Gr=(r,t)=>{switch(r[0]){case"Q":{let e=t||I;return[I.prefix,e.decode(`${I.prefix}${r}`)]}case I.prefix:{let e=t||I;return[I.prefix,e.decode(r)]}case O.prefix:{let e=t||O;return[O.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},qr=(r,t,e)=>{let{prefix:i}=e;if(i!==I.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let n=t.get(i);if(n==null){let o=e.encode(r).slice(1);return t.set(i,o),o}else return n},Hr=(r,t,e)=>{let{prefix:i}=e,n=t.get(i);if(n==null){let o=e.encode(r);return t.set(i,o),o}else return n},X=112,Jr=18,we=(r,t,e)=>{let i=P(r),n=i+P(t),o=new Uint8Array(n+e.byteLength);return V(r,o,0),V(t,o,i),o.set(e,n),o},Xr=Symbol.for("@ipld/js-cid/CID");var Ct={...Dt,...yt,...kt,...gt,...xt,...St,...Et,...At,...It,...wt},Qn={...zt,...Tt};function Ee(r,t,e,i){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:i}}}var Se=Ee("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Mt=Ee("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=v(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Wr={utf8:Se,"utf-8":Se,hex:Ct.base16,latin1:Mt,ascii:Mt,binary:Mt,...Ct},Ae=Wr;function Ie(r,t="utf8"){let e=Ae[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?nt(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function Ut(r){let t=r??8192,e=t>>>1,i,n=t;return function(s){if(s<1||s>e)return v(s);n+s>t&&(i=v(t),n=0);let a=i.subarray(n,n+=s);return n&7&&(n=(n|7)+1),a}}var M=class{fn;len;next;val;constructor(t,e,i){this.fn=t,this.len=e,this.next=void 0,this.val=i}};function Lt(){}var Ot=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Qr=Ut();function Kr(r){return globalThis.Buffer!=null?v(r):Qr(r)}var K=class{len;head;tail;states;constructor(){this.len=0,this.head=new M(Lt,0,0),this.tail=this.head,this.states=null}_push(t,e,i){return this.tail=this.tail.next=new M(t,e,i),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new Vt((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(W,10,d.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=d.fromBigInt(t);return this._push(W,e.length(),e)}uint64Number(t){let e=d.fromNumber(t);return this._push(W,e.length(),e)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=d.fromBigInt(t).zzEncode();return this._push(W,e.length(),e)}sint64Number(t){let e=d.fromNumber(t).zzEncode();return this._push(W,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(Rt,1,t?1:0)}fixed32(t){return this._push(Q,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=d.fromBigInt(t);return this._push(Q,4,e.lo)._push(Q,4,e.hi)}fixed64Number(t){let e=d.fromNumber(t);return this._push(Q,4,e.lo)._push(Q,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(Wt,4,t)}double(t){return this._push(Kt,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(Rt,1,0):this.uint32(e)._push(jr,e,t)}string(t){let e=Yt(t);return e!==0?this.uint32(e)._push(ft,e,t):this._push(Rt,1,0)}fork(){return this.states=new Ot(this),this.head=this.tail=new M(Lt,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new M(Lt,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,i=this.len;return this.reset().uint32(i),i!==0&&(this.tail.next=t.next,this.tail=e,this.len+=i),this}finish(){let t=this.head.next,e=Kr(this.len),i=0;for(;t!=null;)t.fn(t.val,e,i),i+=t.len,t=t.next;return e}};function Rt(r,t,e){t[e]=r&255}function Zr(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var Vt=class extends M{next;constructor(t,e){super(Zr,t,e),this.next=void 0}};function W(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function Q(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function jr(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(K.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(Yr,t,r),this},K.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(tn,t,r),this});function Yr(r,t,e){t.set(r,e)}function tn(r,t,e){r.length<40?ft(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(Ie(r),e)}function Pt(){return new K}function Z(r,t){let e=Pt();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var _;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(_||(_={}));function st(r,t,e,i){return{name:r,type:t,encode:e,decode:i}}function $t(r){function t(n){if(r[n.toString()]==null)throw new Error("Invalid enum value");return r[n]}let e=function(o,s){let a=t(o);s.int32(a)},i=function(o){let s=o.int32();return t(s)};return st("enum",_.VARINT,e,i)}function j(r,t){return st("message",_.LENGTH_DELIMITED,r,t)}var w;(function(r){let t;(function(n){n.Raw="Raw",n.Directory="Directory",n.File="File",n.Metadata="Metadata",n.Symlink="Symlink",n.HAMTShard="HAMTShard"})(t=r.DataType||(r.DataType={}));let e;(function(n){n[n.Raw=0]="Raw",n[n.Directory=1]="Directory",n[n.File=2]="File",n[n.Metadata=3]="Metadata",n[n.Symlink=4]="Symlink",n[n.HAMTShard=5]="HAMTShard"})(e||(e={})),function(n){n.codec=()=>$t(e)}(t=r.DataType||(r.DataType={}));let i;r.codec=()=>(i==null&&(i=j((n,o,s={})=>{if(s.lengthDelimited!==!1&&o.fork(),n.Type!=null&&(o.uint32(8),r.DataType.codec().encode(n.Type,o)),n.Data!=null&&(o.uint32(18),o.bytes(n.Data)),n.filesize!=null&&(o.uint32(24),o.uint64(n.filesize)),n.blocksizes!=null)for(let a of n.blocksizes)o.uint32(32),o.uint64(a);n.hashType!=null&&(o.uint32(40),o.uint64(n.hashType)),n.fanout!=null&&(o.uint32(48),o.uint64(n.fanout)),n.mode!=null&&(o.uint32(56),o.uint32(n.mode)),n.mtime!=null&&(o.uint32(66),at.codec().encode(n.mtime,o)),s.lengthDelimited!==!1&&o.ldelim()},(n,o)=>{let s={blocksizes:[]},a=o==null?n.len:n.pos+o;for(;n.pos<a;){let f=n.uint32();switch(f>>>3){case 1:s.Type=r.DataType.codec().decode(n);break;case 2:s.Data=n.bytes();break;case 3:s.filesize=n.uint64();break;case 4:s.blocksizes.push(n.uint64());break;case 5:s.hashType=n.uint64();break;case 6:s.fanout=n.uint64();break;case 7:s.mode=n.uint32();break;case 8:s.mtime=at.codec().decode(n,n.uint32());break;default:n.skipType(f&7);break}}return s})),i),r.encode=n=>Z(n,r.codec()),r.decode=n=>G(n,r.codec())})(w||(w={}));var at;(function(r){let t;r.codec=()=>(t==null&&(t=j((e,i,n={})=>{n.lengthDelimited!==!1&&i.fork(),e.Seconds!=null&&(i.uint32(8),i.int64(e.Seconds)),e.FractionalNanoseconds!=null&&(i.uint32(21),i.fixed32(e.FractionalNanoseconds)),n.lengthDelimited!==!1&&i.ldelim()},(e,i)=>{let n={},o=i==null?e.len:e.pos+i;for(;e.pos<o;){let s=e.uint32();switch(s>>>3){case 1:n.Seconds=e.int64();break;case 2:n.FractionalNanoseconds=e.fixed32();break;default:e.skipType(s&7);break}}return n})),t),r.encode=e=>Z(e,r.codec()),r.decode=e=>G(e,r.codec())})(at||(at={}));var ke;(function(r){let t;r.codec=()=>(t==null&&(t=j((e,i,n={})=>{n.lengthDelimited!==!1&&i.fork(),e.MimeType!=null&&(i.uint32(10),i.string(e.MimeType)),n.lengthDelimited!==!1&&i.ldelim()},(e,i)=>{let n={},o=i==null?e.len:e.pos+i;for(;e.pos<o;){let s=e.uint32();switch(s>>>3){case 1:n.MimeType=e.string();break;default:e.skipType(s&7);break}}return n})),t),r.encode=e=>Z(e,r.codec()),r.decode=e=>G(e,r.codec())})(ke||(ke={}));var De={Raw:"raw",Directory:"directory",File:"file",Metadata:"metadata",Symlink:"symlink",HAMTShard:"hamt-sharded-directory"},en=["directory","hamt-sharded-directory"],Be=parseInt("0644",8),Te=parseInt("0755",8),Gt=class r{static unmarshal(t){let e=w.decode(t),i=new r({type:De[e.Type!=null?e.Type.toString():"File"],data:e.Data,blockSizes:e.blocksizes,mode:e.mode,mtime:e.mtime!=null?{secs:e.mtime.Seconds??0n,nsecs:e.mtime.FractionalNanoseconds}:void 0,fanout:e.fanout});return i._originalMode=e.mode??0,i}type;data;blockSizes;hashType;fanout;mtime;_mode;_originalMode;constructor(t={type:"file"}){let{type:e,data:i,blockSizes:n,hashType:o,fanout:s,mtime:a,mode:f}=t;if(e!=null&&!Object.values(De).includes(e))throw(0,_t.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE");this.type=e??"file",this.data=i,this.hashType=o,this.fanout=s,this.blockSizes=n??[],this._originalMode=0,this.mode=f,this.mtime=a}set mode(t){t==null?this._mode=this.isDirectory()?Te:Be:this._mode=t&4095}get mode(){return this._mode}isDirectory(){return en.includes(this.type)}addBlockSize(t){this.blockSizes.push(t)}removeBlockSize(t){this.blockSizes.splice(t,1)}fileSize(){if(this.isDirectory())return 0n;let t=0n;return this.blockSizes.forEach(e=>{t+=e}),this.data!=null&&(t+=BigInt(this.data.length)),t}marshal(){let t;switch(this.type){case"raw":t=w.DataType.Raw;break;case"directory":t=w.DataType.Directory;break;case"file":t=w.DataType.File;break;case"metadata":t=w.DataType.Metadata;break;case"symlink":t=w.DataType.Symlink;break;case"hamt-sharded-directory":t=w.DataType.HAMTShard;break;default:throw(0,_t.default)(new Error(`Type: ${t} is not valid`),"ERR_INVALID_TYPE")}let e=this.data;(this.data==null||this.data.length===0)&&(e=void 0);let i;this.mode!=null&&(i=this._originalMode&4294963200|(this.mode??0),i===Be&&!this.isDirectory()&&(i=void 0),i===Te&&this.isDirectory()&&(i=void 0));let n;return this.mtime!=null&&(n={Seconds:this.mtime.secs,FractionalNanoseconds:this.mtime.nsecs}),w.encode({Type:t,Data:e,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:i,mtime:n})}};return Re(rn);})(); | ||
return IpfsUnixfs})); |
{ | ||
"name": "ipfs-unixfs", | ||
"version": "11.1.0", | ||
"version": "11.1.1", | ||
"description": "JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG)", | ||
@@ -149,3 +149,3 @@ "license": "Apache-2.0 OR MIT", | ||
"protons": "^7.0.2", | ||
"uint8arrays": "^4.0.2" | ||
"uint8arrays": "^5.0.0" | ||
}, | ||
@@ -152,0 +152,0 @@ "browser": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85100
996