@wovin/connect-ucan-store-proxy 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-U6LK5UQW.min.js → chunk-LB22G6E6.min.js} +2 -2
- package/dist/chunk-LB22G6E6.min.js.map +1 -0
- package/dist/{chunk-R5T56SIO.min.js → chunk-PXG467HN.min.js} +2 -2
- package/dist/{chunk-ULU4ARX5.min.js → chunk-UFTXT7VB.min.js} +2 -2
- package/dist/{chunk-4WKM2MPH.min.js → chunk-ZG42REPJ.min.js} +16 -16
- package/dist/{chunk-4WKM2MPH.min.js.map → chunk-ZG42REPJ.min.js.map} +1 -1
- package/dist/index.d.ts +120 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/retrieve.d.ts +3 -2
- package/dist/retrieve.d.ts.map +1 -1
- package/dist/retrieve.min.js +1 -1
- package/dist/store.min.js +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.min.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-U6LK5UQW.min.js.map +0 -1
- /package/dist/{chunk-R5T56SIO.min.js.map → chunk-PXG467HN.min.js.map} +0 -0
- /package/dist/{chunk-ULU4ARX5.min.js.map → chunk-UFTXT7VB.min.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var a=Object.create;var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
var a=Object.create;var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var l=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var f=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of o(e))!x.call(r,n)&&n!==t&&s(r,n,{get:()=>e[n],enumerable:!(i=g(e,n))||i.enumerable});return r};var y=(r,e,t)=>(t=r!=null?a(p(r)):{},f(e||!r||!r.__esModule?s(t,"default",{value:r,enumerable:!0}):t,r));function F(r){return r.endsWith("/")?r.slice(0,-1):r}export{l as a,y as b,F as c};
|
|
2
|
+
//# sourceMappingURL=chunk-LB22G6E6.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils.ts"],"sourcesContent":["export interface ProxyConfig {\n\tbaseUrl: string\n\tgatewayBaseUrl: string\n\tnameBaseUrl?: string\n}\n\nexport function stripUrlOfTrailingSlash(baseUrl: string): string {\n\treturn baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl\n}\n\nexport type ParametersExceptFirst<F> = F extends (arg1: any, ...rest: infer R) => any ? R : never\n"],"mappings":"ygBAMO,SAASA,EAAwBC,EAAyB,CAChE,OAAOA,EAAQ,SAAS,GAAG,EAAIA,EAAQ,MAAM,EAAG,EAAE,EAAIA,CACvD","names":["stripUrlOfTrailingSlash","baseUrl"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as Q,b as K}from"./chunk-U6LK5UQW.min.js";var ue=Q(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});var Qe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ke=typeof window<"u"&&typeof window.document<"u",_e=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,Ze=(typeof self>"u"?"undefined":Qe(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",He=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),Ye=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";A.isBrowser=Ke;A.isWebWorker=Ze;A.isNode=_e;A.isJsDom=He;A.isDeno=Ye});var he=Q((Nt,le)=>{"use strict";le.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&function(i){return function(s){return function(c,a){var h={key:c,value:s[c]},d={key:a,value:s[a]};return i(h,d)}}}(e.cmp),o=[];return function i(s){if(s&&s.toJSON&&typeof s.toJSON=="function"&&(s=s.toJSON()),s!==void 0){if(typeof s=="number")return isFinite(s)?""+s:"null";if(typeof s!="object")return JSON.stringify(s);var c,a;if(Array.isArray(s)){for(a="[",c=0;c<s.length;c++)c&&(a+=","),a+=i(s[c])||"null";return a+"]"}if(s===null)return"null";if(o.indexOf(s)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var h=o.push(s)-1,d=Object.keys(s).sort(n&&n(s));for(a="",c=0;c<d.length;c++){var p=d[c],b=i(s[p]);b&&(a&&(a+=","),a+=JSON.stringify(p)+":"+b)}return o.splice(h,1),"{"+a+"}"}}(r)}});var rt=new Uint8Array(0);function _(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 C(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 me(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 i=r.charAt(o),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=o}var c=r.length,a=r.charAt(0),h=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function p(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var u=0,D=0,w=0,m=f.length;w!==m&&f[w]===0;)w++,u++;for(var v=(m-w)*d+1>>>0,g=new Uint8Array(v);w!==m;){for(var x=f[w],L=0,y=v-1;(x!==0||L<D)&&y!==-1;y--,L++)x+=256*g[y]>>>0,g[y]=x%c>>>0,x=x/c>>>0;if(x!==0)throw new Error("Non-zero carry");D=L,w++}for(var S=v-D;S!==v&&g[S]===0;)S++;for(var G=a.repeat(u);S<v;++S)G+=r.charAt(g[S]);return G}function b(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var u=0;if(f[u]!==" "){for(var D=0,w=0;f[u]===a;)D++,u++;for(var m=(f.length-u)*h+1>>>0,v=new Uint8Array(m);f[u];){var g=t[f.charCodeAt(u)];if(g===255)return;for(var x=0,L=m-1;(g!==0||x<w)&&L!==-1;L--,x++)g+=c*v[L]>>>0,v[L]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");w=x,u++}if(f[u]!==" "){for(var y=m-w;y!==m&&v[y]===0;)y++;for(var S=new Uint8Array(D+(m-y)),G=D;y!==m;)S[G++]=v[y++];return S}}}function U(f){var u=b(f);if(u)return u;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:b,decode:U}}var ve=me,xe=ve,Z=xe;var k=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")}},$=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 H(this,e)}},j=class{decoders;constructor(e){this.decoders=e}or(e){return H(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 H(r,e){return new j({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var J=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 k(e,t,n),this.decoder=new $(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Y({name:r,prefix:e,encode:t,decode:n}){return new J(r,e,t,n)}function P({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=Z(t,r);return Y({prefix:e,name:r,encode:n,decode:i=>C(o(i))})}function Ee(r,e,t,n){let o={};for(let d=0;d<e.length;++d)o[e[d]]=d;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*t/8|0),c=0,a=0,h=0;for(let d=0;d<i;++d){let p=o[r[d]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<t|p,c+=t,c>=8&&(c-=8,s[h++]=255&a>>c)}if(c>=t||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return s}function Se(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,i="",s=0,c=0;for(let a=0;a<r.length;++a)for(c=c<<8|r[a],s+=8;s>t;)s-=t,i+=e[o&c>>s];if(s!==0&&(i+=e[o&c<<t-s]),n)for(;i.length*t&7;)i+="=";return i}function E({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return Y({prefix:e,name:r,encode(o){return Se(o,n,t)},decode(o){return Ee(o,n,t,r)}})}var z=E({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ft=E({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),dt=E({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ut=E({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),lt=E({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ht=E({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pt=E({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gt=E({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),bt=E({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var O=P({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mt=P({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Oe=re,ee=128,Le=127,De=~Le,Ae=Math.pow(2,31);function re(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Ae;)e[t++]=r&255|ee,r/=128;for(;r&De;)e[t++]=r&255|ee,r>>>=7;return e[t]=r|0,re.bytes=t-n+1,e}var Ce=q,Ie=128,te=127;function q(r,n){var t=0,n=n||0,o=0,i=n,s,c=r.length;do{if(i>=c)throw q.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&te)<<o:(s&te)*Math.pow(2,o),o+=7}while(s>=Ie);return q.bytes=i-n,t}var Ne=Math.pow(2,7),Fe=Math.pow(2,14),Re=Math.pow(2,21),Ue=Math.pow(2,28),ze=Math.pow(2,35),Be=Math.pow(2,42),Me=Math.pow(2,49),Te=Math.pow(2,56),Ve=Math.pow(2,63),Ge=function(r){return r<Ne?1:r<Fe?2:r<Re?3:r<Ue?4:r<ze?5:r<Be?6:r<Me?7:r<Te?8:r<Ve?9:10},ke={encode:Oe,decode:Ce,encodingLength:Ge},$e=ke,B=$e;function M(r,e=0){return[B.decode(r,e),B.decode.bytes]}function I(r,e,t=0){return B.encode(r,e,t),e}function N(r){return B.encodingLength(r)}function oe(r,e){let t=e.byteLength,n=N(r),o=n+N(t),i=new Uint8Array(o+t);return I(r,i,0),I(t,i,n),i.set(e,o),new F(r,t,e,i)}function ie(r){let e=C(r),[t,n]=M(e),[o,i]=M(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new F(t,o,s,e)}function se(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&_(r.bytes,t.bytes)}}var F=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};function ae(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return Pe(t,W(r),e??O.encoder);default:return qe(t,W(r),e??z.encoder)}}var ce=new WeakMap;function W(r){let e=ce.get(r);if(e==null){let t=new Map;return ce.set(r,t),t}return e}var fe=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!==T)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==We)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=oe(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&&se(e.multihash,n.multihash)}toString(e){return ae(this,e)}toJSON(){return{"/":ae(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:i,bytes:s}=t;return new r(n,o,i,s??de(n,o,i.bytes))}else if(t[Xe]===!0){let{version:n,multihash:o,code:i}=t,s=ie(o);return r.create(n,i,s)}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!==T)throw new Error(`Version 0 CID must use dag-pb (code: ${T}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=de(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,T,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=C(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=o.subarray(t.multihashSize-t.digestSize),s=new F(t.multihashCode,t.digestSize,i,o);return[t.version===0?r.createV0(s):r.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[p,b]=M(e.subarray(t));return t+=b,p},o=n(),i=T;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=t,c=n(),a=n(),h=t+a,d=h-s;return{version:o,codec:i,multihashCode:c,digestSize:a,multihashSize:d,size:h}}static parse(e,t){let[n,o]=Je(e,t),i=r.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return W(i).set(n,e),i}};function Je(r,e){switch(r[0]){case"Q":{let t=e??O;return[O.prefix,t.decode(`${O.prefix}${r}`)]}case O.prefix:{let t=e??O;return[O.prefix,t.decode(r)]}case z.prefix:{let t=e??z;return[z.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 Pe(r,e,t){let{prefix:n}=t;if(n!==O.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return o}function qe(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let i=t.encode(r);return e.set(n,i),i}else return o}var T=112,We=18;function de(r,e,t){let n=N(r),o=n+N(e),i=new Uint8Array(o+t.byteLength);return I(r,i,0),I(e,i,n),i.set(t,o),i}var Xe=Symbol.for("@ipld/js-cid/CID");var R=K(ue(),1),pe=K(he(),1),ge=!1,be=!1;R.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(ge=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(be=process?.env?.LOGGER_PERF_PREFIX==="true"));var et={prefix:void 0,time:ge,delta:be,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},X=[],we=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(r,e,t,n){Object.assign(this,{sinceFirst:r,sinceLast:e,time:t,delta:n})}toString(){let r=this.sinceFirst*.001,e=r.toFixed(r<5?2:1),t=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?e:null,this.delta?t:null].filter(n=>n!=null).join(",")}]`}},ye=class{constructor(r,e){Object.assign(this,{style:r,string:e})}},V=!1,tt=class l{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(e=l.INFO,t={}){t=Object.assign({},et,t),e>10&&console.debug("setup logger",{config:t});let n=this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}),o=(...a)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&n(...a)};o.isDisabled=!0,o.isEnabled=!1;let i=this.wrapLog(console.groupCollapsed,t),s=(a,h)=>{function d(...b){let U=b[b.length-1];return U===o?U():(i(...b.slice(0,-1)),(async()=>{try{let f=U();return f instanceof Promise?await f:f}finally{console.groupEnd()}})())}let p=Object.assign(h.bind({}),{isEnabled:a,isDisabled:!a,group:d,force:h});return a?p:Object.assign(o.bind({}),{isEnabled:a,isDisabled:!a,group:d,force:p})},c=s(e>=l.ERROR,this.wrapLog(console.error,t));return{ERROR:(...a)=>(c(...a),new Error((0,pe.default)(a))),WARN:s(e>=l.WARN,this.wrapLog(console.warn,t)),LOG:s(e>=l.INFO,this.wrapLog(console.log,t)),DEBUG:s(e>=l.DEBUG,this.wrapLog(console.log,{...t,dim:t.dimDebugOnServer})),VERBOSE:s(e>=l.VERBOSE,this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}))}}static wrapLog(e,t){if(R.isNode)return e.bind(console);{let n=[];if(t.time||t.delta){let o=R.isBrowser&&navigator.userAgent.includes("Chrome")?["",l.timeStr(!!t.time,!!t.delta)]:[];n.push(...o)}return t.prefix&&(V?n.push(new ye("dim",t.prefix)):n.push(t.prefix)),e.bind(console,...n)}}static timeStr(e,t,n=0){if(!performance.now)return;let o=performance.now();l.firstLog||(l.firstLog=o,l.lastLog=o);let i=new we(o-l.firstLog,o-l.lastLog,e,t);return l.lastLog=o,n?i.toString():i}static getOriginFromStack(e){let t=!1;for(let n of e.split(`
|
|
1
|
+
import{a as Q,b as K}from"./chunk-LB22G6E6.min.js";var ue=Q(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});var Qe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ke=typeof window<"u"&&typeof window.document<"u",_e=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,Ze=(typeof self>"u"?"undefined":Qe(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",He=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),Ye=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";A.isBrowser=Ke;A.isWebWorker=Ze;A.isNode=_e;A.isJsDom=He;A.isDeno=Ye});var he=Q((Nt,le)=>{"use strict";le.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&function(i){return function(s){return function(c,a){var h={key:c,value:s[c]},d={key:a,value:s[a]};return i(h,d)}}}(e.cmp),o=[];return function i(s){if(s&&s.toJSON&&typeof s.toJSON=="function"&&(s=s.toJSON()),s!==void 0){if(typeof s=="number")return isFinite(s)?""+s:"null";if(typeof s!="object")return JSON.stringify(s);var c,a;if(Array.isArray(s)){for(a="[",c=0;c<s.length;c++)c&&(a+=","),a+=i(s[c])||"null";return a+"]"}if(s===null)return"null";if(o.indexOf(s)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var h=o.push(s)-1,d=Object.keys(s).sort(n&&n(s));for(a="",c=0;c<d.length;c++){var p=d[c],b=i(s[p]);b&&(a&&(a+=","),a+=JSON.stringify(p)+":"+b)}return o.splice(h,1),"{"+a+"}"}}(r)}});var rt=new Uint8Array(0);function _(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 C(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 me(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 i=r.charAt(o),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=o}var c=r.length,a=r.charAt(0),h=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function p(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var u=0,D=0,w=0,m=f.length;w!==m&&f[w]===0;)w++,u++;for(var v=(m-w)*d+1>>>0,g=new Uint8Array(v);w!==m;){for(var x=f[w],L=0,y=v-1;(x!==0||L<D)&&y!==-1;y--,L++)x+=256*g[y]>>>0,g[y]=x%c>>>0,x=x/c>>>0;if(x!==0)throw new Error("Non-zero carry");D=L,w++}for(var S=v-D;S!==v&&g[S]===0;)S++;for(var G=a.repeat(u);S<v;++S)G+=r.charAt(g[S]);return G}function b(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var u=0;if(f[u]!==" "){for(var D=0,w=0;f[u]===a;)D++,u++;for(var m=(f.length-u)*h+1>>>0,v=new Uint8Array(m);f[u];){var g=t[f.charCodeAt(u)];if(g===255)return;for(var x=0,L=m-1;(g!==0||x<w)&&L!==-1;L--,x++)g+=c*v[L]>>>0,v[L]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");w=x,u++}if(f[u]!==" "){for(var y=m-w;y!==m&&v[y]===0;)y++;for(var S=new Uint8Array(D+(m-y)),G=D;y!==m;)S[G++]=v[y++];return S}}}function U(f){var u=b(f);if(u)return u;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:b,decode:U}}var ve=me,xe=ve,Z=xe;var k=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")}},$=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 H(this,e)}},j=class{decoders;constructor(e){this.decoders=e}or(e){return H(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 H(r,e){return new j({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var J=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 k(e,t,n),this.decoder=new $(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Y({name:r,prefix:e,encode:t,decode:n}){return new J(r,e,t,n)}function P({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=Z(t,r);return Y({prefix:e,name:r,encode:n,decode:i=>C(o(i))})}function Ee(r,e,t,n){let o={};for(let d=0;d<e.length;++d)o[e[d]]=d;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*t/8|0),c=0,a=0,h=0;for(let d=0;d<i;++d){let p=o[r[d]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<t|p,c+=t,c>=8&&(c-=8,s[h++]=255&a>>c)}if(c>=t||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return s}function Se(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,i="",s=0,c=0;for(let a=0;a<r.length;++a)for(c=c<<8|r[a],s+=8;s>t;)s-=t,i+=e[o&c>>s];if(s!==0&&(i+=e[o&c<<t-s]),n)for(;i.length*t&7;)i+="=";return i}function E({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return Y({prefix:e,name:r,encode(o){return Se(o,n,t)},decode(o){return Ee(o,n,t,r)}})}var z=E({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ft=E({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),dt=E({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ut=E({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),lt=E({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ht=E({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pt=E({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gt=E({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),bt=E({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var O=P({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mt=P({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Oe=re,ee=128,Le=127,De=~Le,Ae=Math.pow(2,31);function re(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Ae;)e[t++]=r&255|ee,r/=128;for(;r&De;)e[t++]=r&255|ee,r>>>=7;return e[t]=r|0,re.bytes=t-n+1,e}var Ce=q,Ie=128,te=127;function q(r,n){var t=0,n=n||0,o=0,i=n,s,c=r.length;do{if(i>=c)throw q.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&te)<<o:(s&te)*Math.pow(2,o),o+=7}while(s>=Ie);return q.bytes=i-n,t}var Ne=Math.pow(2,7),Fe=Math.pow(2,14),Re=Math.pow(2,21),Ue=Math.pow(2,28),ze=Math.pow(2,35),Be=Math.pow(2,42),Me=Math.pow(2,49),Te=Math.pow(2,56),Ve=Math.pow(2,63),Ge=function(r){return r<Ne?1:r<Fe?2:r<Re?3:r<Ue?4:r<ze?5:r<Be?6:r<Me?7:r<Te?8:r<Ve?9:10},ke={encode:Oe,decode:Ce,encodingLength:Ge},$e=ke,B=$e;function M(r,e=0){return[B.decode(r,e),B.decode.bytes]}function I(r,e,t=0){return B.encode(r,e,t),e}function N(r){return B.encodingLength(r)}function oe(r,e){let t=e.byteLength,n=N(r),o=n+N(t),i=new Uint8Array(o+t);return I(r,i,0),I(t,i,n),i.set(e,o),new F(r,t,e,i)}function ie(r){let e=C(r),[t,n]=M(e),[o,i]=M(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new F(t,o,s,e)}function se(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&_(r.bytes,t.bytes)}}var F=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};function ae(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return Pe(t,W(r),e??O.encoder);default:return qe(t,W(r),e??z.encoder)}}var ce=new WeakMap;function W(r){let e=ce.get(r);if(e==null){let t=new Map;return ce.set(r,t),t}return e}var fe=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!==T)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==We)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=oe(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&&se(e.multihash,n.multihash)}toString(e){return ae(this,e)}toJSON(){return{"/":ae(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:i,bytes:s}=t;return new r(n,o,i,s??de(n,o,i.bytes))}else if(t[Xe]===!0){let{version:n,multihash:o,code:i}=t,s=ie(o);return r.create(n,i,s)}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!==T)throw new Error(`Version 0 CID must use dag-pb (code: ${T}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=de(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,T,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=C(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=o.subarray(t.multihashSize-t.digestSize),s=new F(t.multihashCode,t.digestSize,i,o);return[t.version===0?r.createV0(s):r.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[p,b]=M(e.subarray(t));return t+=b,p},o=n(),i=T;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=t,c=n(),a=n(),h=t+a,d=h-s;return{version:o,codec:i,multihashCode:c,digestSize:a,multihashSize:d,size:h}}static parse(e,t){let[n,o]=Je(e,t),i=r.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return W(i).set(n,e),i}};function Je(r,e){switch(r[0]){case"Q":{let t=e??O;return[O.prefix,t.decode(`${O.prefix}${r}`)]}case O.prefix:{let t=e??O;return[O.prefix,t.decode(r)]}case z.prefix:{let t=e??z;return[z.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 Pe(r,e,t){let{prefix:n}=t;if(n!==O.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return o}function qe(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let i=t.encode(r);return e.set(n,i),i}else return o}var T=112,We=18;function de(r,e,t){let n=N(r),o=n+N(e),i=new Uint8Array(o+t.byteLength);return I(r,i,0),I(e,i,n),i.set(t,o),i}var Xe=Symbol.for("@ipld/js-cid/CID");var R=K(ue(),1),pe=K(he(),1),ge=!1,be=!1;R.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(ge=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(be=process?.env?.LOGGER_PERF_PREFIX==="true"));var et={prefix:void 0,time:ge,delta:be,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},X=[],we=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(r,e,t,n){Object.assign(this,{sinceFirst:r,sinceLast:e,time:t,delta:n})}toString(){let r=this.sinceFirst*.001,e=r.toFixed(r<5?2:1),t=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?e:null,this.delta?t:null].filter(n=>n!=null).join(",")}]`}},ye=class{constructor(r,e){Object.assign(this,{style:r,string:e})}},V=!1,tt=class l{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(e=l.INFO,t={}){t=Object.assign({},et,t),e>10&&console.debug("setup logger",{config:t});let n=this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}),o=(...a)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&n(...a)};o.isDisabled=!0,o.isEnabled=!1;let i=this.wrapLog(console.groupCollapsed,t),s=(a,h)=>{function d(...b){let U=b[b.length-1];return U===o?U():(i(...b.slice(0,-1)),(async()=>{try{let f=U();return f instanceof Promise?await f:f}finally{console.groupEnd()}})())}let p=Object.assign(h.bind({}),{isEnabled:a,isDisabled:!a,group:d,force:h});return a?p:Object.assign(o.bind({}),{isEnabled:a,isDisabled:!a,group:d,force:p})},c=s(e>=l.ERROR,this.wrapLog(console.error,t));return{ERROR:(...a)=>(c(...a),new Error((0,pe.default)(a))),WARN:s(e>=l.WARN,this.wrapLog(console.warn,t)),LOG:s(e>=l.INFO,this.wrapLog(console.log,t)),DEBUG:s(e>=l.DEBUG,this.wrapLog(console.log,{...t,dim:t.dimDebugOnServer})),VERBOSE:s(e>=l.VERBOSE,this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}))}}static wrapLog(e,t){if(R.isNode)return e.bind(console);{let n=[];if(t.time||t.delta){let o=R.isBrowser&&navigator.userAgent.includes("Chrome")?["",l.timeStr(!!t.time,!!t.delta)]:[];n.push(...o)}return t.prefix&&(V?n.push(new ye("dim",t.prefix)):n.push(t.prefix)),e.bind(console,...n)}}static timeStr(e,t,n=0){if(!performance.now)return;let o=performance.now();l.firstLog||(l.firstLog=o,l.lastLog=o);let i=new we(o-l.firstLog,o-l.lastLog,e,t);return l.lastLog=o,n?i.toString():i}static getOriginFromStack(e){let t=!1;for(let n of e.split(`
|
|
2
2
|
`)){let o=n.match(/^\s+at\s+(.*)/);if(o){if(t)return o[1].trim().replace(__dirname,"");t=!0}}}};R.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:r=>{if(X&&X.length){for(let e of X)if(e.match(r))return["span",{},e.format(r)]}return null},hasBody:()=>!0},{header:r=>{if(!(r instanceof we))return null;V||(V=!0);let e=tt.timeStr(r.time,r.delta);return["span",{style:"font-weight: light; color: grey"},e?.toString()]},hasBody:()=>!1},{header:r=>r instanceof ye?(V||(V=!0),["span",{style:"font-weight: light; color: grey; "},r.string]):null,hasBody:()=>!1}));export{oe as a,ie as b,O as c,fe as d,tt as e};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-PXG467HN.min.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,d as p,e as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a,d as p,e as m}from"./chunk-PXG467HN.min.js";import{c as d}from"./chunk-LB22G6E6.min.js";function y({name:e,code:t,encode:r}){return new c(e,t,r)}var c=class{name;code;encode;constructor(t,r,i){this.name=t,this.code=r,this.encode=i}digest(t){if(t instanceof Uint8Array){let r=this.encode(t);return r instanceof Uint8Array?a(this.code,r):r.then(i=>a(this.code,i))}else throw Error("Unknown type, must be binary type")}};var{WARN:x,LOG:b,DEBUG:g,VERBOSE:j,ERROR:u}=m.setup(m.INFO);async function L(e,t,r,{ucans:i}){e=d(e);let s;try{s=await fetch(`${e}/upload`,{method:"PUT",headers:{Authorization:`Bearer ${r.toString()}`,Accept:"application/json","Content-Type":"application/car","x-agent-did":r.issuer.did,ucans:i?.join(", ")},body:t,mode:"cors"})}catch(n){throw u("Failed to upload to ucan proxy:",n),n.message?.includes("net::ERR_CERT_AUTHORITY_INVALID"),n}let o=await s.json();if(!s.ok)throw u("[storeCar] failed:",o?.error||o||s,{result:o,response:s});g("[storeCar] result",{response:s,result:o});let f=o.Type==="error"?o.Message:o.Root.PinErrorMsg;return f&&x("Pin error:",f,{result:o}),p.parse(o.Root.Cid["/"])}export{y as a,L as b};
|
|
2
|
+
//# sourceMappingURL=chunk-UFTXT7VB.min.js.map
|