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

interface-datastore

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

interface-datastore - npm Package Compare versions

Comparing version 8.3.0 to 8.3.1

2

dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.InterfaceDatastore = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var InterfaceDatastore=(()=>{var X=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Re=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var r in e)X(t,r,{get:e[r],enumerable:!0})},Je=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of qe(e))!Re.call(t,o)&&o!==r&&X(t,o,{get:()=>e[o],enumerable:!(n=ke(e,o))||n.enumerable});return t};var Ke=t=>Je(X({},"__esModule",{value:!0}),t);var nr={};d(nr,{Key:()=>K});var Z={};d(Z,{base10:()=>Ze});var sr=new Uint8Array(0);function be(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}function S(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}function me(t){return new TextEncoder().encode(t)}function xe(t){return new TextDecoder().decode(t)}function Xe(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var c=t.length,h=t.charAt(0),z=Math.log(c)/Math.log(256),u=Math.log(256)/Math.log(c);function I(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var p=0,U=0,b=0,x=a.length;b!==x&&a[b]===0;)b++,p++;for(var g=(x-b)*u+1>>>0,l=new Uint8Array(g);b!==x;){for(var w=a[b],C=0,m=g-1;(w!==0||C<U)&&m!==-1;m--,C++)w+=256*l[m]>>>0,l[m]=w%c>>>0,w=w/c>>>0;if(w!==0)throw new Error("Non-zero carry");U=C,b++}for(var v=g-U;v!==g&&l[v]===0;)v++;for(var j=h.repeat(p);v<g;++v)j+=t.charAt(l[v]);return j}function F(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var p=0;if(a[p]!==" "){for(var U=0,b=0;a[p]===h;)U++,p++;for(var x=(a.length-p)*z+1>>>0,g=new Uint8Array(x);a[p];){var l=r[a.charCodeAt(p)];if(l===255)return;for(var w=0,C=x-1;(l!==0||w<b)&&C!==-1;C--,w++)l+=c*g[C]>>>0,g[C]=l%256>>>0,l=l/256>>>0;if(l!==0)throw new Error("Non-zero carry");b=w,p++}if(a[p]!==" "){for(var m=x-b;m!==x&&g[m]===0;)m++;for(var v=new Uint8Array(U+(x-m)),j=U;m!==x;)v[j++]=g[m++];return v}}}function je(a){var p=F(a);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:I,decodeUnsafe:F,decode:je}}var Qe=Xe,We=Qe,we=We;var Q=class{name;prefix;baseEncode;constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},W=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.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 ye(this,e)}},G=class{decoders;constructor(e){this.decoders=e}or(e){return ye(this,e)}decode(e){let r=e[0],n=this.decoders[r];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 ye(t,e){return new G({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var H=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new Q(e,r,n),this.decoder=new W(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function N({name:t,prefix:e,encode:r,decode:n}){return new H(t,e,r,n)}function E({name:t,prefix:e,alphabet:r}){let{encode:n,decode:o}=we(r,t);return N({prefix:e,name:t,encode:n,decode:s=>S(o(s))})}function Ge(t,e,r,n){let o={};for(let u=0;u<e.length;++u)o[e[u]]=u;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),c=0,h=0,z=0;for(let u=0;u<s;++u){let I=o[t[u]];if(I===void 0)throw new SyntaxError(`Non-${n} character`);h=h<<r|I,c+=r,c>=8&&(c-=8,i[z++]=255&h>>c)}if(c>=r||255&h<<8-c)throw new SyntaxError("Unexpected end of data");return i}function He(t,e,r){let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,c=0;for(let h=0;h<t.length;++h)for(c=c<<8|t[h],i+=8;i>r;)i-=r,s+=e[o&c>>i];if(i!==0&&(s+=e[o&c<<r-i]),n)for(;s.length*r&7;)s+="=";return s}function f({name:t,prefix:e,bitsPerChar:r,alphabet:n}){return N({prefix:e,name:t,encode(o){return He(o,n,r)},decode(o){return Ge(o,n,r,t)}})}var Ze=E({prefix:"9",name:"base10",alphabet:"0123456789"});var Y={};d(Y,{base16:()=>Ye,base16upper:()=>_e});var Ye=f({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_e=f({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var _={};d(_,{base2:()=>et});var et=f({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ee={};d(ee,{base256emoji:()=>st});var ve=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}"),tt=ve.reduce((t,e,r)=>(t[r]=e,t),[]),rt=ve.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function nt(t){return t.reduce((e,r)=>(e+=tt[r],e),"")}function ot(t){let e=[];for(let r of t){let n=rt[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var st=N({prefix:"\u{1F680}",name:"base256emoji",encode:nt,decode:ot});var te={};d(te,{base32:()=>T,base32hex:()=>ft,base32hexpad:()=>pt,base32hexpadupper:()=>dt,base32hexupper:()=>ht,base32pad:()=>at,base32padupper:()=>ct,base32upper:()=>it,base32z:()=>ut});var T=f({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),it=f({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),at=f({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ct=f({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ft=f({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ht=f({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pt=f({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),dt=f({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ut=f({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var re={};d(re,{base36:()=>lt,base36upper:()=>bt});var lt=E({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),bt=E({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ne={};d(ne,{base58btc:()=>y,base58flickr:()=>mt});var y=E({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mt=E({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var oe={};d(oe,{base64:()=>xt,base64pad:()=>gt,base64url:()=>wt,base64urlpad:()=>yt});var xt=f({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gt=f({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wt=f({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yt=f({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var se={};d(se,{base8:()=>vt});var vt=f({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ie={};d(ie,{identity:()=>St});var St=N({prefix:"\0",name:"identity",encode:t=>xe(t),decode:t=>me(t)});var vr=new TextEncoder,Sr=new TextDecoder;var ce={};d(ce,{identity:()=>Kt});var Et=Ce,Se=128,Ut=127,Dt=~Ut,zt=Math.pow(2,31);function Ce(t,e,r){e=e||[],r=r||0;for(var n=r;t>=zt;)e[r++]=t&255|Se,t/=128;for(;t&Dt;)e[r++]=t&255|Se,t>>>=7;return e[r]=t|0,Ce.bytes=r-n+1,e}var It=ae,Nt=128,Ae=127;function ae(t,n){var r=0,n=n||0,o=0,s=n,i,c=t.length;do{if(s>=c)throw ae.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&Ae)<<o:(i&Ae)*Math.pow(2,o),o+=7}while(i>=Nt);return ae.bytes=s-n,r}var Tt=Math.pow(2,7),Mt=Math.pow(2,14),Ot=Math.pow(2,21),Lt=Math.pow(2,28),Bt=Math.pow(2,35),Vt=Math.pow(2,42),Pt=Math.pow(2,49),$t=Math.pow(2,56),Ft=Math.pow(2,63),jt=function(t){return t<Tt?1:t<Mt?2:t<Ot?3:t<Lt?4:t<Bt?5:t<Vt?6:t<Pt?7:t<$t?8:t<Ft?9:10},kt={encode:Et,decode:It,encodingLength:jt},qt=kt,B=qt;function V(t,e=0){return[B.decode(t,e),B.decode.bytes]}function M(t,e,r=0){return B.encode(t,e,r),e}function O(t){return B.encodingLength(t)}function D(t,e){let r=e.byteLength,n=O(t),o=n+O(r),s=new Uint8Array(o+r);return M(t,s,0),M(r,s,n),s.set(e,o),new L(t,r,e,s)}function Ee(t){let e=S(t),[r,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 L(r,o,i,e)}function Ue(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&be(t.bytes,r.bytes)}}var L=class{code;size;digest;bytes;constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var De=0,Rt="identity",ze=S;function Jt(t){return D(De,ze(t))}var Kt={code:De,name:Rt,encode:ze,digest:Jt};var pe={};d(pe,{sha256:()=>Xt,sha512:()=>Qt});function he({name:t,code:e,encode:r}){return new fe(t,e,r)}var fe=class{name;code;encode;constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?D(this.code,r):r.then(n=>D(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Ne(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var Xt=he({name:"sha2-256",code:18,encode:Ne("SHA-256")}),Qt=he({name:"sha2-512",code:19,encode:Ne("SHA-512")});function Te(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return Gt(r,de(t),e??y.encoder);default:return Ht(r,de(t),e??T.encoder)}}var Me=new WeakMap;function de(t){let e=Me.get(t);if(e==null){let r=new Map;return Me.set(t,r),r}return e}var q=class t{code;version;multihash;bytes;"/";constructor(e,r,n,o){this.code=r,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:r}=this;if(e!==$)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Zt)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}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:r}=this.multihash,n=D(e,r);return t.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 t.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&Ue(e.multihash,n.multihash)}toString(e){return Te(this,e)}toJSON(){return{"/":Te(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 r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:i}=r;return new t(n,o,s,i??Oe(n,o,s.bytes))}else if(r[Yt]===!0){let{version:n,multihash:o,code:s}=r,i=Ee(o);return t.create(n,s,i)}else return null}static create(e,r,n){if(typeof r!="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(r!==$)throw new Error(`Version 0 CID must use dag-pb (code: ${$}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let o=Oe(e,r,n.bytes);return new t(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,$,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,o=S(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new L(r.multihashCode,r.digestSize,s,o);return[r.version===0?t.createV0(i):t.createV1(r.codec,i),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[I,F]=V(e.subarray(r));return r+=F,I},o=n(),s=$;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,c=n(),h=n(),z=r+h,u=z-i;return{version:o,codec:s,multihashCode:c,digestSize:h,multihashSize:u,size:z}}static parse(e,r){let[n,o]=Wt(e,r),s=t.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return de(s).set(n,e),s}};function Wt(t,e){switch(t[0]){case"Q":{let r=e??y;return[y.prefix,r.decode(`${y.prefix}${t}`)]}case y.prefix:{let r=e??y;return[y.prefix,r.decode(t)]}case T.prefix:{let r=e??T;return[T.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function Gt(t,e,r){let{prefix:n}=r;if(n!==y.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return o}function Ht(t,e,r){let{prefix:n}=r,o=e.get(n);if(o==null){let s=r.encode(t);return e.set(n,s),s}else return o}var $=112,Zt=18;function Oe(t,e,r){let n=O(t),o=n+O(e),s=new Uint8Array(o+r.byteLength);return M(t,s,0),M(e,s,n),s.set(r,o),s}var Yt=Symbol.for("@ipld/js-cid/CID");var ue={...ie,..._,...se,...Z,...Y,...te,...re,...ne,...oe,...ee},Rr={...pe,...ce};function Le(t=0){return new Uint8Array(t)}function Ve(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Be=Ve("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),le=Ve("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Le(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),_t={utf8:Be,"utf-8":Be,hex:ue.base16,latin1:le,ascii:le,binary:le,...ue},R=_t;function Pe(t,e="utf8"){let r=R[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}function $e(t,e="utf8"){let r=R[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}var A="/",Fe=new TextEncoder().encode(A),J=Fe[0],K=class t{_buf;constructor(e,r){if(typeof e=="string")this._buf=Pe(e);else if(e instanceof Uint8Array)this._buf=e;else throw new Error("Invalid key, should be String of Uint8Array");if(r==null&&(r=!0),r&&this.clean(),this._buf.byteLength===0||this._buf[0]!==J)throw new Error("Invalid key")}toString(e="utf8"){return $e(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new t(e.join(A))}static random(){return new t(Math.random().toString().substring(2))}static asKey(e){return e instanceof Uint8Array||typeof e=="string"?new t(e):typeof e.uint8Array=="function"?new t(e.uint8Array()):null}clean(){if((this._buf==null||this._buf.byteLength===0)&&(this._buf=Fe),this._buf[0]!==J){let e=new Uint8Array(this._buf.byteLength+1);e.fill(J,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===J;)this._buf=this._buf.subarray(0,-1)}less(e){let r=this.list(),n=e.list();for(let o=0;o<r.length;o++){if(n.length<o+1)return!1;let s=r[o],i=n[o];if(s<i)return!0;if(s>i)return!1}return r.length<n.length}reverse(){return t.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){let e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(A).slice(1)}type(){return er(this.baseNamespace())}name(){return tr(this.baseNamespace())}instance(e){return new t(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(A)||(e+=A),e+=this.type(),new t(e)}parent(){let e=this.list();return e.length===1?new t(A):new t(e.slice(0,-1).join(A))}child(e){return this.toString()===A?e:e.toString()===A?this:new t(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()===this.toString()?!1:e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()===this.toString()?!1:this.toString().startsWith(e.toString())}isTopLevel(){return this.list().length===1}concat(...e){return t.withNamespaces([...this.namespaces(),...rr(e.map(r=>r.namespaces()))])}};function er(t){let e=t.split(":");return e.length<2?"":e.slice(0,-1).join(":")}function tr(t){let e=t.split(":");return e[e.length-1]}function rr(t){return[].concat(...t)}return Ke(nr);})();
"use strict";var InterfaceDatastore=(()=>{var Q=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Je=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var r in e)Q(t,r,{get:e[r],enumerable:!0})},Ke=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Re(e))!Je.call(t,o)&&o!==r&&Q(t,o,{get:()=>e[o],enumerable:!(n=qe(e,o))||n.enumerable});return t};var Xe=t=>Ke(Q({},"__esModule",{value:!0}),t);var nr={};d(nr,{Key:()=>X});var Y={};d(Y,{base10:()=>Ye});var sr=new Uint8Array(0);function me(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}function S(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}function xe(t){return new TextEncoder().encode(t)}function ge(t){return new TextDecoder().decode(t)}function Qe(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var c=t.length,p=t.charAt(0),z=Math.log(c)/Math.log(256),u=Math.log(256)/Math.log(c);function I(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var h=0,U=0,b=0,x=a.length;b!==x&&a[b]===0;)b++,h++;for(var g=(x-b)*u+1>>>0,l=new Uint8Array(g);b!==x;){for(var w=a[b],C=0,m=g-1;(w!==0||C<U)&&m!==-1;m--,C++)w+=256*l[m]>>>0,l[m]=w%c>>>0,w=w/c>>>0;if(w!==0)throw new Error("Non-zero carry");U=C,b++}for(var v=g-U;v!==g&&l[v]===0;)v++;for(var k=p.repeat(h);v<g;++v)k+=t.charAt(l[v]);return k}function j(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var h=0;if(a[h]!==" "){for(var U=0,b=0;a[h]===p;)U++,h++;for(var x=(a.length-h)*z+1>>>0,g=new Uint8Array(x);a[h];){var l=r[a.charCodeAt(h)];if(l===255)return;for(var w=0,C=x-1;(l!==0||w<b)&&C!==-1;C--,w++)l+=c*g[C]>>>0,g[C]=l%256>>>0,l=l/256>>>0;if(l!==0)throw new Error("Non-zero carry");b=w,h++}if(a[h]!==" "){for(var m=x-b;m!==x&&g[m]===0;)m++;for(var v=new Uint8Array(U+(x-m)),k=U;m!==x;)v[k++]=g[m++];return v}}}function ke(a){var h=j(a);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:I,decodeUnsafe:j,decode:ke}}var We=Qe,Ge=We,ye=Ge;var W=class{name;prefix;baseEncode;constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},G=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.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 ve(this,e)}},H=class{decoders;constructor(e){this.decoders=e}or(e){return ve(this,e)}decode(e){let r=e[0],n=this.decoders[r];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 ve(t,e){return new H({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var Z=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new W(e,r,n),this.decoder=new G(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function N({name:t,prefix:e,encode:r,decode:n}){return new Z(t,e,r,n)}function E({name:t,prefix:e,alphabet:r}){let{encode:n,decode:o}=ye(r,t);return N({prefix:e,name:t,encode:n,decode:s=>S(o(s))})}function He(t,e,r,n){let o={};for(let u=0;u<e.length;++u)o[e[u]]=u;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),c=0,p=0,z=0;for(let u=0;u<s;++u){let I=o[t[u]];if(I===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<r|I,c+=r,c>=8&&(c-=8,i[z++]=255&p>>c)}if(c>=r||255&p<<8-c)throw new SyntaxError("Unexpected end of data");return i}function Ze(t,e,r){let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,c=0;for(let p=0;p<t.length;++p)for(c=c<<8|t[p],i+=8;i>r;)i-=r,s+=e[o&c>>i];if(i!==0&&(s+=e[o&c<<r-i]),n)for(;s.length*r&7;)s+="=";return s}function f({name:t,prefix:e,bitsPerChar:r,alphabet:n}){return N({prefix:e,name:t,encode(o){return Ze(o,n,r)},decode(o){return He(o,n,r,t)}})}var Ye=E({prefix:"9",name:"base10",alphabet:"0123456789"});var _={};d(_,{base16:()=>_e,base16upper:()=>et});var _e=f({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),et=f({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ee={};d(ee,{base2:()=>tt});var tt=f({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var te={};d(te,{base256emoji:()=>it});var Se=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}"),rt=Se.reduce((t,e,r)=>(t[r]=e,t),[]),nt=Se.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function ot(t){return t.reduce((e,r)=>(e+=rt[r],e),"")}function st(t){let e=[];for(let r of t){let n=nt[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var it=N({prefix:"\u{1F680}",name:"base256emoji",encode:ot,decode:st});var re={};d(re,{base32:()=>T,base32hex:()=>pt,base32hexpad:()=>dt,base32hexpadupper:()=>ut,base32hexupper:()=>ht,base32pad:()=>ct,base32padupper:()=>ft,base32upper:()=>at,base32z:()=>lt});var T=f({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),at=f({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ct=f({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ft=f({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pt=f({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ht=f({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),dt=f({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ut=f({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lt=f({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ne={};d(ne,{base36:()=>B,base36upper:()=>bt});var B=E({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),bt=E({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var oe={};d(oe,{base58btc:()=>y,base58flickr:()=>mt});var y=E({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mt=E({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var se={};d(se,{base64:()=>xt,base64pad:()=>gt,base64url:()=>wt,base64urlpad:()=>yt});var xt=f({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gt=f({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wt=f({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yt=f({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ie={};d(ie,{base8:()=>vt});var vt=f({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ae={};d(ae,{identity:()=>St});var St=N({prefix:"\0",name:"identity",encode:t=>ge(t),decode:t=>xe(t)});var vr=new TextEncoder,Sr=new TextDecoder;var fe={};d(fe,{identity:()=>Kt});var Et=Ee,Ae=128,Ut=127,Dt=~Ut,zt=Math.pow(2,31);function Ee(t,e,r){e=e||[],r=r||0;for(var n=r;t>=zt;)e[r++]=t&255|Ae,t/=128;for(;t&Dt;)e[r++]=t&255|Ae,t>>>=7;return e[r]=t|0,Ee.bytes=r-n+1,e}var It=ce,Nt=128,Ce=127;function ce(t,n){var r=0,n=n||0,o=0,s=n,i,c=t.length;do{if(s>=c)throw ce.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&Ce)<<o:(i&Ce)*Math.pow(2,o),o+=7}while(i>=Nt);return ce.bytes=s-n,r}var Tt=Math.pow(2,7),Mt=Math.pow(2,14),Ot=Math.pow(2,21),Lt=Math.pow(2,28),Bt=Math.pow(2,35),Vt=Math.pow(2,42),Pt=Math.pow(2,49),$t=Math.pow(2,56),Ft=Math.pow(2,63),jt=function(t){return t<Tt?1:t<Mt?2:t<Ot?3:t<Lt?4:t<Bt?5:t<Vt?6:t<Pt?7:t<$t?8:t<Ft?9:10},kt={encode:Et,decode:It,encodingLength:jt},qt=kt,V=qt;function P(t,e=0){return[V.decode(t,e),V.decode.bytes]}function M(t,e,r=0){return V.encode(t,e,r),e}function O(t){return V.encodingLength(t)}function D(t,e){let r=e.byteLength,n=O(t),o=n+O(r),s=new Uint8Array(o+r);return M(t,s,0),M(r,s,n),s.set(e,o),new L(t,r,e,s)}function Ue(t){let e=S(t),[r,n]=P(e),[o,s]=P(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new L(r,o,i,e)}function De(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&me(t.bytes,r.bytes)}}var L=class{code;size;digest;bytes;constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var ze=0,Rt="identity",Ie=S;function Jt(t){return D(ze,Ie(t))}var Kt={code:ze,name:Rt,encode:Ie,digest:Jt};var de={};d(de,{sha256:()=>Xt,sha512:()=>Qt});function he({name:t,code:e,encode:r}){return new pe(t,e,r)}var pe=class{name;code;encode;constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?D(this.code,r):r.then(n=>D(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Te(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var Xt=he({name:"sha2-256",code:18,encode:Te("SHA-256")}),Qt=he({name:"sha2-512",code:19,encode:Te("SHA-512")});function Me(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return Gt(r,ue(t),e??y.encoder);default:return Ht(r,ue(t),e??T.encoder)}}var Oe=new WeakMap;function ue(t){let e=Oe.get(t);if(e==null){let r=new Map;return Oe.set(t,r),r}return e}var R=class t{code;version;multihash;bytes;"/";constructor(e,r,n,o){this.code=r,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:r}=this;if(e!==F)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Zt)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}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:r}=this.multihash,n=D(e,r);return t.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 t.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&De(e.multihash,n.multihash)}toString(e){return Me(this,e)}toJSON(){return{"/":Me(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 r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:i}=r;return new t(n,o,s,i??Le(n,o,s.bytes))}else if(r[Yt]===!0){let{version:n,multihash:o,code:s}=r,i=Ue(o);return t.create(n,s,i)}else return null}static create(e,r,n){if(typeof r!="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(r!==F)throw new Error(`Version 0 CID must use dag-pb (code: ${F}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let o=Le(e,r,n.bytes);return new t(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,F,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,o=S(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new L(r.multihashCode,r.digestSize,s,o);return[r.version===0?t.createV0(i):t.createV1(r.codec,i),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[I,j]=P(e.subarray(r));return r+=j,I},o=n(),s=F;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,c=n(),p=n(),z=r+p,u=z-i;return{version:o,codec:s,multihashCode:c,digestSize:p,multihashSize:u,size:z}}static parse(e,r){let[n,o]=Wt(e,r),s=t.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ue(s).set(n,e),s}};function Wt(t,e){switch(t[0]){case"Q":{let r=e??y;return[y.prefix,r.decode(`${y.prefix}${t}`)]}case y.prefix:{let r=e??y;return[y.prefix,r.decode(t)]}case T.prefix:{let r=e??T;return[T.prefix,r.decode(t)]}case B.prefix:{let r=e??B;return[B.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function Gt(t,e,r){let{prefix:n}=r;if(n!==y.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return o}function Ht(t,e,r){let{prefix:n}=r,o=e.get(n);if(o==null){let s=r.encode(t);return e.set(n,s),s}else return o}var F=112,Zt=18;function Le(t,e,r){let n=O(t),o=n+O(e),s=new Uint8Array(o+r.byteLength);return M(t,s,0),M(e,s,n),s.set(r,o),s}var Yt=Symbol.for("@ipld/js-cid/CID");var le={...ae,...ee,...ie,...Y,..._,...re,...ne,...oe,...se,...te},Jr={...de,...fe};function Be(t=0){return new Uint8Array(t)}function Pe(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Ve=Pe("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),be=Pe("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Be(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),_t={utf8:Ve,"utf-8":Ve,hex:le.base16,latin1:be,ascii:be,binary:be,...le},J=_t;function $e(t,e="utf8"){let r=J[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}function Fe(t,e="utf8"){let r=J[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}var A="/",je=new TextEncoder().encode(A),K=je[0],X=class t{_buf;constructor(e,r){if(typeof e=="string")this._buf=$e(e);else if(e instanceof Uint8Array)this._buf=e;else throw new Error("Invalid key, should be String of Uint8Array");if(r==null&&(r=!0),r&&this.clean(),this._buf.byteLength===0||this._buf[0]!==K)throw new Error("Invalid key")}toString(e="utf8"){return Fe(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new t(e.join(A))}static random(){return new t(Math.random().toString().substring(2))}static asKey(e){return e instanceof Uint8Array||typeof e=="string"?new t(e):typeof e.uint8Array=="function"?new t(e.uint8Array()):null}clean(){if((this._buf==null||this._buf.byteLength===0)&&(this._buf=je),this._buf[0]!==K){let e=new Uint8Array(this._buf.byteLength+1);e.fill(K,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===K;)this._buf=this._buf.subarray(0,-1)}less(e){let r=this.list(),n=e.list();for(let o=0;o<r.length;o++){if(n.length<o+1)return!1;let s=r[o],i=n[o];if(s<i)return!0;if(s>i)return!1}return r.length<n.length}reverse(){return t.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){let e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(A).slice(1)}type(){return er(this.baseNamespace())}name(){return tr(this.baseNamespace())}instance(e){return new t(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(A)||(e+=A),e+=this.type(),new t(e)}parent(){let e=this.list();return e.length===1?new t(A):new t(e.slice(0,-1).join(A))}child(e){return this.toString()===A?e:e.toString()===A?this:new t(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()===this.toString()?!1:e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()===this.toString()?!1:this.toString().startsWith(e.toString())}isTopLevel(){return this.list().length===1}concat(...e){return t.withNamespaces([...this.namespaces(),...rr(e.map(r=>r.namespaces()))])}};function er(t){let e=t.split(":");return e.length<2?"":e.slice(0,-1).join(":")}function tr(t){let e=t.split(":");return e[e.length-1]}function rr(t){return[].concat(...t)}return Xe(nr);})();
return InterfaceDatastore}));
{
"name": "interface-datastore",
"version": "8.3.0",
"version": "8.3.1",
"description": "datastore interface",

@@ -65,2 +65,87 @@ "license": "Apache-2.0 OR MIT",

},
"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": {

@@ -80,8 +165,8 @@ "build": "aegir build",

"dependencies": {
"interface-store": "6.0.0",
"uint8arrays": "^5.0.2"
"interface-store": "^6.0.0",
"uint8arrays": "^5.1.0"
},
"devDependencies": {
"aegir": "^42.2.3"
"aegir": "^44.1.1"
}
}

@@ -129,3 +129,3 @@ # interface-datastore

Loading this module through a script tag will make it's exports available as `InterfaceDatastore` in the global namespace.
Loading this module through a script tag will make its exports available as `InterfaceDatastore` in the global namespace.

@@ -144,4 +144,4 @@ ```html

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
- Apache 2.0, ([LICENSE-APACHE](https://github.com/ipfs/js-stores/blob/main/packages/interface-datastore/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](https://github.com/ipfs/js-stores/blob/main/packages/interface-datastore/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

@@ -148,0 +148,0 @@ # Contribute

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