@permaweb/libs 0.0.29 → 0.0.32
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/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var jt=Object.create;var je=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Jt=Object.getOwnPropertyNames;var Ht=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty;var Xt=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);var er=(n,i,s,u)=>{if(i&&typeof i=="object"||typeof i=="function")for(let y of Jt(i))!Kt.call(n,y)&&y!==s&&je(n,y,{get:()=>i[y],enumerable:!(u=Vt(i,y))||u.enumerable});return n};var A=(n,i,s)=>(s=n!=null?jt(Ht(n)):{},er(i||!n||!n.__esModule?je(s,"default",{value:n,enumerable:!0}):s,n));var T=Xt((Er,Ke)=>{var U=Ke.exports={},j,V;function ve(){throw new Error("setTimeout has not been defined")}function Ue(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?j=setTimeout:j=ve}catch{j=ve}try{typeof clearTimeout=="function"?V=clearTimeout:V=Ue}catch{V=Ue}})();function Ve(n){if(j===setTimeout)return setTimeout(n,0);if((j===ve||!j)&&setTimeout)return j=setTimeout,setTimeout(n,0);try{return j(n,0)}catch{try{return j.call(null,n,0)}catch{return j.call(this,n,0)}}}function tr(n){if(V===clearTimeout)return clearTimeout(n);if((V===Ue||!V)&&clearTimeout)return V=clearTimeout,clearTimeout(n);try{return V(n)}catch{try{return V.call(null,n)}catch{return V.call(this,n)}}}var J=[],le=!1,ie,Te=-1;function rr(){!le||!ie||(le=!1,ie.length?J=ie.concat(J):Te=-1,J.length&&Je())}function Je(){if(!le){var n=Ve(rr);le=!0;for(var i=J.length;i;){for(ie=J,J=[];++Te<i;)ie&&ie[Te].run();Te=-1,i=J.length}ie=null,le=!1,tr(n)}}U.nextTick=function(n){var i=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)i[s-1]=arguments[s];J.push(new He(n,i)),J.length===1&&!le&&Ve(Je)};function He(n,i){this.fun=n,this.array=i}He.prototype.run=function(){this.fun.apply(null,this.array)};U.title="browser";U.browser=!0;U.env={};U.argv=[];U.version="";U.versions={};function H(){}U.on=H;U.addListener=H;U.once=H;U.off=H;U.removeListener=H;U.removeAllListeners=H;U.emit=H;U.prependListener=H;U.prependOnceListener=H;U.listeners=function(n){return[]};U.binding=function(n){throw new Error("process.binding is not supported")};U.cwd=function(){return"/"};U.chdir=function(n){throw new Error("process.chdir is not supported")};U.umask=function(){return 0}});var Ji=A(T(),1);var Rr=A(T());var xr=A(T(),1);var he={},Xe=!1;function nr(){if(Xe)return he;Xe=!0,he.byteLength=h,he.toByteArray=B,he.fromByteArray=G;for(var n=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=0,d=u.length;y<d;++y)n[y]=u[y],i[u.charCodeAt(y)]=y;i[45]=62,i[95]=63;function a(f){var m=f.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var x=f.indexOf("=");x===-1&&(x=m);var L=x===m?0:4-x%4;return[x,L]}function h(f){var m=a(f),x=m[0],L=m[1];return(x+L)*3/4-L}function g(f,m,x){return(m+x)*3/4-x}function B(f){var m,x=a(f),L=x[0],_=x[1],R=new s(g(f,L,_)),F=0,Z=_>0?L-4:L,W;for(W=0;W<Z;W+=4)m=i[f.charCodeAt(W)]<<18|i[f.charCodeAt(W+1)]<<12|i[f.charCodeAt(W+2)]<<6|i[f.charCodeAt(W+3)],R[F++]=m>>16&255,R[F++]=m>>8&255,R[F++]=m&255;return _===2&&(m=i[f.charCodeAt(W)]<<2|i[f.charCodeAt(W+1)]>>4,R[F++]=m&255),_===1&&(m=i[f.charCodeAt(W)]<<10|i[f.charCodeAt(W+1)]<<4|i[f.charCodeAt(W+2)]>>2,R[F++]=m>>8&255,R[F++]=m&255),R}function E(f){return n[f>>18&63]+n[f>>12&63]+n[f>>6&63]+n[f&63]}function D(f,m,x){for(var L,_=[],R=m;R<x;R+=3)L=(f[R]<<16&16711680)+(f[R+1]<<8&65280)+(f[R+2]&255),_.push(E(L));return _.join("")}function G(f){for(var m,x=f.length,L=x%3,_=[],R=16383,F=0,Z=x-L;F<Z;F+=R)_.push(D(f,F,F+R>Z?Z:F+R));return L===1?(m=f[x-1],_.push(n[m>>2]+n[m<<4&63]+"==")):L===2&&(m=(f[x-2]<<8)+f[x-1],_.push(n[m>>10]+n[m>>4&63]+n[m<<2&63]+"=")),_.join("")}return he}var Ae={},et=!1;function ir(){if(et)return Ae;et=!0;return Ae.read=function(n,i,s,u,y){var d,a,h=y*8-u-1,g=(1<<h)-1,B=g>>1,E=-7,D=s?y-1:0,G=s?-1:1,f=n[i+D];for(D+=G,d=f&(1<<-E)-1,f>>=-E,E+=h;E>0;d=d*256+n[i+D],D+=G,E-=8);for(a=d&(1<<-E)-1,d>>=-E,E+=u;E>0;a=a*256+n[i+D],D+=G,E-=8);if(d===0)d=1-B;else{if(d===g)return a?NaN:(f?-1:1)*(1/0);a=a+Math.pow(2,u),d=d-B}return(f?-1:1)*a*Math.pow(2,d-u)},Ae.write=function(n,i,s,u,y,d){var a,h,g,B=d*8-y-1,E=(1<<B)-1,D=E>>1,G=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=u?0:d-1,m=u?1:-1,x=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(h=isNaN(i)?1:0,a=E):(a=Math.floor(Math.log(i)/Math.LN2),i*(g=Math.pow(2,-a))<1&&(a--,g*=2),a+D>=1?i+=G/g:i+=G*Math.pow(2,1-D),i*g>=2&&(a++,g/=2),a+D>=E?(h=0,a=E):a+D>=1?(h=(i*g-1)*Math.pow(2,y),a=a+D):(h=i*Math.pow(2,D-1)*Math.pow(2,y),a=0));y>=8;n[s+f]=h&255,f+=m,h/=256,y-=8);for(a=a<<y|h,B+=y;B>0;n[s+f]=a&255,f+=m,a/=256,B-=8);n[s+f-m]|=x*128},Ae}var oe={},tt=!1;function rt(){if(tt)return oe;tt=!0;let n=nr(),i=ir(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;oe.Buffer=a,oe.SlowBuffer=_,oe.INSPECT_MAX_BYTES=50;let u=2147483647;oe.kMaxLength=u,a.TYPED_ARRAY_SUPPORT=y(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function y(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function d(r){if(r>u)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,a.prototype),e}function a(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return E(r)}return h(r,e,t)}a.poolSize=8192;function h(r,e,t){if(typeof r=="string")return D(r,e);if(ArrayBuffer.isView(r))return f(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Y(r,ArrayBuffer)||r&&Y(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Y(r,SharedArrayBuffer)||r&&Y(r.buffer,SharedArrayBuffer)))return m(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=r.valueOf&&r.valueOf();if(o!=null&&o!==r)return a.from(o,e,t);let c=x(r);if(c)return c;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return a.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}a.from=function(r,e,t){return h(r,e,t)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function g(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function B(r,e,t){return g(r),r<=0?d(r):e!==void 0?typeof t=="string"?d(r).fill(e,t):d(r).fill(e):d(r)}a.alloc=function(r,e,t){return B(r,e,t)};function E(r){return g(r),d(r<0?0:L(r)|0)}a.allocUnsafe=function(r){return E(r)},a.allocUnsafeSlow=function(r){return E(r)};function D(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=R(r,e)|0,o=d(t),c=o.write(r,e);return c!==t&&(o=o.slice(0,c)),o}function G(r){let e=r.length<0?0:L(r.length)|0,t=d(e);for(let o=0;o<e;o+=1)t[o]=r[o]&255;return t}function f(r){if(Y(r,Uint8Array)){let e=new Uint8Array(r);return m(e.buffer,e.byteOffset,e.byteLength)}return G(r)}function m(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let o;return e===void 0&&t===void 0?o=new Uint8Array(r):t===void 0?o=new Uint8Array(r,e):o=new Uint8Array(r,e,t),Object.setPrototypeOf(o,a.prototype),o}function x(r){if(a.isBuffer(r)){let e=L(r.length)|0,t=d(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||be(r.length)?d(0):G(r);if(r.type==="Buffer"&&Array.isArray(r.data))return G(r.data)}function L(r){if(r>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return r|0}function _(r){return+r!=r&&(r=0),a.alloc(+r)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype},a.compare=function(e,t){if(Y(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let o=e.length,c=t.length;for(let l=0,p=Math.min(o,c);l<p;++l)if(e[l]!==t[l]){o=e[l],c=t[l];break}return o<c?-1:c<o?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let o;if(t===void 0)for(t=0,o=0;o<e.length;++o)t+=e[o].length;let c=a.allocUnsafe(t),l=0;for(o=0;o<e.length;++o){let p=e[o];if(Y(p,Uint8Array))l+p.length>c.length?(a.isBuffer(p)||(p=a.from(p)),p.copy(c,l)):Uint8Array.prototype.set.call(c,p,l);else if(a.isBuffer(p))p.copy(c,l);else throw new TypeError('"list" argument must be an Array of Buffers');l+=p.length}return c};function R(r,e){if(a.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Y(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&t===0)return 0;let c=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Pe(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Ye(r).length;default:if(c)return o?-1:Pe(r).length;e=(""+e).toLowerCase(),c=!0}}a.byteLength=R;function F(r,e,t){let o=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Wt(this,e,t);case"utf8":case"utf-8":return ke(this,e,t);case"ascii":return Gt(this,e,t);case"latin1":case"binary":return kt(this,e,t);case"base64":return $t(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ot(this,e,t);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),o=!0}}a.prototype._isBuffer=!0;function Z(r,e,t){let o=r[e];r[e]=r[t],r[t]=o}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)Z(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)Z(this,t,t+3),Z(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)Z(this,t,t+7),Z(this,t+1,t+6),Z(this,t+2,t+5),Z(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ke(this,0,e):F.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0},a.prototype.inspect=function(){let e="",t=oe.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,o,c,l){if(Y(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),o===void 0&&(o=e?e.length:0),c===void 0&&(c=0),l===void 0&&(l=this.length),t<0||o>e.length||c<0||l>this.length)throw new RangeError("out of range index");if(c>=l&&t>=o)return 0;if(c>=l)return-1;if(t>=o)return 1;if(t>>>=0,o>>>=0,c>>>=0,l>>>=0,this===e)return 0;let p=l-c,w=o-t,P=Math.min(p,w),S=this.slice(c,l),b=e.slice(t,o);for(let C=0;C<P;++C)if(S[C]!==b[C]){p=S[C],w=b[C];break}return p<w?-1:w<p?1:0};function W(r,e,t,o,c){if(r.length===0)return-1;if(typeof t=="string"?(o=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,be(t)&&(t=c?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(c)return-1;t=r.length-1}else if(t<0)if(c)t=0;else return-1;if(typeof e=="string"&&(e=a.from(e,o)),a.isBuffer(e))return e.length===0?-1:Ge(r,e,t,o,c);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?c?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Ge(r,[e],t,o,c);throw new TypeError("val must be string, number or Buffer")}function Ge(r,e,t,o,c){let l=1,p=r.length,w=e.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(r.length<2||e.length<2)return-1;l=2,p/=2,w/=2,t/=2}function P(b,C){return l===1?b[C]:b.readUInt16BE(C*l)}let S;if(c){let b=-1;for(S=t;S<p;S++)if(P(r,S)===P(e,b===-1?0:S-b)){if(b===-1&&(b=S),S-b+1===w)return b*l}else b!==-1&&(S-=S-b),b=-1}else for(t+w>p&&(t=p-w),S=t;S>=0;S--){let b=!0;for(let C=0;C<w;C++)if(P(r,S+C)!==P(e,C)){b=!1;break}if(b)return S}return-1}a.prototype.includes=function(e,t,o){return this.indexOf(e,t,o)!==-1},a.prototype.indexOf=function(e,t,o){return W(this,e,t,o,!0)},a.prototype.lastIndexOf=function(e,t,o){return W(this,e,t,o,!1)};function vt(r,e,t,o){t=Number(t)||0;let c=r.length-t;o?(o=Number(o),o>c&&(o=c)):o=c;let l=e.length;o>l/2&&(o=l/2);let p;for(p=0;p<o;++p){let w=parseInt(e.substr(p*2,2),16);if(be(w))return p;r[t+p]=w}return p}function Ut(r,e,t,o){return we(Pe(e,r.length-t),r,t,o)}function Rt(r,e,t,o){return we(qt(e),r,t,o)}function Lt(r,e,t,o){return we(Ye(e),r,t,o)}function Nt(r,e,t,o){return we(Zt(e,r.length-t),r,t,o)}a.prototype.write=function(e,t,o,c){if(t===void 0)c="utf8",o=this.length,t=0;else if(o===void 0&&typeof t=="string")c=t,o=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(o)?(o=o>>>0,c===void 0&&(c="utf8")):(c=o,o=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let l=this.length-t;if((o===void 0||o>l)&&(o=l),e.length>0&&(o<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");let p=!1;for(;;)switch(c){case"hex":return vt(this,e,t,o);case"utf8":case"utf-8":return Ut(this,e,t,o);case"ascii":case"latin1":case"binary":return Rt(this,e,t,o);case"base64":return Lt(this,e,t,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Nt(this,e,t,o);default:if(p)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),p=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $t(r,e,t){return e===0&&t===r.length?n.fromByteArray(r):n.fromByteArray(r.slice(e,t))}function ke(r,e,t){t=Math.min(r.length,t);let o=[],c=e;for(;c<t;){let l=r[c],p=null,w=l>239?4:l>223?3:l>191?2:1;if(c+w<=t){let P,S,b,C;switch(w){case 1:l<128&&(p=l);break;case 2:P=r[c+1],(P&192)===128&&(C=(l&31)<<6|P&63,C>127&&(p=C));break;case 3:P=r[c+1],S=r[c+2],(P&192)===128&&(S&192)===128&&(C=(l&15)<<12|(P&63)<<6|S&63,C>2047&&(C<55296||C>57343)&&(p=C));break;case 4:P=r[c+1],S=r[c+2],b=r[c+3],(P&192)===128&&(S&192)===128&&(b&192)===128&&(C=(l&15)<<18|(P&63)<<12|(S&63)<<6|b&63,C>65535&&C<1114112&&(p=C))}}p===null?(p=65533,w=1):p>65535&&(p-=65536,o.push(p>>>10&1023|55296),p=56320|p&1023),o.push(p),c+=w}return Mt(o)}let We=4096;function Mt(r){let e=r.length;if(e<=We)return String.fromCharCode.apply(String,r);let t="",o=0;for(;o<e;)t+=String.fromCharCode.apply(String,r.slice(o,o+=We));return t}function Gt(r,e,t){let o="";t=Math.min(r.length,t);for(let c=e;c<t;++c)o+=String.fromCharCode(r[c]&127);return o}function kt(r,e,t){let o="";t=Math.min(r.length,t);for(let c=e;c<t;++c)o+=String.fromCharCode(r[c]);return o}function Wt(r,e,t){let o=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>o)&&(t=o);let c="";for(let l=e;l<t;++l)c+=zt[r[l]];return c}function Ot(r,e,t){let o=r.slice(e,t),c="";for(let l=0;l<o.length-1;l+=2)c+=String.fromCharCode(o[l]+o[l+1]*256);return c}a.prototype.slice=function(e,t){let o=this.length;e=~~e,t=t===void 0?o:~~t,e<0?(e+=o,e<0&&(e=0)):e>o&&(e=o),t<0?(t+=o,t<0&&(t=0)):t>o&&(t=o),t<e&&(t=e);let c=this.subarray(e,t);return Object.setPrototypeOf(c,a.prototype),c};function N(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,o){e=e>>>0,t=t>>>0,o||N(e,t,this.length);let c=this[e],l=1,p=0;for(;++p<t&&(l*=256);)c+=this[e+p]*l;return c},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,o){e=e>>>0,t=t>>>0,o||N(e,t,this.length);let c=this[e+--t],l=1;for(;t>0&&(l*=256);)c+=this[e+--t]*l;return c},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||N(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||N(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||N(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=te(function(e){e=e>>>0,ue(e,"offset");let t=this[e],o=this[e+7];(t===void 0||o===void 0)&&fe(e,this.length-8);let c=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,l=this[++e]+this[++e]*2**8+this[++e]*2**16+o*2**24;return BigInt(c)+(BigInt(l)<<BigInt(32))}),a.prototype.readBigUInt64BE=te(function(e){e=e>>>0,ue(e,"offset");let t=this[e],o=this[e+7];(t===void 0||o===void 0)&&fe(e,this.length-8);let c=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],l=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+o;return(BigInt(c)<<BigInt(32))+BigInt(l)}),a.prototype.readIntLE=function(e,t,o){e=e>>>0,t=t>>>0,o||N(e,t,this.length);let c=this[e],l=1,p=0;for(;++p<t&&(l*=256);)c+=this[e+p]*l;return l*=128,c>=l&&(c-=Math.pow(2,8*t)),c},a.prototype.readIntBE=function(e,t,o){e=e>>>0,t=t>>>0,o||N(e,t,this.length);let c=t,l=1,p=this[e+--c];for(;c>0&&(l*=256);)p+=this[e+--c]*l;return l*=128,p>=l&&(p-=Math.pow(2,8*t)),p},a.prototype.readInt8=function(e,t){return e=e>>>0,t||N(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){e=e>>>0,t||N(e,2,this.length);let o=this[e]|this[e+1]<<8;return o&32768?o|4294901760:o},a.prototype.readInt16BE=function(e,t){e=e>>>0,t||N(e,2,this.length);let o=this[e+1]|this[e]<<8;return o&32768?o|4294901760:o},a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=te(function(e){e=e>>>0,ue(e,"offset");let t=this[e],o=this[e+7];(t===void 0||o===void 0)&&fe(e,this.length-8);let c=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(o<<24);return(BigInt(c)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),a.prototype.readBigInt64BE=te(function(e){e=e>>>0,ue(e,"offset");let t=this[e],o=this[e+7];(t===void 0||o===void 0)&&fe(e,this.length-8);let c=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(c)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+o)}),a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||N(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||N(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||N(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||N(e,8,this.length),i.read(this,e,!1,52,8)};function Q(r,e,t,o,c,l){if(!a.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>c||e<l)throw new RangeError('"value" argument is out of bounds');if(t+o>r.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,o,c){if(e=+e,t=t>>>0,o=o>>>0,!c){let w=Math.pow(2,8*o)-1;Q(this,e,t,o,w,0)}let l=1,p=0;for(this[t]=e&255;++p<o&&(l*=256);)this[t+p]=e/l&255;return t+o},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,o,c){if(e=+e,t=t>>>0,o=o>>>0,!c){let w=Math.pow(2,8*o)-1;Q(this,e,t,o,w,0)}let l=o-1,p=1;for(this[t+l]=e&255;--l>=0&&(p*=256);)this[t+l]=e/p&255;return t+o},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,1,255,0),this[t]=e&255,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Oe(r,e,t,o,c){ze(e,o,c,r,t,7);let l=Number(e&BigInt(4294967295));r[t++]=l,l=l>>8,r[t++]=l,l=l>>8,r[t++]=l,l=l>>8,r[t++]=l;let p=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=p,p=p>>8,r[t++]=p,p=p>>8,r[t++]=p,p=p>>8,r[t++]=p,t}function _e(r,e,t,o,c){ze(e,o,c,r,t,7);let l=Number(e&BigInt(4294967295));r[t+7]=l,l=l>>8,r[t+6]=l,l=l>>8,r[t+5]=l,l=l>>8,r[t+4]=l;let p=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=p,p=p>>8,r[t+2]=p,p=p>>8,r[t+1]=p,p=p>>8,r[t]=p,t+8}a.prototype.writeBigUInt64LE=te(function(e,t=0){return Oe(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=te(function(e,t=0){return _e(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,o,c){if(e=+e,t=t>>>0,!c){let P=Math.pow(2,8*o-1);Q(this,e,t,o,P-1,-P)}let l=0,p=1,w=0;for(this[t]=e&255;++l<o&&(p*=256);)e<0&&w===0&&this[t+l-1]!==0&&(w=1),this[t+l]=(e/p>>0)-w&255;return t+o},a.prototype.writeIntBE=function(e,t,o,c){if(e=+e,t=t>>>0,!c){let P=Math.pow(2,8*o-1);Q(this,e,t,o,P-1,-P)}let l=o-1,p=1,w=0;for(this[t+l]=e&255;--l>=0&&(p*=256);)e<0&&w===0&&this[t+l+1]!==0&&(w=1),this[t+l]=(e/p>>0)-w&255;return t+o},a.prototype.writeInt8=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},a.prototype.writeInt16LE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeInt32LE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},a.prototype.writeBigInt64LE=te(function(e,t=0){return Oe(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=te(function(e,t=0){return _e(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Fe(r,e,t,o,c,l){if(t+o>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Qe(r,e,t,o,c){return e=+e,t=t>>>0,c||Fe(r,e,t,4),i.write(r,e,t,o,23,4),t+4}a.prototype.writeFloatLE=function(e,t,o){return Qe(this,e,t,!0,o)},a.prototype.writeFloatBE=function(e,t,o){return Qe(this,e,t,!1,o)};function qe(r,e,t,o,c){return e=+e,t=t>>>0,c||Fe(r,e,t,8),i.write(r,e,t,o,52,8),t+8}a.prototype.writeDoubleLE=function(e,t,o){return qe(this,e,t,!0,o)},a.prototype.writeDoubleBE=function(e,t,o){return qe(this,e,t,!1,o)},a.prototype.copy=function(e,t,o,c){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(o||(o=0),!c&&c!==0&&(c=this.length),t>=e.length&&(t=e.length),t||(t=0),c>0&&c<o&&(c=o),c===o||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(o<0||o>=this.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),e.length-t<c-o&&(c=e.length-t+o);let l=c-o;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,o,c):Uint8Array.prototype.set.call(e,this.subarray(o,c),t),l},a.prototype.fill=function(e,t,o,c){if(typeof e=="string"){if(typeof t=="string"?(c=t,t=0,o=this.length):typeof o=="string"&&(c=o,o=this.length),c!==void 0&&typeof c!="string")throw new TypeError("encoding must be a string");if(typeof c=="string"&&!a.isEncoding(c))throw new TypeError("Unknown encoding: "+c);if(e.length===1){let p=e.charCodeAt(0);(c==="utf8"&&p<128||c==="latin1")&&(e=p)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<o)throw new RangeError("Out of range index");if(o<=t)return this;t=t>>>0,o=o===void 0?this.length:o>>>0,e||(e=0);let l;if(typeof e=="number")for(l=t;l<o;++l)this[l]=e;else{let p=a.isBuffer(e)?e:a.from(e,c),w=p.length;if(w===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(l=0;l<o-t;++l)this[l+t]=p[l%w]}return this};let ce={};function De(r,e,t){ce[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(c){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:c,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}De("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),De("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError),De("ERR_OUT_OF_RANGE",function(r,e,t){let o=`The value of "${r}" is out of range.`,c=t;return Number.isInteger(t)&&Math.abs(t)>2**32?c=Ze(String(t)):typeof t=="bigint"&&(c=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(c=Ze(c)),c+="n"),o+=` It must be ${e}. Received ${c}`,o},RangeError);function Ze(r){let e="",t=r.length,o=r[0]==="-"?1:0;for(;t>=o+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function _t(r,e,t){ue(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&fe(e,r.length-(t+1))}function ze(r,e,t,o,c,l){if(r>t||r<e){let p=typeof e=="bigint"?"n":"",w;throw e===0||e===BigInt(0)?w=`>= 0${p} and < 2${p} ** ${(l+1)*8}${p}`:w=`>= -(2${p} ** ${(l+1)*8-1}${p}) and < 2 ** ${(l+1)*8-1}${p}`,new ce.ERR_OUT_OF_RANGE("value",w,r)}_t(o,c,l)}function ue(r,e){if(typeof r!="number")throw new ce.ERR_INVALID_ARG_TYPE(e,"number",r)}function fe(r,e,t){throw Math.floor(r)!==r?(ue(r,t),new ce.ERR_OUT_OF_RANGE("offset","an integer",r)):e<0?new ce.ERR_BUFFER_OUT_OF_BOUNDS:new ce.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${e}`,r)}let Ft=/[^+/0-9A-Za-z-_]/g;function Qt(r){if(r=r.split("=")[0],r=r.trim().replace(Ft,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Pe(r,e){e=e||1/0;let t,o=r.length,c=null,l=[];for(let p=0;p<o;++p){if(t=r.charCodeAt(p),t>55295&&t<57344){if(!c){if(t>56319){(e-=3)>-1&&l.push(239,191,189);continue}else if(p+1===o){(e-=3)>-1&&l.push(239,191,189);continue}c=t;continue}if(t<56320){(e-=3)>-1&&l.push(239,191,189),c=t;continue}t=(c-55296<<10|t-56320)+65536}else c&&(e-=3)>-1&&l.push(239,191,189);if(c=null,t<128){if((e-=1)<0)break;l.push(t)}else if(t<2048){if((e-=2)<0)break;l.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;l.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;l.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return l}function qt(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function Zt(r,e){let t,o,c,l=[];for(let p=0;p<r.length&&!((e-=2)<0);++p)t=r.charCodeAt(p),o=t>>8,c=t%256,l.push(c),l.push(o);return l}function Ye(r){return n.toByteArray(Qt(r))}function we(r,e,t,o){let c;for(c=0;c<o&&!(c+t>=e.length||c>=r.length);++c)e[c+t]=r[c];return c}function Y(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function be(r){return r!==r}let zt=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let o=t*16;for(let c=0;c<16;++c)e[o+c]=r[t]+r[c]}return e}();function te(r){return typeof BigInt>"u"?Yt:r}function Yt(){throw new Error("BigInt not supported")}return oe}var ae=rt();ae.Buffer;ae.SlowBuffer;ae.INSPECT_MAX_BYTES;ae.kMaxLength;var v=ae.Buffer,br=ae.INSPECT_MAX_BYTES,vr=ae.kMaxLength;var Sn=A(T(),1);var fn=A(T(),1);var Wr=A(T(),1);var k={module:"Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",scheduler:"_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA",mu:"fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY",src:{asset:"XYz8buLR5LQdhOOzWuCt9kBjoXHMowouWpXcGm9wdEE",collection:"aHN0YxA7Th1OQdtgv0slWv9LMrvYukvNgWdkotJsML0",collectionActivity:"k8K8WIJb5kXOVvZRFXF5GIZW-7b2NtaTOd6G-E5MF0k",profile:"WBhJpPafkykqZZgTr7TAsz48RKG4vbOEAH4rZ3JxIQ8",zone:"M9G2B9Uvk8VK1pxloESeT4XScguRKSzLyd4as1HFOJ8"},collectionRegistry:"TFWDmf8a3_nw43GCm_CuYlYoylHAjCcFGbgHfDaGcsg",profileRegistry:"SNy4m-DrqxWl01YqGM4sxI8qCni-58re8uuJLvZPypY"},nt={"application/json":{type:"application/json",serialize:n=>JSON.stringify(n)}},q={arweave:"arweave.net",goldsky:"arweave-search.goldsky.com"};var I={keys:{access:"Access-Fee",ans110:{title:"Title",description:"Description",topic:"Topic:*",type:"Type",implements:"Implements",license:"License"},assetType:"Asset-Type",banner:"Banner",bootloader:"Bootloader",bootloaderInit:"On-Boot",collectionId:"Collection-Id",collectionName:"Collection-Name",commericalUse:"Commercial-Use",contentType:"Content-Type",creator:"Creator",currency:"Currency",dataModelTraining:"Data-Model-Training",dataProtocol:"Data-Protocol",dateCreated:"Date-Created",derivations:"Derivations",description:"Description",displayName:"Display-Name",handle:"Handle",implements:"Implements",initialOwner:"Initial-Owner",license:"License",name:"Name",paymentAddress:"Payment-Address",paymentMode:"Payment-Mode",profileCreator:"Profile-Creator",profileIndex:"Profile-Index",protocolName:"Protocol-Name",renderWith:"Render-With",thumbnail:"Thumbnail",title:"Title",topic:"Topic",type:"Type",zoneType:"Zone-Type"},values:{document:"Document"}},it={node1:"https://up.arweave.net",node2:"https://turbo.ardrive.io",batchSize:1,chunkSize:75e5,dispatchUploadSize:100*1024};var Hr=A(T(),1);var Zr=A(T(),1);function ye(n){return n?/^[a-z0-9_-]{43}$/i.test(n):!1}function Ee(n,i){for(let s=0;s<n.length;s++)if(n[s]&&n[s].name===i)return n[s].value;return null}function ot(n){let i=n.match(/^data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+);base64,/);return i?i[1]:null}function at(n){return n.split(",")[1]}function st(n){let i;if(v.isBuffer(n))i=n.length;else if(typeof n=="string")i=v.byteLength(n,"utf-8");else throw new Error("Input must be a string or a Buffer");return i}function Re(n){let i;return i=n.replace(/\[|\]/g,""),`[[${i}]]`}function ge(n){let i;return i=n.replace(/\[|\]/g,""),i}var X=(...n)=>{console.log("[@permaweb/libs]",...n)};function or(n){return n.replace(/^[a-z]/,i=>i.toUpperCase())}function pe(n){return Array.isArray(n)?n.map(pe):n&&typeof n=="object"?Object.entries(n).reduce((i,[s,u])=>{let y=or(s);return i[y]=ye(u)?u:pe(u),i},{}):n}function ar(n){return n.charAt(0).toLowerCase()+n.slice(1)}function K(n){return Array.isArray(n)?n.map(K):n&&typeof n=="object"?Object.entries(n).reduce((i,[s,u])=>{let y=ar(s);return i[y]=ye(u)?u:K(u),i},{}):n}function O(n,i){let s=n.charAt(0).toUpperCase()+n.slice(1);return{name:`${I.keys.bootloader}-${s}`,value:i}}var sr="https://arweave.net";function de(n){return`${sr}/${n}`}var nn=A(T(),1);var Le={p1:"P1",end:"END"},Ne={default:100};async function z(n){let i=n.paginator?n.paginator:Ne.default,s=[],u=0,y=null;if(n.ids&&!n.ids.length)return{data:s,count:u,nextCursor:y,previousCursor:null};try{let d=ur(n),a=await lr({gateway:n.gateway??q.goldsky,query:cr(d)});return a?.data?.transactions?.edges?.length?(s=[...a.data.transactions.edges],u=a.data.transactions.count??0,s.length<i||!a.data.transactions.pageInfo.hasNextPage?y=Le.end:y=s[s.length-1].cursor,{data:s,count:u,nextCursor:y,previousCursor:null}):{data:s,count:u,nextCursor:y,previousCursor:null}}catch(d){return console.error(d),{data:s,count:u,nextCursor:y,previousCursor:null}}}async function ct(n,i){let s=1,u=await z(n);if(u&&u.data.length){let y=u.data;for(i&&i(`Count: ${u.count}`),i&&i(`Pages to fetch: ${Math.ceil(u.count/(n.paginator??Ne.default))}`),i&&i(`Page ${s} fetched`);u.nextCursor&&u.nextCursor!==Le.end;)s+=1,i&&i(`Fetching page ${s}...`),u=await z({...n,cursor:u.nextCursor}),u&&u.data.length&&(y=y.concat(u.data));return i&&i("All pages fetched!"),y}else i&&i("No data found");return null}function cr(n){let i={query:`query { ${n} }`};return JSON.stringify(i)}function ur(n){let i=n.paginator?n.paginator:Ne.default,s=n.ids?JSON.stringify(n.ids):null,u=null;n.minBlock!==void 0&&n.minBlock!==null&&(u={},u.min=n.minBlock);let y=u?JSON.stringify(u).replace(/"([^"]+)":/g,"$1:"):null,d=n.tags?JSON.stringify(n.tags).replace(/"(name)":/g,"$1:").replace(/"(values)":/g,"$1:").replace(/"match"/g,"match").replace(/"FUZZY_OR"/g,"FUZZY_OR"):null,a=n.owners?JSON.stringify(n.owners):null,h=n.recipients?JSON.stringify(n.recipients):null,g=n.cursor&&n.cursor!==Le.end?`"${n.cursor}"`:null,B=`first: ${i}`,E="",D="data { size type } owner { address } block { height timestamp }",G="",f="";switch(n.gateway??q.goldsky){case q.arweave:break;case q.goldsky:g||(E="count"),h&&(f=`recipients: ${h}`),D+=" recipient";break}let x=`
|
|
1
|
+
var Jt=Object.create;var Je=Object.defineProperty;var jt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Ht=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty;var Xt=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);var er=(n,i,s,u)=>{if(i&&typeof i=="object"||typeof i=="function")for(let y of Vt(i))!Kt.call(n,y)&&y!==s&&Je(n,y,{get:()=>i[y],enumerable:!(u=jt(i,y))||u.enumerable});return n};var A=(n,i,s)=>(s=n!=null?Jt(Ht(n)):{},er(i||!n||!n.__esModule?Je(s,"default",{value:n,enumerable:!0}):s,n));var T=Xt((Er,Ke)=>{var U=Ke.exports={},J,j;function ve(){throw new Error("setTimeout has not been defined")}function Ue(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?J=setTimeout:J=ve}catch{J=ve}try{typeof clearTimeout=="function"?j=clearTimeout:j=Ue}catch{j=Ue}})();function je(n){if(J===setTimeout)return setTimeout(n,0);if((J===ve||!J)&&setTimeout)return J=setTimeout,setTimeout(n,0);try{return J(n,0)}catch{try{return J.call(null,n,0)}catch{return J.call(this,n,0)}}}function tr(n){if(j===clearTimeout)return clearTimeout(n);if((j===Ue||!j)&&clearTimeout)return j=clearTimeout,clearTimeout(n);try{return j(n)}catch{try{return j.call(null,n)}catch{return j.call(this,n)}}}var V=[],le=!1,ie,Te=-1;function rr(){!le||!ie||(le=!1,ie.length?V=ie.concat(V):Te=-1,V.length&&Ve())}function Ve(){if(!le){var n=je(rr);le=!0;for(var i=V.length;i;){for(ie=V,V=[];++Te<i;)ie&&ie[Te].run();Te=-1,i=V.length}ie=null,le=!1,tr(n)}}U.nextTick=function(n){var i=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)i[s-1]=arguments[s];V.push(new He(n,i)),V.length===1&&!le&&je(Ve)};function He(n,i){this.fun=n,this.array=i}He.prototype.run=function(){this.fun.apply(null,this.array)};U.title="browser";U.browser=!0;U.env={};U.argv=[];U.version="";U.versions={};function H(){}U.on=H;U.addListener=H;U.once=H;U.off=H;U.removeListener=H;U.removeAllListeners=H;U.emit=H;U.prependListener=H;U.prependOnceListener=H;U.listeners=function(n){return[]};U.binding=function(n){throw new Error("process.binding is not supported")};U.cwd=function(){return"/"};U.chdir=function(n){throw new Error("process.chdir is not supported")};U.umask=function(){return 0}});var Vi=A(T(),1);var Rr=A(T());var xr=A(T(),1);var he={},Xe=!1;function nr(){if(Xe)return he;Xe=!0,he.byteLength=h,he.toByteArray=B,he.fromByteArray=G;for(var n=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=0,d=u.length;y<d;++y)n[y]=u[y],i[u.charCodeAt(y)]=y;i[45]=62,i[95]=63;function a(f){var m=f.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var x=f.indexOf("=");x===-1&&(x=m);var L=x===m?0:4-x%4;return[x,L]}function h(f){var m=a(f),x=m[0],L=m[1];return(x+L)*3/4-L}function g(f,m,x){return(m+x)*3/4-x}function B(f){var m,x=a(f),L=x[0],_=x[1],R=new s(g(f,L,_)),F=0,q=_>0?L-4:L,W;for(W=0;W<q;W+=4)m=i[f.charCodeAt(W)]<<18|i[f.charCodeAt(W+1)]<<12|i[f.charCodeAt(W+2)]<<6|i[f.charCodeAt(W+3)],R[F++]=m>>16&255,R[F++]=m>>8&255,R[F++]=m&255;return _===2&&(m=i[f.charCodeAt(W)]<<2|i[f.charCodeAt(W+1)]>>4,R[F++]=m&255),_===1&&(m=i[f.charCodeAt(W)]<<10|i[f.charCodeAt(W+1)]<<4|i[f.charCodeAt(W+2)]>>2,R[F++]=m>>8&255,R[F++]=m&255),R}function E(f){return n[f>>18&63]+n[f>>12&63]+n[f>>6&63]+n[f&63]}function D(f,m,x){for(var L,_=[],R=m;R<x;R+=3)L=(f[R]<<16&16711680)+(f[R+1]<<8&65280)+(f[R+2]&255),_.push(E(L));return _.join("")}function G(f){for(var m,x=f.length,L=x%3,_=[],R=16383,F=0,q=x-L;F<q;F+=R)_.push(D(f,F,F+R>q?q:F+R));return L===1?(m=f[x-1],_.push(n[m>>2]+n[m<<4&63]+"==")):L===2&&(m=(f[x-2]<<8)+f[x-1],_.push(n[m>>10]+n[m>>4&63]+n[m<<2&63]+"=")),_.join("")}return he}var Ae={},et=!1;function ir(){if(et)return Ae;et=!0;return Ae.read=function(n,i,s,u,y){var d,a,h=y*8-u-1,g=(1<<h)-1,B=g>>1,E=-7,D=s?y-1:0,G=s?-1:1,f=n[i+D];for(D+=G,d=f&(1<<-E)-1,f>>=-E,E+=h;E>0;d=d*256+n[i+D],D+=G,E-=8);for(a=d&(1<<-E)-1,d>>=-E,E+=u;E>0;a=a*256+n[i+D],D+=G,E-=8);if(d===0)d=1-B;else{if(d===g)return a?NaN:(f?-1:1)*(1/0);a=a+Math.pow(2,u),d=d-B}return(f?-1:1)*a*Math.pow(2,d-u)},Ae.write=function(n,i,s,u,y,d){var a,h,g,B=d*8-y-1,E=(1<<B)-1,D=E>>1,G=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=u?0:d-1,m=u?1:-1,x=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(h=isNaN(i)?1:0,a=E):(a=Math.floor(Math.log(i)/Math.LN2),i*(g=Math.pow(2,-a))<1&&(a--,g*=2),a+D>=1?i+=G/g:i+=G*Math.pow(2,1-D),i*g>=2&&(a++,g/=2),a+D>=E?(h=0,a=E):a+D>=1?(h=(i*g-1)*Math.pow(2,y),a=a+D):(h=i*Math.pow(2,D-1)*Math.pow(2,y),a=0));y>=8;n[s+f]=h&255,f+=m,h/=256,y-=8);for(a=a<<y|h,B+=y;B>0;n[s+f]=a&255,f+=m,a/=256,B-=8);n[s+f-m]|=x*128},Ae}var oe={},tt=!1;function rt(){if(tt)return oe;tt=!0;let n=nr(),i=ir(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;oe.Buffer=a,oe.SlowBuffer=_,oe.INSPECT_MAX_BYTES=50;let u=2147483647;oe.kMaxLength=u,a.TYPED_ARRAY_SUPPORT=y(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function y(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function d(r){if(r>u)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,a.prototype),e}function a(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return E(r)}return h(r,e,t)}a.poolSize=8192;function h(r,e,t){if(typeof r=="string")return D(r,e);if(ArrayBuffer.isView(r))return f(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Y(r,ArrayBuffer)||r&&Y(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Y(r,SharedArrayBuffer)||r&&Y(r.buffer,SharedArrayBuffer)))return m(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=r.valueOf&&r.valueOf();if(o!=null&&o!==r)return a.from(o,e,t);let c=x(r);if(c)return c;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return a.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}a.from=function(r,e,t){return h(r,e,t)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function g(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function B(r,e,t){return g(r),r<=0?d(r):e!==void 0?typeof t=="string"?d(r).fill(e,t):d(r).fill(e):d(r)}a.alloc=function(r,e,t){return B(r,e,t)};function E(r){return g(r),d(r<0?0:L(r)|0)}a.allocUnsafe=function(r){return E(r)},a.allocUnsafeSlow=function(r){return E(r)};function D(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=R(r,e)|0,o=d(t),c=o.write(r,e);return c!==t&&(o=o.slice(0,c)),o}function G(r){let e=r.length<0?0:L(r.length)|0,t=d(e);for(let o=0;o<e;o+=1)t[o]=r[o]&255;return t}function f(r){if(Y(r,Uint8Array)){let e=new Uint8Array(r);return m(e.buffer,e.byteOffset,e.byteLength)}return G(r)}function m(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let o;return e===void 0&&t===void 0?o=new Uint8Array(r):t===void 0?o=new Uint8Array(r,e):o=new Uint8Array(r,e,t),Object.setPrototypeOf(o,a.prototype),o}function x(r){if(a.isBuffer(r)){let e=L(r.length)|0,t=d(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||be(r.length)?d(0):G(r);if(r.type==="Buffer"&&Array.isArray(r.data))return G(r.data)}function L(r){if(r>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return r|0}function _(r){return+r!=r&&(r=0),a.alloc(+r)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype},a.compare=function(e,t){if(Y(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let o=e.length,c=t.length;for(let l=0,p=Math.min(o,c);l<p;++l)if(e[l]!==t[l]){o=e[l],c=t[l];break}return o<c?-1:c<o?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let o;if(t===void 0)for(t=0,o=0;o<e.length;++o)t+=e[o].length;let c=a.allocUnsafe(t),l=0;for(o=0;o<e.length;++o){let p=e[o];if(Y(p,Uint8Array))l+p.length>c.length?(a.isBuffer(p)||(p=a.from(p)),p.copy(c,l)):Uint8Array.prototype.set.call(c,p,l);else if(a.isBuffer(p))p.copy(c,l);else throw new TypeError('"list" argument must be an Array of Buffers');l+=p.length}return c};function R(r,e){if(a.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Y(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&t===0)return 0;let c=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Pe(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Ye(r).length;default:if(c)return o?-1:Pe(r).length;e=(""+e).toLowerCase(),c=!0}}a.byteLength=R;function F(r,e,t){let o=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Wt(this,e,t);case"utf8":case"utf-8":return ke(this,e,t);case"ascii":return Gt(this,e,t);case"latin1":case"binary":return kt(this,e,t);case"base64":return $t(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ot(this,e,t);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),o=!0}}a.prototype._isBuffer=!0;function q(r,e,t){let o=r[e];r[e]=r[t],r[t]=o}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)q(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)q(this,t,t+3),q(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)q(this,t,t+7),q(this,t+1,t+6),q(this,t+2,t+5),q(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ke(this,0,e):F.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0},a.prototype.inspect=function(){let e="",t=oe.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,o,c,l){if(Y(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),o===void 0&&(o=e?e.length:0),c===void 0&&(c=0),l===void 0&&(l=this.length),t<0||o>e.length||c<0||l>this.length)throw new RangeError("out of range index");if(c>=l&&t>=o)return 0;if(c>=l)return-1;if(t>=o)return 1;if(t>>>=0,o>>>=0,c>>>=0,l>>>=0,this===e)return 0;let p=l-c,w=o-t,P=Math.min(p,w),S=this.slice(c,l),b=e.slice(t,o);for(let C=0;C<P;++C)if(S[C]!==b[C]){p=S[C],w=b[C];break}return p<w?-1:w<p?1:0};function W(r,e,t,o,c){if(r.length===0)return-1;if(typeof t=="string"?(o=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,be(t)&&(t=c?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(c)return-1;t=r.length-1}else if(t<0)if(c)t=0;else return-1;if(typeof e=="string"&&(e=a.from(e,o)),a.isBuffer(e))return e.length===0?-1:Ge(r,e,t,o,c);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?c?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Ge(r,[e],t,o,c);throw new TypeError("val must be string, number or Buffer")}function Ge(r,e,t,o,c){let l=1,p=r.length,w=e.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(r.length<2||e.length<2)return-1;l=2,p/=2,w/=2,t/=2}function P(b,C){return l===1?b[C]:b.readUInt16BE(C*l)}let S;if(c){let b=-1;for(S=t;S<p;S++)if(P(r,S)===P(e,b===-1?0:S-b)){if(b===-1&&(b=S),S-b+1===w)return b*l}else b!==-1&&(S-=S-b),b=-1}else for(t+w>p&&(t=p-w),S=t;S>=0;S--){let b=!0;for(let C=0;C<w;C++)if(P(r,S+C)!==P(e,C)){b=!1;break}if(b)return S}return-1}a.prototype.includes=function(e,t,o){return this.indexOf(e,t,o)!==-1},a.prototype.indexOf=function(e,t,o){return W(this,e,t,o,!0)},a.prototype.lastIndexOf=function(e,t,o){return W(this,e,t,o,!1)};function vt(r,e,t,o){t=Number(t)||0;let c=r.length-t;o?(o=Number(o),o>c&&(o=c)):o=c;let l=e.length;o>l/2&&(o=l/2);let p;for(p=0;p<o;++p){let w=parseInt(e.substr(p*2,2),16);if(be(w))return p;r[t+p]=w}return p}function Ut(r,e,t,o){return we(Pe(e,r.length-t),r,t,o)}function Rt(r,e,t,o){return we(Zt(e),r,t,o)}function Lt(r,e,t,o){return we(Ye(e),r,t,o)}function Nt(r,e,t,o){return we(qt(e,r.length-t),r,t,o)}a.prototype.write=function(e,t,o,c){if(t===void 0)c="utf8",o=this.length,t=0;else if(o===void 0&&typeof t=="string")c=t,o=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(o)?(o=o>>>0,c===void 0&&(c="utf8")):(c=o,o=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let l=this.length-t;if((o===void 0||o>l)&&(o=l),e.length>0&&(o<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");c||(c="utf8");let p=!1;for(;;)switch(c){case"hex":return vt(this,e,t,o);case"utf8":case"utf-8":return Ut(this,e,t,o);case"ascii":case"latin1":case"binary":return Rt(this,e,t,o);case"base64":return Lt(this,e,t,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Nt(this,e,t,o);default:if(p)throw new TypeError("Unknown encoding: "+c);c=(""+c).toLowerCase(),p=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $t(r,e,t){return e===0&&t===r.length?n.fromByteArray(r):n.fromByteArray(r.slice(e,t))}function ke(r,e,t){t=Math.min(r.length,t);let o=[],c=e;for(;c<t;){let l=r[c],p=null,w=l>239?4:l>223?3:l>191?2:1;if(c+w<=t){let P,S,b,C;switch(w){case 1:l<128&&(p=l);break;case 2:P=r[c+1],(P&192)===128&&(C=(l&31)<<6|P&63,C>127&&(p=C));break;case 3:P=r[c+1],S=r[c+2],(P&192)===128&&(S&192)===128&&(C=(l&15)<<12|(P&63)<<6|S&63,C>2047&&(C<55296||C>57343)&&(p=C));break;case 4:P=r[c+1],S=r[c+2],b=r[c+3],(P&192)===128&&(S&192)===128&&(b&192)===128&&(C=(l&15)<<18|(P&63)<<12|(S&63)<<6|b&63,C>65535&&C<1114112&&(p=C))}}p===null?(p=65533,w=1):p>65535&&(p-=65536,o.push(p>>>10&1023|55296),p=56320|p&1023),o.push(p),c+=w}return Mt(o)}let We=4096;function Mt(r){let e=r.length;if(e<=We)return String.fromCharCode.apply(String,r);let t="",o=0;for(;o<e;)t+=String.fromCharCode.apply(String,r.slice(o,o+=We));return t}function Gt(r,e,t){let o="";t=Math.min(r.length,t);for(let c=e;c<t;++c)o+=String.fromCharCode(r[c]&127);return o}function kt(r,e,t){let o="";t=Math.min(r.length,t);for(let c=e;c<t;++c)o+=String.fromCharCode(r[c]);return o}function Wt(r,e,t){let o=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>o)&&(t=o);let c="";for(let l=e;l<t;++l)c+=zt[r[l]];return c}function Ot(r,e,t){let o=r.slice(e,t),c="";for(let l=0;l<o.length-1;l+=2)c+=String.fromCharCode(o[l]+o[l+1]*256);return c}a.prototype.slice=function(e,t){let o=this.length;e=~~e,t=t===void 0?o:~~t,e<0?(e+=o,e<0&&(e=0)):e>o&&(e=o),t<0?(t+=o,t<0&&(t=0)):t>o&&(t=o),t<e&&(t=e);let c=this.subarray(e,t);return Object.setPrototypeOf(c,a.prototype),c};function N(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,o){e=e>>>0,t=t>>>0,o||N(e,t,this.length);let c=this[e],l=1,p=0;for(;++p<t&&(l*=256);)c+=this[e+p]*l;return c},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,o){e=e>>>0,t=t>>>0,o||N(e,t,this.length);let c=this[e+--t],l=1;for(;t>0&&(l*=256);)c+=this[e+--t]*l;return c},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||N(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||N(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||N(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=te(function(e){e=e>>>0,ue(e,"offset");let t=this[e],o=this[e+7];(t===void 0||o===void 0)&&fe(e,this.length-8);let c=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,l=this[++e]+this[++e]*2**8+this[++e]*2**16+o*2**24;return BigInt(c)+(BigInt(l)<<BigInt(32))}),a.prototype.readBigUInt64BE=te(function(e){e=e>>>0,ue(e,"offset");let t=this[e],o=this[e+7];(t===void 0||o===void 0)&&fe(e,this.length-8);let c=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],l=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+o;return(BigInt(c)<<BigInt(32))+BigInt(l)}),a.prototype.readIntLE=function(e,t,o){e=e>>>0,t=t>>>0,o||N(e,t,this.length);let c=this[e],l=1,p=0;for(;++p<t&&(l*=256);)c+=this[e+p]*l;return l*=128,c>=l&&(c-=Math.pow(2,8*t)),c},a.prototype.readIntBE=function(e,t,o){e=e>>>0,t=t>>>0,o||N(e,t,this.length);let c=t,l=1,p=this[e+--c];for(;c>0&&(l*=256);)p+=this[e+--c]*l;return l*=128,p>=l&&(p-=Math.pow(2,8*t)),p},a.prototype.readInt8=function(e,t){return e=e>>>0,t||N(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){e=e>>>0,t||N(e,2,this.length);let o=this[e]|this[e+1]<<8;return o&32768?o|4294901760:o},a.prototype.readInt16BE=function(e,t){e=e>>>0,t||N(e,2,this.length);let o=this[e+1]|this[e]<<8;return o&32768?o|4294901760:o},a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=te(function(e){e=e>>>0,ue(e,"offset");let t=this[e],o=this[e+7];(t===void 0||o===void 0)&&fe(e,this.length-8);let c=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(o<<24);return(BigInt(c)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),a.prototype.readBigInt64BE=te(function(e){e=e>>>0,ue(e,"offset");let t=this[e],o=this[e+7];(t===void 0||o===void 0)&&fe(e,this.length-8);let c=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(c)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+o)}),a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||N(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||N(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||N(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||N(e,8,this.length),i.read(this,e,!1,52,8)};function Q(r,e,t,o,c,l){if(!a.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>c||e<l)throw new RangeError('"value" argument is out of bounds');if(t+o>r.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,o,c){if(e=+e,t=t>>>0,o=o>>>0,!c){let w=Math.pow(2,8*o)-1;Q(this,e,t,o,w,0)}let l=1,p=0;for(this[t]=e&255;++p<o&&(l*=256);)this[t+p]=e/l&255;return t+o},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,o,c){if(e=+e,t=t>>>0,o=o>>>0,!c){let w=Math.pow(2,8*o)-1;Q(this,e,t,o,w,0)}let l=o-1,p=1;for(this[t+l]=e&255;--l>=0&&(p*=256);)this[t+l]=e/p&255;return t+o},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,1,255,0),this[t]=e&255,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Oe(r,e,t,o,c){ze(e,o,c,r,t,7);let l=Number(e&BigInt(4294967295));r[t++]=l,l=l>>8,r[t++]=l,l=l>>8,r[t++]=l,l=l>>8,r[t++]=l;let p=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=p,p=p>>8,r[t++]=p,p=p>>8,r[t++]=p,p=p>>8,r[t++]=p,t}function _e(r,e,t,o,c){ze(e,o,c,r,t,7);let l=Number(e&BigInt(4294967295));r[t+7]=l,l=l>>8,r[t+6]=l,l=l>>8,r[t+5]=l,l=l>>8,r[t+4]=l;let p=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=p,p=p>>8,r[t+2]=p,p=p>>8,r[t+1]=p,p=p>>8,r[t]=p,t+8}a.prototype.writeBigUInt64LE=te(function(e,t=0){return Oe(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=te(function(e,t=0){return _e(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,o,c){if(e=+e,t=t>>>0,!c){let P=Math.pow(2,8*o-1);Q(this,e,t,o,P-1,-P)}let l=0,p=1,w=0;for(this[t]=e&255;++l<o&&(p*=256);)e<0&&w===0&&this[t+l-1]!==0&&(w=1),this[t+l]=(e/p>>0)-w&255;return t+o},a.prototype.writeIntBE=function(e,t,o,c){if(e=+e,t=t>>>0,!c){let P=Math.pow(2,8*o-1);Q(this,e,t,o,P-1,-P)}let l=o-1,p=1,w=0;for(this[t+l]=e&255;--l>=0&&(p*=256);)e<0&&w===0&&this[t+l+1]!==0&&(w=1),this[t+l]=(e/p>>0)-w&255;return t+o},a.prototype.writeInt8=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},a.prototype.writeInt16LE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeInt32LE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,o){return e=+e,t=t>>>0,o||Q(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},a.prototype.writeBigInt64LE=te(function(e,t=0){return Oe(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=te(function(e,t=0){return _e(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Fe(r,e,t,o,c,l){if(t+o>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Qe(r,e,t,o,c){return e=+e,t=t>>>0,c||Fe(r,e,t,4),i.write(r,e,t,o,23,4),t+4}a.prototype.writeFloatLE=function(e,t,o){return Qe(this,e,t,!0,o)},a.prototype.writeFloatBE=function(e,t,o){return Qe(this,e,t,!1,o)};function Ze(r,e,t,o,c){return e=+e,t=t>>>0,c||Fe(r,e,t,8),i.write(r,e,t,o,52,8),t+8}a.prototype.writeDoubleLE=function(e,t,o){return Ze(this,e,t,!0,o)},a.prototype.writeDoubleBE=function(e,t,o){return Ze(this,e,t,!1,o)},a.prototype.copy=function(e,t,o,c){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(o||(o=0),!c&&c!==0&&(c=this.length),t>=e.length&&(t=e.length),t||(t=0),c>0&&c<o&&(c=o),c===o||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(o<0||o>=this.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("sourceEnd out of bounds");c>this.length&&(c=this.length),e.length-t<c-o&&(c=e.length-t+o);let l=c-o;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,o,c):Uint8Array.prototype.set.call(e,this.subarray(o,c),t),l},a.prototype.fill=function(e,t,o,c){if(typeof e=="string"){if(typeof t=="string"?(c=t,t=0,o=this.length):typeof o=="string"&&(c=o,o=this.length),c!==void 0&&typeof c!="string")throw new TypeError("encoding must be a string");if(typeof c=="string"&&!a.isEncoding(c))throw new TypeError("Unknown encoding: "+c);if(e.length===1){let p=e.charCodeAt(0);(c==="utf8"&&p<128||c==="latin1")&&(e=p)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<o)throw new RangeError("Out of range index");if(o<=t)return this;t=t>>>0,o=o===void 0?this.length:o>>>0,e||(e=0);let l;if(typeof e=="number")for(l=t;l<o;++l)this[l]=e;else{let p=a.isBuffer(e)?e:a.from(e,c),w=p.length;if(w===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(l=0;l<o-t;++l)this[l+t]=p[l%w]}return this};let ce={};function De(r,e,t){ce[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(c){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:c,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}De("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),De("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError),De("ERR_OUT_OF_RANGE",function(r,e,t){let o=`The value of "${r}" is out of range.`,c=t;return Number.isInteger(t)&&Math.abs(t)>2**32?c=qe(String(t)):typeof t=="bigint"&&(c=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(c=qe(c)),c+="n"),o+=` It must be ${e}. Received ${c}`,o},RangeError);function qe(r){let e="",t=r.length,o=r[0]==="-"?1:0;for(;t>=o+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function _t(r,e,t){ue(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&fe(e,r.length-(t+1))}function ze(r,e,t,o,c,l){if(r>t||r<e){let p=typeof e=="bigint"?"n":"",w;throw e===0||e===BigInt(0)?w=`>= 0${p} and < 2${p} ** ${(l+1)*8}${p}`:w=`>= -(2${p} ** ${(l+1)*8-1}${p}) and < 2 ** ${(l+1)*8-1}${p}`,new ce.ERR_OUT_OF_RANGE("value",w,r)}_t(o,c,l)}function ue(r,e){if(typeof r!="number")throw new ce.ERR_INVALID_ARG_TYPE(e,"number",r)}function fe(r,e,t){throw Math.floor(r)!==r?(ue(r,t),new ce.ERR_OUT_OF_RANGE("offset","an integer",r)):e<0?new ce.ERR_BUFFER_OUT_OF_BOUNDS:new ce.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${e}`,r)}let Ft=/[^+/0-9A-Za-z-_]/g;function Qt(r){if(r=r.split("=")[0],r=r.trim().replace(Ft,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Pe(r,e){e=e||1/0;let t,o=r.length,c=null,l=[];for(let p=0;p<o;++p){if(t=r.charCodeAt(p),t>55295&&t<57344){if(!c){if(t>56319){(e-=3)>-1&&l.push(239,191,189);continue}else if(p+1===o){(e-=3)>-1&&l.push(239,191,189);continue}c=t;continue}if(t<56320){(e-=3)>-1&&l.push(239,191,189),c=t;continue}t=(c-55296<<10|t-56320)+65536}else c&&(e-=3)>-1&&l.push(239,191,189);if(c=null,t<128){if((e-=1)<0)break;l.push(t)}else if(t<2048){if((e-=2)<0)break;l.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;l.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;l.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return l}function Zt(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function qt(r,e){let t,o,c,l=[];for(let p=0;p<r.length&&!((e-=2)<0);++p)t=r.charCodeAt(p),o=t>>8,c=t%256,l.push(c),l.push(o);return l}function Ye(r){return n.toByteArray(Qt(r))}function we(r,e,t,o){let c;for(c=0;c<o&&!(c+t>=e.length||c>=r.length);++c)e[c+t]=r[c];return c}function Y(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function be(r){return r!==r}let zt=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let o=t*16;for(let c=0;c<16;++c)e[o+c]=r[t]+r[c]}return e}();function te(r){return typeof BigInt>"u"?Yt:r}function Yt(){throw new Error("BigInt not supported")}return oe}var ae=rt();ae.Buffer;ae.SlowBuffer;ae.INSPECT_MAX_BYTES;ae.kMaxLength;var v=ae.Buffer,br=ae.INSPECT_MAX_BYTES,vr=ae.kMaxLength;var Sn=A(T(),1);var fn=A(T(),1);var Wr=A(T(),1);var k={module:"Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",scheduler:"_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA",mu:"fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY",src:{asset:"XYz8buLR5LQdhOOzWuCt9kBjoXHMowouWpXcGm9wdEE",collection:"aHN0YxA7Th1OQdtgv0slWv9LMrvYukvNgWdkotJsML0",collectionActivity:"k8K8WIJb5kXOVvZRFXF5GIZW-7b2NtaTOd6G-E5MF0k",profile:"WBhJpPafkykqZZgTr7TAsz48RKG4vbOEAH4rZ3JxIQ8",zone:"M9G2B9Uvk8VK1pxloESeT4XScguRKSzLyd4as1HFOJ8"},collectionRegistry:"zwKi27GuKS3GOlwL3EhNGH02SJDDAO5Uy43ZJwomhZ4",profileRegistry:"SNy4m-DrqxWl01YqGM4sxI8qCni-58re8uuJLvZPypY"},nt={"application/json":{type:"application/json",serialize:n=>JSON.stringify(n)}},Z={arweave:"arweave.net",goldsky:"arweave-search.goldsky.com"};var I={keys:{access:"Access-Fee",ans110:{title:"Title",description:"Description",topic:"Topic:*",type:"Type",implements:"Implements",license:"License"},assetType:"Asset-Type",banner:"Banner",bootloader:"Bootloader",bootloaderInit:"On-Boot",collectionId:"Collection-Id",collectionName:"Collection-Name",commericalUse:"Commercial-Use",contentType:"Content-Type",creator:"Creator",currency:"Currency",dataModelTraining:"Data-Model-Training",dataProtocol:"Data-Protocol",dateCreated:"Date-Created",derivations:"Derivations",description:"Description",displayName:"Display-Name",handle:"Handle",implements:"Implements",initialOwner:"Initial-Owner",license:"License",name:"Name",paymentAddress:"Payment-Address",paymentMode:"Payment-Mode",profileCreator:"Profile-Creator",profileIndex:"Profile-Index",protocolName:"Protocol-Name",renderWith:"Render-With",thumbnail:"Thumbnail",title:"Title",topic:"Topic",type:"Type",zoneType:"Zone-Type"},values:{document:"Document"}},it={node1:"https://up.arweave.net",node2:"https://turbo.ardrive.io",batchSize:1,chunkSize:75e5,dispatchUploadSize:100*1024};var Hr=A(T(),1);var qr=A(T(),1);function ye(n){return n?/^[a-z0-9_-]{43}$/i.test(n):!1}function Ee(n,i){for(let s=0;s<n.length;s++)if(n[s]&&n[s].name===i)return n[s].value;return null}function ot(n){let i=n.match(/^data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+);base64,/);return i?i[1]:null}function at(n){return n.split(",")[1]}function st(n){let i;if(v.isBuffer(n))i=n.length;else if(typeof n=="string")i=v.byteLength(n,"utf-8");else throw new Error("Input must be a string or a Buffer");return i}function Re(n){let i;return i=n.replace(/\[|\]/g,""),`[[${i}]]`}function ge(n){let i;return i=n.replace(/\[|\]/g,""),i}var X=(...n)=>{console.log("[@permaweb/libs]",...n)};function or(n){return n.replace(/^[a-z]/,i=>i.toUpperCase())}function pe(n){return Array.isArray(n)?n.map(pe):n&&typeof n=="object"?Object.entries(n).reduce((i,[s,u])=>{let y=or(s);return i[y]=ye(u)?u:pe(u),i},{}):n}function ar(n){return n.charAt(0).toLowerCase()+n.slice(1)}function K(n){return Array.isArray(n)?n.map(K):n&&typeof n=="object"?Object.entries(n).reduce((i,[s,u])=>{let y=ar(s);return i[y]=ye(u)?u:K(u),i},{}):n}function O(n,i){let s=n.charAt(0).toUpperCase()+n.slice(1);return{name:`${I.keys.bootloader}-${s}`,value:i}}var sr="https://arweave.net";function de(n){return`${sr}/${n}`}var nn=A(T(),1);var Le={p1:"P1",end:"END"},Ne={default:100};async function z(n){let i=n.paginator?n.paginator:Ne.default,s=[],u=0,y=null;if(n.ids&&!n.ids.length)return{data:s,count:u,nextCursor:y,previousCursor:null};try{let d=ur(n),a=await lr({gateway:n.gateway??Z.goldsky,query:cr(d)});return a?.data?.transactions?.edges?.length?(s=[...a.data.transactions.edges],u=a.data.transactions.count??0,s.length<i||!a.data.transactions.pageInfo.hasNextPage?y=Le.end:y=s[s.length-1].cursor,{data:s,count:u,nextCursor:y,previousCursor:null}):{data:s,count:u,nextCursor:y,previousCursor:null}}catch(d){return console.error(d),{data:s,count:u,nextCursor:y,previousCursor:null}}}async function ct(n,i){let s=1,u=await z(n);if(u&&u.data.length){let y=u.data;for(i&&i(`Count: ${u.count}`),i&&i(`Pages to fetch: ${Math.ceil(u.count/(n.paginator??Ne.default))}`),i&&i(`Page ${s} fetched`);u.nextCursor&&u.nextCursor!==Le.end;)s+=1,i&&i(`Fetching page ${s}...`),u=await z({...n,cursor:u.nextCursor}),u&&u.data.length&&(y=y.concat(u.data));return i&&i("All pages fetched!"),y}else i&&i("No data found");return null}function cr(n){let i={query:`query { ${n} }`};return JSON.stringify(i)}function ur(n){let i=n.paginator?n.paginator:Ne.default,s=n.ids?JSON.stringify(n.ids):null,u=null;n.minBlock!==void 0&&n.minBlock!==null&&(u={},u.min=n.minBlock);let y=u?JSON.stringify(u).replace(/"([^"]+)":/g,"$1:"):null,d=n.tags?JSON.stringify(n.tags).replace(/"(name)":/g,"$1:").replace(/"(values)":/g,"$1:").replace(/"match"/g,"match").replace(/"FUZZY_OR"/g,"FUZZY_OR"):null,a=n.owners?JSON.stringify(n.owners):null,h=n.recipients?JSON.stringify(n.recipients):null,g=n.cursor&&n.cursor!==Le.end?`"${n.cursor}"`:null,B=`first: ${i}`,E="",D="data { size type } owner { address } block { height timestamp }",G="",f="";switch(n.gateway??Z.goldsky){case Z.arweave:break;case Z.goldsky:g||(E="count"),h&&(f=`recipients: ${h}`),D+=" recipient";break}let x=`
|
|
2
2
|
transactions(
|
|
3
3
|
ids: ${s},
|
|
4
4
|
tags: ${d},
|
|
@@ -24,7 +24,7 @@ var jt=Object.create;var je=Object.defineProperty;var Vt=Object.getOwnPropertyDe
|
|
|
24
24
|
${D}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
}`;return n.queryKey&&(x=`${n.queryKey}: ${x}`),x}async function lr(n){try{return await(await fetch(`https://${n.gateway}/graphql`,{method:"POST",headers:{"Content-Type":"application/json"},body:n.query})).json()}catch(i){throw i}}var yn=q.goldsky;async function ut(n,i){let s=[{name:"Authority",value:k.mu}];i.tags&&i.tags.length>0&&i.tags.forEach(u=>s.push(u)),console.log(i.data);try{let u=await n.ao.spawn({module:i.module,scheduler:i.scheduler,signer:n.signer,tags:s,data:i.data});return X(`Process ID: ${u}`),u}catch(u){throw console.log(u),new Error(u.message??"Error spawning process")}}function lt(n){return async i=>await re(n,i)}async function re(n,i){try{let s=[{name:"Action",value:i.action}];i.tags&&s.push(...i.tags);let u=i.useRawData?i.data:JSON.stringify(i.data);return await n.ao.message({process:i.processId,signer:n.signer,tags:s,data:u})}catch(s){throw new Error(s)}}function pt(n){return async i=>await ee(n,i)}async function ee(n,i){try{let s=[{name:"Action",value:i.action}];i.tags&&s.push(...i.tags);let u;if(typeof i.data=="object")u=JSON.stringify(i.data||{});else if(typeof i.data=="string"){try{JSON.parse(i.data)}catch(d){throw console.error(d),new Error("Invalid JSON data")}u=i.data}let y=await n.ao.dryrun({process:i.processId,tags:s,data:u});if(y.Messages&&y.Messages.length){if(y.Messages[0].Data)return JSON.parse(y.Messages[0].Data);if(y.Messages[0].Tags)return y.Messages[0].Tags.reduce((d,a)=>(d[a.name]=a.value,d),{})}}catch(s){throw new Error(s.message??"Error dryrunning process")}}async function pr(n,i){try{let{Messages:s}=await n.ao.result({message:i.messageId,process:i.processId});if(s&&s.length){let u={};return s.forEach(y=>{let d=Ee(y.Tags,"Action")||i.action,a=null,h=y.Data;if(h)try{a=JSON.parse(h)}catch{a=h}let g=Ee(y.Tags,"Status"),B=Ee(y.Tags,"Message");u[d]={id:i.messageId,status:g,message:B,data:a}}),u}else return null}catch(s){console.error(s)}}async function yt(n,i){let s=null;if(i.evalSrc?s=i.evalSrc:i.evalTxId&&(s=await yr(i.evalTxId)),s)try{let u=await re(n,{processId:i.processId,action:"Eval",data:s,tags:i.evalTags||null,useRawData:!0});return X(`Eval: ${u}`),await pr(n,{processId:i.processId,messageId:u,action:"Eval"})}catch(u){throw new Error(u.message??"Error sending process eval")}return null}function dt(n){return async(i,s)=>{try{let u={module:i.module||k.module,scheduler:i.scheduler||k.scheduler};i.data&&(u.data=i.data),i.tags&&(u.tags=i.tags),s&&s("Spawning process...");let y=await ut(n,u);if(i.evalTxId||i.evalSrc){s&&s("Process retrieved!"),s&&s("Sending eval...");try{await yt(n,{processId:y,evalTxId:i.evalTxId||null,evalSrc:i.evalSrc||null,evalTags:i.evalTags})&&s&&s("Eval complete")}catch(d){throw new Error(d.message??"Error creating process")}}return y}catch(u){throw new Error(u.message??"Error creating process")}}}async function ne(n,i,s){try{let u={module:i.module||k.module,scheduler:i.scheduler||k.scheduler};i.data&&(u.data=i.data),i.tags&&(u.tags=i.tags),s&&s("Spawning process...");let y=await ut(n,u);if(i.evalTxId||i.evalSrc){s&&s("Process retrieved!"),s&&s("Sending eval...");try{await yt(n,{processId:y,evalTxId:i.evalTxId||null,evalSrc:i.evalSrc||null,evalTags:i.evalTags})&&s&&s("Eval complete")}catch(d){throw new Error(d.message??"Error creating process")}}return y}catch(u){throw new Error(u.message??"Error creating process")}}async function yr(n){try{return await(await fetch(de(n))).text()}catch(i){throw new Error(i)}}var In=A(T(),1);function ft(n){return async i=>{if(ye(i))return i;if(!n.arweave)throw new Error("Must initialize with Arweave in order to create transactions");try{return await ht(n,{data:i})}catch(s){throw new Error(s.message??"Error resolving transaction")}}}async function se(n,i){if(ye(i))return i;if(!n.arweave)throw new Error("Must initialize with Arweave in order to create transactions");try{return await ht(n,{data:i})}catch(s){throw new Error(s.message??"Error resolving transaction")}}async function ht(n,i){let s=null,u=null,y=null;if(typeof i.data=="string"&&(s=v.from(at(i.data),"base64"),u=ot(i.data),y=st(s)),i.data instanceof File&&(s=new Uint8Array(await i.data.arrayBuffer()),u=i.data.type,y=i.data.size),s&&u&&y)if(y<Number(it.dispatchUploadSize))try{let d=await n.arweave.createTransaction({data:s},"use_wallet");return d.addTag(I.keys.contentType,u),i.tags&&i.tags.length>0&&i.tags.forEach(h=>d.addTag(h.name,h.value)),(await global.window.arweaveWallet.dispatch(d)).id}catch(d){throw new Error(d.message??"Error dispatching transaction")}else throw new Error("Paid uploads are not yet supported");else throw new Error("Error preparing transaction data")}var Gn=A(T(),1);var Ln=A(T(),1);var ki=A(T(),1);var Jn=A(T(),1);function Ie(n){return async(i,s)=>{let u=gr(i);if(u)throw new Error(u);let y=nt[i.contentType]?.serialize(i.data)??i.data,d=hr(i);try{return await ne(n,{tags:d,data:y},s?h=>s(h):void 0)}catch(a){throw new Error(a.message??"Error creating asset")}}}async function $e(n,i,s){try{let u=K(await ee(n,{processId:i,action:"Info"}));if(s?.useGateway){let y=await z({gateway:q.goldsky,ids:[i],tags:null,owners:null,cursor:null});return{...y?.data?.[0]?Be(y.data[0]):{},...u}}return{id:i,...u}}catch(u){throw new Error(u.message||"Error fetching atomic asset")}}function gt(n){return async(i,s)=>await $e(n,i,s)}async function mt(n){try{let i=await z({gateway:q.arweave,ids:n??null,tags:null,owners:null,cursor:null});return i&&i.data.length?i.data.map(s=>Be(s)):null}catch(i){throw new Error(i)}}function Be(n){let i={id:n.node.id,owner:n.node.owner.address};for(let s of n.node.tags){let u=s.name,d=(u.startsWith(`${I.keys.bootloader}-`)?u.slice(`${I.keys.bootloader}-`.length):u).split("-").map((h,g)=>g===0?h.toLowerCase():h.charAt(0).toUpperCase()+h.slice(1).toLowerCase()).join(""),a;try{a=JSON.parse(s.value)}catch{a=s.value.toString()}i[d]=a}return i}function hr(n){let i=[{name:I.keys.bootloaderInit,value:n.src??k.src.asset},{name:I.keys.creator,value:n.creator},{name:I.keys.assetType,value:n.assetType},{name:I.keys.contentType,value:n.contentType},{name:I.keys.implements,value:"ANS-110"},{name:I.keys.dateCreated,value:new Date().getTime().toString()},O("Name",n.name),O("Description",n.description),O("Topics",JSON.stringify(n.topics)),O("Ticker","ATOMIC"),O("Denomination",n.denomination?.toString()??"1"),O("TotalSupply",n.supply?.toString()??"1"),O("Transferable",n.transferable?.toString()??"true"),O("Creator",n.creator)];if(n.metadata)for(let s in n.metadata)i.push(O(pe(s),n.metadata[s].toString()));return n.tags&&n.tags.forEach(s=>i.push(s)),i}function gr(n){if(typeof n!="object"||n===null)return"The provided arguments are invalid or empty.";let i=["name","description","topics","creator","data","contentType","assetType"];for(let s of i)if(!(s in n))return`Missing field '${s}'`;return typeof n.name!="string"||n.name.trim()===""?"Name is required":typeof n.description!="string"?"The description must be a valid string":!Array.isArray(n.topics)||n.topics.length===0?"Topics are required":typeof n.creator!="string"||n.creator.trim()===""?"Creator is required":n.data===void 0||n.data===null?"Data field is required":typeof n.contentType!="string"||n.contentType.trim()===""?"Content type must be a non-empty string":typeof n.assetType!="string"||n.assetType.trim()===""?"Type must be a non-empty string":"supply"in n&&(typeof n.supply!="number"||n.supply<=0)?"Supply must be a positive number":"denomination"in n&&(typeof n.denomination!="number"||n.denomination<=0)?"Denomination must be a positive number":"transferable"in n&&typeof n.transferable!="boolean"?"Transferable must be a boolean value":"metadata"in n&&typeof n.metadata!="object"?"Metadata must be an object":"tags"in n&&(!Array.isArray(n.tags)||n.tags.some(s=>typeof s!="object"))?"Tags must be an array of objects":"src"in n&&typeof n.src!="string"?"Source must be a valid string":null}var ai=A(T(),1);var mr="eXCtpVbcd_jZ0dmU2PZ8focaKxBGECBQ8wMib7sIVPo",me="lJovHqM9hwNjHV5JoY9NGWtt0WD-5D4gOqNL2VWW5jk";function wt(n){return async(i,s)=>{if(!n.signer)throw new Error("No signer provided");let u=new Date().getTime().toString(),y=[{name:I.keys.contentType,value:"application/json"},{name:I.keys.creator,value:i.creator},{name:I.keys.ans110.title,value:ge(i.title)},{name:I.keys.ans110.description,value:ge(i.description)},{name:I.keys.ans110.type,value:I.values.document},{name:I.keys.dateCreated,value:u},{name:I.keys.name,value:ge(i.title)},{name:"Action",value:"Add-Collection"}],d=null,a=null;try{d=i.banner?await se(n,i.thumbnail):me,a=i.banner?await se(n,i.banner):mr,i.thumbnail&&y.push({name:I.keys.thumbnail,value:d}),i.banner&&y.push({name:I.keys.banner,value:a})}catch(B){console.error(B)}let h=await fetch(de(k.src.collection));if(!h.ok)throw new Error("Unable to fetch process src");let g=await h.text();g=g.replace(/'<NAME>'/g,Re(i.title)),g=g.replace(/'<DESCRIPTION>'/g,Re(i.description)),g=g.replace(/<CREATOR>/g,i.creator),g=g.replace(/<THUMBNAIL>/g,d||me),g=g.replace(/<BANNER>/g,a||me),g=g.replace(/<DATECREATED>/g,u),g=g.replace(/<LASTUPDATE>/g,u);try{let B=await ne(n,{tags:y},s?E=>s(E):void 0);if(X("Sending eval message to collection..."),s&&s("Sending eval message to collection..."),await n.ao.message({process:B,signer:n.signer,tags:[{name:"Action",value:"Eval"}],data:g}),!i.skipRegistry){X("Sending collection to registry..."),s&&s("Sending collection to registry...");let E=[{name:"Action",value:"Add-Collection"},{name:"CollectionId",value:B},{name:"Name",value:ge(i.title)},{name:"Creator",value:i.creator},{name:"DateCreated",value:u}];a&&E.push({name:"Banner",value:a}),d&&E.push({name:"Thumbnail",value:d}),await n.ao.message({process:k.collectionRegistry,signer:n.signer,tags:E})}if(!i.skipActivity){X("Creating collection activity process..."),s&&s("Creating collection activity process...");let E=[{name:"CollectionId",value:B},{name:"DateCreated",value:u},{name:"On-Boot",value:k.src.collectionActivity}],D=await ne(n,{tags:E},s?G=>s(G):void 0);X("Adding activity to collection process..."),s&&s("Adding activity to collection process..."),await n.ao.message({process:B,signer:n.signer,tags:[{name:"Action",value:"Eval"}],data:`ActivityProcess = '${D}'`})}return B}catch(B){throw new Error(B.message??"Error creating collection")}}}function Tt(n){return async i=>await re(n,{processId:i.creator,action:"Run-Action",tags:[{name:"ForwardTo",value:i.collectionId},{name:"ForwardAction",value:"Update-Assets"}],data:{Target:i.collectionId,Action:"Update-Assets",Input:JSON.stringify({AssetIds:i.assetIds,UpdateType:i.updateType})}})}function At(n){return async i=>{let s=await ee(n,{processId:i,action:"Info"});return{...{id:i,title:s.Name,description:s.Description,creator:s.Creator,dateCreated:s.DateCreated,thumbnail:s.Thumbnail??me,banner:s.Banner??me},assetIds:s.Assets}}}function Et(n){return async i=>{let s=i.creator?"Get-Collections-By-User":"Get-Collections",u=await ee(n,{processId:k.collectionRegistry,action:s,tags:i.creator?[{name:"Creator",value:i.creator}]:null});return u&&u.Collections&&u.Collections.length?u.Collections.map(d=>({id:d.Id,title:d.Name.replace(/\[|\]/g,""),description:d.Description,creator:d.Creator,dateCreated:d.DateCreated,banner:d.Banner,thumbnail:d.Thumbnail})):null}}var hi=A(T(),1);function It(n){let i=Ie(n);return async(s,u)=>{let y=s.tags?s.tags:[];y.push({name:"Data-Source",value:s.parentId}),y.push({name:"Root-Source",value:s.rootId??s.parentId});let d={name:`Comment on ${s.parentId}`,description:`Comment on ${s.parentId}`,topics:["comment"],creator:s.creator,data:s.content,contentType:"text/plain",assetType:"comment",tags:y};return i(d,u)}}function Bt(n){return async i=>{try{let s=await $e(n,i,{useGateway:!0}),u=s?.dataSource,y=s?.rootSource;if(!u||!y)throw new Error("dataSource and rootSource must be present on a comment");return{content:await Ct(i),parentId:u,rootId:y}}catch(s){throw new Error(s.message??"Error getting comment")}}}function xt(n){return async i=>{if(!i.parentId&&!i.rootId)throw new Error("Must provide either parentId or rootId");let s=[];i.parentId&&s.push({name:"Data-Source",values:[i.parentId??""]}),i.rootId&&s.push({name:"Root-Source",values:[i.rootId??""]});let u=await z({gateway:q.goldsky,ids:null,tags:s,owners:null,cursor:null}),y=[];u&&u.data.length&&(y=u.data.map(a=>Be(a)));let d=[];for(let a of y){let h=a?.dataSource,g=a?.rootSource;if(!h||!g)throw new Error("dataSource and rootSource must be present on a comment");d.push({id:a.id,content:await Ct(a.id),parentId:h,rootId:g})}return d}}async function Ct(n){try{return await(await fetch(de(n))).text()}catch(i){throw new Error(i.message??"Error getting comment data")}}var Ni=A(T(),1);var Bi=A(T(),1);function xe(n){return async(i,s)=>{try{let u=[{name:I.keys.bootloaderInit,value:k.src.zone}];return i.tags&&i.tags.length&&i.tags.forEach(d=>u.push(d)),await ne(n,{data:i.data,tags:u},s?d=>s(d):void 0)}catch(u){throw new Error(u.message??"Error creating zone")}}}function Ce(n){return async(i,s)=>{try{let u=Object.entries(i).map(([d,a])=>({key:d,value:a}));return await re(n,{processId:s,action:"Zone-Update",data:u})}catch(u){throw new Error(u)}}}function St(n){return async(i,s)=>{try{return await re(n,{processId:s,action:"Zone-Append",tags:[{name:"Path",value:i.path}],data:i.data})}catch(u){throw new Error(u)}}}function Se(n){return async i=>{try{let s=await ee(n,{processId:i,action:"Info"});return K(s)}catch(s){throw new Error(s)}}}function Dt(n){let i=xe(n);return async(s,u)=>{let y=null,d=[{name:I.keys.dataProtocol,value:"Zone"},{name:I.keys.zoneType,value:"User"}],a=async h=>{let g=h.toLowerCase();if(s[g])try{let B=await se(n,s[g]);d.push(O(h,B))}catch(B){u?u(`Failed to resolve ${h}: ${B.message}`):console.error(B)}};d.push(O("Username",s.username)),d.push(O("DisplayName",s.displayName)),d.push(O("Description",s.description)),await Promise.all([a("Thumbnail"),a("Banner")]);try{y=await i({tags:d},u)}catch(h){throw new Error(h.message??"Error creating profile")}return y}}function Pt(n){let i=Ce(n);return async(s,u,y)=>{if(u){let d={Username:s.username,DisplayName:s.displayName,Description:s.description};if(s.thumbnail)try{d.Thumbnail=await se(n,s.thumbnail)}catch(a){y&&y(`Failed to resolve thumbnail: ${a.message}`)}if(s.banner)try{d.Banner=await se(n,s.banner)}catch(a){y&&y(`Failed to resolve banner: ${a.message}`)}try{return await i(d,u)}catch(a){throw new Error(a.message??"Error creating profile")}}else throw new Error("No profile provided")}}function Me(n){let i=Se(n);return async s=>{try{let u=await i(s);return{id:s,...u.store,assets:u.assets}}catch(u){throw new Error(u.message??"Error fetching profile")}}}function bt(n){let i=Me(n);return async s=>{try{let u=await z({gateway:q.goldsky,tags:[{name:I.keys.dataProtocol,values:["Zone"]},{name:I.keys.zoneType,values:["User"]}],owners:[s]});return u?.data?.length>0?(u.data.sort((y,d)=>{let a=y.node.block?.timestamp??0;return(d.node.block?.timestamp??0)-a}),await i(u.data[0].node.id)):{id:null}}catch(u){throw new Error(u.message??"Error fetching profile")}}}globalThis.Buffer||(globalThis.Buffer=v);function Tr(n){return{createZone:xe(n),updateZone:Ce(n),addToZone:St(n),getZone:Se(n),createProfile:Dt(n),updateProfile:Pt(n),getProfileById:Me(n),getProfileByWalletAddress:bt(n),createAtomicAsset:Ie(n),getAtomicAsset:gt(n),getAtomicAssets:mt,createComment:It(n),getComment:Bt(n),getComments:xt(n),createCollection:wt(n),updateCollectionAssets:Tt(n),getCollection:At(n),getCollections:Et(n),resolveTransaction:ft(n),getGQLData:z,getAggregatedGQLData:ct,createProcess:dt(n),readProcess:pt(n),sendMessage:lt(n),mapFromProcessCase:K,mapToProcessCase:pe}}var ji={init:Tr};export{ji as default};
|
|
27
|
+
}`;return n.queryKey&&(x=`${n.queryKey}: ${x}`),x}async function lr(n){try{return await(await fetch(`https://${n.gateway}/graphql`,{method:"POST",headers:{"Content-Type":"application/json"},body:n.query})).json()}catch(i){throw i}}var yn=Z.goldsky;async function ut(n,i){let s=[{name:"Authority",value:k.mu}];i.tags&&i.tags.length>0&&i.tags.forEach(u=>s.push(u)),console.log(i.data);try{let u=await n.ao.spawn({module:i.module,scheduler:i.scheduler,signer:n.signer,tags:s,data:i.data});return X(`Process ID: ${u}`),u}catch(u){throw console.log(u),new Error(u.message??"Error spawning process")}}function lt(n){return async i=>await re(n,i)}async function re(n,i){try{let s=[{name:"Action",value:i.action}];i.tags&&s.push(...i.tags);let u=i.useRawData?i.data:JSON.stringify(i.data);return await n.ao.message({process:i.processId,signer:n.signer,tags:s,data:u})}catch(s){throw new Error(s)}}function pt(n){return async i=>await ee(n,i)}async function ee(n,i){try{let s=[{name:"Action",value:i.action}];i.tags&&s.push(...i.tags);let u;if(typeof i.data=="object")u=JSON.stringify(i.data||{});else if(typeof i.data=="string"){try{JSON.parse(i.data)}catch(d){throw console.error(d),new Error("Invalid JSON data")}u=i.data}let y=await n.ao.dryrun({process:i.processId,tags:s,data:u});if(y.Messages&&y.Messages.length){if(y.Messages[0].Data)return JSON.parse(y.Messages[0].Data);if(y.Messages[0].Tags)return y.Messages[0].Tags.reduce((d,a)=>(d[a.name]=a.value,d),{})}}catch(s){throw new Error(s.message??"Error dryrunning process")}}async function pr(n,i){try{let{Messages:s}=await n.ao.result({message:i.messageId,process:i.processId});if(s&&s.length){let u={};return s.forEach(y=>{let d=Ee(y.Tags,"Action")||i.action,a=null,h=y.Data;if(h)try{a=JSON.parse(h)}catch{a=h}let g=Ee(y.Tags,"Status"),B=Ee(y.Tags,"Message");u[d]={id:i.messageId,status:g,message:B,data:a}}),u}else return null}catch(s){console.error(s)}}async function yt(n,i){let s=null;if(i.evalSrc?s=i.evalSrc:i.evalTxId&&(s=await yr(i.evalTxId)),s)try{let u=await re(n,{processId:i.processId,action:"Eval",data:s,tags:i.evalTags||null,useRawData:!0});return X(`Eval: ${u}`),await pr(n,{processId:i.processId,messageId:u,action:"Eval"})}catch(u){throw new Error(u.message??"Error sending process eval")}return null}function dt(n){return async(i,s)=>{try{let u={module:i.module||k.module,scheduler:i.scheduler||k.scheduler};i.data&&(u.data=i.data),i.tags&&(u.tags=i.tags),s&&s("Spawning process...");let y=await ut(n,u);if(i.evalTxId||i.evalSrc){s&&s("Process retrieved!"),s&&s("Sending eval...");try{await yt(n,{processId:y,evalTxId:i.evalTxId||null,evalSrc:i.evalSrc||null,evalTags:i.evalTags})&&s&&s("Eval complete")}catch(d){throw new Error(d.message??"Error creating process")}}return y}catch(u){throw new Error(u.message??"Error creating process")}}}async function ne(n,i,s){try{let u={module:i.module||k.module,scheduler:i.scheduler||k.scheduler};i.data&&(u.data=i.data),i.tags&&(u.tags=i.tags),s&&s("Spawning process...");let y=await ut(n,u);if(i.evalTxId||i.evalSrc){s&&s("Process retrieved!"),s&&s("Sending eval...");try{await yt(n,{processId:y,evalTxId:i.evalTxId||null,evalSrc:i.evalSrc||null,evalTags:i.evalTags})&&s&&s("Eval complete")}catch(d){throw new Error(d.message??"Error creating process")}}return y}catch(u){throw new Error(u.message??"Error creating process")}}async function yr(n){try{return await(await fetch(de(n))).text()}catch(i){throw new Error(i)}}var In=A(T(),1);function ft(n){return async i=>{if(ye(i))return i;if(!n.arweave)throw new Error("Must initialize with Arweave in order to create transactions");try{return await ht(n,{data:i})}catch(s){throw new Error(s.message??"Error resolving transaction")}}}async function se(n,i){if(ye(i))return i;if(!n.arweave)throw new Error("Must initialize with Arweave in order to create transactions");try{return await ht(n,{data:i})}catch(s){throw new Error(s.message??"Error resolving transaction")}}async function ht(n,i){let s=null,u=null,y=null;if(typeof i.data=="string"&&(s=v.from(at(i.data),"base64"),u=ot(i.data),y=st(s)),i.data instanceof File&&(s=new Uint8Array(await i.data.arrayBuffer()),u=i.data.type,y=i.data.size),s&&u&&y)if(y<Number(it.dispatchUploadSize))try{let d=await n.arweave.createTransaction({data:s},"use_wallet");return d.addTag(I.keys.contentType,u),i.tags&&i.tags.length>0&&i.tags.forEach(h=>d.addTag(h.name,h.value)),(await global.window.arweaveWallet.dispatch(d)).id}catch(d){throw new Error(d.message??"Error dispatching transaction")}else throw new Error("Paid uploads are not yet supported");else throw new Error("Error preparing transaction data")}var Gn=A(T(),1);var Ln=A(T(),1);var ki=A(T(),1);var Vn=A(T(),1);function Ie(n){return async(i,s)=>{let u=gr(i);if(u)throw new Error(u);let y=nt[i.contentType]?.serialize(i.data)??i.data,d=hr(i);try{return await ne(n,{tags:d,data:y},s?h=>s(h):void 0)}catch(a){throw new Error(a.message??"Error creating asset")}}}async function $e(n,i,s){try{let u=K(await ee(n,{processId:i,action:"Info"}));if(s?.useGateway){let y=await z({gateway:Z.goldsky,ids:[i],tags:null,owners:null,cursor:null});return{...y?.data?.[0]?Be(y.data[0]):{},...u}}return{id:i,...u}}catch(u){throw new Error(u.message||"Error fetching atomic asset")}}function gt(n){return async(i,s)=>await $e(n,i,s)}async function mt(n){try{let i=await z({gateway:Z.arweave,ids:n??null,tags:null,owners:null,cursor:null});return i&&i.data.length?i.data.map(s=>Be(s)):null}catch(i){throw new Error(i)}}function Be(n){let i={id:n.node.id,owner:n.node.owner.address};for(let s of n.node.tags){let u=s.name,d=(u.startsWith(`${I.keys.bootloader}-`)?u.slice(`${I.keys.bootloader}-`.length):u).split("-").map((h,g)=>g===0?h.toLowerCase():h.charAt(0).toUpperCase()+h.slice(1).toLowerCase()).join(""),a;try{a=JSON.parse(s.value)}catch{a=s.value.toString()}i[d]=a}return i}function hr(n){let i=[{name:I.keys.bootloaderInit,value:n.src??k.src.asset},{name:I.keys.creator,value:n.creator},{name:I.keys.assetType,value:n.assetType},{name:I.keys.contentType,value:n.contentType},{name:I.keys.implements,value:"ANS-110"},{name:I.keys.dateCreated,value:new Date().getTime().toString()},O("Name",n.name),O("Description",n.description),O("Topics",JSON.stringify(n.topics)),O("Ticker","ATOMIC"),O("Denomination",n.denomination?.toString()??"1"),O("TotalSupply",n.supply?.toString()??"1"),O("Transferable",n.transferable?.toString()??"true"),O("Creator",n.creator)];if(n.metadata)for(let s in n.metadata)i.push(O(pe(s),n.metadata[s].toString()));return n.tags&&n.tags.forEach(s=>i.push(s)),i}function gr(n){if(typeof n!="object"||n===null)return"The provided arguments are invalid or empty.";let i=["name","description","topics","creator","data","contentType","assetType"];for(let s of i)if(!(s in n))return`Missing field '${s}'`;return typeof n.name!="string"||n.name.trim()===""?"Name is required":typeof n.description!="string"?"The description must be a valid string":!Array.isArray(n.topics)||n.topics.length===0?"Topics are required":typeof n.creator!="string"||n.creator.trim()===""?"Creator is required":n.data===void 0||n.data===null?"Data field is required":typeof n.contentType!="string"||n.contentType.trim()===""?"Content type must be a non-empty string":typeof n.assetType!="string"||n.assetType.trim()===""?"Type must be a non-empty string":"supply"in n&&(typeof n.supply!="number"||n.supply<=0)?"Supply must be a positive number":"denomination"in n&&(typeof n.denomination!="number"||n.denomination<=0)?"Denomination must be a positive number":"transferable"in n&&typeof n.transferable!="boolean"?"Transferable must be a boolean value":"metadata"in n&&typeof n.metadata!="object"?"Metadata must be an object":"tags"in n&&(!Array.isArray(n.tags)||n.tags.some(s=>typeof s!="object"))?"Tags must be an array of objects":"src"in n&&typeof n.src!="string"?"Source must be a valid string":null}var ai=A(T(),1);var mr="eXCtpVbcd_jZ0dmU2PZ8focaKxBGECBQ8wMib7sIVPo",me="lJovHqM9hwNjHV5JoY9NGWtt0WD-5D4gOqNL2VWW5jk";function wt(n){return async(i,s)=>{if(!n.signer)throw new Error("No signer provided");let u=new Date().getTime().toString(),y=[{name:I.keys.contentType,value:"application/json"},{name:I.keys.creator,value:i.creator},{name:I.keys.ans110.title,value:ge(i.title)},{name:I.keys.ans110.description,value:ge(i.description)},{name:I.keys.ans110.type,value:I.values.document},{name:I.keys.dateCreated,value:u},{name:I.keys.name,value:ge(i.title)},{name:"Action",value:"Add-Collection"}],d=null,a=null;try{d=i.banner?await se(n,i.thumbnail):me,a=i.banner?await se(n,i.banner):mr,i.thumbnail&&y.push({name:I.keys.thumbnail,value:d}),i.banner&&y.push({name:I.keys.banner,value:a})}catch(B){console.error(B)}let h=await fetch(de(k.src.collection));if(!h.ok)throw new Error("Unable to fetch process src");let g=await h.text();g=g.replace(/'<NAME>'/g,Re(i.title)),g=g.replace(/'<DESCRIPTION>'/g,Re(i.description)),g=g.replace(/<CREATOR>/g,i.creator),g=g.replace(/<THUMBNAIL>/g,d||me),g=g.replace(/<BANNER>/g,a||me),g=g.replace(/<DATECREATED>/g,u),g=g.replace(/<LASTUPDATE>/g,u);try{let B=await ne(n,{tags:y},s?E=>s(E):void 0);if(X("Sending eval message to collection..."),s&&s("Sending eval message to collection..."),await n.ao.message({process:B,signer:n.signer,tags:[{name:"Action",value:"Eval"}],data:g}),!i.skipRegistry){X("Sending collection to registry..."),s&&s("Sending collection to registry...");let E=[{name:"Action",value:"Add-Collection"},{name:"CollectionId",value:B},{name:"Name",value:ge(i.title)},{name:"Creator",value:i.creator},{name:"DateCreated",value:u}];a&&E.push({name:"Banner",value:a}),d&&E.push({name:"Thumbnail",value:d}),await n.ao.message({process:k.collectionRegistry,signer:n.signer,tags:E})}if(!i.skipActivity){X("Creating collection activity process..."),s&&s("Creating collection activity process...");let E=[{name:"CollectionId",value:B},{name:"DateCreated",value:u},{name:"On-Boot",value:k.src.collectionActivity}],D=await ne(n,{tags:E},s?G=>s(G):void 0);X("Adding activity to collection process..."),s&&s("Adding activity to collection process..."),await n.ao.message({process:B,signer:n.signer,tags:[{name:"Action",value:"Eval"}],data:`ActivityProcess = '${D}'`})}return B}catch(B){throw new Error(B.message??"Error creating collection")}}}function Tt(n){return async i=>await re(n,{processId:i.creator,action:"Run-Action",tags:[{name:"ForwardTo",value:i.collectionId},{name:"ForwardAction",value:"Update-Assets"}],data:{Target:i.collectionId,Action:"Update-Assets",Input:JSON.stringify({AssetIds:i.assetIds,UpdateType:i.updateType})}})}function At(n){return async i=>{let s=await ee(n,{processId:i,action:"Info"});return{...{id:i,title:s.Name,description:s.Description,creator:s.Creator,dateCreated:s.DateCreated,thumbnail:s.Thumbnail??me,banner:s.Banner??me},assetIds:s.Assets}}}function Et(n){return async i=>{let s=i.creator?"Get-Collections-By-User":"Get-Collections",u=await ee(n,{processId:k.collectionRegistry,action:s,tags:i.creator?[{name:"Creator",value:i.creator}]:null});return u&&u.Collections&&u.Collections.length?u.Collections.map(d=>({id:d.Id,title:d.Name.replace(/\[|\]/g,""),description:d.Description,creator:d.Creator,dateCreated:d.DateCreated,banner:d.Banner,thumbnail:d.Thumbnail})):null}}var hi=A(T(),1);function It(n){let i=Ie(n);return async(s,u)=>{let y=s.tags?s.tags:[];y.push({name:"Data-Source",value:s.parentId}),y.push({name:"Root-Source",value:s.rootId??s.parentId});let d={name:`Comment on ${s.parentId}`,description:`Comment on ${s.parentId}`,topics:["comment"],creator:s.creator,data:s.content,contentType:"text/plain",assetType:"comment",tags:y};return i(d,u)}}function Bt(n){return async i=>{try{let s=await $e(n,i,{useGateway:!0}),u=s?.dataSource,y=s?.rootSource;if(!u||!y)throw new Error("dataSource and rootSource must be present on a comment");return{content:await Ct(i),parentId:u,rootId:y}}catch(s){throw new Error(s.message??"Error getting comment")}}}function xt(n){return async i=>{if(!i.parentId&&!i.rootId)throw new Error("Must provide either parentId or rootId");let s=[];i.parentId&&s.push({name:"Data-Source",values:[i.parentId??""]}),i.rootId&&s.push({name:"Root-Source",values:[i.rootId??""]});let u=await z({gateway:Z.goldsky,ids:null,tags:s,owners:null,cursor:null}),y=[];u&&u.data.length&&(y=u.data.map(a=>Be(a)));let d=[];for(let a of y){let h=a?.dataSource,g=a?.rootSource;if(!h||!g)throw new Error("dataSource and rootSource must be present on a comment");d.push({id:a.id,content:await Ct(a.id),parentId:h,rootId:g})}return d}}async function Ct(n){try{return await(await fetch(de(n))).text()}catch(i){throw new Error(i.message??"Error getting comment data")}}var Ni=A(T(),1);var Bi=A(T(),1);function xe(n){return async(i,s)=>{try{let u=[{name:I.keys.bootloaderInit,value:k.src.zone}];return i.tags&&i.tags.length&&i.tags.forEach(d=>u.push(d)),await ne(n,{data:i.data,tags:u},s?d=>s(d):void 0)}catch(u){throw new Error(u.message??"Error creating zone")}}}function Ce(n){return async(i,s)=>{try{let u=Object.entries(i).map(([d,a])=>({key:d,value:a}));return await re(n,{processId:s,action:"Zone-Update",data:u})}catch(u){throw new Error(u)}}}function St(n){return async(i,s)=>{try{return await re(n,{processId:s,action:"Zone-Append",tags:[{name:"Path",value:i.path}],data:i.data})}catch(u){throw new Error(u)}}}function Se(n){return async i=>{try{let s=await ee(n,{processId:i,action:"Info"});return K(s)}catch(s){throw new Error(s)}}}function Dt(n){let i=xe(n);return async(s,u)=>{let y=null,d=[{name:I.keys.dataProtocol,value:"Zone"},{name:I.keys.zoneType,value:"User"}],a=async h=>{let g=h.toLowerCase();if(s[g])try{let B=await se(n,s[g]);d.push(O(h,B))}catch(B){u?u(`Failed to resolve ${h}: ${B.message}`):console.error(B)}};d.push(O("Username",s.username)),d.push(O("DisplayName",s.displayName)),d.push(O("Description",s.description)),await Promise.all([a("Thumbnail"),a("Banner")]);try{y=await i({tags:d},u)}catch(h){throw new Error(h.message??"Error creating profile")}return y}}function Pt(n){let i=Ce(n);return async(s,u,y)=>{if(u){let d={Username:s.username,DisplayName:s.displayName,Description:s.description};if(s.thumbnail)try{d.Thumbnail=await se(n,s.thumbnail)}catch(a){y&&y(`Failed to resolve thumbnail: ${a.message}`)}if(s.banner)try{d.Banner=await se(n,s.banner)}catch(a){y&&y(`Failed to resolve banner: ${a.message}`)}try{return await i(d,u)}catch(a){throw new Error(a.message??"Error creating profile")}}else throw new Error("No profile provided")}}function Me(n){let i=Se(n);return async s=>{try{let u=await i(s);return{id:s,...u.store,assets:u.assets}}catch(u){throw new Error(u.message??"Error fetching profile")}}}function bt(n){let i=Me(n);return async s=>{try{let u=await z({gateway:Z.goldsky,tags:[{name:I.keys.dataProtocol,values:["Zone"]},{name:I.keys.zoneType,values:["User"]}],owners:[s]});return u?.data?.length>0?(u.data.sort((y,d)=>{let a=y.node.block?.timestamp??0;return(d.node.block?.timestamp??0)-a}),await i(u.data[0].node.id)):{id:null}}catch(u){throw new Error(u.message??"Error fetching profile")}}}globalThis.Buffer||(globalThis.Buffer=v);function Tr(n){return{createZone:xe(n),updateZone:Ce(n),addToZone:St(n),getZone:Se(n),createProfile:Dt(n),updateProfile:Pt(n),getProfileById:Me(n),getProfileByWalletAddress:bt(n),createAtomicAsset:Ie(n),getAtomicAsset:gt(n),getAtomicAssets:mt,createComment:It(n),getComment:Bt(n),getComments:xt(n),createCollection:wt(n),updateCollectionAssets:Tt(n),getCollection:At(n),getCollections:Et(n),resolveTransaction:ft(n),getGQLData:z,getAggregatedGQLData:ct,createProcess:dt(n),readProcess:pt(n),sendMessage:lt(n),mapFromProcessCase:K,mapToProcessCase:pe}}var Ji={init:Tr};export{Ji as default};
|
|
28
28
|
/*! Bundled license information:
|
|
29
29
|
|
|
30
30
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|