@permaweb/libs 0.0.24 → 0.0.26

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.
Files changed (55) hide show
  1. package/dist/index.cjs +8 -7
  2. package/dist/index.cjs.map +3 -3
  3. package/dist/index.esm.js +7 -6
  4. package/dist/index.esm.js.map +3 -3
  5. package/dist/index.js +8 -7
  6. package/dist/index.js.map +3 -3
  7. package/dist/types/common/gql.d.ts +2 -1
  8. package/dist/types/helpers/config.d.ts +1 -0
  9. package/dist/types/helpers/types.d.ts +4 -3
  10. package/dist/types/index.d.ts +2 -0
  11. package/dist/types/services/collections.d.ts +1 -0
  12. package/package.json +3 -2
  13. package/dist/bundle.esm.js +0 -1
  14. package/dist/common/ao.d.ts +0 -24
  15. package/dist/common/ao.js +0 -326
  16. package/dist/common/ao.js.map +0 -1
  17. package/dist/common/arweave.d.ts +0 -7
  18. package/dist/common/arweave.js +0 -62
  19. package/dist/common/arweave.js.map +0 -1
  20. package/dist/common/gql.d.ts +0 -3
  21. package/dist/common/gql.js +0 -176
  22. package/dist/common/gql.js.map +0 -1
  23. package/dist/common/index.d.ts +0 -3
  24. package/dist/common/index.js +0 -4
  25. package/dist/common/index.js.map +0 -1
  26. package/dist/helpers/config.d.ts +0 -67
  27. package/dist/helpers/config.js +0 -68
  28. package/dist/helpers/config.js.map +0 -1
  29. package/dist/helpers/endpoints.d.ts +0 -3
  30. package/dist/helpers/endpoints.js +0 -17
  31. package/dist/helpers/endpoints.js.map +0 -1
  32. package/dist/helpers/index.d.ts +0 -4
  33. package/dist/helpers/index.js +0 -5
  34. package/dist/helpers/index.js.map +0 -1
  35. package/dist/helpers/types.d.ts +0 -184
  36. package/dist/helpers/types.js +0 -2
  37. package/dist/helpers/types.js.map +0 -1
  38. package/dist/helpers/utils.d.ts +0 -37
  39. package/dist/helpers/utils.js +0 -245
  40. package/dist/helpers/utils.js.map +0 -1
  41. package/dist/index.cjs.js +0 -153
  42. package/dist/index.cjs.js.map +0 -7
  43. package/dist/index.d.ts +0 -3
  44. package/dist/services/assets.d.ts +0 -5
  45. package/dist/services/assets.js +0 -277
  46. package/dist/services/assets.js.map +0 -1
  47. package/dist/services/index.d.ts +0 -3
  48. package/dist/services/index.js +0 -4
  49. package/dist/services/index.js.map +0 -1
  50. package/dist/services/profiles.d.ts +0 -5
  51. package/dist/services/profiles.js +0 -146
  52. package/dist/services/profiles.js.map +0 -1
  53. package/dist/services/zones.d.ts +0 -10
  54. package/dist/services/zones.js +0 -78
  55. package/dist/services/zones.js.map +0 -1
