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

blockstore-core

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blockstore-core - npm Package Compare versions

Comparing version 5.0.1 to 5.0.2

2

dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.BlockstoreCore = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var BlockstoreCore=(()=>{var Y=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Le=Object.prototype.hasOwnProperty;var Ue=(r,e)=>{for(var t in e)Y(r,t,{get:e[t],enumerable:!0})},$e=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ne(e))!Le.call(r,o)&&o!==t&&Y(r,o,{get:()=>e[o],enumerable:!(n=De(e,o))||n.enumerable});return r};var Oe=r=>$e(Y({},"__esModule",{value:!0}),r);var $t={};Ue($t,{BaseBlockstore:()=>M,BlackHoleBlockstore:()=>Q,MemoryBlockstore:()=>G,TieredBlockstore:()=>_});var M=class{has(e,t){return Promise.reject(new Error(".has is not implemented"))}put(e,t,n){return Promise.reject(new Error(".put is not implemented"))}async*putMany(e,t){for await(let{cid:n,block:o}of e)await this.put(n,o,t),yield n}get(e,t){return Promise.reject(new Error(".get is not implemented"))}async*getMany(e,t){for await(let n of e)yield{cid:n,block:await this.get(n,t)}}delete(e,t){return Promise.reject(new Error(".delete is not implemented"))}async*deleteMany(e,t){for await(let n of e)await this.delete(n,t),yield n}async*getAll(e){throw new Error(".getAll is not implemented")}};var T=class extends Error{constructor(e="Put failed"){super(e),this.name="PutFailedError"}};var R=class extends Error{constructor(e="Delete failed"){super(e),this.name="DeleteFailedError"}};var I=class extends Error{constructor(e="Not Found"){super(e),this.name="NotFoundError"}};var Tt=new Uint8Array(0);function fe(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function 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")}function Pe(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var f=r.length,p=r.charAt(0),A=Math.log(f)/Math.log(256),a=Math.log(256)/Math.log(f);function u(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var l=0,c=0,m=0,b=d.length;m!==b&&d[m]===0;)m++,l++;for(var y=(b-m)*a+1>>>0,w=new Uint8Array(y);m!==b;){for(var x=d[m],F=0,C=y-1;(x!==0||F<c)&&C!==-1;C--,F++)x+=256*w[C]>>>0,w[C]=x%f>>>0,x=x/f>>>0;if(x!==0)throw new Error("Non-zero carry");c=F,m++}for(var S=y-c;S!==y&&w[S]===0;)S++;for(var N=p.repeat(l);S<y;++S)N+=r.charAt(w[S]);return N}function h(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var l=0;if(d[l]!==" "){for(var c=0,m=0;d[l]===p;)c++,l++;for(var b=(d.length-l)*A+1>>>0,y=new Uint8Array(b);d[l];){var w=t[d.charCodeAt(l)];if(w===255)return;for(var x=0,F=b-1;(w!==0||x<m)&&F!==-1;F--,x++)w+=f*y[F]>>>0,y[F]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");m=x,l++}if(d[l]!==" "){for(var C=b-m;C!==b&&y[C]===0;)C++;for(var S=new Uint8Array(c+(b-C)),N=c;C!==b;)S[N++]=y[C++];return S}}}function z(d){var l=h(d);if(l)return l;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:h,decode:z}}var Be=Pe,Ve=Be,le=Ve;var ee=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},te=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return de(this,e)}},re=class{decoders;constructor(e){this.decoders=e}or(e){return de(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function de(r,e){return new re({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var ne=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new ee(e,t,n),this.decoder=new te(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function he({name:r,prefix:e,encode:t,decode:n}){return new ne(r,e,t,n)}function oe({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=le(t,r);return he({prefix:e,name:r,encode:n,decode:s=>D(o(s))})}function je(r,e,t,n){let o={};for(let a=0;a<e.length;++a)o[e[a]]=a;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),f=0,p=0,A=0;for(let a=0;a<s;++a){let u=o[r[a]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<t|u,f+=t,f>=8&&(f-=8,i[A++]=255&p>>f)}if(f>=t||255&p<<8-f)throw new SyntaxError("Unexpected end of data");return i}function Te(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,f=0;for(let p=0;p<r.length;++p)for(f=f<<8|r[p],i+=8;i>t;)i-=t,s+=e[o&f>>i];if(i!==0&&(s+=e[o&f<<t-i]),n)for(;s.length*t&7;)s+="=";return s}function g({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return he({prefix:e,name:r,encode(o){return Te(o,n,t)},decode(o){return je(o,n,t,r)}})}var v=g({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Zt=g({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Kt=g({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Wt=g({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ht=g({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_t=g({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Yt=g({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),er=g({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),tr=g({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var k=oe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),or=oe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Re=be,pe=128,qe=127,Je=~qe,Ge=Math.pow(2,31);function be(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Ge;)e[t++]=r&255|pe,r/=128;for(;r&Je;)e[t++]=r&255|pe,r>>>=7;return e[t]=r|0,be.bytes=t-n+1,e}var Qe=se,Xe=128,me=127;function se(r,n){var t=0,n=n||0,o=0,s=n,i,f=r.length;do{if(s>=f)throw se.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&me)<<o:(i&me)*Math.pow(2,o),o+=7}while(i>=Xe);return se.bytes=s-n,t}var Ze=Math.pow(2,7),Ke=Math.pow(2,14),We=Math.pow(2,21),He=Math.pow(2,28),_e=Math.pow(2,35),Ye=Math.pow(2,42),et=Math.pow(2,49),tt=Math.pow(2,56),rt=Math.pow(2,63),nt=function(r){return r<Ze?1:r<Ke?2:r<We?3:r<He?4:r<_e?5:r<Ye?6:r<et?7:r<tt?8:r<rt?9:10},ot={encode:Re,decode:Qe,encodingLength:nt},st=ot,P=st;function B(r,e=0){return[P.decode(r,e),P.decode.bytes]}function L(r,e,t=0){return P.encode(r,e,t),e}function U(r){return P.encodingLength(r)}function we(r,e){let t=e.byteLength,n=U(r),o=n+U(t),s=new Uint8Array(o+t);return L(r,s,0),L(t,s,n),s.set(e,o),new $(r,t,e,s)}function q(r){let e=D(r),[t,n]=B(e),[o,s]=B(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new $(t,o,i,e)}function ge(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&fe(r.bytes,t.bytes)}}var $=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};function Ce(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return at(t,ie(r),e??k.encoder);default:return ct(t,ie(r),e??v.encoder)}}var ve=new WeakMap;function ie(r){let e=ve.get(r);if(e==null){let t=new Map;return ve.set(r,t),t}return e}var J=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==V)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==ut)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=we(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&ge(e.multihash,n.multihash)}toString(e){return Ce(this,e)}toJSON(){return{"/":Ce(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i??Ee(n,o,s.bytes))}else if(t[ft]===!0){let{version:n,multihash:o,code:s}=t,i=q(o);return r.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==V)throw new Error(`Version 0 CID must use dag-pb (code: ${V}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=Ee(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,V,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=D(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new $(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[u,h]=B(e.subarray(t));return t+=h,u},o=n(),s=V;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,f=n(),p=n(),A=t+p,a=A-i;return{version:o,codec:s,multihashCode:f,digestSize:p,multihashSize:a,size:A}}static parse(e,t){let[n,o]=it(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ie(s).set(n,e),s}};function it(r,e){switch(r[0]){case"Q":{let t=e??k;return[k.prefix,t.decode(`${k.prefix}${r}`)]}case k.prefix:{let t=e??k;return[k.prefix,t.decode(r)]}case v.prefix:{let t=e??v;return[v.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function at(r,e,t){let{prefix:n}=t;if(n!==k.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o}function ct(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o}var V=112,ut=18;function Ee(r,e,t){let n=U(r),o=n+U(e),s=new Uint8Array(o+t.byteLength);return L(r,s,0),L(e,s,n),s.set(t,o),s}var ft=Symbol.for("@ipld/js-cid/CID");var Fe=85;var G=class extends M{data;constructor(){super(),this.data=new Map}put(e,t){return this.data.set(v.encode(e.multihash.bytes),t),e}get(e){let t=this.data.get(v.encode(e.multihash.bytes));if(t==null)throw new I;return t}has(e){return this.data.has(v.encode(e.multihash.bytes))}async delete(e){this.data.delete(v.encode(e.multihash.bytes))}async*getAll(){for(let[e,t]of this.data.entries())yield{cid:J.createV1(Fe,q(v.decode(e))),block:t}}};var Q=class extends M{put(e){return e}get(){throw new I}has(){return!1}async delete(){}async*getAll(){}};var Se=g({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Fr=g({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Sr=g({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ar=g({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function dt(r,e){try{if(typeof r=="string"&&r.length>0)return ht(r);if(typeof r=="number"&&isFinite(r))return e?.long?mt(r):pt(r);throw new Error("Value is not a string or number.")}catch(t){let n=bt(t)?`${t.message}. value=${JSON.stringify(r)}`:"An unknown error has occured.";throw new Error(n)}}function ht(r){if(r=String(r),r.length>100)throw new Error("Value exceeds the maximum length of 100 characters.");let e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!e)return NaN;let t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*315576e5;case"weeks":case"week":case"w":return t*6048e5;case"days":case"day":case"d":return t*864e5;case"hours":case"hour":case"hrs":case"hr":case"h":return t*36e5;case"minutes":case"minute":case"mins":case"min":case"m":return t*6e4;case"seconds":case"second":case"secs":case"sec":case"s":return t*1e3;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:throw new Error(`The unit ${n} was matched, but no matching case exists.`)}}var Z=dt;function pt(r){let e=Math.abs(r);return e>=864e5?`${Math.round(r/864e5)}d`:e>=36e5?`${Math.round(r/36e5)}h`:e>=6e4?`${Math.round(r/6e4)}m`:e>=1e3?`${Math.round(r/1e3)}s`:`${r}ms`}function mt(r){let e=Math.abs(r);return e>=864e5?X(r,e,864e5,"day"):e>=36e5?X(r,e,36e5,"hour"):e>=6e4?X(r,e,6e4,"minute"):e>=1e3?X(r,e,1e3,"second"):`${r} ms`}function X(r,e,t,n){let o=e>=t*1.5;return`${Math.round(r/t)} ${n}${o?"s":""}`}function bt(r){return typeof r=="object"&&r!==null&&"message"in r}function ae(r){t.debug=t,t.default=t,t.coerce=p,t.disable=s,t.enable=o,t.enabled=i,t.humanize=Z,t.destroy=A,Object.keys(r).forEach(a=>{t[a]=r[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let u=0;for(let h=0;h<a.length;h++)u=(u<<5)-u+a.charCodeAt(h),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(a){let u,h=null,z,d;function l(...c){if(!l.enabled)return;let m=l,b=Number(new Date),y=b-(u||b);m.diff=y,m.prev=u,m.curr=b,u=b,c[0]=t.coerce(c[0]),typeof c[0]!="string"&&c.unshift("%O");let w=0;c[0]=c[0].replace(/%([a-zA-Z%])/g,(F,C)=>{if(F==="%%")return"%";w++;let S=t.formatters[C];if(typeof S=="function"){let N=c[w];F=S.call(m,N),c.splice(w,1),w--}return F}),t.formatArgs.call(m,c),(m.log||t.log).apply(m,c)}return l.namespace=a,l.useColors=t.useColors(),l.color=t.selectColor(a),l.extend=n,l.destroy=t.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(z!==t.namespaces&&(z=t.namespaces,d=t.enabled(a)),d),set:c=>{h=c}}),typeof t.init=="function"&&t.init(l),l}function n(a,u){let h=t(this.namespace+(typeof u>"u"?":":u)+a);return h.log=this.log,h}function o(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let u,h=(typeof a=="string"?a:"").split(/[\s,]+/),z=h.length;for(u=0;u<z;u++)h[u]&&(a=h[u].replace(/\*/g,".*?"),a[0]==="-"?t.skips.push(new RegExp("^"+a.substr(1)+"$")):t.names.push(new RegExp("^"+a+"$")))}function s(){let a=[...t.names.map(f),...t.skips.map(f).map(u=>"-"+u)].join(",");return t.enable(""),a}function i(a){if(a[a.length-1]==="*")return!0;let u,h;for(u=0,h=t.skips.length;u<h;u++)if(t.skips[u].test(a))return!1;for(u=0,h=t.names.length;u<h;u++)if(t.names[u].test(a))return!0;return!1}function f(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function p(a){return a instanceof Error?a.stack??a.message:a}function A(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.setupFormatters(t.formatters),t.enable(t.load()),t}var K=Et(),yt=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function wt(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/(edge|trident)\/(\d+)/)!=null?!1:typeof document<"u"&&document.documentElement?.style?.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/firefox\/(\d+)/)!=null&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/applewebkit\/(\d+)/)}function gt(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Z(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}var xt=console.debug??console.log??(()=>{});function Ct(r){try{r?K?.setItem("debug",r):K?.removeItem("debug")}catch{}}function vt(){let r;try{r=K?.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Et(){try{return localStorage}catch{}}function Ft(r){r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}var Ae=ae({formatArgs:gt,save:Ct,load:vt,useColors:wt,setupFormatters:Ft,colors:yt,storage:K,log:xt});var E=Ae;E.formatters.b=r=>r==null?"undefined":k.baseEncode(r);E.formatters.t=r=>r==null?"undefined":v.baseEncode(r);E.formatters.m=r=>r==null?"undefined":Se.baseEncode(r);E.formatters.p=r=>r==null?"undefined":r.toString();E.formatters.c=r=>r==null?"undefined":r.toString();E.formatters.k=r=>r==null?"undefined":r.toString();E.formatters.a=r=>r==null?"undefined":r.toString();function St(r){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=r,e.destroy=()=>!0,e.extend=()=>e,e}function ke(r){let e=St(`${r}:trace`);return E.enabled(`${r}:trace`)&&E.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(e=E(`${r}:trace`)),Object.assign(E(r),{error:E(`${r}:error`),trace:e})}function At(r){return r[Symbol.asyncIterator]!=null}function kt(r){if(At(r))return(async()=>{for await(let e of r);})();for(let e of r);}var ce=kt;function Mt(r){let[e,t]=r[Symbol.asyncIterator]!=null?[r[Symbol.asyncIterator](),Symbol.asyncIterator]:[r[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:o=>{n.push(o)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[t](){return this}}}var Me=Mt;function zt(r){return r[Symbol.asyncIterator]!=null}function It(r,e){let t=0;if(zt(r))return async function*(){for await(let p of r)await e(p,t++)&&(yield p)}();let n=Me(r),{value:o,done:s}=n.next();if(s===!0)return function*(){}();let i=e(o,t++);if(typeof i.then=="function")return async function*(){await i&&(yield o);for await(let p of n)await e(p,t++)&&(yield p)}();let f=e;return function*(){i===!0&&(yield o);for(let p of n)f(p,t++)&&(yield p)}()}var ze=It;function W(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var H=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},O=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new H(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let t=this.head;this.head=t.next=new H(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var ue=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}};function j(r={}){return Dt(t=>{let n=t.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},r)}function Dt(r,e){e=e??{};let t=e.onEnd,n=new O,o,s,i,f=W(),p=async()=>{try{return n.isEmpty()?i?{done:!0}:await new Promise((c,m)=>{s=b=>{s=null,n.push(b);try{c(r(n))}catch(y){m(y)}return o}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{f.resolve(),f=W()})}},A=c=>s!=null?s(c):(n.push(c),o),a=c=>(n=new O,s!=null?s({error:c}):(n.push({error:c}),o)),u=c=>{if(i)return o;if(e?.objectMode!==!0&&c?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return A({done:!1,value:c})},h=c=>i?o:(i=!0,c!=null?a(c):A({done:!0})),z=()=>(n=new O,h(),{done:!0}),d=c=>(h(c),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:p,return:z,throw:d,push:u,end:h,get readableLength(){return n.size},onEmpty:async c=>{let m=c?.signal;if(m?.throwIfAborted(),n.isEmpty())return;let b,y;m!=null&&(b=new Promise((w,x)=>{y=()=>{x(new ue)},m.addEventListener("abort",y)}));try{await Promise.race([f.promise,b])}finally{y!=null&&m!=null&&m?.removeEventListener("abort",y)}}},t==null)return o;let l=o;return o={[Symbol.asyncIterator](){return this},next(){return l.next()},throw(c){return l.throw(c),t!=null&&(t(c),t=void 0),{done:!0}},return(){return l.return(),t!=null&&(t(),t=void 0),{done:!0}},push:u,end(c){return l.end(c),t!=null&&(t(c),t=void 0),o},get readableLength(){return l.readableLength},onEmpty:c=>l.onEmpty(c)},o}function Nt(r){return r[Symbol.asyncIterator]!=null}function Lt(...r){let e=[];for(let t of r)Nt(t)||e.push(t);return e.length===r.length?function*(){for(let t of e)yield*t}():async function*(){let t=j({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async n=>{for await(let o of n)t.push(o)})),t.end()}catch(n){t.end(n)}}),yield*t}()}var Ie=Lt;var Ut=ke("blockstore:core:tiered"),_=class extends M{stores;constructor(e){super(),this.stores=e.slice()}async put(e,t,n){try{return await Promise.all(this.stores.map(async o=>{await o.put(e,t,n)})),e}catch(o){throw new T(String(o))}}async get(e,t){for(let n of this.stores)try{let o=await n.get(e,t);if(o!=null)return o}catch(o){Ut.error(o)}throw new I}async has(e,t){for(let n of this.stores)if(await n.has(e,t))return!0;return!1}async delete(e,t){try{await Promise.all(this.stores.map(async n=>{await n.delete(e,t)}))}catch(n){throw new R(String(n))}}async*putMany(e,t={}){let n,o=this.stores.map(s=>{let i=j({objectMode:!0});return ce(s.putMany(i,t)).catch(f=>{n=f}),i});try{for await(let s of e){if(n!=null)throw n;o.forEach(i=>i.push(s)),yield s.cid}}finally{o.forEach(s=>s.end())}}async*deleteMany(e,t={}){let n,o=this.stores.map(s=>{let i=j({objectMode:!0});return ce(s.deleteMany(i,t)).catch(f=>{n=f}),i});try{for await(let s of e){if(n!=null)throw n;o.forEach(i=>i.push(s)),yield s}}finally{o.forEach(s=>s.end())}}async*getAll(e){let t=new Set;yield*ze(Ie(...this.stores.map(n=>n.getAll(e))),n=>{let o=n.cid.toString();return t.has(o)?!1:(t.add(o),!0)})}};return Oe($t);})();
"use strict";var BlockstoreCore=(()=>{var te=Object.defineProperty;var Ne=Object.getOwnPropertyDescriptor;var Le=Object.getOwnPropertyNames;var Ue=Object.prototype.hasOwnProperty;var $e=(r,e)=>{for(var t in e)te(r,t,{get:e[t],enumerable:!0})},Oe=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Le(e))!Ue.call(r,o)&&o!==t&&te(r,o,{get:()=>e[o],enumerable:!(n=Ne(e,o))||n.enumerable});return r};var Pe=r=>Oe(te({},"__esModule",{value:!0}),r);var Ot={};$e(Ot,{BaseBlockstore:()=>M,BlackHoleBlockstore:()=>K,MemoryBlockstore:()=>X,TieredBlockstore:()=>ee});var M=class{has(e,t){return Promise.reject(new Error(".has is not implemented"))}put(e,t,n){return Promise.reject(new Error(".put is not implemented"))}async*putMany(e,t){for await(let{cid:n,block:o}of e)await this.put(n,o,t),yield n}get(e,t){return Promise.reject(new Error(".get is not implemented"))}async*getMany(e,t){for await(let n of e)yield{cid:n,block:await this.get(n,t)}}delete(e,t){return Promise.reject(new Error(".delete is not implemented"))}async*deleteMany(e,t){for await(let n of e)await this.delete(n,t),yield n}async*getAll(e){throw new Error(".getAll is not implemented")}};var R=class extends Error{constructor(e="Put failed"){super(e),this.name="PutFailedError"}};var q=class extends Error{constructor(e="Delete failed"){super(e),this.name="DeleteFailedError"}};var I=class extends Error{constructor(e="Not Found"){super(e),this.name="NotFoundError"}};var Rt=new Uint8Array(0);function le(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function 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")}function Be(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var f=r.length,p=r.charAt(0),A=Math.log(f)/Math.log(256),a=Math.log(256)/Math.log(f);function u(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var l=0,c=0,m=0,b=d.length;m!==b&&d[m]===0;)m++,l++;for(var y=(b-m)*a+1>>>0,w=new Uint8Array(y);m!==b;){for(var x=d[m],F=0,C=y-1;(x!==0||F<c)&&C!==-1;C--,F++)x+=256*w[C]>>>0,w[C]=x%f>>>0,x=x/f>>>0;if(x!==0)throw new Error("Non-zero carry");c=F,m++}for(var S=y-c;S!==y&&w[S]===0;)S++;for(var N=p.repeat(l);S<y;++S)N+=r.charAt(w[S]);return N}function h(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var l=0;if(d[l]!==" "){for(var c=0,m=0;d[l]===p;)c++,l++;for(var b=(d.length-l)*A+1>>>0,y=new Uint8Array(b);d[l];){var w=t[d.charCodeAt(l)];if(w===255)return;for(var x=0,F=b-1;(w!==0||x<m)&&F!==-1;F--,x++)w+=f*y[F]>>>0,y[F]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");m=x,l++}if(d[l]!==" "){for(var C=b-m;C!==b&&y[C]===0;)C++;for(var S=new Uint8Array(c+(b-C)),N=c;C!==b;)S[N++]=y[C++];return S}}}function z(d){var l=h(d);if(l)return l;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:h,decode:z}}var Ve=Be,je=Ve,de=je;var re=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},ne=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return he(this,e)}},oe=class{decoders;constructor(e){this.decoders=e}or(e){return he(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function he(r,e){return new oe({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var se=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new re(e,t,n),this.decoder=new ne(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function pe({name:r,prefix:e,encode:t,decode:n}){return new se(r,e,t,n)}function L({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=de(t,r);return pe({prefix:e,name:r,encode:n,decode:s=>D(o(s))})}function Te(r,e,t,n){let o={};for(let a=0;a<e.length;++a)o[e[a]]=a;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),f=0,p=0,A=0;for(let a=0;a<s;++a){let u=o[r[a]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<t|u,f+=t,f>=8&&(f-=8,i[A++]=255&p>>f)}if(f>=t||255&p<<8-f)throw new SyntaxError("Unexpected end of data");return i}function Re(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,f=0;for(let p=0;p<r.length;++p)for(f=f<<8|r[p],i+=8;i>t;)i-=t,s+=e[o&f>>i];if(i!==0&&(s+=e[o&f<<t-i]),n)for(;s.length*t&7;)s+="=";return s}function g({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return pe({prefix:e,name:r,encode(o){return Re(o,n,t)},decode(o){return Te(o,n,t,r)}})}var v=g({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Zt=g({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Wt=g({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ht=g({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Yt=g({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_t=g({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),er=g({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),tr=g({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),rr=g({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var J=L({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),sr=L({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var k=L({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),cr=L({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var qe=ye,me=128,Je=127,Ge=~Je,Qe=Math.pow(2,31);function ye(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Qe;)e[t++]=r&255|me,r/=128;for(;r&Ge;)e[t++]=r&255|me,r>>>=7;return e[t]=r|0,ye.bytes=t-n+1,e}var Xe=ie,Ke=128,be=127;function ie(r,n){var t=0,n=n||0,o=0,s=n,i,f=r.length;do{if(s>=f)throw ie.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&be)<<o:(i&be)*Math.pow(2,o),o+=7}while(i>=Ke);return ie.bytes=s-n,t}var Ze=Math.pow(2,7),We=Math.pow(2,14),He=Math.pow(2,21),Ye=Math.pow(2,28),_e=Math.pow(2,35),et=Math.pow(2,42),tt=Math.pow(2,49),rt=Math.pow(2,56),nt=Math.pow(2,63),ot=function(r){return r<Ze?1:r<We?2:r<He?3:r<Ye?4:r<_e?5:r<et?6:r<tt?7:r<rt?8:r<nt?9:10},st={encode:qe,decode:Xe,encodingLength:ot},it=st,B=it;function V(r,e=0){return[B.decode(r,e),B.decode.bytes]}function U(r,e,t=0){return B.encode(r,e,t),e}function $(r){return B.encodingLength(r)}function ge(r,e){let t=e.byteLength,n=$(r),o=n+$(t),s=new Uint8Array(o+t);return U(r,s,0),U(t,s,n),s.set(e,o),new O(r,t,e,s)}function G(r){let e=D(r),[t,n]=V(e),[o,s]=V(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new O(t,o,i,e)}function xe(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&le(r.bytes,t.bytes)}}var O=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};function ve(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return ct(t,ae(r),e??k.encoder);default:return ut(t,ae(r),e??v.encoder)}}var Ee=new WeakMap;function ae(r){let e=Ee.get(r);if(e==null){let t=new Map;return Ee.set(r,t),t}return e}var Q=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==j)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==ft)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=ge(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&xe(e.multihash,n.multihash)}toString(e){return ve(this,e)}toJSON(){return{"/":ve(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i??Fe(n,o,s.bytes))}else if(t[lt]===!0){let{version:n,multihash:o,code:s}=t,i=G(o);return r.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==j)throw new Error(`Version 0 CID must use dag-pb (code: ${j}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=Fe(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,j,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=D(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new O(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[u,h]=V(e.subarray(t));return t+=h,u},o=n(),s=j;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,f=n(),p=n(),A=t+p,a=A-i;return{version:o,codec:s,multihashCode:f,digestSize:p,multihashSize:a,size:A}}static parse(e,t){let[n,o]=at(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ae(s).set(n,e),s}};function at(r,e){switch(r[0]){case"Q":{let t=e??k;return[k.prefix,t.decode(`${k.prefix}${r}`)]}case k.prefix:{let t=e??k;return[k.prefix,t.decode(r)]}case v.prefix:{let t=e??v;return[v.prefix,t.decode(r)]}case J.prefix:{let t=e??J;return[J.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function ct(r,e,t){let{prefix:n}=t;if(n!==k.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o}function ut(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o}var j=112,ft=18;function Fe(r,e,t){let n=$(r),o=n+$(e),s=new Uint8Array(o+t.byteLength);return U(r,s,0),U(e,s,n),s.set(t,o),s}var lt=Symbol.for("@ipld/js-cid/CID");var Se=85;var X=class extends M{data;constructor(){super(),this.data=new Map}put(e,t){return this.data.set(v.encode(e.multihash.bytes),t),e}get(e){let t=this.data.get(v.encode(e.multihash.bytes));if(t==null)throw new I;return t}has(e){return this.data.has(v.encode(e.multihash.bytes))}async delete(e){this.data.delete(v.encode(e.multihash.bytes))}async*getAll(){for(let[e,t]of this.data.entries())yield{cid:Q.createV1(Se,G(v.decode(e))),block:t}}};var K=class extends M{put(e){return e}get(){throw new I}has(){return!1}async delete(){}async*getAll(){}};var Ae=g({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zr=g({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ir=g({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Dr=g({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function ht(r,e){try{if(typeof r=="string"&&r.length>0)return pt(r);if(typeof r=="number"&&isFinite(r))return e?.long?bt(r):mt(r);throw new Error("Value is not a string or number.")}catch(t){let n=yt(t)?`${t.message}. value=${JSON.stringify(r)}`:"An unknown error has occured.";throw new Error(n)}}function pt(r){if(r=String(r),r.length>100)throw new Error("Value exceeds the maximum length of 100 characters.");let e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!e)return NaN;let t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*315576e5;case"weeks":case"week":case"w":return t*6048e5;case"days":case"day":case"d":return t*864e5;case"hours":case"hour":case"hrs":case"hr":case"h":return t*36e5;case"minutes":case"minute":case"mins":case"min":case"m":return t*6e4;case"seconds":case"second":case"secs":case"sec":case"s":return t*1e3;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:throw new Error(`The unit ${n} was matched, but no matching case exists.`)}}var W=ht;function mt(r){let e=Math.abs(r);return e>=864e5?`${Math.round(r/864e5)}d`:e>=36e5?`${Math.round(r/36e5)}h`:e>=6e4?`${Math.round(r/6e4)}m`:e>=1e3?`${Math.round(r/1e3)}s`:`${r}ms`}function bt(r){let e=Math.abs(r);return e>=864e5?Z(r,e,864e5,"day"):e>=36e5?Z(r,e,36e5,"hour"):e>=6e4?Z(r,e,6e4,"minute"):e>=1e3?Z(r,e,1e3,"second"):`${r} ms`}function Z(r,e,t,n){let o=e>=t*1.5;return`${Math.round(r/t)} ${n}${o?"s":""}`}function yt(r){return typeof r=="object"&&r!==null&&"message"in r}function ce(r){t.debug=t,t.default=t,t.coerce=p,t.disable=s,t.enable=o,t.enabled=i,t.humanize=W,t.destroy=A,Object.keys(r).forEach(a=>{t[a]=r[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let u=0;for(let h=0;h<a.length;h++)u=(u<<5)-u+a.charCodeAt(h),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(a){let u,h=null,z,d;function l(...c){if(!l.enabled)return;let m=l,b=Number(new Date),y=b-(u||b);m.diff=y,m.prev=u,m.curr=b,u=b,c[0]=t.coerce(c[0]),typeof c[0]!="string"&&c.unshift("%O");let w=0;c[0]=c[0].replace(/%([a-zA-Z%])/g,(F,C)=>{if(F==="%%")return"%";w++;let S=t.formatters[C];if(typeof S=="function"){let N=c[w];F=S.call(m,N),c.splice(w,1),w--}return F}),t.formatArgs.call(m,c),(m.log||t.log).apply(m,c)}return l.namespace=a,l.useColors=t.useColors(),l.color=t.selectColor(a),l.extend=n,l.destroy=t.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(z!==t.namespaces&&(z=t.namespaces,d=t.enabled(a)),d),set:c=>{h=c}}),typeof t.init=="function"&&t.init(l),l}function n(a,u){let h=t(this.namespace+(typeof u>"u"?":":u)+a);return h.log=this.log,h}function o(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let u,h=(typeof a=="string"?a:"").split(/[\s,]+/),z=h.length;for(u=0;u<z;u++)h[u]&&(a=h[u].replace(/\*/g,".*?"),a[0]==="-"?t.skips.push(new RegExp("^"+a.substr(1)+"$")):t.names.push(new RegExp("^"+a+"$")))}function s(){let a=[...t.names.map(f),...t.skips.map(f).map(u=>"-"+u)].join(",");return t.enable(""),a}function i(a){if(a[a.length-1]==="*")return!0;let u,h;for(u=0,h=t.skips.length;u<h;u++)if(t.skips[u].test(a))return!1;for(u=0,h=t.names.length;u<h;u++)if(t.names[u].test(a))return!0;return!1}function f(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function p(a){return a instanceof Error?a.stack??a.message:a}function A(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.setupFormatters(t.formatters),t.enable(t.load()),t}var H=Ft(),wt=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function gt(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/(edge|trident)\/(\d+)/)!=null?!1:typeof document<"u"&&document.documentElement?.style?.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/firefox\/(\d+)/)!=null&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/applewebkit\/(\d+)/)}function xt(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+W(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}var Ct=console.debug??console.log??(()=>{});function vt(r){try{r?H?.setItem("debug",r):H?.removeItem("debug")}catch{}}function Et(){let r;try{r=H?.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Ft(){try{return localStorage}catch{}}function St(r){r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}var ke=ce({formatArgs:xt,save:vt,load:Et,useColors:gt,setupFormatters:St,colors:wt,storage:H,log:Ct});var E=ke;E.formatters.b=r=>r==null?"undefined":k.baseEncode(r);E.formatters.t=r=>r==null?"undefined":v.baseEncode(r);E.formatters.m=r=>r==null?"undefined":Ae.baseEncode(r);E.formatters.p=r=>r==null?"undefined":r.toString();E.formatters.c=r=>r==null?"undefined":r.toString();E.formatters.k=r=>r==null?"undefined":r.toString();E.formatters.a=r=>r==null?"undefined":r.toString();function At(r){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=r,e.destroy=()=>!0,e.extend=()=>e,e}function Me(r){let e=At(`${r}:trace`);return E.enabled(`${r}:trace`)&&E.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(e=E(`${r}:trace`)),Object.assign(E(r),{error:E(`${r}:error`),trace:e})}function kt(r){return r[Symbol.asyncIterator]!=null}function Mt(r){if(kt(r))return(async()=>{for await(let e of r);})();for(let e of r);}var ue=Mt;function zt(r){let[e,t]=r[Symbol.asyncIterator]!=null?[r[Symbol.asyncIterator](),Symbol.asyncIterator]:[r[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:o=>{n.push(o)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[t](){return this}}}var ze=zt;function It(r){return r[Symbol.asyncIterator]!=null}function Dt(r,e){let t=0;if(It(r))return async function*(){for await(let p of r)await e(p,t++)&&(yield p)}();let n=ze(r),{value:o,done:s}=n.next();if(s===!0)return function*(){}();let i=e(o,t++);if(typeof i.then=="function")return async function*(){await i&&(yield o);for await(let p of n)await e(p,t++)&&(yield p)}();let f=e;return function*(){i===!0&&(yield o);for(let p of n)f(p,t++)&&(yield p)}()}var Ie=Dt;function Y(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var _=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},P=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new _(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let t=this.head;this.head=t.next=new _(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var fe=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}};function T(r={}){return Nt(t=>{let n=t.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},r)}function Nt(r,e){e=e??{};let t=e.onEnd,n=new P,o,s,i,f=Y(),p=async()=>{try{return n.isEmpty()?i?{done:!0}:await new Promise((c,m)=>{s=b=>{s=null,n.push(b);try{c(r(n))}catch(y){m(y)}return o}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{f.resolve(),f=Y()})}},A=c=>s!=null?s(c):(n.push(c),o),a=c=>(n=new P,s!=null?s({error:c}):(n.push({error:c}),o)),u=c=>{if(i)return o;if(e?.objectMode!==!0&&c?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return A({done:!1,value:c})},h=c=>i?o:(i=!0,c!=null?a(c):A({done:!0})),z=()=>(n=new P,h(),{done:!0}),d=c=>(h(c),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:p,return:z,throw:d,push:u,end:h,get readableLength(){return n.size},onEmpty:async c=>{let m=c?.signal;if(m?.throwIfAborted(),n.isEmpty())return;let b,y;m!=null&&(b=new Promise((w,x)=>{y=()=>{x(new fe)},m.addEventListener("abort",y)}));try{await Promise.race([f.promise,b])}finally{y!=null&&m!=null&&m?.removeEventListener("abort",y)}}},t==null)return o;let l=o;return o={[Symbol.asyncIterator](){return this},next(){return l.next()},throw(c){return l.throw(c),t!=null&&(t(c),t=void 0),{done:!0}},return(){return l.return(),t!=null&&(t(),t=void 0),{done:!0}},push:u,end(c){return l.end(c),t!=null&&(t(c),t=void 0),o},get readableLength(){return l.readableLength},onEmpty:c=>l.onEmpty(c)},o}function Lt(r){return r[Symbol.asyncIterator]!=null}function Ut(...r){let e=[];for(let t of r)Lt(t)||e.push(t);return e.length===r.length?function*(){for(let t of e)yield*t}():async function*(){let t=T({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async n=>{for await(let o of n)t.push(o)})),t.end()}catch(n){t.end(n)}}),yield*t}()}var De=Ut;var $t=Me("blockstore:core:tiered"),ee=class extends M{stores;constructor(e){super(),this.stores=e.slice()}async put(e,t,n){try{return await Promise.all(this.stores.map(async o=>{await o.put(e,t,n)})),e}catch(o){throw new R(String(o))}}async get(e,t){for(let n of this.stores)try{let o=await n.get(e,t);if(o!=null)return o}catch(o){$t.error(o)}throw new I}async has(e,t){for(let n of this.stores)if(await n.has(e,t))return!0;return!1}async delete(e,t){try{await Promise.all(this.stores.map(async n=>{await n.delete(e,t)}))}catch(n){throw new q(String(n))}}async*putMany(e,t={}){let n,o=this.stores.map(s=>{let i=T({objectMode:!0});return ue(s.putMany(i,t)).catch(f=>{n=f}),i});try{for await(let s of e){if(n!=null)throw n;o.forEach(i=>i.push(s)),yield s.cid}}finally{o.forEach(s=>s.end())}}async*deleteMany(e,t={}){let n,o=this.stores.map(s=>{let i=T({objectMode:!0});return ue(s.deleteMany(i,t)).catch(f=>{n=f}),i});try{for await(let s of e){if(n!=null)throw n;o.forEach(i=>i.push(s)),yield s}}finally{o.forEach(s=>s.end())}}async*getAll(e){let t=new Set;yield*Ie(De(...this.stores.map(n=>n.getAll(e))),n=>{let o=n.cid.toString();return t.has(o)?!1:(t.add(o),!0)})}};return Pe(Ot);})();
return BlockstoreCore}));
{
"name": "blockstore-core",
"version": "5.0.1",
"version": "5.0.2",
"description": "Contains various implementations of the API contract described in interface-blockstore",

@@ -86,2 +86,87 @@ "author": "Alex Potsides <alex.potsides@protocol.ai>",

},
"release": {
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "deps",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
},
"scripts": {

@@ -102,3 +187,3 @@ "clean": "aegir clean",

"dependencies": {
"@libp2p/logger": "^5.0.0",
"@libp2p/logger": "^5.0.1",
"interface-blockstore": "^5.0.0",

@@ -110,6 +195,6 @@ "interface-store": "^6.0.0",

"it-pushable": "^3.2.3",
"multiformats": "^13.2.2"
"multiformats": "^13.2.3"
},
"devDependencies": {
"aegir": "^44.1.0",
"aegir": "^44.1.1",
"interface-blockstore-tests": "^7.0.0",

@@ -116,0 +201,0 @@ "it-all": "^3.0.6",

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