package/dist/index.esm.js CHANGED
@@ -1,12 +1,13 @@
1
- var Ft=Object.create;var Se=Object.defineProperty;var Ut=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var vt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var ee=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Lt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Rt(e))!Nt.call(r,i)&&i!==t&&Se(r,i,{get:()=>e[i],enumerable:!(n=Ut(e,i))||n.enumerable});return r};var f=(r,e,t)=>(t=r!=null?Ft(vt(r)):{},Lt(e||!r||!r.__esModule?Se(t,"default",{value:r,enumerable:!0}):t,r));var d=ee((Nr,Ue)=>{var m=Ue.exports={},S,b;function ue(){throw new Error("setTimeout has not been defined")}function le(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?S=setTimeout:S=ue}catch{S=ue}try{typeof clearTimeout=="function"?b=clearTimeout:b=le}catch{b=le}})();function be(r){if(S===setTimeout)return setTimeout(r,0);if((S===ue||!S)&&setTimeout)return S=setTimeout,setTimeout(r,0);try{return S(r,0)}catch{try{return S.call(null,r,0)}catch{return S.call(this,r,0)}}}function $t(r){if(b===clearTimeout)return clearTimeout(r);if((b===le||!b)&&clearTimeout)return b=clearTimeout,clearTimeout(r);try{return b(r)}catch{try{return b.call(null,r)}catch{return b.call(this,r)}}}var N=[],Q=!1,W,te=-1;function Mt(){!Q||!W||(Q=!1,W.length?N=W.concat(N):te=-1,N.length&&Pe())}function Pe(){if(!Q){var r=be(Mt);Q=!0;for(var e=N.length;e;){for(W=N,N=[];++te<e;)W&&W[te].run();te=-1,e=N.length}W=null,Q=!1,$t(r)}}m.nextTick=function(r){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];N.push(new Fe(r,e)),N.length===1&&!Q&&be(Pe)};function Fe(r,e){this.fun=r,this.array=e}Fe.prototype.run=function(){this.fun.apply(null,this.array)};m.title="browser";m.browser=!0;m.env={};m.argv=[];m.version="";m.versions={};function L(){}m.on=L;m.addListener=L;m.once=L;m.off=L;m.removeListener=L;m.removeAllListeners=L;m.emit=L;m.prependListener=L;m.prependOnceListener=L;m.listeners=function(r){return[]};m.binding=function(r){throw new Error("process.binding is not supported")};m.cwd=function(){return"/"};m.chdir=function(r){throw new Error("process.chdir is not supported")};m.umask=function(){return 0}});var Ne=ee(re=>{"use strict";var $r=f(d());re.byteLength=Gt;re.toByteArray=Ot;re.fromByteArray=qt;var P=[],E=[],kt=typeof Uint8Array<"u"?Uint8Array:Array,pe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(O=0,Re=pe.length;O<Re;++O)P[O]=pe[O],E[pe.charCodeAt(O)]=O;var O,Re;E[45]=62;E[95]=63;function ve(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function Gt(r){var e=ve(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Wt(r,e,t){return(e+t)*3/4-t}function Ot(r){var e,t=ve(r),n=t[0],i=t[1],o=new kt(Wt(r,n,i)),a=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)e=E[r.charCodeAt(u)]<<18|E[r.charCodeAt(u+1)]<<12|E[r.charCodeAt(u+2)]<<6|E[r.charCodeAt(u+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=E[r.charCodeAt(u)]<<2|E[r.charCodeAt(u+1)]>>4,o[a++]=e&255),i===1&&(e=E[r.charCodeAt(u)]<<10|E[r.charCodeAt(u+1)]<<4|E[r.charCodeAt(u+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function _t(r){return P[r>>18&63]+P[r>>12&63]+P[r>>6&63]+P[r&63]}function Qt(r,e,t){for(var n,i=[],o=e;o<t;o+=3)n=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),i.push(_t(n));return i.join("")}function qt(r){for(var e,t=r.length,n=t%3,i=[],o=16383,a=0,c=t-n;a<c;a+=o)i.push(Qt(r,a,a+o>c?c:a+o));return n===1?(e=r[t-1],i.push(P[e>>2]+P[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(P[e>>10]+P[e>>4&63]+P[e<<2&63]+"=")),i.join("")}});var Le=ee(ye=>{var kr=f(d());ye.read=function(r,e,t,n,i){var o,a,c=i*8-n-1,u=(1<<c)-1,l=u>>1,p=-7,y=t?i-1:0,C=t?-1:1,D=r[e+y];for(y+=C,o=D&(1<<-p)-1,D>>=-p,p+=c;p>0;o=o*256+r[e+y],y+=C,p-=8);for(a=o&(1<<-p)-1,o>>=-p,p+=n;p>0;a=a*256+r[e+y],y+=C,p-=8);if(o===0)o=1-l;else{if(o===u)return a?NaN:(D?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-l}return(D?-1:1)*a*Math.pow(2,o-n)};ye.write=function(r,e,t,n,i,o){var a,c,u,l=o*8-i-1,p=(1<<l)-1,y=p>>1,C=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=n?0:o-1,ce=n?1:-1,Pt=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,a=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+y>=1?e+=C/u:e+=C*Math.pow(2,1-y),e*u>=2&&(a++,u/=2),a+y>=p?(c=0,a=p):a+y>=1?(c=(e*u-1)*Math.pow(2,i),a=a+y):(c=e*Math.pow(2,y-1)*Math.pow(2,i),a=0));i>=8;r[t+D]=c&255,D+=ce,c/=256,i-=8);for(a=a<<i|c,l+=i;l>0;r[t+D]=a&255,D+=ce,a/=256,l-=8);r[t+D-ce]|=Pt*128}});var Ke=ee(j=>{"use strict";var Or=f(d());var fe=Ne(),Z=Le(),$e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;j.Buffer=s;j.SlowBuffer=Ht;j.INSPECT_MAX_BYTES=50;var ne=2147483647;j.kMaxLength=ne;s.TYPED_ARRAY_SUPPORT=Zt();!s.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 Zt(){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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function $(r){if(r>ne)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,s.prototype),e}function s(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 ge(r)}return We(r,e,t)}s.poolSize=8192;function We(r,e,t){if(typeof r=="string")return jt(r,e);if(ArrayBuffer.isView(r))return Vt(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(F(r,ArrayBuffer)||r&&F(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(F(r,SharedArrayBuffer)||r&&F(r.buffer,SharedArrayBuffer)))return he(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return s.from(n,e,t);let i=Yt(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return s.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)}s.from=function(r,e,t){return We(r,e,t)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function Oe(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 zt(r,e,t){return Oe(r),r<=0?$(r):e!==void 0?typeof t=="string"?$(r).fill(e,t):$(r).fill(e):$(r)}s.alloc=function(r,e,t){return zt(r,e,t)};function ge(r){return Oe(r),$(r<0?0:we(r)|0)}s.allocUnsafe=function(r){return ge(r)};s.allocUnsafeSlow=function(r){return ge(r)};function jt(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=_e(r,e)|0,n=$(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}function de(r){let e=r.length<0?0:we(r.length)|0,t=$(e);for(let n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Vt(r){if(F(r,Uint8Array)){let e=new Uint8Array(r);return he(e.buffer,e.byteOffset,e.byteLength)}return de(r)}function he(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 n;return e===void 0&&t===void 0?n=new Uint8Array(r):t===void 0?n=new Uint8Array(r,e):n=new Uint8Array(r,e,t),Object.setPrototypeOf(n,s.prototype),n}function Yt(r){if(s.isBuffer(r)){let e=we(r.length)|0,t=$(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||xe(r.length)?$(0):de(r);if(r.type==="Buffer"&&Array.isArray(r.data))return de(r.data)}function we(r){if(r>=ne)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ne.toString(16)+" bytes");return r|0}function Ht(r){return+r!=r&&(r=0),s.alloc(+r)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype};s.compare=function(e,t){if(F(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let o=0,a=Math.min(n,i);o<a;++o)if(e[o]!==t[o]){n=e[o],i=t[o];break}return n<i?-1:i<n?1:0};s.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}};s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let i=s.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){let a=e[n];if(F(a,Uint8Array))o+a.length>i.length?(s.isBuffer(a)||(a=s.from(a)),a.copy(i,o)):Uint8Array.prototype.set.call(i,a,o);else if(s.isBuffer(a))a.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return i};function _e(r,e){if(s.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||F(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,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return me(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Je(r).length;default:if(i)return n?-1:me(r).length;e=(""+e).toLowerCase(),i=!0}}s.byteLength=_e;function Jt(r,e,t){let n=!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 sr(this,e,t);case"utf8":case"utf-8":return qe(this,e,t);case"ascii":return or(this,e,t);case"latin1":case"binary":return ar(this,e,t);case"base64":return nr(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return cr(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function _(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}s.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)_(this,t,t+1);return this};s.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)_(this,t,t+3),_(this,t+1,t+2);return this};s.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)_(this,t,t+7),_(this,t+1,t+6),_(this,t+2,t+5),_(this,t+3,t+4);return this};s.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?qe(this,0,e):Jt.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:s.compare(this,e)===0};s.prototype.inspect=function(){let e="",t=j.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};$e&&(s.prototype[$e]=s.prototype.inspect);s.prototype.compare=function(e,t,n,i,o){if(F(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.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),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),t<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=n)return 0;if(i>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;let a=o-i,c=n-t,u=Math.min(a,c),l=this.slice(i,o),p=e.slice(t,n);for(let y=0;y<u;++y)if(l[y]!==p[y]){a=l[y],c=p[y];break}return a<c?-1:c<a?1:0};function Qe(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,xe(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),s.isBuffer(e))return e.length===0?-1:Me(r,e,t,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Me(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function Me(r,e,t,n,i){let o=1,a=r.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;o=2,a/=2,c/=2,t/=2}function u(p,y){return o===1?p[y]:p.readUInt16BE(y*o)}let l;if(i){let p=-1;for(l=t;l<a;l++)if(u(r,l)===u(e,p===-1?0:l-p)){if(p===-1&&(p=l),l-p+1===c)return p*o}else p!==-1&&(l-=l-p),p=-1}else for(t+c>a&&(t=a-c),l=t;l>=0;l--){let p=!0;for(let y=0;y<c;y++)if(u(r,l+y)!==u(e,y)){p=!1;break}if(p)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};s.prototype.indexOf=function(e,t,n){return Qe(this,e,t,n,!0)};s.prototype.lastIndexOf=function(e,t,n){return Qe(this,e,t,n,!1)};function Kt(r,e,t,n){t=Number(t)||0;let i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let o=e.length;n>o/2&&(n=o/2);let a;for(a=0;a<n;++a){let c=parseInt(e.substr(a*2,2),16);if(xe(c))return a;r[t+a]=c}return a}function Xt(r,e,t,n){return ie(me(e,r.length-t),r,t,n)}function er(r,e,t,n){return ie(yr(e),r,t,n)}function tr(r,e,t,n){return ie(Je(e),r,t,n)}function rr(r,e,t,n){return ie(fr(e,r.length-t),r,t,n)}s.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"hex":return Kt(this,e,t,n);case"utf8":case"utf-8":return Xt(this,e,t,n);case"ascii":case"latin1":case"binary":return er(this,e,t,n);case"base64":return tr(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rr(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function nr(r,e,t){return e===0&&t===r.length?fe.fromByteArray(r):fe.fromByteArray(r.slice(e,t))}function qe(r,e,t){t=Math.min(r.length,t);let n=[],i=e;for(;i<t;){let o=r[i],a=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=t){let u,l,p,y;switch(c){case 1:o<128&&(a=o);break;case 2:u=r[i+1],(u&192)===128&&(y=(o&31)<<6|u&63,y>127&&(a=y));break;case 3:u=r[i+1],l=r[i+2],(u&192)===128&&(l&192)===128&&(y=(o&15)<<12|(u&63)<<6|l&63,y>2047&&(y<55296||y>57343)&&(a=y));break;case 4:u=r[i+1],l=r[i+2],p=r[i+3],(u&192)===128&&(l&192)===128&&(p&192)===128&&(y=(o&15)<<18|(u&63)<<12|(l&63)<<6|p&63,y>65535&&y<1114112&&(a=y))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=c}return ir(n)}var ke=4096;function ir(r){let e=r.length;if(e<=ke)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=ke));return t}function or(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function ar(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function sr(r,e,t){let n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);let i="";for(let o=e;o<t;++o)i+=dr[r[o]];return i}function cr(r,e,t){let n=r.slice(e,t),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let i=this.subarray(e,t);return Object.setPrototypeOf(i,s.prototype),i};function g(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")}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||g(e,t,this.length);let i=this[e],o=1,a=0;for(;++a<t&&(o*=256);)i+=this[e+a]*o;return i};s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||g(e,t,this.length);let i=this[e+--t],o=1;for(;t>0&&(o*=256);)i+=this[e+--t]*o;return i};s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e=e>>>0,t||g(e,1,this.length),this[e]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||g(e,2,this.length),this[e]|this[e+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||g(e,2,this.length),this[e]<<8|this[e+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||g(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||g(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};s.prototype.readBigUInt64LE=M(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let i=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});s.prototype.readBigUInt64BE=M(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)});s.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||g(e,t,this.length);let i=this[e],o=1,a=0;for(;++a<t&&(o*=256);)i+=this[e+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i};s.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||g(e,t,this.length);let i=t,o=1,a=this[e+--i];for(;i>0&&(o*=256);)a+=this[e+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*t)),a};s.prototype.readInt8=function(e,t){return e=e>>>0,t||g(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};s.prototype.readInt16LE=function(e,t){e=e>>>0,t||g(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(e,t){e=e>>>0,t||g(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(e,t){return e=e>>>0,t||g(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};s.prototype.readInt32BE=function(e,t){return e=e>>>0,t||g(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};s.prototype.readBigInt64LE=M(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});s.prototype.readBigInt64BE=M(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let i=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});s.prototype.readFloatLE=function(e,t){return e=e>>>0,t||g(e,4,this.length),Z.read(this,e,!0,23,4)};s.prototype.readFloatBE=function(e,t){return e=e>>>0,t||g(e,4,this.length),Z.read(this,e,!1,23,4)};s.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||g(e,8,this.length),Z.read(this,e,!0,52,8)};s.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||g(e,8,this.length),Z.read(this,e,!1,52,8)};function x(r,e,t,n,i,o){if(!s.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;x(this,e,t,n,c,0)}let o=1,a=0;for(this[t]=e&255;++a<n&&(o*=256);)this[t+a]=e/o&255;return t+n};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;x(this,e,t,n,c,0)}let o=n-1,a=1;for(this[t+o]=e&255;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,1,255,0),this[t]=e&255,t+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||x(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};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||x(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 Ze(r,e,t,n,i){He(e,n,i,r,t,7);let o=Number(e&BigInt(4294967295));r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a,t}function ze(r,e,t,n,i){He(e,n,i,r,t,7);let o=Number(e&BigInt(4294967295));r[t+7]=o,o=o>>8,r[t+6]=o,o=o>>8,r[t+5]=o,o=o>>8,r[t+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=a,a=a>>8,r[t+2]=a,a=a>>8,r[t+1]=a,a=a>>8,r[t]=a,t+8}s.prototype.writeBigUInt64LE=M(function(e,t=0){return Ze(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeBigUInt64BE=M(function(e,t=0){return ze(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let u=Math.pow(2,8*n-1);x(this,e,t,n,u-1,-u)}let o=0,a=1,c=0;for(this[t]=e&255;++o<n&&(a*=256);)e<0&&c===0&&this[t+o-1]!==0&&(c=1),this[t+o]=(e/a>>0)-c&255;return t+n};s.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let u=Math.pow(2,8*n-1);x(this,e,t,n,u-1,-u)}let o=n-1,a=1,c=0;for(this[t+o]=e&255;--o>=0&&(a*=256);)e<0&&c===0&&this[t+o+1]!==0&&(c=1),this[t+o]=(e/a>>0)-c&255;return t+n};s.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};s.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};s.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};s.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||x(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};s.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||x(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};s.prototype.writeBigInt64LE=M(function(e,t=0){return Ze(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});s.prototype.writeBigInt64BE=M(function(e,t=0){return ze(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function je(r,e,t,n,i,o){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Ve(r,e,t,n,i){return e=+e,t=t>>>0,i||je(r,e,t,4,34028234663852886e22,-34028234663852886e22),Z.write(r,e,t,n,23,4),t+4}s.prototype.writeFloatLE=function(e,t,n){return Ve(this,e,t,!0,n)};s.prototype.writeFloatBE=function(e,t,n){return Ve(this,e,t,!1,n)};function Ye(r,e,t,n,i){return e=+e,t=t>>>0,i||je(r,e,t,8,17976931348623157e292,-17976931348623157e292),Z.write(r,e,t,n,52,8),t+8}s.prototype.writeDoubleLE=function(e,t,n){return Ye(this,e,t,!0,n)};s.prototype.writeDoubleBE=function(e,t,n){return Ye(this,e,t,!1,n)};s.prototype.copy=function(e,t,n,i){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);let o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),o};s.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let a=e.charCodeAt(0);(i==="utf8"&&a<128||i==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let o;if(typeof e=="number")for(o=t;o<n;++o)this[o]=e;else{let a=s.isBuffer(e)?e:s.from(e,i),c=a.length;if(c===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=a[o%c]}return this};var q={};function Te(r,e,t){q[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(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}Te("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Te("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);Te("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=Ge(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Ge(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Ge(r){let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function ur(r,e,t){z(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&J(e,r.length-(t+1))}function He(r,e,t,n,i,o){if(r>t||r<e){let a=typeof e=="bigint"?"n":"",c;throw o>3?e===0||e===BigInt(0)?c=`>= 0${a} and < 2${a} ** ${(o+1)*8}${a}`:c=`>= -(2${a} ** ${(o+1)*8-1}${a}) and < 2 ** ${(o+1)*8-1}${a}`:c=`>= ${e}${a} and <= ${t}${a}`,new q.ERR_OUT_OF_RANGE("value",c,r)}ur(n,i,o)}function z(r,e){if(typeof r!="number")throw new q.ERR_INVALID_ARG_TYPE(e,"number",r)}function J(r,e,t){throw Math.floor(r)!==r?(z(r,t),new q.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new q.ERR_BUFFER_OUT_OF_BOUNDS:new q.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var lr=/[^+/0-9A-Za-z-_]/g;function pr(r){if(r=r.split("=")[0],r=r.trim().replace(lr,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function me(r,e){e=e||1/0;let t,n=r.length,i=null,o=[];for(let a=0;a<n;++a){if(t=r.charCodeAt(a),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function yr(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function fr(r,e){let t,n,i,o=[];for(let a=0;a<r.length&&!((e-=2)<0);++a)t=r.charCodeAt(a),n=t>>8,i=t%256,o.push(i),o.push(n);return o}function Je(r){return fe.toByteArray(pr(r))}function ie(r,e,t,n){let i;for(i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function F(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function xe(r){return r!==r}var dr=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)e[n+i]=r[t]+r[i]}return e}();function M(r){return typeof BigInt>"u"?hr:r}function hr(){throw new Error("BigInt not supported")}});var ai=f(d(),1),bt=f(Ke(),1);var Jr=f(d(),1);var Qr=f(d(),1),w={module:"Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",scheduler:"_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA",mu:"fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY",src:{asset:"XYz8buLR5LQdhOOzWuCt9kBjoXHMowouWpXcGm9wdEE",collection:"2ZDuM2VUCN8WHoAKOOjiH4_7Apq0ZHKnTWdLppxCdGY",profile:"WBhJpPafkykqZZgTr7TAsz48RKG4vbOEAH4rZ3JxIQ8",zone:"M9G2B9Uvk8VK1pxloESeT4XScguRKSzLyd4as1HFOJ8"},collectionRegistry:"TFWDmf8a3_nw43GCm_CuYlYoylHAjCcFGbgHfDaGcsg",profileRegistry:"SNy4m-DrqxWl01YqGM4sxI8qCni-58re8uuJLvZPypY"},Xe={"application/json":{type:"application/json",serialize:r=>JSON.stringify(r)}},A={arweave:"arweave.net",goldsky:"arweave-search.goldsky.com"};var h={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"}},et={node1:"https://up.arweave.net",node2:"https://turbo.ardrive.io",batchSize:1,chunkSize:75e5,dispatchUploadSize:100*1024};var Yr=f(d(),1);var zr=f(d(),1);function Y(r){return r?/^[a-z0-9_-]{43}$/i.test(r):!1}function oe(r,e){for(let t=0;t<r.length;t++)if(r[t]&&r[t].name===e)return r[t].value;return null}function tt(r){let e=r.match(/^data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+);base64,/);return e?e[1]:null}function rt(r){return r.split(",")[1]}function nt(r){let e;if(Buffer.isBuffer(r))e=r.length;else if(typeof r=="string")e=Buffer.byteLength(r,"utf-8");else throw new Error("Input must be a string or a Buffer");return e}function Ee(r){let e;return e=r.replace(/\[|\]/g,""),`[[${e}]]`}function K(r){let e;return e=r.replace(/\[|\]/g,""),e}var T=(...r)=>{console.log("[@permaweb/libs]",...r)};function mr(r){return r.replace(/^[a-z]/,e=>e.toUpperCase())}function V(r){return Array.isArray(r)?r.map(V):r&&typeof r=="object"?Object.entries(r).reduce((e,[t,n])=>{let i=mr(t);return e[i]=Y(n)?n:V(n),e},{}):r}function gr(r){return r.charAt(0).toLowerCase()+r.slice(1)}function U(r){return Array.isArray(r)?r.map(U):r&&typeof r=="object"?Object.entries(r).reduce((e,[t,n])=>{let i=gr(t);return e[i]=Y(n)?n:U(n),e},{}):r}function I(r,e){let t=r.charAt(0).toUpperCase()+r.slice(1);return{name:`${h.keys.bootloader}-${t}`,value:e}}var wr="https://arweave.net";function H(r){return`${wr}/${r}`}var Hr=f(d(),1);var mn=f(d(),1);var pn=f(d(),1);var on=f(d(),1);var it={p1:"P1",end:"END"},ot={default:100};async function R(r){let e=r.paginator?r.paginator:ot.default,t=[],n=0,i=null;if(r.ids&&!r.ids.length)return{data:t,count:n,nextCursor:i,previousCursor:null};try{let o=Er(r),a=await Ar({gateway:r.gateway,query:xr(o)});return a.data.transactions.edges.length?(t=[...a.data.transactions.edges],n=a.data.transactions.count??0,t.length<e||!a.data.transactions.pageInfo.hasNextPage?i=it.end:i=t[t.length-1].cursor,{data:t,count:n,nextCursor:i,previousCursor:null}):{data:t,count:n,nextCursor:i,previousCursor:null}}catch(o){return console.error(o),{data:t,count:n,nextCursor:i,previousCursor:null}}}function xr(r){let e={query:`query { ${r} }`};return JSON.stringify(e)}function Er(r){let e=r.paginator?r.paginator:ot.default,t=r.ids?JSON.stringify(r.ids):null,n=null;r.minBlock!==void 0&&r.minBlock!==null&&(n={},n.min=r.minBlock);let i=n?JSON.stringify(n).replace(/"([^"]+)":/g,"$1:"):null,o=r.tags?JSON.stringify(r.tags).replace(/"(name)":/g,"$1:").replace(/"(values)":/g,"$1:").replace(/"FUZZY_OR"/g,"FUZZY_OR"):null,a=r.owners?JSON.stringify(r.owners):null,c=r.cursor&&r.cursor!==it.end?`"${r.cursor}"`:null,u=`first: ${e}`,l="",p="data { size type } owner { address } block { height timestamp }",y="";switch(r.gateway){case A.arweave:break;case A.goldsky:l="count";break}let C=`
1
+ var Ft=Object.create;var ve=Object.defineProperty;var Ut=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var Nt=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var re=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var $t=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Rt(e))!Lt.call(r,i)&&i!==t&&ve(r,i,{get:()=>e[i],enumerable:!(n=Ut(e,i))||n.enumerable});return r};var f=(r,e,t)=>(t=r!=null?Ft(Nt(r)):{},$t(e||!r||!r.__esModule?ve(t,"default",{value:r,enumerable:!0}):t,r));var d=re((Lr,Ne)=>{var g=Ne.exports={},b,P;function le(){throw new Error("setTimeout has not been defined")}function pe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?b=setTimeout:b=le}catch{b=le}try{typeof clearTimeout=="function"?P=clearTimeout:P=pe}catch{P=pe}})();function Fe(r){if(b===setTimeout)return setTimeout(r,0);if((b===le||!b)&&setTimeout)return b=setTimeout,setTimeout(r,0);try{return b(r,0)}catch{try{return b.call(null,r,0)}catch{return b.call(this,r,0)}}}function Mt(r){if(P===clearTimeout)return clearTimeout(r);if((P===pe||!P)&&clearTimeout)return P=clearTimeout,clearTimeout(r);try{return P(r)}catch{try{return P.call(null,r)}catch{return P.call(this,r)}}}var N=[],Q=!1,O,ne=-1;function Gt(){!Q||!O||(Q=!1,O.length?N=O.concat(N):ne=-1,N.length&&Ue())}function Ue(){if(!Q){var r=Fe(Gt);Q=!0;for(var e=N.length;e;){for(O=N,N=[];++ne<e;)O&&O[ne].run();ne=-1,e=N.length}O=null,Q=!1,Mt(r)}}g.nextTick=function(r){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];N.push(new Re(r,e)),N.length===1&&!Q&&Fe(Ue)};function Re(r,e){this.fun=r,this.array=e}Re.prototype.run=function(){this.fun.apply(null,this.array)};g.title="browser";g.browser=!0;g.env={};g.argv=[];g.version="";g.versions={};function L(){}g.on=L;g.addListener=L;g.once=L;g.off=L;g.removeListener=L;g.removeAllListeners=L;g.emit=L;g.prependListener=L;g.prependOnceListener=L;g.listeners=function(r){return[]};g.binding=function(r){throw new Error("process.binding is not supported")};g.cwd=function(){return"/"};g.chdir=function(r){throw new Error("process.chdir is not supported")};g.umask=function(){return 0}});var Me=re(ie=>{"use strict";var Mr=f(d());ie.byteLength=Ot;ie.toByteArray=_t;ie.fromByteArray=qt;var v=[],I=[],Wt=typeof Uint8Array<"u"?Uint8Array:Array,ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(k=0,Le=ye.length;k<Le;++k)v[k]=ye[k],I[ye.charCodeAt(k)]=k;var k,Le;I[45]=62;I[95]=63;function $e(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function Ot(r){var e=$e(r),t=e[0],n=e[1];return(t+n)*3/4-n}function kt(r,e,t){return(e+t)*3/4-t}function _t(r){var e,t=$e(r),n=t[0],i=t[1],o=new Wt(kt(r,n,i)),a=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)e=I[r.charCodeAt(u)]<<18|I[r.charCodeAt(u+1)]<<12|I[r.charCodeAt(u+2)]<<6|I[r.charCodeAt(u+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=I[r.charCodeAt(u)]<<2|I[r.charCodeAt(u+1)]>>4,o[a++]=e&255),i===1&&(e=I[r.charCodeAt(u)]<<10|I[r.charCodeAt(u+1)]<<4|I[r.charCodeAt(u+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function Qt(r){return v[r>>18&63]+v[r>>12&63]+v[r>>6&63]+v[r&63]}function Zt(r,e,t){for(var n,i=[],o=e;o<t;o+=3)n=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),i.push(Qt(n));return i.join("")}function qt(r){for(var e,t=r.length,n=t%3,i=[],o=16383,a=0,c=t-n;a<c;a+=o)i.push(Zt(r,a,a+o>c?c:a+o));return n===1?(e=r[t-1],i.push(v[e>>2]+v[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(v[e>>10]+v[e>>4&63]+v[e<<2&63]+"=")),i.join("")}});var Ge=re(fe=>{var Wr=f(d());fe.read=function(r,e,t,n,i){var o,a,c=i*8-n-1,u=(1<<c)-1,p=u>>1,l=-7,y=t?i-1:0,S=t?-1:1,A=r[e+y];for(y+=S,o=A&(1<<-l)-1,A>>=-l,l+=c;l>0;o=o*256+r[e+y],y+=S,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=a*256+r[e+y],y+=S,l-=8);if(o===0)o=1-p;else{if(o===u)return a?NaN:(A?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-p}return(A?-1:1)*a*Math.pow(2,o-n)};fe.write=function(r,e,t,n,i,o){var a,c,u,p=o*8-i-1,l=(1<<p)-1,y=l>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:o-1,te=n?1:-1,H=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+y>=1?e+=S/u:e+=S*Math.pow(2,1-y),e*u>=2&&(a++,u/=2),a+y>=l?(c=0,a=l):a+y>=1?(c=(e*u-1)*Math.pow(2,i),a=a+y):(c=e*Math.pow(2,y-1)*Math.pow(2,i),a=0));i>=8;r[t+A]=c&255,A+=te,c/=256,i-=8);for(a=a<<i|c,p+=i;p>0;r[t+A]=a&255,A+=te,a/=256,p-=8);r[t+A-te]|=H*128}});var tt=re(j=>{"use strict";var _r=f(d());var de=Me(),q=Ge(),We=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;j.Buffer=s;j.SlowBuffer=Ht;j.INSPECT_MAX_BYTES=50;var oe=2147483647;j.kMaxLength=oe;s.TYPED_ARRAY_SUPPORT=zt();!s.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 zt(){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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function $(r){if(r>oe)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,s.prototype),e}function s(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 we(r)}return Qe(r,e,t)}s.poolSize=8192;function Qe(r,e,t){if(typeof r=="string")return Vt(r,e);if(ArrayBuffer.isView(r))return Yt(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(F(r,ArrayBuffer)||r&&F(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(F(r,SharedArrayBuffer)||r&&F(r.buffer,SharedArrayBuffer)))return ge(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return s.from(n,e,t);let i=Jt(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return s.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)}s.from=function(r,e,t){return Qe(r,e,t)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function Ze(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 jt(r,e,t){return Ze(r),r<=0?$(r):e!==void 0?typeof t=="string"?$(r).fill(e,t):$(r).fill(e):$(r)}s.alloc=function(r,e,t){return jt(r,e,t)};function we(r){return Ze(r),$(r<0?0:Te(r)|0)}s.allocUnsafe=function(r){return we(r)};s.allocUnsafeSlow=function(r){return we(r)};function Vt(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=qe(r,e)|0,n=$(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}function he(r){let e=r.length<0?0:Te(r.length)|0,t=$(e);for(let n=0;n<e;n+=1)t[n]=r[n]&255;return t}function Yt(r){if(F(r,Uint8Array)){let e=new Uint8Array(r);return ge(e.buffer,e.byteOffset,e.byteLength)}return he(r)}function ge(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 n;return e===void 0&&t===void 0?n=new Uint8Array(r):t===void 0?n=new Uint8Array(r,e):n=new Uint8Array(r,e,t),Object.setPrototypeOf(n,s.prototype),n}function Jt(r){if(s.isBuffer(r)){let e=Te(r.length)|0,t=$(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||Ae(r.length)?$(0):he(r);if(r.type==="Buffer"&&Array.isArray(r.data))return he(r.data)}function Te(r){if(r>=oe)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+oe.toString(16)+" bytes");return r|0}function Ht(r){return+r!=r&&(r=0),s.alloc(+r)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype};s.compare=function(e,t){if(F(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let o=0,a=Math.min(n,i);o<a;++o)if(e[o]!==t[o]){n=e[o],i=t[o];break}return n<i?-1:i<n?1:0};s.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}};s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let i=s.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){let a=e[n];if(F(a,Uint8Array))o+a.length>i.length?(s.isBuffer(a)||(a=s.from(a)),a.copy(i,o)):Uint8Array.prototype.set.call(i,a,o);else if(s.isBuffer(a))a.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return i};function qe(r,e){if(s.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||F(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,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return me(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return et(r).length;default:if(i)return n?-1:me(r).length;e=(""+e).toLowerCase(),i=!0}}s.byteLength=qe;function Kt(r,e,t){let n=!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 cr(this,e,t);case"utf8":case"utf-8":return je(this,e,t);case"ascii":return ar(this,e,t);case"latin1":case"binary":return sr(this,e,t);case"base64":return ir(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ur(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function _(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}s.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)_(this,t,t+1);return this};s.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)_(this,t,t+3),_(this,t+1,t+2);return this};s.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)_(this,t,t+7),_(this,t+1,t+6),_(this,t+2,t+5),_(this,t+3,t+4);return this};s.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?je(this,0,e):Kt.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:s.compare(this,e)===0};s.prototype.inspect=function(){let e="",t=j.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};We&&(s.prototype[We]=s.prototype.inspect);s.prototype.compare=function(e,t,n,i,o){if(F(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.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),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),t<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=n)return 0;if(i>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;let a=o-i,c=n-t,u=Math.min(a,c),p=this.slice(i,o),l=e.slice(t,n);for(let y=0;y<u;++y)if(p[y]!==l[y]){a=p[y],c=l[y];break}return a<c?-1:c<a?1:0};function ze(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Ae(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),s.isBuffer(e))return e.length===0?-1:Oe(r,e,t,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Oe(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function Oe(r,e,t,n,i){let o=1,a=r.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;o=2,a/=2,c/=2,t/=2}function u(l,y){return o===1?l[y]:l.readUInt16BE(y*o)}let p;if(i){let l=-1;for(p=t;p<a;p++)if(u(r,p)===u(e,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===c)return l*o}else l!==-1&&(p-=p-l),l=-1}else for(t+c>a&&(t=a-c),p=t;p>=0;p--){let l=!0;for(let y=0;y<c;y++)if(u(r,p+y)!==u(e,y)){l=!1;break}if(l)return p}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};s.prototype.indexOf=function(e,t,n){return ze(this,e,t,n,!0)};s.prototype.lastIndexOf=function(e,t,n){return ze(this,e,t,n,!1)};function Xt(r,e,t,n){t=Number(t)||0;let i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let o=e.length;n>o/2&&(n=o/2);let a;for(a=0;a<n;++a){let c=parseInt(e.substr(a*2,2),16);if(Ae(c))return a;r[t+a]=c}return a}function er(r,e,t,n){return ae(me(e,r.length-t),r,t,n)}function tr(r,e,t,n){return ae(fr(e),r,t,n)}function rr(r,e,t,n){return ae(et(e),r,t,n)}function nr(r,e,t,n){return ae(dr(e,r.length-t),r,t,n)}s.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"hex":return Xt(this,e,t,n);case"utf8":case"utf-8":return er(this,e,t,n);case"ascii":case"latin1":case"binary":return tr(this,e,t,n);case"base64":return rr(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nr(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ir(r,e,t){return e===0&&t===r.length?de.fromByteArray(r):de.fromByteArray(r.slice(e,t))}function je(r,e,t){t=Math.min(r.length,t);let n=[],i=e;for(;i<t;){let o=r[i],a=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=t){let u,p,l,y;switch(c){case 1:o<128&&(a=o);break;case 2:u=r[i+1],(u&192)===128&&(y=(o&31)<<6|u&63,y>127&&(a=y));break;case 3:u=r[i+1],p=r[i+2],(u&192)===128&&(p&192)===128&&(y=(o&15)<<12|(u&63)<<6|p&63,y>2047&&(y<55296||y>57343)&&(a=y));break;case 4:u=r[i+1],p=r[i+2],l=r[i+3],(u&192)===128&&(p&192)===128&&(l&192)===128&&(y=(o&15)<<18|(u&63)<<12|(p&63)<<6|l&63,y>65535&&y<1114112&&(a=y))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=c}return or(n)}var ke=4096;function or(r){let e=r.length;if(e<=ke)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=ke));return t}function ar(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function sr(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function cr(r,e,t){let n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);let i="";for(let o=e;o<t;++o)i+=hr[r[o]];return i}function ur(r,e,t){let n=r.slice(e,t),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let i=this.subarray(e,t);return Object.setPrototypeOf(i,s.prototype),i};function m(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")}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||m(e,t,this.length);let i=this[e],o=1,a=0;for(;++a<t&&(o*=256);)i+=this[e+a]*o;return i};s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||m(e,t,this.length);let i=this[e+--t],o=1;for(;t>0&&(o*=256);)i+=this[e+--t]*o;return i};s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e=e>>>0,t||m(e,1,this.length),this[e]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||m(e,2,this.length),this[e]|this[e+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||m(e,2,this.length),this[e]<<8|this[e+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||m(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||m(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};s.prototype.readBigUInt64LE=G(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let i=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});s.prototype.readBigUInt64BE=G(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)});s.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||m(e,t,this.length);let i=this[e],o=1,a=0;for(;++a<t&&(o*=256);)i+=this[e+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i};s.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||m(e,t,this.length);let i=t,o=1,a=this[e+--i];for(;i>0&&(o*=256);)a+=this[e+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*t)),a};s.prototype.readInt8=function(e,t){return e=e>>>0,t||m(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};s.prototype.readInt16LE=function(e,t){e=e>>>0,t||m(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(e,t){e=e>>>0,t||m(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(e,t){return e=e>>>0,t||m(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};s.prototype.readInt32BE=function(e,t){return e=e>>>0,t||m(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};s.prototype.readBigInt64LE=G(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});s.prototype.readBigInt64BE=G(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&K(e,this.length-8);let i=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});s.prototype.readFloatLE=function(e,t){return e=e>>>0,t||m(e,4,this.length),q.read(this,e,!0,23,4)};s.prototype.readFloatBE=function(e,t){return e=e>>>0,t||m(e,4,this.length),q.read(this,e,!1,23,4)};s.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||m(e,8,this.length),q.read(this,e,!0,52,8)};s.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||m(e,8,this.length),q.read(this,e,!1,52,8)};function x(r,e,t,n,i,o){if(!s.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;x(this,e,t,n,c,0)}let o=1,a=0;for(this[t]=e&255;++a<n&&(o*=256);)this[t+a]=e/o&255;return t+n};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;x(this,e,t,n,c,0)}let o=n-1,a=1;for(this[t+o]=e&255;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,1,255,0),this[t]=e&255,t+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||x(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};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||x(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 Ve(r,e,t,n,i){Xe(e,n,i,r,t,7);let o=Number(e&BigInt(4294967295));r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a,t}function Ye(r,e,t,n,i){Xe(e,n,i,r,t,7);let o=Number(e&BigInt(4294967295));r[t+7]=o,o=o>>8,r[t+6]=o,o=o>>8,r[t+5]=o,o=o>>8,r[t+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=a,a=a>>8,r[t+2]=a,a=a>>8,r[t+1]=a,a=a>>8,r[t]=a,t+8}s.prototype.writeBigUInt64LE=G(function(e,t=0){return Ve(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeBigUInt64BE=G(function(e,t=0){return Ye(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let u=Math.pow(2,8*n-1);x(this,e,t,n,u-1,-u)}let o=0,a=1,c=0;for(this[t]=e&255;++o<n&&(a*=256);)e<0&&c===0&&this[t+o-1]!==0&&(c=1),this[t+o]=(e/a>>0)-c&255;return t+n};s.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let u=Math.pow(2,8*n-1);x(this,e,t,n,u-1,-u)}let o=n-1,a=1,c=0;for(this[t+o]=e&255;--o>=0&&(a*=256);)e<0&&c===0&&this[t+o+1]!==0&&(c=1),this[t+o]=(e/a>>0)-c&255;return t+n};s.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};s.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};s.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};s.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||x(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};s.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||x(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};s.prototype.writeBigInt64LE=G(function(e,t=0){return Ve(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});s.prototype.writeBigInt64BE=G(function(e,t=0){return Ye(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Je(r,e,t,n,i,o){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function He(r,e,t,n,i){return e=+e,t=t>>>0,i||Je(r,e,t,4,34028234663852886e22,-34028234663852886e22),q.write(r,e,t,n,23,4),t+4}s.prototype.writeFloatLE=function(e,t,n){return He(this,e,t,!0,n)};s.prototype.writeFloatBE=function(e,t,n){return He(this,e,t,!1,n)};function Ke(r,e,t,n,i){return e=+e,t=t>>>0,i||Je(r,e,t,8,17976931348623157e292,-17976931348623157e292),q.write(r,e,t,n,52,8),t+8}s.prototype.writeDoubleLE=function(e,t,n){return Ke(this,e,t,!0,n)};s.prototype.writeDoubleBE=function(e,t,n){return Ke(this,e,t,!1,n)};s.prototype.copy=function(e,t,n,i){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);let o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),o};s.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let a=e.charCodeAt(0);(i==="utf8"&&a<128||i==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let o;if(typeof e=="number")for(o=t;o<n;++o)this[o]=e;else{let a=s.isBuffer(e)?e:s.from(e,i),c=a.length;if(c===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=a[o%c]}return this};var Z={};function xe(r,e,t){Z[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(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}xe("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);xe("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);xe("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=_e(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=_e(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function _e(r){let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function lr(r,e,t){z(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&K(e,r.length-(t+1))}function Xe(r,e,t,n,i,o){if(r>t||r<e){let a=typeof e=="bigint"?"n":"",c;throw o>3?e===0||e===BigInt(0)?c=`>= 0${a} and < 2${a} ** ${(o+1)*8}${a}`:c=`>= -(2${a} ** ${(o+1)*8-1}${a}) and < 2 ** ${(o+1)*8-1}${a}`:c=`>= ${e}${a} and <= ${t}${a}`,new Z.ERR_OUT_OF_RANGE("value",c,r)}lr(n,i,o)}function z(r,e){if(typeof r!="number")throw new Z.ERR_INVALID_ARG_TYPE(e,"number",r)}function K(r,e,t){throw Math.floor(r)!==r?(z(r,t),new Z.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var pr=/[^+/0-9A-Za-z-_]/g;function yr(r){if(r=r.split("=")[0],r=r.trim().replace(pr,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function me(r,e){e=e||1/0;let t,n=r.length,i=null,o=[];for(let a=0;a<n;++a){if(t=r.charCodeAt(a),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function fr(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function dr(r,e){let t,n,i,o=[];for(let a=0;a<r.length&&!((e-=2)<0);++a)t=r.charCodeAt(a),n=t>>8,i=t%256,o.push(i),o.push(n);return o}function et(r){return de.toByteArray(yr(r))}function ae(r,e,t,n){let i;for(i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function F(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function Ae(r){return r!==r}var hr=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)e[n+i]=r[t]+r[i]}return e}();function G(r){return typeof BigInt>"u"?gr:r}function gr(){throw new Error("BigInt not supported")}});var si=f(d(),1),vt=f(tt(),1);var Kr=f(d(),1);var Zr=f(d(),1),w={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"},rt={"application/json":{type:"application/json",serialize:r=>JSON.stringify(r)}},E={arweave:"arweave.net",goldsky:"arweave-search.goldsky.com"};var h={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"}},nt={node1:"https://up.arweave.net",node2:"https://turbo.ardrive.io",batchSize:1,chunkSize:75e5,dispatchUploadSize:100*1024};var Jr=f(d(),1);var jr=f(d(),1);function Y(r){return r?/^[a-z0-9_-]{43}$/i.test(r):!1}function se(r,e){for(let t=0;t<r.length;t++)if(r[t]&&r[t].name===e)return r[t].value;return null}function it(r){let e=r.match(/^data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+);base64,/);return e?e[1]:null}function ot(r){return r.split(",")[1]}function at(r){let e;if(Buffer.isBuffer(r))e=r.length;else if(typeof r=="string")e=Buffer.byteLength(r,"utf-8");else throw new Error("Input must be a string or a Buffer");return e}function Ee(r){let e;return e=r.replace(/\[|\]/g,""),`[[${e}]]`}function X(r){let e;return e=r.replace(/\[|\]/g,""),e}var T=(...r)=>{console.log("[@permaweb/libs]",...r)};function mr(r){return r.replace(/^[a-z]/,e=>e.toUpperCase())}function V(r){return Array.isArray(r)?r.map(V):r&&typeof r=="object"?Object.entries(r).reduce((e,[t,n])=>{let i=mr(t);return e[i]=Y(n)?n:V(n),e},{}):r}function wr(r){return r.charAt(0).toLowerCase()+r.slice(1)}function U(r){return Array.isArray(r)?r.map(U):r&&typeof r=="object"?Object.entries(r).reduce((e,[t,n])=>{let i=wr(t);return e[i]=Y(n)?n:U(n),e},{}):r}function C(r,e){let t=r.charAt(0).toUpperCase()+r.slice(1);return{name:`${h.keys.bootloader}-${t}`,value:e}}var Tr="https://arweave.net";function J(r){return`${Tr}/${r}`}var Hr=f(d(),1);var mn=f(d(),1);var yn=f(d(),1);var an=f(d(),1);var Ie={p1:"P1",end:"END"},Be={default:100};async function B(r){let e=r.paginator?r.paginator:Be.default,t=[],n=0,i=null;if(r.ids&&!r.ids.length)return{data:t,count:n,nextCursor:i,previousCursor:null};try{let o=Er(r),a=await Ir({gateway:r.gateway??E.goldsky,query:Ar(o)});return a?.data?.transactions?.edges?.length?(t=[...a.data.transactions.edges],n=a.data.transactions.count??0,t.length<e||!a.data.transactions.pageInfo.hasNextPage?i=Ie.end:i=t[t.length-1].cursor,{data:t,count:n,nextCursor:i,previousCursor:null}):{data:t,count:n,nextCursor:i,previousCursor:null}}catch(o){return console.error(o),{data:t,count:n,nextCursor:i,previousCursor:null}}}async function st(r,e){let t=1,n=await B(r);if(n&&n.data.length){let i=n.data;for(e&&e(`Count: ${n.count}`),e&&e(`Pages to fetch: ${Math.ceil(n.count/(r.paginator??Be.default))}`),e&&e(`Page ${t} fetched`);n.nextCursor&&n.nextCursor!==Ie.end;)t+=1,e&&e(`Fetching page ${t}...`),n=await B({...r,cursor:n.nextCursor}),n&&n.data.length&&(i=i.concat(n.data));return e&&e("All pages fetched!"),i}else e&&e("No data found");return null}function Ar(r){let e={query:`query { ${r} }`};return JSON.stringify(e)}function Er(r){let e=r.paginator?r.paginator:Be.default,t=r.ids?JSON.stringify(r.ids):null,n=null;r.minBlock!==void 0&&r.minBlock!==null&&(n={},n.min=r.minBlock);let i=n?JSON.stringify(n).replace(/"([^"]+)":/g,"$1:"):null,o=r.tags?JSON.stringify(r.tags).replace(/"(name)":/g,"$1:").replace(/"(values)":/g,"$1:").replace(/"match"/g,"match").replace(/"FUZZY_OR"/g,"FUZZY_OR"):null,a=r.owners?JSON.stringify(r.owners):null,c=r.recipients?JSON.stringify(r.recipients):null,u=r.cursor&&r.cursor!==Ie.end?`"${r.cursor}"`:null,p=`first: ${e}`,l="",y="data { size type } owner { address } block { height timestamp }",S="",A="";switch(r.gateway??E.goldsky){case E.arweave:break;case E.goldsky:u||(l="count"),c&&(A=`recipients: ${c}`);break}let H=`
2
2
  transactions(
3
3
  ids: ${t},
4
4
  tags: ${o},
5
- ${u}
5
+ ${p}
6
6
  owners: ${a},
7
+ ${A},
7
8
  block: ${i},
8
- after: ${c},
9
- ${y}
9
+ after: ${u},
10
+ ${S}
10
11
 
11
12
  ){
12
13
  ${l}
@@ -21,10 +22,10 @@ var Ft=Object.create;var Se=Object.defineProperty;var Ut=Object.getOwnPropertyDe
21
22
  name
22
23
  value
23
24
  }
24
- ${p}
25
+ ${y}
25
26
  }
26
27
  }
27
- }`;return r.queryKey&&(C=`${r.queryKey}: ${C}`),C}async function Ar(r){try{return await(await fetch(`https://${r.gateway}/graphql`,{method:"POST",headers:{"Content-Type":"application/json"},body:r.query})).json()}catch(e){throw e}}var Ir=A.goldsky,Br=100;async function at(r,e){let t=[{name:"Authority",value:w.mu}];e.tags&&e.tags.length>0&&e.tags.forEach(n=>t.push(n));try{let n=await r.ao.spawn({module:e.module,scheduler:e.scheduler,signer:r.signer,tags:t,data:e.data});return T(`Process ID: ${n}`),n}catch(n){throw new Error(n.message??"Error spawning process")}}function st(r){return async e=>await v(r,e)}async function v(r,e){try{let t=[{name:"Action",value:e.action}];e.tags&&t.push(...e.tags);let n=e.useRawData?e.data:JSON.stringify(e.data);return await r.ao.message({process:e.processId,signer:r.signer,tags:t,data:n})}catch(t){throw new Error(t)}}function ct(r){return async e=>await B(r,e)}async function B(r,e){try{let t=[{name:"Action",value:e.action}];e.tags&&t.push(...e.tags);let n;if(typeof e.data=="object")n=JSON.stringify(e.data||{});else if(typeof e.data=="string"){try{JSON.parse(e.data)}catch(o){throw console.error(o),new Error("Invalid JSON data")}n=e.data}let i=await r.ao.dryrun({process:e.processId,tags:t,data:n});if(i.Messages&&i.Messages.length){if(i.Messages[0].Data)return JSON.parse(i.Messages[0].Data);if(i.Messages[0].Tags)return i.Messages[0].Tags.reduce((o,a)=>(o[a.name]=a.value,o),{})}}catch(t){throw new Error(t.message??"Error dryrunning process")}}async function Cr(r,e){try{let{Messages:t}=await r.ao.result({message:e.messageId,process:e.processId});if(t&&t.length){let n={};return t.forEach(i=>{let o=oe(i.Tags,"Action")||e.action,a=null,c=i.Data;if(c)try{a=JSON.parse(c)}catch{a=c}let u=oe(i.Tags,"Status"),l=oe(i.Tags,"Message");n[o]={id:e.messageId,status:u,message:l,data:a}}),n}else return null}catch(t){console.error(t)}}async function ut(r,e){let t=null;if(e.evalSrc?t=e.evalSrc:e.evalTxId&&(t=await Dr(e.evalTxId)),t)try{let n=await v(r,{processId:e.processId,action:"Eval",data:t,tags:e.evalTags||null,useRawData:!0});return T(`Eval: ${n}`),await Cr(r,{processId:e.processId,messageId:n,action:"Eval"})}catch(n){throw new Error(n.message??"Error sending process eval")}return null}function lt(r){return async(e,t)=>{try{let n={module:e.module||w.module,scheduler:e.scheduler||w.scheduler};e.spawnData&&(n.data=e.spawnData),e.spawnTags&&(n.tags=e.spawnTags),t&&t("Spawning process...");let i=await at(r,n);if(e.evalTxId||e.evalSrc){t&&t("Retrieving process..."),await pt(i,t),t&&t("Process retrieved!"),t&&t("Sending eval...");try{await ut(r,{processId:i,evalTxId:e.evalTxId||null,evalSrc:e.evalSrc||null,evalTags:e.evalTags})&&t&&t("Eval complete")}catch(o){throw new Error(o.message??"Error creating process")}}return i}catch(n){throw new Error(n.message??"Error creating process")}}}async function k(r,e,t){try{let n={module:e.module||w.module,scheduler:e.scheduler||w.scheduler};e.spawnData&&(n.data=e.spawnData),e.spawnTags&&(n.tags=e.spawnTags),t&&t("Spawning process...");let i=await at(r,n);if(t&&t("Retrieving process..."),await pt(i,t),e.evalTxId||e.evalSrc){t&&t("Process retrieved!"),t&&t("Sending eval...");try{await ut(r,{processId:i,evalTxId:e.evalTxId||null,evalSrc:e.evalSrc||null,evalTags:e.evalTags})&&t&&t("Eval complete")}catch(o){throw new Error(o.message??"Error creating process")}}return i}catch(n){throw new Error(n.message??"Error creating process")}}async function pt(r,e){let t=0;for(;t<Br;){await new Promise(i=>setTimeout(i,2e3));let n=await R({gateway:Ir,ids:[r]});if(n?.data?.length){let i=n.data[0].node.id;return T(`Process found: ${i} (Try ${t+1})`),i}else T(`Process not found: ${r} (Try ${t+1})`),t++}throw new Error("Process not found, please try again")}async function Dr(r){try{return await(await fetch(H(r))).text()}catch(e){throw new Error(e)}}var hn=f(d(),1);function yt(r){return async e=>{if(Y(e))return e;if(!r.arweave)throw new Error("Must initialize with Arweave in order to create transactions");try{return await ft(r,{data:e})}catch(t){throw new Error(t.message??"Error resolving transaction")}}}async function G(r,e){if(Y(e))return e;if(!r.arweave)throw new Error("Must initialize with Arweave in order to create transactions");try{return await ft(r,{data:e})}catch(t){throw new Error(t.message??"Error resolving transaction")}}async function ft(r,e){let t=null,n=null;try{typeof e.data=="string"&&e.data.startsWith("data:")&&(t=Buffer.from(rt(e.data),"base64"),n=tt(e.data))}catch(i){throw new Error(i)}if(t&&n){let i=nt(t);if(T(`Content upload size: ${i}`),i<Number(et.dispatchUploadSize)){let o=await r.arweave.createTransaction({data:t},"use_wallet");return o.addTag(h.keys.contentType,n),e.tags&&e.tags.length>0&&e.tags.forEach(c=>o.addTag(c.name,c.value)),(await global.window.arweaveWallet.dispatch(o)).id}else throw new Error("Data exceeds max upload limit")}else throw new Error("Error preparing transaction data")}var Kn=f(d(),1);var Cn=f(d(),1);function ae(r){return async(e,t)=>{let n=Pr(e);if(n)throw new Error(n);let i=Xe[e.contentType]?.serialize(e.data)??e.data,o=br(e);try{return await k(r,{spawnTags:o,spawnData:i},t?c=>t(c):void 0)}catch(a){throw new Error(a.message??"Error creating asset")}}}async function Ae(r,e,t){try{let n=U(await B(r,{processId:e,action:"Info"}));if(t?.useGateway){let i=await R({gateway:A.goldsky,ids:[e],tags:null,owners:null,cursor:null});return{...i?.data?.[0]?se(i.data[0]):{},...n}}return{id:e,...n}}catch(n){throw new Error(n.message||"Error fetching atomic asset")}}function dt(r){return async(e,t)=>await Ae(r,e,t)}async function ht(r){try{let e=await R({gateway:A.arweave,ids:r??null,tags:null,owners:null,cursor:null});return e&&e.data.length?e.data.map(t=>se(t)):null}catch(e){throw new Error(e)}}function se(r){let e={id:r.node.id,owner:r.node.owner.address};for(let t of r.node.tags){let n=t.name,o=(n.startsWith(`${h.keys.bootloader}-`)?n.slice(`${h.keys.bootloader}-`.length):n).split("-").map((c,u)=>u===0?c.toLowerCase():c.charAt(0).toUpperCase()+c.slice(1).toLowerCase()).join(""),a;try{a=JSON.parse(t.value)}catch{a=t.value.toString()}e[o]=a}return e}function br(r){let e=[{name:h.keys.bootloaderInit,value:r.src??w.src.asset},{name:h.keys.creator,value:r.creator},{name:h.keys.assetType,value:r.assetType},{name:h.keys.contentType,value:r.contentType},{name:h.keys.implements,value:"ANS-110"},{name:h.keys.dateCreated,value:new Date().getTime().toString()},I("Name",r.name),I("Description",r.description),I("Topics",JSON.stringify(r.topics)),I("Ticker","ATOMIC"),I("Denomination",r.denomination?.toString()??"1"),I("TotalSupply",r.supply?.toString()??"1"),I("Transferable",r.transferable?.toString()??"true"),I("Creator",r.creator)];if(r.metadata)for(let t in r.metadata)e.push(I(V(t),r.metadata[t].toString()));return r.tags&&r.tags.forEach(t=>e.push(t)),e}function Pr(r){if(typeof r!="object"||r===null)return"The provided arguments are invalid or empty.";let e=["name","description","topics","creator","data","contentType","assetType"];for(let t of e)if(!(t in r))return`Missing field '${t}'`;return typeof r.name!="string"||r.name.trim()===""?"Name is required":typeof r.description!="string"?"The description must be a valid string":!Array.isArray(r.topics)||r.topics.length===0?"Topics are required":typeof r.creator!="string"||r.creator.trim()===""?"Creator is required":r.data===void 0||r.data===null?"Data field is required":typeof r.contentType!="string"||r.contentType.trim()===""?"Content type must be a non-empty string":typeof r.assetType!="string"||r.assetType.trim()===""?"Type must be a non-empty string":"supply"in r&&(typeof r.supply!="number"||r.supply<=0)?"Supply must be a positive number":"denomination"in r&&(typeof r.denomination!="number"||r.denomination<=0)?"Denomination must be a positive number":"transferable"in r&&typeof r.transferable!="boolean"?"Transferable must be a boolean value":"metadata"in r&&typeof r.metadata!="object"?"Metadata must be an object":"tags"in r&&(!Array.isArray(r.tags)||r.tags.some(t=>typeof t!="object"))?"Tags must be an array of objects":"src"in r&&typeof r.src!="string"?"Source must be a valid string":null}var Rn=f(d(),1);var Fr="eXCtpVbcd_jZ0dmU2PZ8focaKxBGECBQ8wMib7sIVPo",X="lJovHqM9hwNjHV5JoY9NGWtt0WD-5D4gOqNL2VWW5jk";function mt(r){return async(e,t)=>{if(!r.signer)throw new Error("No signer provided");let n=new Date().getTime().toString(),i=[{name:h.keys.contentType,value:"application/json"},{name:h.keys.creator,value:e.creator},{name:h.keys.ans110.title,value:K(e.title)},{name:h.keys.ans110.description,value:K(e.description)},{name:h.keys.ans110.type,value:h.values.document},{name:h.keys.dateCreated,value:n},{name:h.keys.name,value:K(e.title)},{name:"Action",value:"Add-Collection"}],o=null,a=null;try{o=e.banner?await G(r,e.thumbnail):X,a=e.banner?await G(r,e.banner):Fr,e.thumbnail&&i.push({name:h.keys.thumbnail,value:o}),e.banner&&i.push({name:h.keys.banner,value:a})}catch(l){console.error(l)}let c=await fetch(H(w.src.collection));if(!c.ok)throw new Error("Unable to fetch process src");let u=await c.text();u=u.replace(/'<NAME>'/g,Ee(e.title)),u=u.replace(/'<DESCRIPTION>'/g,Ee(e.description)),u=u.replace(/<CREATOR>/g,e.creator),u=u.replace(/<THUMBNAIL>/g,o||X),u=u.replace(/<BANNER>/g,a||X),u=u.replace(/<DATECREATED>/g,n),u=u.replace(/<LASTUPDATE>/g,n);try{let l=await k(r,{spawnTags:i},t?y=>t(y):void 0);T("Sending eval message to collection..."),t&&t("Sending eval message to collection..."),await r.ao.message({process:l,signer:r.signer,tags:[{name:"Action",value:"Eval"}],data:u});let p=[{name:"Action",value:"Add-Collection"},{name:"CollectionId",value:l},{name:"Name",value:K(e.title)},{name:"Creator",value:e.creator},{name:"DateCreated",value:n}];return a&&p.push({name:"Banner",value:a}),o&&p.push({name:"Thumbnail",value:o}),e.skipRegistry||(T("Sending collection to registry..."),t&&t("Sending collection to registry..."),await r.ao.message({process:w.collectionRegistry,signer:r.signer,tags:p})),T("Sending profile request..."),t&&t("Sending profile request..."),await r.ao.message({process:l,signer:r.signer,tags:[{name:"Action",value:"Add-Collection-To-Profile"},{name:"ProfileProcess",value:e.creator}]}),l}catch(l){throw new Error(l.message??"Error creating collection")}}}function gt(r){return async e=>await v(r,{processId:e.creator,action:"Run-Action",tags:[{name:"ForwardTo",value:e.collectionId},{name:"ForwardAction",value:"Update-Assets"}],data:{Target:e.collectionId,Action:"Update-Assets",Input:JSON.stringify({AssetIds:e.assetIds,UpdateType:e.updateType})}})}function wt(r){return async e=>{let t=await B(r,{processId:e,action:"Info"});return{...{id:e,title:t.Name,description:t.Description,creator:t.Creator,dateCreated:t.DateCreated,thumbnail:t.Thumbnail??X,banner:t.Banner??X},assetIds:t.Assets}}}function Tt(r){return async e=>{let t=e.creator?"Get-Collections-By-User":"Get-Collections",n=await B(r,{processId:w.collectionRegistry,action:t,tags:e.creator?[{name:"Creator",value:e.creator}]:null});return n&&n.Collections&&n.Collections.length?n.Collections.map(o=>({id:o.Id,title:o.Name.replace(/\[|\]/g,""),description:o.Description,creator:o.Creator,dateCreated:o.DateCreated,banner:o.Banner,thumbnail:o.Thumbnail})):null}}var kn=f(d(),1);function xt(r){let e=ae(r);return async(t,n)=>{let i=t.tags?t.tags:[];i.push({name:"Data-Source",value:t.parentId}),i.push({name:"Root-Source",value:t.rootId??t.parentId});let o={name:`Comment on ${t.parentId}`,description:`Comment on ${t.parentId}`,topics:["comment"],creator:t.creator,data:t.content,contentType:"text/plain",assetType:"comment",tags:i};return e(o,n)}}function Et(r){return async e=>{try{let t=await Ae(r,e,{useGateway:!0}),n=t?.dataSource,i=t?.rootSource;if(!n||!i)throw new Error("dataSource and rootSource must be present on a comment");return{content:await It(e),parentId:n,rootId:i}}catch(t){throw new Error(t.message??"Error getting comment")}}}function At(r){return async e=>{if(!e.parentId&&!e.rootId)throw new Error("Must provide either parentId or rootId");let t=[];e.parentId&&t.push({name:"Data-Source",values:[e.parentId??""]}),e.rootId&&t.push({name:"Root-Source",values:[e.rootId??""]});let n=await R({gateway:A.goldsky,ids:null,tags:t,owners:null,cursor:null}),i=[];n&&n.data.length&&(i=n.data.map(a=>se(a)));let o=[];for(let a of i){let c=a?.dataSource,u=a?.rootSource;if(!c||!u)throw new Error("dataSource and rootSource must be present on a comment");o.push({id:a.id,content:await It(a.id),parentId:c,rootId:u})}return o}}async function It(r){try{return await(await fetch(H(r))).text()}catch(e){throw new Error(e.message??"Error getting comment data")}}var Jn=f(d(),1);var Qn=f(d(),1);function Ie(r){return async(e,t)=>{try{let n=[{name:h.keys.bootloaderInit,value:w.src.zone}];return e.tags&&e.tags.length&&e.tags.forEach(o=>n.push(o)),await k(r,{spawnTags:n},t?o=>t(o):void 0)}catch(n){throw new Error(n.message??"Error creating zone")}}}function Be(r){return async(e,t)=>{try{let n=Object.entries(e).map(([o,a])=>({key:o,value:a}));return await v(r,{processId:t,action:"Zone-Update",data:n})}catch(n){throw new Error(n)}}}function Bt(r){return async(e,t)=>{try{return await v(r,{processId:t,action:"Zone-Append",tags:[{name:"Path",value:e.path}],data:e.data})}catch(n){throw new Error(n)}}}function Ce(r){return async e=>{try{let t=await B(r,{processId:e,action:"Info"});return U(t)}catch(t){throw new Error(t)}}}function Ct(r){return async(e,t)=>{try{if(!r.signer)throw new Error("No signer provided");let i=[{name:"Date-Created",value:new Date().getTime().toString()},{name:"Action",value:"Create-Profile"}],o=null,a=null;try{e.thumbnail&&(o=await G(r,e.thumbnail)),e.banner&&(a=await G(r,e.banner))}catch(p){console.error(p)}let c=await k(r,{spawnTags:i,evalTxId:w.src.profile},p=>T(p)),u={UserName:e.userName,DisplayName:e.displayName,Description:e.description};o&&(u.ProfileImage=o),a&&(u.CoverImage=a),T("Updating profile..."),t&&t("Updating profile...");let l=await v(r,{processId:c,action:"Update-Profile",data:u});return T(`Profile update: ${l}`),c}catch(n){throw new Error(n.message??"Error creating profile")}}}function Dt(r){return async(e,t,n)=>{if(t){let i={UserName:e.userName,DisplayName:e.displayName,Description:e.description};if(e.thumbnail)try{i.Thumbnail=await G(r,e.thumbnail)}catch(o){n&&n(`Failed to resolve thumbnail: ${o.message}`)}if(e.banner)try{i.Banner=await G(r,e.banner)}catch(o){n&&n(`Failed to resolve banner: ${o.message}`)}try{T("Updating profile..."),n&&n("Updating profile...");let o=await v(r,{processId:t,action:"Update-Profile",data:i});return T(`Profile update: ${o}`),o}catch(o){throw new Error(o.message??"Error updating profile")}}else throw new Error("No profile provided")}}function De(r){return async e=>{try{let t=await B(r,{processId:e,action:"Info"}),{Profile:n={},...i}=t,o={...i,...n};return{id:e,...U(o)}}catch(t){throw new Error(t.message??"Error fetching profile")}}}function St(r){let e=De(r);return async t=>{try{let n=await B(r,{processId:w.profileRegistry,action:"Get-Profiles-By-Delegate",data:{Address:t}}),i;if(n&&n.length>0&&n[0].ProfileId)return i=n[0].ProfileId,await e(i)}catch(n){throw new Error(n.message??"Error fetching profile")}}}globalThis.Buffer||(globalThis.Buffer=bt.Buffer);function Rr(r){return{createZone:Ie(r),updateZone:Be(r),addToZone:Bt(r),getZone:Ce(r),createProfile:Ct(r),updateProfile:Dt(r),getProfileById:De(r),getProfileByWalletAddress:St(r),createAtomicAsset:ae(r),getAtomicAsset:dt(r),getAtomicAssets:ht,createComment:xt(r),getComment:Et(r),getComments:At(r),createCollection:mt(r),updateCollectionAssets:gt(r),getCollection:wt(r),getCollections:Tt(r),resolveTransaction:yt(r),getGQLData:R,createProcess:lt(r),readProcess:ct(r),sendMessage:st(r),mapFromProcessCase:U,mapToProcessCase:V}}var ii={init:Rr};export{ii as default};
28
+ }`;return r.queryKey&&(H=`${r.queryKey}: ${H}`),H}async function Ir(r){try{return await(await fetch(`https://${r.gateway}/graphql`,{method:"POST",headers:{"Content-Type":"application/json"},body:r.query})).json()}catch(e){throw e}}var Br=E.goldsky,Cr=100;async function ct(r,e){let t=[{name:"Authority",value:w.mu}];e.tags&&e.tags.length>0&&e.tags.forEach(n=>t.push(n));try{let n=await r.ao.spawn({module:e.module,scheduler:e.scheduler,signer:r.signer,tags:t,data:e.data});return T(`Process ID: ${n}`),n}catch(n){throw new Error(n.message??"Error spawning process")}}function ut(r){return async e=>await R(r,e)}async function R(r,e){try{let t=[{name:"Action",value:e.action}];e.tags&&t.push(...e.tags);let n=e.useRawData?e.data:JSON.stringify(e.data);return await r.ao.message({process:e.processId,signer:r.signer,tags:t,data:n})}catch(t){throw new Error(t)}}function lt(r){return async e=>await D(r,e)}async function D(r,e){try{let t=[{name:"Action",value:e.action}];e.tags&&t.push(...e.tags);let n;if(typeof e.data=="object")n=JSON.stringify(e.data||{});else if(typeof e.data=="string"){try{JSON.parse(e.data)}catch(o){throw console.error(o),new Error("Invalid JSON data")}n=e.data}let i=await r.ao.dryrun({process:e.processId,tags:t,data:n});if(i.Messages&&i.Messages.length){if(i.Messages[0].Data)return JSON.parse(i.Messages[0].Data);if(i.Messages[0].Tags)return i.Messages[0].Tags.reduce((o,a)=>(o[a.name]=a.value,o),{})}}catch(t){throw new Error(t.message??"Error dryrunning process")}}async function Dr(r,e){try{let{Messages:t}=await r.ao.result({message:e.messageId,process:e.processId});if(t&&t.length){let n={};return t.forEach(i=>{let o=se(i.Tags,"Action")||e.action,a=null,c=i.Data;if(c)try{a=JSON.parse(c)}catch{a=c}let u=se(i.Tags,"Status"),p=se(i.Tags,"Message");n[o]={id:e.messageId,status:u,message:p,data:a}}),n}else return null}catch(t){console.error(t)}}async function pt(r,e){let t=null;if(e.evalSrc?t=e.evalSrc:e.evalTxId&&(t=await Sr(e.evalTxId)),t)try{let n=await R(r,{processId:e.processId,action:"Eval",data:t,tags:e.evalTags||null,useRawData:!0});return T(`Eval: ${n}`),await Dr(r,{processId:e.processId,messageId:n,action:"Eval"})}catch(n){throw new Error(n.message??"Error sending process eval")}return null}function yt(r){return async(e,t)=>{try{let n={module:e.module||w.module,scheduler:e.scheduler||w.scheduler};e.data&&(n.data=e.data),e.tags&&(n.tags=e.tags),t&&t("Spawning process...");let i=await ct(r,n);if(t&&t("Retrieving process..."),await ft(i,t),e.evalTxId||e.evalSrc){t&&t("Process retrieved!"),t&&t("Sending eval...");try{await pt(r,{processId:i,evalTxId:e.evalTxId||null,evalSrc:e.evalSrc||null,evalTags:e.evalTags})&&t&&t("Eval complete")}catch(o){throw new Error(o.message??"Error creating process")}}return i}catch(n){throw new Error(n.message??"Error creating process")}}}async function M(r,e,t){try{let n={module:e.module||w.module,scheduler:e.scheduler||w.scheduler};e.data&&(n.data=e.data),e.tags&&(n.tags=e.tags),t&&t("Spawning process...");let i=await ct(r,n);if(t&&t("Retrieving process..."),await ft(i,t),e.evalTxId||e.evalSrc){t&&t("Process retrieved!"),t&&t("Sending eval...");try{await pt(r,{processId:i,evalTxId:e.evalTxId||null,evalSrc:e.evalSrc||null,evalTags:e.evalTags})&&t&&t("Eval complete")}catch(o){throw new Error(o.message??"Error creating process")}}return i}catch(n){throw new Error(n.message??"Error creating process")}}async function ft(r,e){let t=0;for(;t<Cr;){await new Promise(i=>setTimeout(i,2e3));let n=await B({gateway:Br,ids:[r]});if(n?.data?.length){let i=n.data[0].node.id;return T(`Process found: ${i} (Try ${t+1})`),i}else T(`Process not found: ${r} (Try ${t+1})`),t++}throw new Error("Process not found, please try again")}async function Sr(r){try{return await(await fetch(J(r))).text()}catch(e){throw new Error(e)}}var gn=f(d(),1);function dt(r){return async e=>{if(Y(e))return e;if(!r.arweave)throw new Error("Must initialize with Arweave in order to create transactions");try{return await ht(r,{data:e})}catch(t){throw new Error(t.message??"Error resolving transaction")}}}async function W(r,e){if(Y(e))return e;if(!r.arweave)throw new Error("Must initialize with Arweave in order to create transactions");try{return await ht(r,{data:e})}catch(t){throw new Error(t.message??"Error resolving transaction")}}async function ht(r,e){let t=null,n=null;try{typeof e.data=="string"&&e.data.startsWith("data:")&&(t=Buffer.from(ot(e.data),"base64"),n=it(e.data))}catch(i){throw new Error(i)}if(t&&n){let i=at(t);if(T(`Content upload size: ${i}`),i<Number(nt.dispatchUploadSize)){let o=await r.arweave.createTransaction({data:t},"use_wallet");return o.addTag(h.keys.contentType,n),e.tags&&e.tags.length>0&&e.tags.forEach(c=>o.addTag(c.name,c.value)),(await global.window.arweaveWallet.dispatch(o)).id}else throw new Error("Data exceeds max upload limit")}else throw new Error("Error preparing transaction data")}var Xn=f(d(),1);var Dn=f(d(),1);function ce(r){return async(e,t)=>{let n=vr(e);if(n)throw new Error(n);let i=rt[e.contentType]?.serialize(e.data)??e.data,o=Pr(e);try{return await M(r,{tags:o,data:i},t?c=>t(c):void 0)}catch(a){throw new Error(a.message??"Error creating asset")}}}async function Ce(r,e,t){try{let n=U(await D(r,{processId:e,action:"Info"}));if(t?.useGateway){let i=await B({gateway:E.goldsky,ids:[e],tags:null,owners:null,cursor:null});return{...i?.data?.[0]?ue(i.data[0]):{},...n}}return{id:e,...n}}catch(n){throw new Error(n.message||"Error fetching atomic asset")}}function gt(r){return async(e,t)=>await Ce(r,e,t)}async function mt(r){try{let e=await B({gateway:E.arweave,ids:r??null,tags:null,owners:null,cursor:null});return e&&e.data.length?e.data.map(t=>ue(t)):null}catch(e){throw new Error(e)}}function ue(r){let e={id:r.node.id,owner:r.node.owner.address};for(let t of r.node.tags){let n=t.name,o=(n.startsWith(`${h.keys.bootloader}-`)?n.slice(`${h.keys.bootloader}-`.length):n).split("-").map((c,u)=>u===0?c.toLowerCase():c.charAt(0).toUpperCase()+c.slice(1).toLowerCase()).join(""),a;try{a=JSON.parse(t.value)}catch{a=t.value.toString()}e[o]=a}return e}function Pr(r){let e=[{name:h.keys.bootloaderInit,value:r.src??w.src.asset},{name:h.keys.creator,value:r.creator},{name:h.keys.assetType,value:r.assetType},{name:h.keys.contentType,value:r.contentType},{name:h.keys.implements,value:"ANS-110"},{name:h.keys.dateCreated,value:new Date().getTime().toString()},C("Name",r.name),C("Description",r.description),C("Topics",JSON.stringify(r.topics)),C("Ticker","ATOMIC"),C("Denomination",r.denomination?.toString()??"1"),C("TotalSupply",r.supply?.toString()??"1"),C("Transferable",r.transferable?.toString()??"true"),C("Creator",r.creator)];if(r.metadata)for(let t in r.metadata)e.push(C(V(t),r.metadata[t].toString()));return r.tags&&r.tags.forEach(t=>e.push(t)),e}function vr(r){if(typeof r!="object"||r===null)return"The provided arguments are invalid or empty.";let e=["name","description","topics","creator","data","contentType","assetType"];for(let t of e)if(!(t in r))return`Missing field '${t}'`;return typeof r.name!="string"||r.name.trim()===""?"Name is required":typeof r.description!="string"?"The description must be a valid string":!Array.isArray(r.topics)||r.topics.length===0?"Topics are required":typeof r.creator!="string"||r.creator.trim()===""?"Creator is required":r.data===void 0||r.data===null?"Data field is required":typeof r.contentType!="string"||r.contentType.trim()===""?"Content type must be a non-empty string":typeof r.assetType!="string"||r.assetType.trim()===""?"Type must be a non-empty string":"supply"in r&&(typeof r.supply!="number"||r.supply<=0)?"Supply must be a positive number":"denomination"in r&&(typeof r.denomination!="number"||r.denomination<=0)?"Denomination must be a positive number":"transferable"in r&&typeof r.transferable!="boolean"?"Transferable must be a boolean value":"metadata"in r&&typeof r.metadata!="object"?"Metadata must be an object":"tags"in r&&(!Array.isArray(r.tags)||r.tags.some(t=>typeof t!="object"))?"Tags must be an array of objects":"src"in r&&typeof r.src!="string"?"Source must be a valid string":null}var Rn=f(d(),1);var Fr="eXCtpVbcd_jZ0dmU2PZ8focaKxBGECBQ8wMib7sIVPo",ee="lJovHqM9hwNjHV5JoY9NGWtt0WD-5D4gOqNL2VWW5jk";function wt(r){return async(e,t)=>{if(!r.signer)throw new Error("No signer provided");let n=new Date().getTime().toString(),i=[{name:h.keys.contentType,value:"application/json"},{name:h.keys.creator,value:e.creator},{name:h.keys.ans110.title,value:X(e.title)},{name:h.keys.ans110.description,value:X(e.description)},{name:h.keys.ans110.type,value:h.values.document},{name:h.keys.dateCreated,value:n},{name:h.keys.name,value:X(e.title)},{name:"Action",value:"Add-Collection"}],o=null,a=null;try{o=e.banner?await W(r,e.thumbnail):ee,a=e.banner?await W(r,e.banner):Fr,e.thumbnail&&i.push({name:h.keys.thumbnail,value:o}),e.banner&&i.push({name:h.keys.banner,value:a})}catch(p){console.error(p)}let c=await fetch(J(w.src.collection));if(!c.ok)throw new Error("Unable to fetch process src");let u=await c.text();u=u.replace(/'<NAME>'/g,Ee(e.title)),u=u.replace(/'<DESCRIPTION>'/g,Ee(e.description)),u=u.replace(/<CREATOR>/g,e.creator),u=u.replace(/<THUMBNAIL>/g,o||ee),u=u.replace(/<BANNER>/g,a||ee),u=u.replace(/<DATECREATED>/g,n),u=u.replace(/<LASTUPDATE>/g,n);try{let p=await M(r,{tags:i},t?l=>t(l):void 0);if(T("Sending eval message to collection..."),t&&t("Sending eval message to collection..."),await r.ao.message({process:p,signer:r.signer,tags:[{name:"Action",value:"Eval"}],data:u}),!e.skipRegistry){T("Sending collection to registry..."),t&&t("Sending collection to registry...");let l=[{name:"Action",value:"Add-Collection"},{name:"CollectionId",value:p},{name:"Name",value:X(e.title)},{name:"Creator",value:e.creator},{name:"DateCreated",value:n}];a&&l.push({name:"Banner",value:a}),o&&l.push({name:"Thumbnail",value:o}),await r.ao.message({process:w.collectionRegistry,signer:r.signer,tags:l})}if(!e.skipActivity){T("Creating collection activity process..."),t&&t("Creating collection activity process...");let l=[{name:"CollectionId",value:p},{name:"DateCreated",value:n},{name:"On-Boot",value:w.src.collectionActivity}],y=await M(r,{tags:l},t?S=>t(S):void 0);T("Adding activity to collection process..."),t&&t("Adding activity to collection process..."),await r.ao.message({process:p,signer:r.signer,tags:[{name:"Action",value:"Eval"}],data:`ActivityProcess = '${y}'`})}return p}catch(p){throw new Error(p.message??"Error creating collection")}}}function Tt(r){return async e=>await R(r,{processId:e.creator,action:"Run-Action",tags:[{name:"ForwardTo",value:e.collectionId},{name:"ForwardAction",value:"Update-Assets"}],data:{Target:e.collectionId,Action:"Update-Assets",Input:JSON.stringify({AssetIds:e.assetIds,UpdateType:e.updateType})}})}function xt(r){return async e=>{let t=await D(r,{processId:e,action:"Info"});return{...{id:e,title:t.Name,description:t.Description,creator:t.Creator,dateCreated:t.DateCreated,thumbnail:t.Thumbnail??ee,banner:t.Banner??ee},assetIds:t.Assets}}}function At(r){return async e=>{let t=e.creator?"Get-Collections-By-User":"Get-Collections",n=await D(r,{processId:w.collectionRegistry,action:t,tags:e.creator?[{name:"Creator",value:e.creator}]:null});return n&&n.Collections&&n.Collections.length?n.Collections.map(o=>({id:o.Id,title:o.Name.replace(/\[|\]/g,""),description:o.Description,creator:o.Creator,dateCreated:o.DateCreated,banner:o.Banner,thumbnail:o.Thumbnail})):null}}var Wn=f(d(),1);function Et(r){let e=ce(r);return async(t,n)=>{let i=t.tags?t.tags:[];i.push({name:"Data-Source",value:t.parentId}),i.push({name:"Root-Source",value:t.rootId??t.parentId});let o={name:`Comment on ${t.parentId}`,description:`Comment on ${t.parentId}`,topics:["comment"],creator:t.creator,data:t.content,contentType:"text/plain",assetType:"comment",tags:i};return e(o,n)}}function It(r){return async e=>{try{let t=await Ce(r,e,{useGateway:!0}),n=t?.dataSource,i=t?.rootSource;if(!n||!i)throw new Error("dataSource and rootSource must be present on a comment");return{content:await Ct(e),parentId:n,rootId:i}}catch(t){throw new Error(t.message??"Error getting comment")}}}function Bt(r){return async e=>{if(!e.parentId&&!e.rootId)throw new Error("Must provide either parentId or rootId");let t=[];e.parentId&&t.push({name:"Data-Source",values:[e.parentId??""]}),e.rootId&&t.push({name:"Root-Source",values:[e.rootId??""]});let n=await B({gateway:E.goldsky,ids:null,tags:t,owners:null,cursor:null}),i=[];n&&n.data.length&&(i=n.data.map(a=>ue(a)));let o=[];for(let a of i){let c=a?.dataSource,u=a?.rootSource;if(!c||!u)throw new Error("dataSource and rootSource must be present on a comment");o.push({id:a.id,content:await Ct(a.id),parentId:c,rootId:u})}return o}}async function Ct(r){try{return await(await fetch(J(r))).text()}catch(e){throw new Error(e.message??"Error getting comment data")}}var Kn=f(d(),1);var Zn=f(d(),1);function De(r){return async(e,t)=>{try{let n=[{name:h.keys.bootloaderInit,value:w.src.zone}];return e.tags&&e.tags.length&&e.tags.forEach(o=>n.push(o)),await M(r,{tags:n},t?o=>t(o):void 0)}catch(n){throw new Error(n.message??"Error creating zone")}}}function Se(r){return async(e,t)=>{try{let n=Object.entries(e).map(([o,a])=>({key:o,value:a}));return await R(r,{processId:t,action:"Zone-Update",data:n})}catch(n){throw new Error(n)}}}function Dt(r){return async(e,t)=>{try{return await R(r,{processId:t,action:"Zone-Append",tags:[{name:"Path",value:e.path}],data:e.data})}catch(n){throw new Error(n)}}}function be(r){return async e=>{try{let t=await D(r,{processId:e,action:"Info"});return U(t)}catch(t){throw new Error(t)}}}function St(r){return async(e,t)=>{try{if(!r.signer)throw new Error("No signer provided");let i=[{name:"Date-Created",value:new Date().getTime().toString()},{name:"Action",value:"Create-Profile"}],o=null,a=null;try{e.thumbnail&&(o=await W(r,e.thumbnail)),e.banner&&(a=await W(r,e.banner))}catch(l){console.error(l)}let c=await M(r,{tags:i,evalTxId:w.src.profile},l=>T(l)),u={UserName:e.userName,DisplayName:e.displayName,Description:e.description};o&&(u.ProfileImage=o),a&&(u.CoverImage=a),T("Updating profile..."),t&&t("Updating profile...");let p=await R(r,{processId:c,action:"Update-Profile",data:u});return T(`Profile update: ${p}`),c}catch(n){throw new Error(n.message??"Error creating profile")}}}function bt(r){return async(e,t,n)=>{if(t){let i={UserName:e.userName,DisplayName:e.displayName,Description:e.description};if(e.thumbnail)try{i.Thumbnail=await W(r,e.thumbnail)}catch(o){n&&n(`Failed to resolve thumbnail: ${o.message}`)}if(e.banner)try{i.Banner=await W(r,e.banner)}catch(o){n&&n(`Failed to resolve banner: ${o.message}`)}try{T("Updating profile..."),n&&n("Updating profile...");let o=await R(r,{processId:t,action:"Update-Profile",data:i});return T(`Profile update: ${o}`),o}catch(o){throw new Error(o.message??"Error updating profile")}}else throw new Error("No profile provided")}}function Pe(r){return async e=>{try{let t=await D(r,{processId:e,action:"Info"}),{Profile:n={},...i}=t,o={...i,...n};return{id:e,...U(o)}}catch(t){throw new Error(t.message??"Error fetching profile")}}}function Pt(r){let e=Pe(r);return async t=>{try{let n=await D(r,{processId:w.profileRegistry,action:"Get-Profiles-By-Delegate",data:{Address:t}}),i;if(n&&n.length>0&&n[0].ProfileId)return i=n[0].ProfileId,await e(i)}catch(n){throw new Error(n.message??"Error fetching profile")}}}globalThis.Buffer||(globalThis.Buffer=vt.Buffer);function Rr(r){return{createZone:De(r),updateZone:Se(r),addToZone:Dt(r),getZone:be(r),createProfile:St(r),updateProfile:bt(r),getProfileById:Pe(r),getProfileByWalletAddress:Pt(r),createAtomicAsset:ce(r),getAtomicAsset:gt(r),getAtomicAssets:mt,createComment:Et(r),getComment:It(r),getComments:Bt(r),createCollection:wt(r),updateCollectionAssets:Tt(r),getCollection:xt(r),getCollections:At(r),resolveTransaction:dt(r),getGQLData:B,getAggregatedGQLData:st,createProcess:yt(r),readProcess:lt(r),sendMessage:ut(r),mapFromProcessCase:U,mapToProcessCase:V}}var oi={init:Rr};export{oi as default};
28
29
  /*! Bundled license information:
29
30
 
30
31
  ieee754/index.js: