@ar.io/sdk 1.2.0-alpha.10 → 1.2.0-alpha.11
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.
|
@@ -213,12 +213,12 @@ ${C}`,A.pop(),`[${H}]`}let P=Object.keys(T),N=P.length;if(N===0)return"{}";if(l<
|
|
|
213
213
|
${B}`,W="",J="",F=Math.min(N,c);HB(T)&&(W+=GB(T,q,c),P=P.slice(T.length),F-=T.length,J=q),o&&(P=KB(P)),A.push(T);for(let H=0;H<F;H++){let Y=P[H],E=m(Y,T[Y],A,R,B);E!==void 0&&(W+=`${J}"${dl(Y)}": ${E}`,J=q)}if(N>c){let H=N-c;W+=`${J}"...": "${nd(H)} not stringified"`,J=q}return J!==""&&(W=`
|
|
214
214
|
${B}${W}
|
|
215
215
|
${C}`),A.pop(),`{${W}}`}case"number":return isFinite(T)?String(T):t?t(T):"null";case"boolean":return T===!0?"true":"false";case"undefined":return;case"bigint":if(h)return String(T);default:return t?t(T):void 0}}function y(M,T,A){switch(typeof T){case"string":return`"${dl(T)}"`;case"object":{if(T===null)return"null";if(typeof T.toJSON=="function"){if(T=T.toJSON(M),typeof T!="object")return y(M,T,A);if(T===null)return"null"}if(A.indexOf(T)!==-1)return r;let R="";if(Array.isArray(T)){if(T.length===0)return"[]";if(l<A.length+1)return'"[Array]"';A.push(T);let q=Math.min(T.length,c),W=0;for(;W<q-1;W++){let F=y(W,T[W],A);R+=F!==void 0?F:"null",R+=","}let J=y(W,T[W],A);if(R+=J!==void 0?J:"null",T.length-1>c){let F=T.length-c-1;R+=`,"... ${nd(F)} not stringified"`}return A.pop(),`[${R}]`}let B=Object.keys(T),C=B.length;if(C===0)return"{}";if(l<A.length+1)return'"[Object]"';let P="",N=Math.min(C,c);HB(T)&&(R+=GB(T,",",c),B=B.slice(T.length),N-=T.length,P=","),o&&(B=KB(B)),A.push(T);for(let q=0;q<N;q++){let W=B[q],J=y(W,T[W],A);J!==void 0&&(R+=`${P}"${dl(W)}":${J}`,P=",")}if(C>c){let q=C-c;R+=`${P}"...":"${nd(q)} not stringified"`}return A.pop(),`{${R}}`}case"number":return isFinite(T)?String(T):t?t(T):"null";case"boolean":return T===!0?"true":"false";case"undefined":return;case"bigint":if(h)return String(T);default:return t?t(T):void 0}}function v(M,T,A){if(arguments.length>1){let R="";if(typeof A=="number"?R=" ".repeat(Math.min(A,10)):typeof A=="string"&&(R=A.slice(0,10)),T!=null){if(typeof T=="function")return p("",{"":M},[],T,R,"");if(Array.isArray(T))return w("",M,[],oxt(T),R,"")}if(R.length!==0)return m("",M,[],R,"")}return y("",M,[])}return v}});var XB=De(gl=>{"use strict";Tt();Rt();xt();Object.defineProperty(gl,"__esModule",{value:!0});gl.createInteractionTagsList=gl.createDummyTx=gl.createInteractionTx=void 0;var ad=Hh(),sxt=Hu(),pl=_p();async function hxt(i,t,r,h,o,l="",c="0",p=!1,w,m){let y={data:Math.random().toString().slice(-4)};l&&l.length&&(y.target=l.toString(),c&&+c>0&&(y.quantity=c.toString())),p&&(y.reward="0",y.last_tx="p7vc1iSP6bvH_fCeUFa9LqoV5qiyW-jdEKouAT0XMoSwrNraB9mgpi29Q10waEpO"),m&&m.length&&(y.reward=m);let v=await i.createTransaction(y);return Mnt(r,h,w,o).forEach(T=>v.addTag(T.name,T.value)),t&&await t(v),v}gl.createInteractionTx=hxt;function fxt(i,t,r){let o=new sxt.TagsParser().decodeTags(i);return{id:i.id,owner:{address:t,key:""},recipient:i.target,tags:o,fee:{winston:i.reward,ar:""},quantity:{winston:i.quantity,ar:""},block:{id:r.indep_hash,height:r.height,timestamp:r.timestamp,previous:null},dry:!0,anchor:null,signature:null,data:null,parent:null,bundledIn:null}}gl.createDummyTx=fxt;function Mnt(i,t,r,h){let o=[];if(h&&h.length)for(let l of h)o.push(new pl.Tag(l.name.toString(),l.value.toString()));return o.push(new pl.Tag(ad.SMART_WEAVE_TAGS.APP_NAME,"SmartWeaveAction")),o.push(new pl.Tag(ad.SMART_WEAVE_TAGS.APP_VERSION,"0.3.0")),o.push(new pl.Tag(ad.SMART_WEAVE_TAGS.SDK,"Warp")),o.push(new pl.Tag(ad.SMART_WEAVE_TAGS.CONTRACT_TX_ID,i)),o.push(new pl.Tag(ad.SMART_WEAVE_TAGS.INPUT,JSON.stringify(t))),o.push(new pl.Tag(ad.WARP_TAGS.INPUT_FORMAT,"tag")),r&&o.push(new pl.Tag(ad.WARP_TAGS.WARP_TESTNET,"1.0.0")),o}gl.createInteractionTagsList=Mnt});var YB=De(Ap=>{"use strict";Tt();Rt();xt();Object.defineProperty(Ap,"__esModule",{value:!0});Ap.REGISTER_PROVIDER=Ap.emptyTransfer=void 0;Ap.emptyTransfer={target:"",winstonQty:"0"};Ap.REGISTER_PROVIDER=["node1","node2","arweave"]});var tO=De(Y4=>{"use strict";Tt();Rt();xt();Object.defineProperty(Y4,"__esModule",{value:!0});Y4.InnerWritesEvaluator=void 0;var QB=class{eval(t){let r=[];return Object.keys(t.interactions).forEach(h=>{let o=t.interactions[h];this.evalForeignCalls(t.contractTxId,o,r)}),r}evalForeignCalls(t,r,h){Object.keys(r.interactionInput.foreignContractCalls).forEach(o=>{let l=r.interactionInput.foreignContractCalls[o];l.innerCallType=="write"&&Object.keys(l.interactions).forEach(c=>{let p=l.interactions[c];p.interactionInput.dryWrite&&!h.includes(l.contractTxId)&&t!==l.contractTxId&&h.push(l.contractTxId),this.evalForeignCalls(t,p,h)})})}};Y4.InnerWritesEvaluator=QB});var cO={};fs(cO,{AVSCTap:()=>uv,ArweaveSigner:()=>aO,DataItem:()=>fv,MAX_TAG_BYTES:()=>tw,MIN_BINARY_SIZE:()=>fO,SIG_CONFIG:()=>xp,SignatureConfig:()=>oh,Signer:()=>xnt,createData:()=>Bnt,default:()=>Bxt,deserializeTags:()=>Q4,indexToType:()=>sO,serializeTags:()=>hO,tagsExceedLimit:()=>Int,warparbundles:()=>Oxt});async function Rnt(i){if(Array.isArray(i)){let o=(0,Jh.concatBuffers)([(0,Jh.stringToBuffer)("list"),(0,Jh.stringToBuffer)(i.length.toString())]);return await knt(i,await Zu().hash(o,"SHA-384"))}let t=i,r=(0,Jh.concatBuffers)([(0,Jh.stringToBuffer)("blob"),(0,Jh.stringToBuffer)(t.byteLength.toString())]),h=(0,Jh.concatBuffers)([await Zu().hash(r,"SHA-384"),await Zu().hash(t,"SHA-384")]);return await Zu().hash(h,"SHA-384")}async function knt(i,t){if(i.length<1)return t;let r=(0,Jh.concatBuffers)([t,await Rnt(i[0])]),h=await Zu().hash(r,"SHA-384");return await knt(i.slice(1),h)}function Zu(){return Axt??=new Ext}async function iO(i){return Rnt([(0,Jh.stringToBuffer)("dataitem"),(0,Jh.stringToBuffer)("1"),(0,Jh.stringToBuffer)(i.signatureType.toString()),i.rawOwner,i.rawTarget,i.rawAnchor,i.rawTags,i.rawData])}async function Txt(i,t){let r=await iO(i),h=await t.sign(r),o=await Zu().hash(h);return{signature:ge.from(h),id:ge.from(o)}}async function xxt(i,t){let{signature:r,id:h}=await Txt(i,t);return i.getRaw().set(r,2),h}function hO(i){let t=new uv;return t.writeTags(i),t.toBuffer()}function Int(i){let t=new uv;return t.writeTags(i),t.tagsExceedLimit()}function Q4(i){return new uv(i).readTags()}function ml(i){let t=0;for(let r=i.length-1;r>=0;r--)t=t*256+i[r];return t}function Rxt(i){if(i>29)throw new Error("Short too long");let t=[0,0];for(let r=0;r<t.length;r++){let h=i&255;t[r]=h,i=(i-h)/256}return Uint8Array.from(t)}function Snt(i){let t=[0,0,0,0,0,0,0,0];for(let r=0;r<t.length;r++){let h=i&255;t[r]=h,i=(i-h)/256}return Uint8Array.from(t)}function Bnt(i,t,r){let h=t.publicKey,o=r?.target?Ixt.default.toBuffer(r.target):null,l=1+(o?.byteLength??0),c=r?.anchor?ge.from(r.anchor):null,p=1+(c?.byteLength??0),w=(r?.tags?.length??0)>0?hO(r.tags):null,m=16+(w?w.byteLength:0),y=ge.from(i),v=y.byteLength,M=2+t.signatureLength+t.ownerLength+l+p+m+v,T=ge.alloc(M);if(T.set(Rxt(t.signatureType),0),T.set(new Uint8Array(t.signatureLength).fill(0),2),h.byteLength!==t.ownerLength)throw new Error(`Owner must be ${t.ownerLength} bytes, but was incorrectly ${h.byteLength}`);T.set(h,2+t.signatureLength);let A=2+t.signatureLength+t.ownerLength;if(T[A]=o?1:0,o){if(o.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${o.byteLength}`);T.set(o,A+1)}let R=A+l,B=R+1;if(T[R]=c?1:0,c){if(B+=c.byteLength,c.byteLength!==32)throw new Error("Anchor must be 32 bytes");T.set(c,R+1)}T.set(Snt(r?.tags?.length??0),B);let C=Snt(w?.byteLength??0);T.set(C,B+8),w&&T.set(w,B+16);let P=B+m;return T.set(y,P),new fv(T)}var uxt,nO,cxt,lxt,dxt,pxt,Ju,gxt,mxt,sd,vxt,yxt,oO,Ent,Ant,bxt,wxt,rO,_xt,Tnt,xnt,Mxt,Jh,eO,Sxt,Ext,Axt,oh,xp,aO,sO,Wf,uv,kxt,Tp,tw,fO,fv,Ixt,uO,Bxt,Oxt,lO=Vi(()=>{"use strict";Tt();Rt();xt();uxt=Object.create,nO=Object.defineProperty,cxt=Object.getOwnPropertyDescriptor,lxt=Object.getOwnPropertyNames,dxt=Object.getPrototypeOf,pxt=Object.prototype.hasOwnProperty,Ju=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),gxt=(i,t)=>{for(var r in t)nO(i,r,{get:t[r],enumerable:!0})},mxt=(i,t,r,h)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of lxt(t))!pxt.call(i,o)&&o!==r&&nO(i,o,{get:()=>t[o],enumerable:!(h=cxt(t,o))||h.enumerable});return i},sd=(i,t,r)=>(r=i!=null?uxt(dxt(i)):{},mxt(t||!i||!i.__esModule?nO(r,"default",{value:i,enumerable:!0}):r,i)),vxt=Ju(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});function t(r){var h=4,o=r.length,l=o%h;if(!l)return r;var c=o,p=h-l,w=o+p,m=ge.alloc(w);for(m.write(r);p--;)m.write("=",c++);return m.toString()}i.default=t}),yxt=Ju(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t=vxt();function r(w,m){return m===void 0&&(m="utf8"),ge.isBuffer(w)?l(w.toString("base64")):l(ge.from(w,m).toString("base64"))}function h(w,m){return m===void 0&&(m="utf8"),ge.from(o(w),"base64").toString(m)}function o(w){return w=w.toString(),t.default(w).replace(/\-/g,"+").replace(/_/g,"/")}function l(w){return w.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(w){return ge.from(o(w),"base64")}var p=r;p.encode=r,p.decode=h,p.toBase64=o,p.fromBase64=l,p.toBuffer=c,i.default=p}),oO=Ju((i,t)=>{t.exports=yxt().default,t.exports.default=t.exports}),Ent=Ju(i=>{"use strict";i.byteLength=w,i.toByteArray=y,i.fromByteArray=T;var t=[],r=[],h=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(l=0,c=o.length;l<c;++l)t[l]=o[l],r[o.charCodeAt(l)]=l;var l,c;r[45]=62,r[95]=63;function p(A){var R=A.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=A.indexOf("=");B===-1&&(B=R);var C=B===R?0:4-B%4;return[B,C]}function w(A){var R=p(A),B=R[0],C=R[1];return(B+C)*3/4-C}function m(A,R,B){return(R+B)*3/4-B}function y(A){var R,B=p(A),C=B[0],P=B[1],N=new h(m(A,C,P)),q=0,W=P>0?C-4:C,J;for(J=0;J<W;J+=4)R=r[A.charCodeAt(J)]<<18|r[A.charCodeAt(J+1)]<<12|r[A.charCodeAt(J+2)]<<6|r[A.charCodeAt(J+3)],N[q++]=R>>16&255,N[q++]=R>>8&255,N[q++]=R&255;return P===2&&(R=r[A.charCodeAt(J)]<<2|r[A.charCodeAt(J+1)]>>4,N[q++]=R&255),P===1&&(R=r[A.charCodeAt(J)]<<10|r[A.charCodeAt(J+1)]<<4|r[A.charCodeAt(J+2)]>>2,N[q++]=R>>8&255,N[q++]=R&255),N}function v(A){return t[A>>18&63]+t[A>>12&63]+t[A>>6&63]+t[A&63]}function M(A,R,B){for(var C,P=[],N=R;N<B;N+=3)C=(A[N]<<16&16711680)+(A[N+1]<<8&65280)+(A[N+2]&255),P.push(v(C));return P.join("")}function T(A){for(var R,B=A.length,C=B%3,P=[],N=16383,q=0,W=B-C;q<W;q+=N)P.push(M(A,q,q+N>W?W:q+N));return C===1?(R=A[B-1],P.push(t[R>>2]+t[R<<4&63]+"==")):C===2&&(R=(A[B-2]<<8)+A[B-1],P.push(t[R>>10]+t[R>>4&63]+t[R<<2&63]+"=")),P.join("")}}),Ant=Ju(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.b64UrlDecode=i.b64UrlEncode=i.bufferTob64Url=i.bufferTob64=i.b64UrlToBuffer=i.stringToB64Url=i.stringToBuffer=i.bufferToString=i.b64UrlToString=i.concatBuffers=void 0;var t=Ent();function r(M){let T=0;for(let B=0;B<M.length;B++)T+=M[B].byteLength;let A=new Uint8Array(T),R=0;A.set(new Uint8Array(M[0]),R),R+=M[0].byteLength;for(let B=1;B<M.length;B++)A.set(new Uint8Array(M[B]),R),R+=M[B].byteLength;return A}i.concatBuffers=r;function h(M){let T=p(M);return o(T)}i.b64UrlToString=h;function o(M){return new TextDecoder("utf-8",{fatal:!0}).decode(M)}i.bufferToString=o;function l(M){return new TextEncoder().encode(M)}i.stringToBuffer=l;function c(M){return m(l(M))}i.stringToB64Url=c;function p(M){return new Uint8Array(t.toByteArray(v(M)))}i.b64UrlToBuffer=p;function w(M){return t.fromByteArray(new Uint8Array(M))}i.bufferTob64=w;function m(M){return y(w(M))}i.bufferTob64Url=m;function y(M){return M.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}i.b64UrlEncode=y;function v(M){M=M.replace(/\-/g,"+").replace(/\_/g,"/");let T;return M.length%4==0?T=0:T=4-M.length%4,M.concat("=".repeat(T))}i.b64UrlDecode=v}),bxt=Ju(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t=Ant(),r=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let h=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),o=await this.driver.exportKey("jwk",h.privateKey);return{kty:o.kty,e:o.e,n:o.n,d:o.d,p:o.p,q:o.q,dp:o.dp,dq:o.dq,qi:o.qi}}async sign(h,o,{saltLength:l}={}){let c=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(h),o);return new Uint8Array(c)}async hash(h,o="SHA-256"){let l=await this.driver.digest(o,h);return new Uint8Array(l)}async verify(h,o,l){let c={kty:"RSA",e:"AQAB",n:h},p=await this.jwkToPublicCryptoKey(c),w=await this.driver.digest("SHA-256",o),m=await this.driver.verify({name:"RSA-PSS",saltLength:0},p,l,o),y=await this.driver.verify({name:"RSA-PSS",saltLength:32},p,l,o),v=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((p.algorithm.modulusLength-1)/8)-w.byteLength-2},p,l,o);return m||y||v}async jwkToCryptoKey(h){return this.driver.importKey("jwk",h,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(h){return this.driver.importKey("jwk",h,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let h=crypto?.subtle;return h===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(o=>typeof h[o]=="function")}async encrypt(h,o,l){let c=await this.driver.importKey("raw",typeof o=="string"?t.stringToBuffer(o):o,{name:"PBKDF2",length:32},!1,["deriveKey"]),p=await this.driver.deriveKey({name:"PBKDF2",salt:l?t.stringToBuffer(l):t.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),w=new Uint8Array(16);crypto.getRandomValues(w);let m=await this.driver.encrypt({name:"AES-CBC",iv:w},p,h);return t.concatBuffers([w,m])}async decrypt(h,o,l){let c=await this.driver.importKey("raw",typeof o=="string"?t.stringToBuffer(o):o,{name:"PBKDF2",length:32},!1,["deriveKey"]),p=await this.driver.deriveKey({name:"PBKDF2",salt:l?t.stringToBuffer(l):t.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),w=h.slice(0,16),m=await this.driver.decrypt({name:"AES-CBC",iv:w},p,h.slice(16));return t.concatBuffers([m])}};i.default=r}),wxt=Ju(i=>{i.read=function(t,r,h,o,l){var c,p,w=l*8-o-1,m=(1<<w)-1,y=m>>1,v=-7,M=h?l-1:0,T=h?-1:1,A=t[r+M];for(M+=T,c=A&(1<<-v)-1,A>>=-v,v+=w;v>0;c=c*256+t[r+M],M+=T,v-=8);for(p=c&(1<<-v)-1,c>>=-v,v+=o;v>0;p=p*256+t[r+M],M+=T,v-=8);if(c===0)c=1-y;else{if(c===m)return p?NaN:(A?-1:1)*(1/0);p=p+Math.pow(2,o),c=c-y}return(A?-1:1)*p*Math.pow(2,c-o)},i.write=function(t,r,h,o,l,c){var p,w,m,y=c*8-l-1,v=(1<<y)-1,M=v>>1,T=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=o?0:c-1,R=o?1:-1,B=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(w=isNaN(r)?1:0,p=v):(p=Math.floor(Math.log(r)/Math.LN2),r*(m=Math.pow(2,-p))<1&&(p--,m*=2),p+M>=1?r+=T/m:r+=T*Math.pow(2,1-M),r*m>=2&&(p++,m/=2),p+M>=v?(w=0,p=v):p+M>=1?(w=(r*m-1)*Math.pow(2,l),p=p+M):(w=r*Math.pow(2,M-1)*Math.pow(2,l),p=0));l>=8;t[h+A]=w&255,A+=R,w/=256,l-=8);for(p=p<<l|w,y+=l;y>0;t[h+A]=p&255,A+=R,p/=256,y-=8);t[h+A-R]|=B*128}}),rO=Ju(i=>{"use strict";var t=Ent(),r=wxt(),h=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=p,i.SlowBuffer=P,i.INSPECT_MAX_BYTES=50;var o=2147483647;i.kMaxLength=o,p.TYPED_ARRAY_SUPPORT=l(),!p.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 l(){try{let I=new Uint8Array(1),O={foo:function(){return 42}};return Object.setPrototypeOf(O,Uint8Array.prototype),Object.setPrototypeOf(I,O),I.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function c(I){if(I>o)throw new RangeError('The value "'+I+'" is invalid for option "size"');let O=new Uint8Array(I);return Object.setPrototypeOf(O,p.prototype),O}function p(I,O,L){if(typeof I=="number"){if(typeof O=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(I)}return w(I,O,L)}p.poolSize=8192;function w(I,O,L){if(typeof I=="string")return M(I,O);if(ArrayBuffer.isView(I))return A(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(mt(I,ArrayBuffer)||I&&mt(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(mt(I,SharedArrayBuffer)||I&&mt(I.buffer,SharedArrayBuffer)))return R(I,O,L);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let V=I.valueOf&&I.valueOf();if(V!=null&&V!==I)return p.from(V,O,L);let st=B(I);if(st)return st;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return p.from(I[Symbol.toPrimitive]("string"),O,L);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I)}p.from=function(I,O,L){return w(I,O,L)},Object.setPrototypeOf(p.prototype,Uint8Array.prototype),Object.setPrototypeOf(p,Uint8Array);function m(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function y(I,O,L){return m(I),I<=0?c(I):O!==void 0?typeof L=="string"?c(I).fill(O,L):c(I).fill(O):c(I)}p.alloc=function(I,O,L){return y(I,O,L)};function v(I){return m(I),c(I<0?0:C(I)|0)}p.allocUnsafe=function(I){return v(I)},p.allocUnsafeSlow=function(I){return v(I)};function M(I,O){if((typeof O!="string"||O==="")&&(O="utf8"),!p.isEncoding(O))throw new TypeError("Unknown encoding: "+O);let L=N(I,O)|0,V=c(L),st=V.write(I,O);return st!==L&&(V=V.slice(0,st)),V}function T(I){let O=I.length<0?0:C(I.length)|0,L=c(O);for(let V=0;V<O;V+=1)L[V]=I[V]&255;return L}function A(I){if(mt(I,Uint8Array)){let O=new Uint8Array(I);return R(O.buffer,O.byteOffset,O.byteLength)}return T(I)}function R(I,O,L){if(O<0||I.byteLength<O)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<O+(L||0))throw new RangeError('"length" is outside of buffer bounds');let V;return O===void 0&&L===void 0?V=new Uint8Array(I):L===void 0?V=new Uint8Array(I,O):V=new Uint8Array(I,O,L),Object.setPrototypeOf(V,p.prototype),V}function B(I){if(p.isBuffer(I)){let O=C(I.length)|0,L=c(O);return L.length===0||I.copy(L,0,0,O),L}if(I.length!==void 0)return typeof I.length!="number"||wt(I.length)?c(0):T(I);if(I.type==="Buffer"&&Array.isArray(I.data))return T(I.data)}function C(I){if(I>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return I|0}function P(I){return+I!=I&&(I=0),p.alloc(+I)}p.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==p.prototype},p.compare=function(I,O){if(mt(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),mt(O,Uint8Array)&&(O=p.from(O,O.offset,O.byteLength)),!p.isBuffer(I)||!p.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===O)return 0;let L=I.length,V=O.length;for(let st=0,ft=Math.min(L,V);st<ft;++st)if(I[st]!==O[st]){L=I[st],V=O[st];break}return L<V?-1:V<L?1:0},p.isEncoding=function(I){switch(String(I).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}},p.concat=function(I,O){if(!Array.isArray(I))throw new TypeError('"list" argument must be an Array of Buffers');if(I.length===0)return p.alloc(0);let L;if(O===void 0)for(O=0,L=0;L<I.length;++L)O+=I[L].length;let V=p.allocUnsafe(O),st=0;for(L=0;L<I.length;++L){let ft=I[L];if(mt(ft,Uint8Array))st+ft.length>V.length?(p.isBuffer(ft)||(ft=p.from(ft)),ft.copy(V,st)):Uint8Array.prototype.set.call(V,ft,st);else if(p.isBuffer(ft))ft.copy(V,st);else throw new TypeError('"list" argument must be an Array of Buffers');st+=ft.length}return V};function N(I,O){if(p.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||mt(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);let L=I.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&L===0)return 0;let st=!1;for(;;)switch(O){case"ascii":case"latin1":case"binary":return L;case"utf8":case"utf-8":return ut(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L*2;case"hex":return L>>>1;case"base64":return bt(I).length;default:if(st)return V?-1:ut(I).length;O=(""+O).toLowerCase(),st=!0}}p.byteLength=N;function q(I,O,L){let V=!1;if((O===void 0||O<0)&&(O=0),O>this.length||((L===void 0||L>this.length)&&(L=this.length),L<=0)||(L>>>=0,O>>>=0,L<=O))return"";for(I||(I="utf8");;)switch(I){case"hex":return e(this,O,L);case"utf8":case"utf-8":return d(this,O,L);case"ascii":return x(this,O,L);case"latin1":case"binary":return a(this,O,L);case"base64":return f(this,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u(this,O,L);default:if(V)throw new TypeError("Unknown encoding: "+I);I=(I+"").toLowerCase(),V=!0}}p.prototype._isBuffer=!0;function W(I,O,L){let V=I[O];I[O]=I[L],I[L]=V}p.prototype.swap16=function(){let I=this.length;if(I%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;O<I;O+=2)W(this,O,O+1);return this},p.prototype.swap32=function(){let I=this.length;if(I%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let O=0;O<I;O+=4)W(this,O,O+3),W(this,O+1,O+2);return this},p.prototype.swap64=function(){let I=this.length;if(I%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let O=0;O<I;O+=8)W(this,O,O+7),W(this,O+1,O+6),W(this,O+2,O+5),W(this,O+3,O+4);return this},p.prototype.toString=function(){let I=this.length;return I===0?"":arguments.length===0?d(this,0,I):q.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(I){if(!p.isBuffer(I))throw new TypeError("Argument must be a Buffer");return this===I?!0:p.compare(this,I)===0},p.prototype.inspect=function(){let I="",O=i.INSPECT_MAX_BYTES;return I=this.toString("hex",0,O).replace(/(.{2})/g,"$1 ").trim(),this.length>O&&(I+=" ... "),"<Buffer "+I+">"},h&&(p.prototype[h]=p.prototype.inspect),p.prototype.compare=function(I,O,L,V,st){if(mt(I,Uint8Array)&&(I=p.from(I,I.offset,I.byteLength)),!p.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(O===void 0&&(O=0),L===void 0&&(L=I?I.length:0),V===void 0&&(V=0),st===void 0&&(st=this.length),O<0||L>I.length||V<0||st>this.length)throw new RangeError("out of range index");if(V>=st&&O>=L)return 0;if(V>=st)return-1;if(O>=L)return 1;if(O>>>=0,L>>>=0,V>>>=0,st>>>=0,this===I)return 0;let ft=st-V,ht=L-O,Et=Math.min(ft,ht),_t=this.slice(V,st),vt=I.slice(O,L);for(let Qt=0;Qt<Et;++Qt)if(_t[Qt]!==vt[Qt]){ft=_t[Qt],ht=vt[Qt];break}return ft<ht?-1:ht<ft?1:0};function J(I,O,L,V,st){if(I.length===0)return-1;if(typeof L=="string"?(V=L,L=0):L>2147483647?L=2147483647:L<-2147483648&&(L=-2147483648),L=+L,wt(L)&&(L=st?0:I.length-1),L<0&&(L=I.length+L),L>=I.length){if(st)return-1;L=I.length-1}else if(L<0)if(st)L=0;else return-1;if(typeof O=="string"&&(O=p.from(O,V)),p.isBuffer(O))return O.length===0?-1:F(I,O,L,V,st);if(typeof O=="number")return O=O&255,typeof Uint8Array.prototype.indexOf=="function"?st?Uint8Array.prototype.indexOf.call(I,O,L):Uint8Array.prototype.lastIndexOf.call(I,O,L):F(I,[O],L,V,st);throw new TypeError("val must be string, number or Buffer")}function F(I,O,L,V,st){let ft=1,ht=I.length,Et=O.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(I.length<2||O.length<2)return-1;ft=2,ht/=2,Et/=2,L/=2}function _t(Qt,It){return ft===1?Qt[It]:Qt.readUInt16BE(It*ft)}let vt;if(st){let Qt=-1;for(vt=L;vt<ht;vt++)if(_t(I,vt)===_t(O,Qt===-1?0:vt-Qt)){if(Qt===-1&&(Qt=vt),vt-Qt+1===Et)return Qt*ft}else Qt!==-1&&(vt-=vt-Qt),Qt=-1}else for(L+Et>ht&&(L=ht-Et),vt=L;vt>=0;vt--){let Qt=!0;for(let It=0;It<Et;It++)if(_t(I,vt+It)!==_t(O,It)){Qt=!1;break}if(Qt)return vt}return-1}p.prototype.includes=function(I,O,L){return this.indexOf(I,O,L)!==-1},p.prototype.indexOf=function(I,O,L){return J(this,I,O,L,!0)},p.prototype.lastIndexOf=function(I,O,L){return J(this,I,O,L,!1)};function H(I,O,L,V){L=Number(L)||0;let st=I.length-L;V?(V=Number(V),V>st&&(V=st)):V=st;let ft=O.length;V>ft/2&&(V=ft/2);let ht;for(ht=0;ht<V;++ht){let Et=parseInt(O.substr(ht*2,2),16);if(wt(Et))return ht;I[L+ht]=Et}return ht}function Y(I,O,L,V){return lt(ut(O,I.length-L),I,L,V)}function E(I,O,L,V){return lt(pt(O),I,L,V)}function n(I,O,L,V){return lt(bt(O),I,L,V)}function s(I,O,L,V){return lt(St(O,I.length-L),I,L,V)}p.prototype.write=function(I,O,L,V){if(O===void 0)V="utf8",L=this.length,O=0;else if(L===void 0&&typeof O=="string")V=O,L=this.length,O=0;else if(isFinite(O))O=O>>>0,isFinite(L)?(L=L>>>0,V===void 0&&(V="utf8")):(V=L,L=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let st=this.length-O;if((L===void 0||L>st)&&(L=st),I.length>0&&(L<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");V||(V="utf8");let ft=!1;for(;;)switch(V){case"hex":return H(this,I,O,L);case"utf8":case"utf-8":return Y(this,I,O,L);case"ascii":case"latin1":case"binary":return E(this,I,O,L);case"base64":return n(this,I,O,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s(this,I,O,L);default:if(ft)throw new TypeError("Unknown encoding: "+V);V=(""+V).toLowerCase(),ft=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f(I,O,L){return O===0&&L===I.length?t.fromByteArray(I):t.fromByteArray(I.slice(O,L))}function d(I,O,L){L=Math.min(I.length,L);let V=[],st=O;for(;st<L;){let ft=I[st],ht=null,Et=ft>239?4:ft>223?3:ft>191?2:1;if(st+Et<=L){let _t,vt,Qt,It;switch(Et){case 1:ft<128&&(ht=ft);break;case 2:_t=I[st+1],(_t&192)===128&&(It=(ft&31)<<6|_t&63,It>127&&(ht=It));break;case 3:_t=I[st+1],vt=I[st+2],(_t&192)===128&&(vt&192)===128&&(It=(ft&15)<<12|(_t&63)<<6|vt&63,It>2047&&(It<55296||It>57343)&&(ht=It));break;case 4:_t=I[st+1],vt=I[st+2],Qt=I[st+3],(_t&192)===128&&(vt&192)===128&&(Qt&192)===128&&(It=(ft&15)<<18|(_t&63)<<12|(vt&63)<<6|Qt&63,It>65535&&It<1114112&&(ht=It))}}ht===null?(ht=65533,Et=1):ht>65535&&(ht-=65536,V.push(ht>>>10&1023|55296),ht=56320|ht&1023),V.push(ht),st+=Et}return S(V)}var g=4096;function S(I){let O=I.length;if(O<=g)return String.fromCharCode.apply(String,I);let L="",V=0;for(;V<O;)L+=String.fromCharCode.apply(String,I.slice(V,V+=g));return L}function x(I,O,L){let V="";L=Math.min(I.length,L);for(let st=O;st<L;++st)V+=String.fromCharCode(I[st]&127);return V}function a(I,O,L){let V="";L=Math.min(I.length,L);for(let st=O;st<L;++st)V+=String.fromCharCode(I[st]);return V}function e(I,O,L){let V=I.length;(!O||O<0)&&(O=0),(!L||L<0||L>V)&&(L=V);let st="";for(let ft=O;ft<L;++ft)st+=Mt[I[ft]];return st}function u(I,O,L){let V=I.slice(O,L),st="";for(let ft=0;ft<V.length-1;ft+=2)st+=String.fromCharCode(V[ft]+V[ft+1]*256);return st}p.prototype.slice=function(I,O){let L=this.length;I=~~I,O=O===void 0?L:~~O,I<0?(I+=L,I<0&&(I=0)):I>L&&(I=L),O<0?(O+=L,O<0&&(O=0)):O>L&&(O=L),O<I&&(O=I);let V=this.subarray(I,O);return Object.setPrototypeOf(V,p.prototype),V};function b(I,O,L){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+O>L)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=this[I],st=1,ft=0;for(;++ft<O&&(st*=256);)V+=this[I+ft]*st;return V},p.prototype.readUintBE=p.prototype.readUIntBE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=this[I+--O],st=1;for(;O>0&&(st*=256);)V+=this[I+--O]*st;return V},p.prototype.readUint8=p.prototype.readUInt8=function(I,O){return I=I>>>0,O||b(I,1,this.length),this[I]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(I,O){return I=I>>>0,O||b(I,2,this.length),this[I]|this[I+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(I,O){return I=I>>>0,O||b(I,2,this.length),this[I]<<8|this[I+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(I,O){return I=I>>>0,O||b(I,4,this.length),(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(I,O){return I=I>>>0,O||b(I,4,this.length),this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},p.prototype.readBigUInt64LE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24,st=this[++I]+this[++I]*2**8+this[++I]*2**16+L*2**24;return BigInt(V)+(BigInt(st)<<BigInt(32))}),p.prototype.readBigUInt64BE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=O*2**24+this[++I]*2**16+this[++I]*2**8+this[++I],st=this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+L;return(BigInt(V)<<BigInt(32))+BigInt(st)}),p.prototype.readIntLE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=this[I],st=1,ft=0;for(;++ft<O&&(st*=256);)V+=this[I+ft]*st;return st*=128,V>=st&&(V-=Math.pow(2,8*O)),V},p.prototype.readIntBE=function(I,O,L){I=I>>>0,O=O>>>0,L||b(I,O,this.length);let V=O,st=1,ft=this[I+--V];for(;V>0&&(st*=256);)ft+=this[I+--V]*st;return st*=128,ft>=st&&(ft-=Math.pow(2,8*O)),ft},p.prototype.readInt8=function(I,O){return I=I>>>0,O||b(I,1,this.length),this[I]&128?(255-this[I]+1)*-1:this[I]},p.prototype.readInt16LE=function(I,O){I=I>>>0,O||b(I,2,this.length);let L=this[I]|this[I+1]<<8;return L&32768?L|4294901760:L},p.prototype.readInt16BE=function(I,O){I=I>>>0,O||b(I,2,this.length);let L=this[I+1]|this[I]<<8;return L&32768?L|4294901760:L},p.prototype.readInt32LE=function(I,O){return I=I>>>0,O||b(I,4,this.length),this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},p.prototype.readInt32BE=function(I,O){return I=I>>>0,O||b(I,4,this.length),this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},p.prototype.readBigInt64LE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=this[I+4]+this[I+5]*2**8+this[I+6]*2**16+(L<<24);return(BigInt(V)<<BigInt(32))+BigInt(O+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24)}),p.prototype.readBigInt64BE=ne(function(I){I=I>>>0,j(I,"offset");let O=this[I],L=this[I+7];(O===void 0||L===void 0)&&rt(I,this.length-8);let V=(O<<24)+this[++I]*2**16+this[++I]*2**8+this[++I];return(BigInt(V)<<BigInt(32))+BigInt(this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+L)}),p.prototype.readFloatLE=function(I,O){return I=I>>>0,O||b(I,4,this.length),r.read(this,I,!0,23,4)},p.prototype.readFloatBE=function(I,O){return I=I>>>0,O||b(I,4,this.length),r.read(this,I,!1,23,4)},p.prototype.readDoubleLE=function(I,O){return I=I>>>0,O||b(I,8,this.length),r.read(this,I,!0,52,8)},p.prototype.readDoubleBE=function(I,O){return I=I>>>0,O||b(I,8,this.length),r.read(this,I,!1,52,8)};function _(I,O,L,V,st,ft){if(!p.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(O>st||O<ft)throw new RangeError('"value" argument is out of bounds');if(L+V>I.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(I,O,L,V){if(I=+I,O=O>>>0,L=L>>>0,!V){let ht=Math.pow(2,8*L)-1;_(this,I,O,L,ht,0)}let st=1,ft=0;for(this[O]=I&255;++ft<L&&(st*=256);)this[O+ft]=I/st&255;return O+L},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(I,O,L,V){if(I=+I,O=O>>>0,L=L>>>0,!V){let ht=Math.pow(2,8*L)-1;_(this,I,O,L,ht,0)}let st=L-1,ft=1;for(this[O+st]=I&255;--st>=0&&(ft*=256);)this[O+st]=I/ft&255;return O+L},p.prototype.writeUint8=p.prototype.writeUInt8=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,1,255,0),this[O]=I&255,O+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,65535,0),this[O]=I&255,this[O+1]=I>>>8,O+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,65535,0),this[O]=I>>>8,this[O+1]=I&255,O+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,4294967295,0),this[O+3]=I>>>24,this[O+2]=I>>>16,this[O+1]=I>>>8,this[O]=I&255,O+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,4294967295,0),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4};function k(I,O,L,V,st){U(O,V,st,I,L,7);let ft=Number(O&BigInt(4294967295));I[L++]=ft,ft=ft>>8,I[L++]=ft,ft=ft>>8,I[L++]=ft,ft=ft>>8,I[L++]=ft;let ht=Number(O>>BigInt(32)&BigInt(4294967295));return I[L++]=ht,ht=ht>>8,I[L++]=ht,ht=ht>>8,I[L++]=ht,ht=ht>>8,I[L++]=ht,L}function $(I,O,L,V,st){U(O,V,st,I,L,7);let ft=Number(O&BigInt(4294967295));I[L+7]=ft,ft=ft>>8,I[L+6]=ft,ft=ft>>8,I[L+5]=ft,ft=ft>>8,I[L+4]=ft;let ht=Number(O>>BigInt(32)&BigInt(4294967295));return I[L+3]=ht,ht=ht>>8,I[L+2]=ht,ht=ht>>8,I[L+1]=ht,ht=ht>>8,I[L]=ht,L+8}p.prototype.writeBigUInt64LE=ne(function(I,O=0){return k(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=ne(function(I,O=0){return $(this,I,O,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(I,O,L,V){if(I=+I,O=O>>>0,!V){let Et=Math.pow(2,8*L-1);_(this,I,O,L,Et-1,-Et)}let st=0,ft=1,ht=0;for(this[O]=I&255;++st<L&&(ft*=256);)I<0&&ht===0&&this[O+st-1]!==0&&(ht=1),this[O+st]=(I/ft>>0)-ht&255;return O+L},p.prototype.writeIntBE=function(I,O,L,V){if(I=+I,O=O>>>0,!V){let Et=Math.pow(2,8*L-1);_(this,I,O,L,Et-1,-Et)}let st=L-1,ft=1,ht=0;for(this[O+st]=I&255;--st>=0&&(ft*=256);)I<0&&ht===0&&this[O+st+1]!==0&&(ht=1),this[O+st]=(I/ft>>0)-ht&255;return O+L},p.prototype.writeInt8=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,1,127,-128),I<0&&(I=255+I+1),this[O]=I&255,O+1},p.prototype.writeInt16LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,32767,-32768),this[O]=I&255,this[O+1]=I>>>8,O+2},p.prototype.writeInt16BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,2,32767,-32768),this[O]=I>>>8,this[O+1]=I&255,O+2},p.prototype.writeInt32LE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,2147483647,-2147483648),this[O]=I&255,this[O+1]=I>>>8,this[O+2]=I>>>16,this[O+3]=I>>>24,O+4},p.prototype.writeInt32BE=function(I,O,L){return I=+I,O=O>>>0,L||_(this,I,O,4,2147483647,-2147483648),I<0&&(I=4294967295+I+1),this[O]=I>>>24,this[O+1]=I>>>16,this[O+2]=I>>>8,this[O+3]=I&255,O+4},p.prototype.writeBigInt64LE=ne(function(I,O=0){return k(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=ne(function(I,O=0){return $(this,I,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function it(I,O,L,V,st,ft){if(L+V>I.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("Index out of range")}function Z(I,O,L,V,st){return O=+O,L=L>>>0,st||it(I,O,L,4,34028234663852886e22,-34028234663852886e22),r.write(I,O,L,V,23,4),L+4}p.prototype.writeFloatLE=function(I,O,L){return Z(this,I,O,!0,L)},p.prototype.writeFloatBE=function(I,O,L){return Z(this,I,O,!1,L)};function et(I,O,L,V,st){return O=+O,L=L>>>0,st||it(I,O,L,8,17976931348623157e292,-17976931348623157e292),r.write(I,O,L,V,52,8),L+8}p.prototype.writeDoubleLE=function(I,O,L){return et(this,I,O,!0,L)},p.prototype.writeDoubleBE=function(I,O,L){return et(this,I,O,!1,L)},p.prototype.copy=function(I,O,L,V){if(!p.isBuffer(I))throw new TypeError("argument should be a Buffer");if(L||(L=0),!V&&V!==0&&(V=this.length),O>=I.length&&(O=I.length),O||(O=0),V>0&&V<L&&(V=L),V===L||I.length===0||this.length===0)return 0;if(O<0)throw new RangeError("targetStart out of bounds");if(L<0||L>=this.length)throw new RangeError("Index out of range");if(V<0)throw new RangeError("sourceEnd out of bounds");V>this.length&&(V=this.length),I.length-O<V-L&&(V=I.length-O+L);let st=V-L;return this===I&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(O,L,V):Uint8Array.prototype.set.call(I,this.subarray(L,V),O),st},p.prototype.fill=function(I,O,L,V){if(typeof I=="string"){if(typeof O=="string"?(V=O,O=0,L=this.length):typeof L=="string"&&(V=L,L=this.length),V!==void 0&&typeof V!="string")throw new TypeError("encoding must be a string");if(typeof V=="string"&&!p.isEncoding(V))throw new TypeError("Unknown encoding: "+V);if(I.length===1){let ft=I.charCodeAt(0);(V==="utf8"&&ft<128||V==="latin1")&&(I=ft)}}else typeof I=="number"?I=I&255:typeof I=="boolean"&&(I=Number(I));if(O<0||this.length<O||this.length<L)throw new RangeError("Out of range index");if(L<=O)return this;O=O>>>0,L=L===void 0?this.length:L>>>0,I||(I=0);let st;if(typeof I=="number")for(st=O;st<L;++st)this[st]=I;else{let ft=p.isBuffer(I)?I:p.from(I,V),ht=ft.length;if(ht===0)throw new TypeError('The value "'+I+'" is invalid for argument "value"');for(st=0;st<L-O;++st)this[st+O]=ft[st%ht]}return this};var Q={};function z(I,O,L){Q[I]=class extends L{constructor(){super(),Object.defineProperty(this,"message",{value:O.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(V){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:V,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}z("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),z("ERR_INVALID_ARG_TYPE",function(I,O){return`The "${I}" argument must be of type number. Received type ${typeof O}`},TypeError),z("ERR_OUT_OF_RANGE",function(I,O,L){let V=`The value of "${I}" is out of range.`,st=L;return Number.isInteger(L)&&Math.abs(L)>2**32?st=tt(String(L)):typeof L=="bigint"&&(st=String(L),(L>BigInt(2)**BigInt(32)||L<-(BigInt(2)**BigInt(32)))&&(st=tt(st)),st+="n"),V+=` It must be ${O}. Received ${st}`,V},RangeError);function tt(I){let O="",L=I.length,V=I[0]==="-"?1:0;for(;L>=V+4;L-=3)O=`_${I.slice(L-3,L)}${O}`;return`${I.slice(0,L)}${O}`}function X(I,O,L){j(O,"offset"),(I[O]===void 0||I[O+L]===void 0)&&rt(O,I.length-(L+1))}function U(I,O,L,V,st,ft){if(I>L||I<O){let ht=typeof O=="bigint"?"n":"",Et;throw ft>3?O===0||O===BigInt(0)?Et=`>= 0${ht} and < 2${ht} ** ${(ft+1)*8}${ht}`:Et=`>= -(2${ht} ** ${(ft+1)*8-1}${ht}) and < 2 ** ${(ft+1)*8-1}${ht}`:Et=`>= ${O}${ht} and <= ${L}${ht}`,new Q.ERR_OUT_OF_RANGE("value",Et,I)}X(V,st,ft)}function j(I,O){if(typeof I!="number")throw new Q.ERR_INVALID_ARG_TYPE(O,"number",I)}function rt(I,O,L){throw Math.floor(I)!==I?(j(I,L),new Q.ERR_OUT_OF_RANGE(L||"offset","an integer",I)):O<0?new Q.ERR_BUFFER_OUT_OF_BOUNDS:new Q.ERR_OUT_OF_RANGE(L||"offset",`>= ${L?1:0} and <= ${O}`,I)}var ot=/[^+/0-9A-Za-z-_]/g;function ct(I){if(I=I.split("=")[0],I=I.trim().replace(ot,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function ut(I,O){O=O||1/0;let L,V=I.length,st=null,ft=[];for(let ht=0;ht<V;++ht){if(L=I.charCodeAt(ht),L>55295&&L<57344){if(!st){if(L>56319){(O-=3)>-1&&ft.push(239,191,189);continue}else if(ht+1===V){(O-=3)>-1&&ft.push(239,191,189);continue}st=L;continue}if(L<56320){(O-=3)>-1&&ft.push(239,191,189),st=L;continue}L=(st-55296<<10|L-56320)+65536}else st&&(O-=3)>-1&&ft.push(239,191,189);if(st=null,L<128){if((O-=1)<0)break;ft.push(L)}else if(L<2048){if((O-=2)<0)break;ft.push(L>>6|192,L&63|128)}else if(L<65536){if((O-=3)<0)break;ft.push(L>>12|224,L>>6&63|128,L&63|128)}else if(L<1114112){if((O-=4)<0)break;ft.push(L>>18|240,L>>12&63|128,L>>6&63|128,L&63|128)}else throw new Error("Invalid code point")}return ft}function pt(I){let O=[];for(let L=0;L<I.length;++L)O.push(I.charCodeAt(L)&255);return O}function St(I,O){let L,V,st,ft=[];for(let ht=0;ht<I.length&&!((O-=2)<0);++ht)L=I.charCodeAt(ht),V=L>>8,st=L%256,ft.push(st),ft.push(V);return ft}function bt(I){return t.toByteArray(ct(I))}function lt(I,O,L,V){let st;for(st=0;st<V&&!(st+L>=O.length||st>=I.length);++st)O[st+L]=I[st];return st}function mt(I,O){return I instanceof O||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===O.name}function wt(I){return I!==I}var Mt=function(){let I="0123456789abcdef",O=new Array(256);for(let L=0;L<16;++L){let V=L*16;for(let st=0;st<16;++st)O[V+st]=I[L]+I[st]}return O}();function ne(I){return typeof BigInt>"u"?nt:I}function nt(){throw new Error("BigInt not supported")}}),_xt=Ju((i,t)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,t.exports={Buffer:rO().Buffer,Crypto:window.crypto}):t.exports={Buffer:rO().Buffer,Crypto:crypto}}),Tnt={};gxt(Tnt,{AVSCTap:()=>uv,ArweaveSigner:()=>aO,DataItem:()=>fv,MAX_TAG_BYTES:()=>tw,MIN_BINARY_SIZE:()=>fO,SIG_CONFIG:()=>xp,SignatureConfig:()=>oh,Signer:()=>xnt,createData:()=>Bnt,deserializeTags:()=>Q4,indexToType:()=>sO,serializeTags:()=>hO,tagsExceedLimit:()=>Int});xnt=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(i,t,r,h){throw new Error("You must implement verify method on child")}},Mxt=sd(oO(),1),Jh=sd(Ant(),1);eO=sd(bxt(),1),Sxt=eO.default.default?eO.default.default:eO.default,Ext=class extends Sxt{getPublicKey(i){throw new Error("Unimplemented")}};(function(i){i[i.ARWEAVE=1]="ARWEAVE",i[i.ED25519=2]="ED25519",i[i.ETHEREUM=3]="ETHEREUM",i[i.SOLANA=4]="SOLANA",i[i.INJECTEDAPTOS=5]="INJECTEDAPTOS",i[i.MULTIAPTOS=6]="MULTIAPTOS",i[i.TYPEDETHEREUM=7]="TYPEDETHEREUM"})(oh||(oh={}));xp={[oh.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[oh.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[oh.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[oh.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[oh.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[oh.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[oh.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},aO=class{signatureType=1;ownerLength=xp[1].pubLength;signatureLength=xp[1].sigLength;jwk;pk;constructor(i){this.pk=i.n,this.jwk=i}get publicKey(){return Mxt.default.toBuffer(this.pk)}sign(i){return Zu().sign(this.jwk,i)}static async verify(i,t,r){return await Zu().verify(i,t,r)}},sO={1:aO},Wf=sd(oO(),1);uv=class{buf;pos;constructor(i=ge.alloc(tw),t=0){this.buf=i,this.pos=t}writeTags(i){if(!Array.isArray(i))throw new Error("input must be array");let t=i.length,r;if(t)for(this.writeLong(t),r=0;r<t;r++){let h=i[r];if(h?.name===void 0||h?.value===void 0)throw new Error(`Invalid tag format for ${h}, expected {name:string, value: string}`);this.writeString(h.name),this.writeString(h.value)}this.writeLong(0)}toBuffer(){let i=ge.alloc(this.pos);if(this.pos>this.buf.length)throw new Error(`Too many tag bytes (${this.pos} > ${this.buf.length})`);return this.buf.copy(i,0,0,this.pos),i}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(i){let t=this.buf,r,h;if(i>=-1073741824&&i<1073741824){h=i>=0?i<<1:~i<<1|1;do t[this.pos]=h&127,h>>=7;while(h&&(t[this.pos++]|=128))}else{r=i>=0?i*2:-i*2-1;do t[this.pos]=r&127,r/=128;while(r>=1&&(t[this.pos++]|=128))}this.pos++,this.buf=t}writeString(i){let t=ge.byteLength(i),r=this.buf;this.writeLong(t);let h=this.pos;if(this.pos+=t,!(this.pos>r.length)){if(t>64)this.buf.write(i,this.pos-t,t,"utf8");else{let o,l,c,p;for(o=0,l=t;o<l;o++)c=i.charCodeAt(o),c<128?r[h++]=c:c<2048?(r[h++]=c>>6|192,r[h++]=c&63|128):(c&64512)===55296&&((p=i.charCodeAt(o+1))&64512)===56320?(c=65536+((c&1023)<<10)+(p&1023),o++,r[h++]=c>>18|240,r[h++]=c>>12&63|128,r[h++]=c>>6&63|128,r[h++]=c&63|128):(r[h++]=c>>12|224,r[h++]=c>>6&63|128,r[h++]=c&63|128)}this.buf=r}}readLong(){let i=0,t=0,r=this.buf,h,o,l,c;do h=r[this.pos++],o=h&128,i|=(h&127)<<t,t+=7;while(o&&t<28);if(o){l=i,c=268435456;do h=r[this.pos++],l+=(h&127)*c,c*=128;while(h&128);return(l%2?-(l+1):l)/2}return i>>1^-(i&1)}skipLong(){let i=this.buf;for(;i[this.pos++]&128;);}readTags(){let i=[],t;for(;t=this.readLong();)for(t<0&&(t=-t,this.skipLong());t--;){let r=this.readString(),h=this.readString();i.push({name:r,value:h})}return i}readString(){let i=this.readLong(),t=this.pos,r=this.buf;if(this.pos+=i,!(this.pos>r.length))return this.buf.slice(t,t+i).toString()}};kxt=sd(_xt(),1),Tp=sd(rO(),1),tw=4096,fO=80,fv=class{binary;_id;constructor(i){this.binary=i}static isDataItem(i){return i.binary!==void 0}get signatureType(){let i=ml(this.binary.subarray(0,2));if(oh?.[i]!==void 0)return i;throw new Error("Unknown signature type: "+i)}async isValid(){return fv.verify(this.binary)}get id(){return(async()=>Wf.default.encode(await this.rawId))()}set id(i){this._id=Wf.default.toBuffer(i)}get rawId(){return(async()=>Tp.Buffer.from(await kxt.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(i){this._id=i}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Wf.default.encode(this.rawSignature)}set rawOwner(i){if(i.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${i.byteLength} bytes.`);this.binary.set(i,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return xp[this.signatureType].sigLength}get owner(){return Wf.default.encode(this.rawOwner)}get ownerLength(){return xp[this.signatureType].pubLength}get rawTarget(){let i=this.getTargetStart();return this.binary[i]==1?this.binary.subarray(i+1,i+33):Tp.Buffer.alloc(0)}get target(){return Wf.default.encode(this.rawTarget)}get rawAnchor(){let i=this.getAnchorStart();return this.binary[i]==1?this.binary.subarray(i+1,i+33):Tp.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let i=this.getTagsStart(),t=ml(this.binary.subarray(i+8,i+16));return this.binary.subarray(i+16,i+16+t)}get tags(){let i=this.getTagsStart();if(ml(this.binary.subarray(i,i+8))==0)return[];let t=ml(this.binary.subarray(i+8,i+16));return Q4(Tp.Buffer.from(this.binary.subarray(i+16,i+16+t)))}get tagsB64Url(){return this.tags.map(i=>({name:Wf.default.encode(i.name),value:Wf.default.encode(i.value)}))}getStartOfData(){let i=this.getTagsStart(),t=this.binary.subarray(i+8,i+16),r=ml(t);return i+16+r}get rawData(){let i=this.getTagsStart(),t=this.binary.subarray(i+8,i+16),r=ml(t),h=i+16+r;return this.binary.subarray(h,this.binary.length)}get data(){return Wf.default.encode(this.rawData)}getRaw(){return this.binary}async sign(i){return this._id=await xxt(this,i),this.rawId}async setSignature(i){this.binary.set(i,2),this._id=Tp.Buffer.from(await Zu().hash(i))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(i=>({name:Wf.default.encode(i.name),value:Wf.default.encode(i.value)})),data:this.data}}static async verify(i){if(i.byteLength<fO)return!1;let t=new fv(i),r=t.signatureType,h=t.getTagsStart(),o=ml(i.subarray(h,h+8)),l=i.subarray(h+8,h+16),c=ml(l);if(c>tw)return!1;if(o>0)try{if(Q4(Tp.Buffer.from(i.subarray(h+16,h+16+c))).length!==o)return!1}catch{return!1}let p=sO[r],w=await iO(t);return await p.verify(t.rawOwner,w,t.rawSignature)}async getSignatureData(){return iO(this)}getTagsStart(){let i=this.getTargetStart(),t=this.binary[i]==1,r=i+(t?33:1),h=this.binary[r]==1;return r+=h?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let i=this.getTargetStart()+1,t=this.binary[this.getTargetStart()]==1;return i+=t?32:0,i}},Ixt=sd(oO(),1);uO={...Tnt};globalThis.arbundles??=uO;Bxt=uO,Oxt=uO;});var pO=De(ew=>{"use strict";Tt();Rt();xt();Object.defineProperty(ew,"__esModule",{value:!0});ew.Signature=void 0;var Cxt=(lO(),Dn(cO)),dO=class{constructor(t,r){this.warp=t,this.isCustomSignature(r)?(this.assertEnvForCustomSigner(r.type),this.signer=r.signer,this.type=r.type,this.signatureProviderType="CustomSignature"):this.isValidBundlerSignature(r)?(this.signatureProviderType="BundlerSigner",this.type=Pxt(r.signatureType),this.bundlerSigner=r):(this.assignArweaveSigner(r),this.bundlerSigner=typeof r=="string"?null:new Cxt.ArweaveSigner(r),this.signatureProviderType="ArWallet",this.type="arweave"),this.wallet=r}async getAddress(){if(this.cachedAddress)return this.cachedAddress;switch(this.signatureProviderType){case"CustomSignature":return this.wallet.getAddress?this.cachedAddress=await this.wallet.getAddress():this.cachedAddress=await this.deduceSignerBySigning(),this.cachedAddress;case"ArWallet":return this.cachedAddress=await this.deduceSignerBySigning(),this.cachedAddress;case"BundlerSigner":return this.cachedAddress=await this.deduceSignerBySigning(),this.cachedAddress;default:throw Error("Unknown Signature::signatureProvider : "+this.signatureProviderType)}}async deduceSignerBySigning(){let{arweave:t}=this.warp;if(this.signatureProviderType=="BundlerSigner")try{return await this.bundlerSigner.getAddress()}catch{throw new Error("Could not get address from the signer. Is the 'getAddress' implementation correct?'")}else if(this.signatureProviderType=="ArWallet"||this.signatureProviderType=="CustomSignature"){let r=await t.createTransaction({data:Math.random().toString().slice(-4),reward:"72600854",last_tx:"p7vc1iSP6bvH_fCeUFa9LqoV5qiyW-jdEKouAT0XMoSwrNraB9mgpi29Q10waEpO"});return await this.signer(r),t.wallets.ownerToAddress(r.owner)}else throw Error("Unknown Signature::type")}checkNonArweaveSigningAvailability(t){if(this.type!=="arweave"&&!t)throw new Error(`Unable to use signing function of type: ${this.type} when bundling is disabled.`)}checkBundlerSignerAvailability(t){if((!t||this.warp.environment=="local")&&this.signatureProviderType=="BundlerSigner")throw new Error("Only wallet of type 'ArWallet' or 'CustomSignature' is allowed when bundling is disabled or in local environment.")}assignArweaveSigner(t){this.signer=async r=>{await this.warp.arweave.transactions.sign(r,t)}}assertEnvForCustomSigner(t){if(this.warp.interactionsLoader.type()==="warp")throw new Error("Unable to use signing function when bundling is enabled.");if(t=="ethereum")throw new Error(`Unable to use signing function with signature of type: ${t}.`)}isCustomSignature(t){return t.signer!==void 0&&t.type!==void 0}isValidBundlerSignature(t){let r=t,h=!!r.signatureType&&!!r.ownerLength&&!!r.signatureLength;if(h&&!r.publicKey)throw new Error("It seems that you are using BundlerSigner, but publicKey is not set! Maybe try calling await bundlerSigner.setPublicKey() before using it.");return h}};ew.Signature=dO;function Pxt(i){if(i===3)return"ethereum";if(i===1)return"arweave";throw Error(`Not supported arbundle SignatureType : ${i}`)}});var mO=De(rw=>{"use strict";Tt();Rt();xt();Object.defineProperty(rw,"__esModule",{value:!0});rw.EvaluationOptionsEvaluator=void 0;var Nxt=ko(),gO=class{constructor(t,r){if(this.saferEvaluationOptions={internalWrites:h=>{if(h.internalWrites===void 0||this.rootOptions.internalWrites==h.internalWrites)return this.rootOptions.internalWrites;if(this.rootOptions.internalWrites&&!h.internalWrites||!this.rootOptions.internalWrites&&h.internalWrites)return h.internalWrites;throw new Error('Could not determine "internalWrites" value ')},throwOnInternalWriteError:h=>h.throwOnInternalWriteError===void 0?this.rootOptions.throwOnInternalWriteError:h.throwOnInternalWriteError,unsafeClient:h=>{if(h.unsafeClient===void 0||this.rootOptions.unsafeClient==h.unsafeClient)return this.rootOptions.unsafeClient;if(this.rootOptions.unsafeClient==="throw"||this.rootOptions.unsafeClient==="skip")return this.rootOptions.unsafeClient;if(this.rootOptions.unsafeClient==="allow")return h.unsafeClient==="throw"?"skip":h.unsafeClient;throw new Error('Could not determine "unsafeClient" value')},ignoreExceptions:h=>{if(h.ignoreExceptions===void 0||this.rootOptions.ignoreExceptions==h.ignoreExceptions)return this.rootOptions.ignoreExceptions;if(this.rootOptions.ignoreExceptions&&!h.ignoreExceptions)return this.rootOptions.ignoreExceptions;if(!this.rootOptions.ignoreExceptions&&h.ignoreExceptions)return this.rootOptions.ignoreExceptions;throw new Error('Could not determine "ignoreExceptions" value')},waitForConfirmation:()=>this.rootOptions.waitForConfirmation,updateCacheForEachInteraction:()=>this.rootOptions.updateCacheForEachInteraction,maxCallDepth:()=>this.rootOptions.maxCallDepth,maxInteractionEvaluationTimeSeconds:()=>this.rootOptions.maxInteractionEvaluationTimeSeconds,stackTrace:()=>this.rootOptions.stackTrace,sourceType:()=>this.rootOptions.sourceType,sequencerUrl:()=>this.rootOptions.sequencerUrl,gasLimit:()=>this.rootOptions.gasLimit,allowBigInt:()=>this.rootOptions.allowBigInt,walletBalanceUrl:()=>this.rootOptions.walletBalanceUrl,mineArLocalBlocks:()=>this.rootOptions.mineArLocalBlocks,cacheEveryNInteractions:()=>this.rootOptions.cacheEveryNInteractions,remoteStateSyncEnabled:()=>this.rootOptions.remoteStateSyncEnabled,remoteStateSyncSource:()=>this.rootOptions.remoteStateSyncSource,useKVStorage:h=>h.useKVStorage,useConstructor:h=>h.useConstructor,whitelistSources:()=>this.rootOptions.whitelistSources,transactionsPagesPerBatch:()=>this.rootOptions.transactionsPagesPerBatch,strictSortKey:()=>this.rootOptions.strictSortKey,strictEvolve:()=>this.rootOptions.strictEvolve},this.notConflictingEvaluationOptions=["useKVStorage","sourceType","useConstructor","transactionsPagesPerBatch","strictSortKey"],r){let h=[];for(let o in r){if(!t.hasOwnProperty(o))throw new Error("Unknown option set in contract's manifest. You probably need to update the Warp SDK version.");let l=o,c=r[o],p=t[o];if(!this.notConflictingEvaluationOptions.includes(l))if(l==="internalWrites"){if(p===!1&&c===!0)throw new Error("Cannot proceed with contract evaluation. User is blocking internal writes, while contract requires them.")}else if(l==="unsafeClient"){if(p==="throw"&&c!=="throw"||p==="skip"&&c==="allow")throw new Error(`Cannot proceed with contract evaluation. User requires to ${p} on any unsafeClient usage, while contract uses ${c} option.`)}else t[o]!==r[o]&&h.push(`Option {${o}} differs. EvaluationOptions: [${t[o]}], manifest: [${r[o]}]. Use contract.setEvaluationOptions({${o}: ${r[o]}}) to evaluate contract state.`)}if(h.length)throw new Error(h.join(`
|
|
216
|
-
`))}this.rootOptions=Object.freeze(Object.assign({},t,r||{}))}forForeignContract(t){let r=(0,Nxt.deepCopy)(this.rootOptions);if(t)for(let h in t)r[h]=this.saferEvaluationOptions[h](t);return Object.freeze(r)}};rw.EvaluationOptionsEvaluator=gO});var cv={};fs(cv,{__addDisposableResource:()=>Ynt,__assign:()=>iw,__asyncDelegator:()=>Wnt,__asyncGenerator:()=>znt,__asyncValues:()=>Knt,__await:()=>Rp,__awaiter:()=>Dnt,__classPrivateFieldGet:()=>Znt,__classPrivateFieldIn:()=>Xnt,__classPrivateFieldSet:()=>Jnt,__createBinding:()=>ow,__decorate:()=>Pnt,__disposeResources:()=>Qnt,__esDecorate:()=>Lxt,__exportStar:()=>Unt,__extends:()=>Ont,__generator:()=>$nt,__importDefault:()=>Vnt,__importStar:()=>Gnt,__makeTemplateObject:()=>Hnt,__metadata:()=>Lnt,__param:()=>Nnt,__propKey:()=>$xt,__read:()=>yO,__rest:()=>Cnt,__runInitializers:()=>Dxt,__setFunctionName:()=>Uxt,__spread:()=>qnt,__spreadArray:()=>jnt,__spreadArrays:()=>Fnt,__values:()=>nw,default:()=>jxt});function Ont(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");vO(i,t);function r(){this.constructor=i}i.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Cnt(i,t){var r={};for(var h in i)Object.prototype.hasOwnProperty.call(i,h)&&t.indexOf(h)<0&&(r[h]=i[h]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,h=Object.getOwnPropertySymbols(i);o<h.length;o++)t.indexOf(h[o])<0&&Object.prototype.propertyIsEnumerable.call(i,h[o])&&(r[h[o]]=i[h[o]]);return r}function Pnt(i,t,r,h){var o=arguments.length,l=o<3?t:h===null?h=Object.getOwnPropertyDescriptor(t,r):h,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(i,t,r,h);else for(var p=i.length-1;p>=0;p--)(c=i[p])&&(l=(o<3?c(l):o>3?c(t,r,l):c(t,r))||l);return o>3&&l&&Object.defineProperty(t,r,l),l}function Nnt(i,t){return function(r,h){t(r,h,i)}}function Lxt(i,t,r,h,o,l){function c(C){if(C!==void 0&&typeof C!="function")throw new TypeError("Function expected");return C}for(var p=h.kind,w=p==="getter"?"get":p==="setter"?"set":"value",m=!t&&i?h.static?i:i.prototype:null,y=t||(m?Object.getOwnPropertyDescriptor(m,h.name):{}),v,M=!1,T=r.length-1;T>=0;T--){var A={};for(var R in h)A[R]=R==="access"?{}:h[R];for(var R in h.access)A.access[R]=h.access[R];A.addInitializer=function(C){if(M)throw new TypeError("Cannot add initializers after decoration has completed");l.push(c(C||null))};var B=(0,r[T])(p==="accessor"?{get:y.get,set:y.set}:y[w],A);if(p==="accessor"){if(B===void 0)continue;if(B===null||typeof B!="object")throw new TypeError("Object expected");(v=c(B.get))&&(y.get=v),(v=c(B.set))&&(y.set=v),(v=c(B.init))&&o.unshift(v)}else(v=c(B))&&(p==="field"?o.unshift(v):y[w]=v)}m&&Object.defineProperty(m,h.name,y),M=!0}function Dxt(i,t,r){for(var h=arguments.length>2,o=0;o<t.length;o++)r=h?t[o].call(i,r):t[o].call(i);return h?r:void 0}function $xt(i){return typeof i=="symbol"?i:"".concat(i)}function Uxt(i,t,r){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(i,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function Lnt(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}function Dnt(i,t,r,h){function o(l){return l instanceof r?l:new r(function(c){c(l)})}return new(r||(r=Promise))(function(l,c){function p(y){try{m(h.next(y))}catch(v){c(v)}}function w(y){try{m(h.throw(y))}catch(v){c(v)}}function m(y){y.done?l(y.value):o(y.value).then(p,w)}m((h=h.apply(i,t||[])).next())})}function $nt(i,t){var r={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},h,o,l,c;return c={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function p(m){return function(y){return w([m,y])}}function w(m){if(h)throw new TypeError("Generator is already executing.");for(;c&&(c=0,m[0]&&(r=0)),r;)try{if(h=1,o&&(l=m[0]&2?o.return:m[0]?o.throw||((l=o.return)&&l.call(o),0):o.next)&&!(l=l.call(o,m[1])).done)return l;switch(o=0,l&&(m=[m[0]&2,l.value]),m[0]){case 0:case 1:l=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(l=r.trys,!(l=l.length>0&&l[l.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!l||m[1]>l[0]&&m[1]<l[3])){r.label=m[1];break}if(m[0]===6&&r.label<l[1]){r.label=l[1],l=m;break}if(l&&r.label<l[2]){r.label=l[2],r.ops.push(m);break}l[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(i,r)}catch(y){m=[6,y],o=0}finally{h=l=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function Unt(i,t){for(var r in i)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ow(t,i,r)}function nw(i){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&i[t],h=0;if(r)return r.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&h>=i.length&&(i=void 0),{value:i&&i[h++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function yO(i,t){var r=typeof Symbol=="function"&&i[Symbol.iterator];if(!r)return i;var h=r.call(i),o,l=[],c;try{for(;(t===void 0||t-- >0)&&!(o=h.next()).done;)l.push(o.value)}catch(p){c={error:p}}finally{try{o&&!o.done&&(r=h.return)&&r.call(h)}finally{if(c)throw c.error}}return l}function qnt(){for(var i=[],t=0;t<arguments.length;t++)i=i.concat(yO(arguments[t]));return i}function Fnt(){for(var i=0,t=0,r=arguments.length;t<r;t++)i+=arguments[t].length;for(var h=Array(i),o=0,t=0;t<r;t++)for(var l=arguments[t],c=0,p=l.length;c<p;c++,o++)h[o]=l[c];return h}function jnt(i,t,r){if(r||arguments.length===2)for(var h=0,o=t.length,l;h<o;h++)(l||!(h in t))&&(l||(l=Array.prototype.slice.call(t,0,h)),l[h]=t[h]);return i.concat(l||Array.prototype.slice.call(t))}function Rp(i){return this instanceof Rp?(this.v=i,this):new Rp(i)}function znt(i,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var h=r.apply(i,t||[]),o,l=[];return o={},p("next"),p("throw"),p("return",c),o[Symbol.asyncIterator]=function(){return this},o;function c(T){return function(A){return Promise.resolve(A).then(T,v)}}function p(T,A){h[T]&&(o[T]=function(R){return new Promise(function(B,C){l.push([T,R,B,C])>1||w(T,R)})},A&&(o[T]=A(o[T])))}function w(T,A){try{m(h[T](A))}catch(R){M(l[0][3],R)}}function m(T){T.value instanceof Rp?Promise.resolve(T.value.v).then(y,v):M(l[0][2],T)}function y(T){w("next",T)}function v(T){w("throw",T)}function M(T,A){T(A),l.shift(),l.length&&w(l[0][0],l[0][1])}}function Wnt(i){var t,r;return t={},h("next"),h("throw",function(o){throw o}),h("return"),t[Symbol.iterator]=function(){return this},t;function h(o,l){t[o]=i[o]?function(c){return(r=!r)?{value:Rp(i[o](c)),done:!1}:l?l(c):c}:l}}function Knt(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],r;return t?t.call(i):(i=typeof nw=="function"?nw(i):i[Symbol.iterator](),r={},h("next"),h("throw"),h("return"),r[Symbol.asyncIterator]=function(){return this},r);function h(l){r[l]=i[l]&&function(c){return new Promise(function(p,w){c=i[l](c),o(p,w,c.done,c.value)})}}function o(l,c,p,w){Promise.resolve(w).then(function(m){l({value:m,done:p})},c)}}function Hnt(i,t){return Object.defineProperty?Object.defineProperty(i,"raw",{value:t}):i.raw=t,i}function Gnt(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&ow(t,i,r);return qxt(t,i),t}function Vnt(i){return i&&i.__esModule?i:{default:i}}function Znt(i,t,r,h){if(r==="a"&&!h)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!h:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?h:r==="a"?h.call(i):h?h.value:t.get(i)}function Jnt(i,t,r,h,o){if(h==="m")throw new TypeError("Private method is not writable");if(h==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!o:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return h==="a"?o.call(i,r):o?o.value=r:t.set(i,r),r}function Xnt(i,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof i=="function"?t===i:i.has(t)}function Ynt(i,t,r){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var h,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");h=t[Symbol.asyncDispose]}if(h===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");h=t[Symbol.dispose],r&&(o=h)}if(typeof h!="function")throw new TypeError("Object not disposable.");o&&(h=function(){try{o.call(this)}catch(l){return Promise.reject(l)}}),i.stack.push({value:t,dispose:h,async:r})}else r&&i.stack.push({async:!0});return t}function Qnt(i){function t(h){i.error=i.hasError?new Fxt(h,i.error,"An error was suppressed during disposal."):h,i.hasError=!0}function r(){for(;i.stack.length;){var h=i.stack.pop();try{var o=h.dispose&&h.dispose.call(h.value);if(h.async)return Promise.resolve(o).then(r,function(l){return t(l),r()})}catch(l){t(l)}}if(i.hasError)throw i.error}return r()}var vO,iw,ow,qxt,Fxt,jxt,lv=Vi(()=>{"use strict";Tt();Rt();xt();vO=function(i,t){return vO=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,h){r.__proto__=h}||function(r,h){for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(r[o]=h[o])},vO(i,t)};iw=function(){return iw=Object.assign||function(t){for(var r,h=1,o=arguments.length;h<o;h++){r=arguments[h];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(t[l]=r[l])}return t},iw.apply(this,arguments)};ow=Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]};qxt=Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t};Fxt=typeof SuppressedError=="function"?SuppressedError:function(i,t,r){var h=new Error(r);return h.name="SuppressedError",h.error=i,h.suppressed=t,h};jxt={__extends:Ont,__assign:iw,__rest:Cnt,__decorate:Pnt,__param:Nnt,__metadata:Lnt,__awaiter:Dnt,__generator:$nt,__createBinding:ow,__exportStar:Unt,__values:nw,__read:yO,__spread:qnt,__spreadArrays:Fnt,__spreadArray:jnt,__await:Rp,__asyncGenerator:znt,__asyncDelegator:Wnt,__asyncValues:Knt,__makeTemplateObject:Hnt,__importStar:Gnt,__importDefault:Vnt,__classPrivateFieldGet:Znt,__classPrivateFieldSet:Jnt,__classPrivateFieldIn:Xnt,__addDisposableResource:Ynt,__disposeResources:Qnt}});var dv=De(vl=>{"use strict";Tt();Rt();xt();Object.defineProperty(vl,"__esModule",{value:!0});vl.E_CANCELED=vl.E_ALREADY_LOCKED=vl.E_TIMEOUT=void 0;vl.E_TIMEOUT=new Error("timeout while waiting for mutex to become available");vl.E_ALREADY_LOCKED=new Error("mutex already locked");vl.E_CANCELED=new Error("request for lock canceled")});var wO=De(bO=>{"use strict";Tt();Rt();xt();Object.defineProperty(bO,"__esModule",{value:!0});var tot=(lv(),Dn(cv)),zxt=dv(),Wxt=function(){function i(t,r){r===void 0&&(r=zxt.E_CANCELED),this._value=t,this._cancelError=r,this._weightedQueues=[],this._weightedWaiters=[]}return i.prototype.acquire=function(t){var r=this;if(t===void 0&&(t=1),t<=0)throw new Error("invalid weight ".concat(t,": must be positive"));return new Promise(function(h,o){r._weightedQueues[t-1]||(r._weightedQueues[t-1]=[]),r._weightedQueues[t-1].push({resolve:h,reject:o}),r._dispatch()})},i.prototype.runExclusive=function(t,r){return r===void 0&&(r=1),tot.__awaiter(this,void 0,void 0,function(){var h,o,l;return tot.__generator(this,function(c){switch(c.label){case 0:return[4,this.acquire(r)];case 1:h=c.sent(),o=h[0],l=h[1],c.label=2;case 2:return c.trys.push([2,,4,5]),[4,t(o)];case 3:return[2,c.sent()];case 4:return l(),[7];case 5:return[2]}})})},i.prototype.waitForUnlock=function(t){var r=this;if(t===void 0&&(t=1),t<=0)throw new Error("invalid weight ".concat(t,": must be positive"));return new Promise(function(h){r._weightedWaiters[t-1]||(r._weightedWaiters[t-1]=[]),r._weightedWaiters[t-1].push(h),r._dispatch()})},i.prototype.isLocked=function(){return this._value<=0},i.prototype.getValue=function(){return this._value},i.prototype.setValue=function(t){this._value=t,this._dispatch()},i.prototype.release=function(t){if(t===void 0&&(t=1),t<=0)throw new Error("invalid weight ".concat(t,": must be positive"));this._value+=t,this._dispatch()},i.prototype.cancel=function(){var t=this;this._weightedQueues.forEach(function(r){return r.forEach(function(h){return h.reject(t._cancelError)})}),this._weightedQueues=[]},i.prototype._dispatch=function(){for(var t,r=this._value;r>0;r--){var h=(t=this._weightedQueues[r-1])===null||t===void 0?void 0:t.shift();if(h){var o=this._value,l=r;this._value-=r,r=this._value+1,h.resolve([o,this._newReleaser(l)])}}this._drainUnlockWaiters()},i.prototype._newReleaser=function(t){var r=this,h=!1;return function(){h||(h=!0,r.release(t))}},i.prototype._drainUnlockWaiters=function(){for(var t=this._value;t>0;t--)this._weightedWaiters[t-1]&&(this._weightedWaiters[t-1].forEach(function(r){return r()}),this._weightedWaiters[t-1]=[])},i}();bO.default=Wxt});var rot=De(_O=>{"use strict";Tt();Rt();xt();Object.defineProperty(_O,"__esModule",{value:!0});var eot=(lv(),Dn(cv)),Kxt=wO(),Hxt=function(){function i(t){this._semaphore=new Kxt.default(1,t)}return i.prototype.acquire=function(){return eot.__awaiter(this,void 0,void 0,function(){var t,r;return eot.__generator(this,function(h){switch(h.label){case 0:return[4,this._semaphore.acquire()];case 1:return t=h.sent(),r=t[1],[2,r]}})})},i.prototype.runExclusive=function(t){return this._semaphore.runExclusive(function(){return t()})},i.prototype.isLocked=function(){return this._semaphore.isLocked()},i.prototype.waitForUnlock=function(){return this._semaphore.waitForUnlock()},i.prototype.release=function(){this._semaphore.isLocked()&&this._semaphore.release()},i.prototype.cancel=function(){return this._semaphore.cancel()},i}();_O.default=Hxt});var MO=De(sw=>{"use strict";Tt();Rt();xt();Object.defineProperty(sw,"__esModule",{value:!0});sw.withTimeout=void 0;var aw=(lv(),Dn(cv)),Gxt=dv();function Vxt(i,t,r){var h=this;return r===void 0&&(r=Gxt.E_TIMEOUT),{acquire:function(o){if(o!==void 0&&o<=0)throw new Error("invalid weight ".concat(o,": must be positive"));return new Promise(function(l,c){return aw.__awaiter(h,void 0,void 0,function(){var p,w,m,y,v;return aw.__generator(this,function(M){switch(M.label){case 0:p=!1,w=setTimeout(function(){p=!0,c(r)},t),M.label=1;case 1:return M.trys.push([1,3,,4]),[4,i.acquire(o)];case 2:return m=M.sent(),p?(y=Array.isArray(m)?m[1]:m,y()):(clearTimeout(w),l(m)),[3,4];case 3:return v=M.sent(),p||(clearTimeout(w),c(v)),[3,4];case 4:return[2]}})})})},runExclusive:function(o,l){return aw.__awaiter(this,void 0,void 0,function(){var c,p;return aw.__generator(this,function(w){switch(w.label){case 0:c=function(){},w.label=1;case 1:return w.trys.push([1,,7,8]),[4,this.acquire(l)];case 2:return p=w.sent(),Array.isArray(p)?(c=p[1],[4,o(p[0])]):[3,4];case 3:return[2,w.sent()];case 4:return c=p,[4,o()];case 5:return[2,w.sent()];case 6:return[3,8];case 7:return c(),[7];case 8:return[2]}})})},release:function(o){i.release(o)},cancel:function(){return i.cancel()},waitForUnlock:function(o){if(o!==void 0&&o<=0)throw new Error("invalid weight ".concat(o,": must be positive"));return new Promise(function(l,c){var p=setTimeout(function(){return c(r)},t);i.waitForUnlock(o).then(function(){clearTimeout(p),l()})})},isLocked:function(){return i.isLocked()},getValue:function(){return i.getValue()},setValue:function(o){return i.setValue(o)}}}sw.withTimeout=Vxt});var iot=De(hw=>{"use strict";Tt();Rt();xt();Object.defineProperty(hw,"__esModule",{value:!0});hw.tryAcquire=void 0;var Zxt=dv(),Jxt=MO();function Xxt(i,t){return t===void 0&&(t=Zxt.E_ALREADY_LOCKED),(0,Jxt.withTimeout)(i,0,t)}hw.tryAcquire=Xxt});var not=De(Xh=>{"use strict";Tt();Rt();xt();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.tryAcquire=Xh.withTimeout=Xh.Semaphore=Xh.Mutex=void 0;var Yxt=(lv(),Dn(cv)),Qxt=rot();Object.defineProperty(Xh,"Mutex",{enumerable:!0,get:function(){return Qxt.default}});var tRt=wO();Object.defineProperty(Xh,"Semaphore",{enumerable:!0,get:function(){return tRt.default}});var eRt=MO();Object.defineProperty(Xh,"withTimeout",{enumerable:!0,get:function(){return eRt.withTimeout}});var rRt=iot();Object.defineProperty(Xh,"tryAcquire",{enumerable:!0,get:function(){return rRt.tryAcquire}});Yxt.__exportStar(dv(),Xh)});var oot=De(fw=>{"use strict";Tt();Rt();xt();Object.defineProperty(fw,"__esModule",{value:!0});fw.SimpleLRUCache=void 0;var SO=class{constructor(t){this.cache=new Map,this.capacity=t||10}has(t){return this.cache.has(t)}size(){return this.cache.size}get(t){if(!this.cache.has(t))return null;let r=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,r),r}set(t,r){this.cache.delete(t),this.cache.size===this.capacity?(this.cache.delete(this.cache.keys().next().value),this.cache.set(t,r)):this.cache.set(t,r)}keys(){return Array.from(this.cache.keys())}};fw.SimpleLRUCache=SO});var AO=De(uw=>{"use strict";Tt();Rt();xt();Object.defineProperty(uw,"__esModule",{value:!0});uw.ContractInteractionState=void 0;var iRt=Lu(),nRt=oot(),EO=class{constructor(t){this._warp=t,this._json=new Map,this._initialJson=new Map,this._kv=new Map}has(t,r){var h;return((h=this._json.get(t))===null||h===void 0?void 0:h.has(r))||!1}get(t,r){var h;return((h=this._json.get(t))===null||h===void 0?void 0:h.get(r))||null}getLessOrEqual(t,r){let h=this._json.get(t);if(h!=null&&h.size()>0){let o=h.keys();r&&(o=o.filter(c=>c.localeCompare(r)<=0)),o=o.sort((c,p)=>c.localeCompare(p));let l=o[o.length-1];if(h.get(l))return new iRt.SortKeyCacheResult(l,h.get(l))}return null}async getKV(t,r){var h;return this._kv.has(t)&&((h=await this._kv.get(t).get(r))===null||h===void 0?void 0:h.cachedValue)||null}async delKV(t,r){this._kv.has(t)&&await this._kv.get(t).del(r)}getKvKeys(t,r,h){return this._warp.kvStorageFactory(t).keys(r,h)}getKvRange(t,r,h){return this._warp.kvStorageFactory(t).kvMap(r,h)}async commit(t,r=!1){if(t.dry)return await this.rollbackKVs(),this.reset();try{let h=new Map;this._json.forEach((o,l)=>{let c=this.getLessOrEqual(l,t.sortKey);c!=null&&h.set(l,c.cachedValue)}),await this.doStoreJson(h,t,r),await this.commitKVs()}finally{this.reset()}}async commitKV(){await this.commitKVs(),this._kv.clear()}async rollback(t,r){try{await this.doStoreJson(this._initialJson,t,r),await this.rollbackKVs()}finally{this.reset()}}setInitial(t,r,h){this._initialJson.set(t,r),this.update(t,r,h)}update(t,r,h){if(!this._json.has(t)){let o=new nRt.SimpleLRUCache(10);this._json.set(t,o)}this._json.get(t).set(h,r)}async updateKV(t,r,h){await(await this.getOrInitKvStorage(t)).put(r,h)}async getOrInitKvStorage(t){if(this._kv.has(t))return this._kv.get(t);let r=this._warp.kvStorageFactory(t);return this._kv.set(t,r),await r.open(),r}reset(){this._json.clear(),this._initialJson.clear(),this._kv.clear()}async doStoreJson(t,r,h=!1){if(t.size>1||h)for(let[o,l]of t)await this._warp.stateEvaluator.putInCache(o,r,l)}async rollbackKVs(){for(let t of this._kv.values())try{await t.rollback()}finally{await t.close()}}async commitKVs(){for(let t of this._kv.values())try{await t.commit()}finally{await t.close()}}};uw.ContractInteractionState=EO});var dw=De(Op=>{"use strict";Tt();Rt();xt();var oRt=Op&&Op.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Op,"__esModule",{value:!0});Op.HandlerBasedContract=void 0;var aRt=oRt(_nt()),pv=Lu(),TO=UB(),xO=$f(),RO=Q0(),aot=Gm(),kp=Hh(),cw=XB(),Ip=Xs(),sot=bn(),hot=WB(),sRt=ll(),yl=ko(),Bp=YB(),hRt=tO(),fRt=pO(),uRt=mO(),cRt=Km(),lRt=not(),lw=_p(),fot=AO(),kO=Ku(),uot=(lO(),Dn(cO)),IO=class{constructor(t,r,h=null,o=null){var l,c;if(this._contractTxId=t,this.warp=r,this._parentContract=h,this._innerCallData=o,this.logger=sot.LoggerFactory.INST.create("HandlerBasedContract"),this.ecLogger=sot.LoggerFactory.INST.create("ExecutionContext"),this._innerWritesEvaluator=new hRt.InnerWritesEvaluator,this._mutex=new lRt.Mutex,this._benchmarkStats=null,this._children=[],this._dreStates=new Map,this.waitForConfirmation=this.waitForConfirmation.bind(this),this._arweaveWrapper=new sRt.ArweaveWrapper(r),this._sorter=new RO.LexicographicalInteractionsSorter(r.arweave),h!=null){this._evaluationOptions=this.getRoot().evaluationOptions(),this._callDepth=h.callDepth()+1;let p=h.getCallStack().getInteraction(o.callingInteraction.id);if(this._callDepth>this._evaluationOptions.maxCallDepth)throw new Error(`Max call depth of ${this._evaluationOptions.maxCallDepth} has been exceeded for interaction ${JSON.stringify(p.interactionInput)}`);if(this.logger.debug("Calling interaction",{id:o.callingInteraction.id,sortKey:o.callingInteraction.sortKey,type:o.callType}),((c=(l=p.interactionInput)===null||l===void 0?void 0:l.foreignContractCalls[t])===null||c===void 0?void 0:c.innerCallType)==="write"&&o.callType==="read")throw new Error("Calling a readContractState after performing an inner write is wrong - instead use a state from the result of an internal write.");let w=new TO.ContractCallRecord(t,this._callDepth,o?.callType);p.interactionInput.foreignContractCalls[t]=w,this._callStack=w,this._rootSortKey=h.rootSortKey,h._children.push(this)}else this._callDepth=0,this._callStack=new TO.ContractCallRecord(t,0),this._rootSortKey=null,this._evaluationOptions=new aot.DefaultEvaluationOptions,this._children=[],this._interactionState=new fot.ContractInteractionState(r);this.getCallStack=this.getCallStack.bind(this),this._warpFetchWrapper=new cRt.WarpFetchWrapper(this.warp)}async readState(t,r,h,o){var l,c,p;if(this.logger.info("Read state for",{contractTxId:this._contractTxId,sortKeyOrBlockHeight:t}),!this.isRoot()&&t==null)throw new Error("SortKey MUST be always set for non-root contract calls");let{stateEvaluator:w}=this.warp,m=typeof t=="number"?this._sorter.generateLastSortKey(t):t;if(m&&!this.isRoot()&&this.interactionState().has(this.txId(),m)){let v=this.interactionState().get(this.txId(),m);return new pv.SortKeyCacheResult(m,v)}let y=await this._mutex.acquire();try{let v=Ip.Benchmark.measure();this.maybeResetRootContract();let M=await this.createExecutionContext(this._contractTxId,m,!1,r,h,o);this.logger.info("Execution Context",{srcTxId:(l=M.contractDefinition)===null||l===void 0?void 0:l.srcTxId,missingInteractions:(c=M.sortedInteractions)===null||c===void 0?void 0:c.length,cachedSortKey:(p=M.cachedState)===null||p===void 0?void 0:p.sortKey}),v.stop();let T=Ip.Benchmark.measure(),A=await w.eval(M);T.stop();let R=v.elapsed(!0)+T.elapsed(!0);return this._benchmarkStats={gatewayCommunication:v.elapsed(!0),stateEvaluation:T.elapsed(!0),total:R},this.logger.info("Benchmark",{"Gateway communication ":v.elapsed(),"Contract evaluation ":T.elapsed(),"Total: ":`${R.toFixed(0)}ms`}),m&&!this.isRoot()&&this.interactionState().update(this.txId(),A.cachedValue,m),A}finally{y()}}async readStateFor(t,r,h,o){return this.readState(t,r,h,o)}async readStateBatch(t=1,r,h){if(!this.isRoot())throw new Error("readStateBatch is only allowed for root contract calls");if(t<1)throw new Error("At least one page per batch is required");if(h?.aborted)throw new xO.AbortError("readStateBatch aborted");let o=this._contractTxId,{interactionsLoader:l,stateEvaluator:c}=this.warp,p=await c.latestAvailableState(o),w={...this._evaluationOptions,transactionsPagesPerBatch:t},m,y=0;do{let v=Ip.Benchmark.measure();if(this.logger.debug(`Loading ${y+1} batch`,w),m=await l.load(o,p?.sortKey,r,w),h?.aborted)throw new xO.AbortError("readStateBatch aborted");if(m.length==0&&y>0)break;if(this.logger.debug(`Evaluating ${m.length} in ${y+1} batch`),p=await this.readStateFor(p?.sortKey||RO.genesisSortKey,m,h),h?.aborted)throw new xO.AbortError("readStateBatch aborted");this.logger.debug(`Batch ${y+1} evaluated in ${v.elapsed()} at sortKey ${p.sortKey}`),y++}while(m.length>0);return p}async viewState(t,r=[],h=Bp.emptyTransfer,o,l,c){return this.logger.info("View state for",this._contractTxId),await this.callContract(t,"view",o,c,r,h,!1,!1,!0,l)}async viewStateForTx(t,r,h){return this.logger.info(`View state for ${this._contractTxId}`),await this.doApplyInputOnTx(t,r,"view",h)}async dryWrite(t,r,h,o,l,c){return this.logger.info("Dry-write for",this._contractTxId),await this.callContract(t,"write",r,c,h,o,void 0,l)}async applyInput(t,r,h){return this.logger.info(`Apply-input from transaction ${r.id} for ${this._contractTxId}`),await this.doApplyInputOnTx(t,r,"write",h)}async writeInteraction(t,r){if(this.logger.info("Write interaction",{input:t,options:r}),!this._signature)throw new Error("Wallet not connected. Use 'connect' method first.");let{arweave:h,interactionsLoader:o,environment:l}=this.warp;await this.warp.definitionLoader.load(this._contractTxId);let c=r?.tags||[],p=r?.transfer||Bp.emptyTransfer,w=r?.strict===!0,m=r?.vrf===!0,y=r?.disableBundling===!0,v=r?.reward,M=r?.manifestData,T=r?.inputFormatAsData,A=o.type()=="warp"&&!y;if(this._signature.checkNonArweaveSigningAvailability(A),this._signature.checkBundlerSignerAvailability(A),A&&p.target!=Bp.emptyTransfer.target&&p.winstonQty!=Bp.emptyTransfer.winstonQty)throw new Error("Ar Transfers are not allowed for bundled interactions");if(m&&!A&&l==="mainnet")throw new Error("Vrf generation is only available for bundle interaction");if(!t)throw new Error(`Input should be a truthy value: ${JSON.stringify(t)}`);if(A)return await this.bundleInteraction(t,{tags:c,strict:w,vrf:m,manifestData:M,inputFormatAsData:T});{let R=await this.createInteraction(t,c,p,w,!1,m&&l!=="mainnet",v),B=await h.transactions.post(R);if(B.status!==200)return this.logger.error("Error while posting transaction",B),null;if(this._evaluationOptions.waitForConfirmation){this.logger.info("Waiting for confirmation of",R.id);let C=Ip.Benchmark.measure();await this.waitForConfirmation(R.id),this.logger.info("Transaction confirmed after",C.elapsed())}return this.warp.environment=="local"&&this._evaluationOptions.mineArLocalBlocks&&await this.warp.testing.mineBlock(),{originalTxId:R.id,interactionTx:R}}}async bundleInteraction(t,r){if(this.logger.info("Bundle interaction input: {}, tag: {}",t,r.tags),!this.maxInteractionDataItemSizeBytes){let c=fetch(`${(0,yl.stripTrailingSlash)(this.warp.gwUrl())}`);this.maxInteractionDataItemSizeBytes=(await(0,yl.getJsonResponse)(c)).maxInteractionDataItemSizeBytes}let h=await this.createInteractionDataItem(t,r.tags,Bp.emptyTransfer,r.strict,r.vrf,r.manifestData,r.inputFormatAsData),o=this._warpFetchWrapper.fetch(`${(0,yl.stripTrailingSlash)(this._evaluationOptions.sequencerUrl)}/gateway/v2/sequencer/register`,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:h.getRaw()}),l=await h.id;return{bundlrResponse:await(0,yl.getJsonResponse)(o),originalTxId:l,interactionTx:h}}async createInteractionDataItem(t,r,h,o,l=!1,c,p){var w;this._evaluationOptions.internalWrites&&await this.discoverInternalWrites(t,r,h,o,l),l&&r.push(new lw.Tag(kp.WARP_TAGS.REQUEST_VRF,"true"));let m=(0,cw.createInteractionTagsList)(this._contractTxId,t,this.warp.environment==="testnet",r),y;((0,uot.tagsExceedLimit)(m)||p)&&(m=[...m.filter(T=>T.name!=kp.SMART_WEAVE_TAGS.INPUT&&T.name!=kp.WARP_TAGS.INPUT_FORMAT),new lw.Tag(kp.WARP_TAGS.INPUT_FORMAT,"data")],y={input:t}),c&&(y={...y,manifest:this.createManifest(c)}),y=y?JSON.stringify(y):Math.random().toString().slice(-4);let v=this._signature.bundlerSigner;if(!v)throw new Error("Signer not set correctly. If you connect wallet through 'use_wallet', please remember that it only works when bundling is disabled.");let M;if((0,yl.isBrowser)()&&(!((w=v.signer)===null||w===void 0)&&w.signDataItem)?M=await v.signDataItem(y,m):(M=(0,uot.createData)(y,v,{tags:m}),await M.sign(v)),M.getRaw().length>this.maxInteractionDataItemSizeBytes)throw new Error(`Interaction data item size: ${M.getRaw().length} exceeds maximum interactions size limit: ${this.maxInteractionDataItemSizeBytes}.`);return!this._evaluationOptions.internalWrites&&o&&await this.checkInteractionInStrictMode(M.owner,t,r,h,o,l),M}async createInteraction(t,r,h,o,l=!1,c=!1,p){this._evaluationOptions.internalWrites&&await this.discoverInternalWrites(t,r,h,o,c),c&&r.push(new lw.Tag(kp.WARP_TAGS.REQUEST_VRF,"true"));let w=await(0,cw.createInteractionTx)(this.warp.arweave,this._signature.signer,this._contractTxId,t,r,h.target,h.winstonQty,l,this.warp.environment==="testnet",p);return!this._evaluationOptions.internalWrites&&o&&await this.checkInteractionInStrictMode(w.owner,t,r,h,o,c),w}async checkInteractionInStrictMode(t,r,h,o,l,c){let{arweave:p}=this.warp,w=this._signature.type=="arweave"?await p.wallets.ownerToAddress(t):await this._signature.getAddress(),m=await this.callContract(r,"write",w,void 0,h,o,l,c);if(m.type!=="ok")throw Error("Cannot create interaction: "+JSON.stringify(m.error||m.errorMessage))}txId(){return this._contractTxId}getCallStack(){return this._callStack}connect(t){return this._signature=new fRt.Signature(this.warp,t),this}setEvaluationOptions(t){if(!this.isRoot())throw new Error("Evaluation options can be set only for the root contract");return this._evaluationOptions={...this._evaluationOptions,...t},this}async waitForConfirmation(t){let{arweave:r}=this.warp,h=await r.transactions.getStatus(t);return h.confirmed===null?(this.logger.info(`Transaction ${t} not yet confirmed. Waiting another 20 seconds before next check.`),await(0,yl.sleep)(2e4),this.waitForConfirmation(t)):(this.logger.info(`Transaction ${t} confirmed`,h),h)}async createExecutionContext(t,r,h=!1,o,l,c){var p,w,m,y,v;let{definitionLoader:M,interactionsLoader:T,stateEvaluator:A}=this.warp,R,B=Ip.Benchmark.measure();if(this.isRoot()||(R=this.interactionState().getLessOrEqual(this.txId(),r)),R=c||R||await A.latestAvailableState(t,r),r&&this.evaluationOptions().strictSortKey&&R?.sortKey!=r)throw new Error(`State not cached at the exact required ${r} sortKey`);this.logger.debug("cache lookup",B.elapsed()),B.reset();let C=hot.Evolve.evolvedSrcTxId((p=R?.cachedValue)===null||p===void 0?void 0:p.state),P,N,q,W,J=o||[];if(this.logger.debug("Cached state",R,r),R&&R.sortKey==r||r==RO.genesisSortKey&&o?.length)this.logger.debug("State fully cached, not loading interactions."),(h||C||o?.length)&&(N=await M.load(t,C),q=this.resolveEvaluationOptions((w=N.manifest)===null||w===void 0?void 0:w.evaluationOptions),this.warp.executorFactory.checkWhiteListContractSources(N,q),o?.length&&(J=await this.getSortedInteractions(o)));else{if(o?.length)throw new Error(`Cannot apply requested interactions at ${r}`);if(N=await M.load(t,C),q=this.resolveEvaluationOptions((m=N.manifest)===null||m===void 0?void 0:m.evaluationOptions),q.remoteStateSyncEnabled&&!q.useKVStorage){W=await this.getRemoteContractState(t),R=await this.maybeSyncStateWithRemoteSource(W,r,R);let F=hot.Evolve.evolvedSrcTxId((y=R?.cachedValue)===null||y===void 0?void 0:y.state);F&&F!==N.srcTxId&&(N=await M.load(t,F))}this.warp.executorFactory.checkWhiteListContractSources(N,q),!W&&J.length==0&&(J=await T.load(t,R?.sortKey,this.getToSortKey(r),q)),R?.sortKey&&(J=J.filter(F=>F.sortKey.localeCompare(R?.sortKey)>0)),r&&(J=J.filter(F=>F.sortKey.localeCompare(r)<=0)),this.logger.debug("contract and interactions load",B.elapsed()),this.isRoot()&&J.length&&(this._rootSortKey=J[J.length-1].sortKey)}return N&&(q||(q=this.resolveEvaluationOptions((v=N.manifest)===null||v===void 0?void 0:v.evaluationOptions)),this.ecLogger.debug(`Evaluation options ${t}:`,q),P=await this.warp.executorFactory.create(N,q,this.warp,this.interactionState())),{warp:this.warp,contract:this,contractDefinition:N,sortedInteractions:J,evaluationOptions:q||this.evaluationOptions(),handler:P,cachedState:R,requestedSortKey:r,signal:l}}async getSortedInteractions(t){return(await this._sorter.sort(t.map(r=>({node:r,cursor:null})))).map(r=>r.node)}resolveEvaluationOptions(t){return this.isRoot()?(this._eoEvaluator=new uRt.EvaluationOptionsEvaluator(this.evaluationOptions(),t),this._eoEvaluator.rootOptions):this.getRootEoEvaluator().forForeignContract(t)}async getRemoteContractState(t){if(this.hasDreState(t))return this.getDreState(t);{let r=await this.fetchRemoteContractState(t);return r!=null?this.setDREState(t,r):null}}async fetchRemoteContractState(t){return(0,yl.getJsonResponse)(this._warpFetchWrapper.fetch(`${this._evaluationOptions.remoteStateSyncSource}?id=${t}&events=false`))}getToSortKey(t){var r;return!((r=this._parentContract)===null||r===void 0)&&r.rootSortKey?t?this._parentContract.rootSortKey.localeCompare(t)>0?this._parentContract.rootSortKey:t:this._parentContract.rootSortKey:t}async createExecutionContextFromTx(t,r,h){let o=r.owner.address,l=r.sortKey;return{...await this.createExecutionContext(t,l,!0,void 0,h),caller:o}}maybeResetRootContract(){this.isRoot()&&(this.logger.debug("Clearing call stack for the root contract"),this._callStack=new TO.ContractCallRecord(this.txId(),0),this._rootSortKey=null,this.warp.interactionsLoader.clearCache(),this._children=[],this._interactionState=new fot.ContractInteractionState(this.warp),this._dreStates=new Map)}async callContract(t,r,h,o,l=[],c=Bp.emptyTransfer,p=!1,w=!1,m=!0,y){var v;this.logger.info("Call contract input",t),this.maybeResetRootContract(),this._signature||this.logger.warn("Wallet not set.");let{arweave:M,stateEvaluator:T}=this.warp,A=await this.createExecutionContext(this._contractTxId,o,!0,void 0,y),R=o?await this._sorter.extractBlockHeight(o):void 0,B;this.warp.environment=="mainnet"&&this.warp.interactionsLoader.type()!=="arweave"?B=await this._arweaveWrapper.warpGwBlock():R?B=await M.blocks.getByHeight(R):B=await M.blocks.getCurrent();let C;h?C=h:this._signature?C=await this._signature.getAddress():C="",this.logger.info("effectiveCaller",C),A={...A,caller:C};let P=await T.eval(A);this.logger.info("Current state",P.cachedValue.state);let N={input:t,caller:A.caller,interactionType:r};this.logger.debug("interaction",N);let q=await(0,cw.createInteractionTx)(M,m?(v=this._signature)===null||v===void 0?void 0:v.signer:void 0,this._contractTxId,t,l,c.target,c.winstonQty,!0,this.warp.environment==="testnet"),W=(0,cw.createDummyTx)(q,A.caller,B);if(this.logger.debug("Creating sortKey for",{blockId:W.block.id,id:W.id,height:W.block.height}),W.sortKey=await this._sorter.createSortKey(W.block.id,W.id,W.block.height,!0),W.strict=p,w){let F=this.warp.maybeLoadPlugin("vrf");F?W.vrf=F.process().generateMockVrf(W.sortKey):this.logger.warn('Cannot generate mock vrf for interaction - no "warp-contracts-plugin-vrf" attached!')}let J=await this.evalInteraction({interaction:N,interactionTx:W},A,P.cachedValue);return J.type!=="ok"&&this.logger.fatal("Error while interacting with contract",{type:J.type,error:J.errorMessage}),J}async doApplyInputOnTx(t,r,h,o){this.maybeResetRootContract();let l,c=await this.createExecutionContextFromTx(this._contractTxId,r,o);!this.isRoot()&&this.interactionState().has(this.txId(),r.sortKey)?l=new pv.SortKeyCacheResult(r.sortKey,this.interactionState().get(this.txId(),r.sortKey)):(l=await this.warp.stateEvaluator.eval(c),this.interactionState().update(this.txId(),l.cachedValue,r.sortKey)),this.logger.debug("callContractForTx - evalStateResult",{result:l.cachedValue.state,txId:this._contractTxId});let w={interaction:{input:t,caller:this._parentContract.txId(),interactionType:h},interactionTx:r},m=await this.evalInteraction(w,c,l.cachedValue);return m.originalValidity=l.cachedValue.validity,m.originalErrorMessages=l.cachedValue.errorMessages,m}async evalInteraction(t,r,h){let o=this.getCallStack().addInteractionData(t),l=Ip.Benchmark.measure();await r.handler.initState(h.state);let c=await r.handler.handle(r,h,t);return o.update({cacheHit:!1,outputState:this._evaluationOptions.stackTrace.saveState?c.state:void 0,executionTime:l.elapsed(!0),valid:c.type==="ok",errorMessage:c.errorMessage,gasUsed:c.gasUsed}),c}parent(){return this._parentContract}callDepth(){return this._callDepth}evaluationOptions(){return this._evaluationOptions}lastReadStateStats(){return this._benchmarkStats}async stateHash(t){let r=(0,aRt.default)(t),h=await kO.Crypto.subtle.digest("SHA-256",kO.Buffer.from(r,"utf-8"));return kO.Buffer.from(h).toString("hex")}async syncState(t,r){let{stateEvaluator:h}=this.warp,o=await this._warpFetchWrapper.fetch(`${t}?${new URLSearchParams({id:this._contractTxId,...r})}`).then(l=>l.ok?l.json():Promise.reject(l)).catch(l=>{var c,p;throw!((c=l.body)===null||c===void 0)&&c.message&&this.logger.error(l.body.message),new Error(`Unable to retrieve state. ${l.status}: ${(p=l.body)===null||p===void 0?void 0:p.message}`)});return await h.syncState(this._contractTxId,o.sortKey,o.state,o.validity),this}async evolve(t,r){return await this.writeInteraction({function:"evolve",value:t},r)}get rootSortKey(){return this._rootSortKey}getRootEoEvaluator(){return this.getRoot()._eoEvaluator}isRoot(){return this._parentContract==null}async getStorageValues(t){let r=await this.warp.stateEvaluator.getCache().getLast(this.txId());if(r==null)return new pv.SortKeyCacheResult(null,new Map);let h=this.warp.kvStorageFactory(this.txId()),o=new Map;try{await h.open();for(let l of t){let c=await h.getLessOrEqual(l,r.sortKey);o.set(l,c==null?null:c.cachedValue)}return new pv.SortKeyCacheResult(r.sortKey,o)}finally{await h.close()}}interactionState(){return this.getRoot()._interactionState}getRoot(){let t=this;for(;!t.isRoot();)t=t.parent();return t}async maybeSyncStateWithRemoteSource(t,r,h){let{stateEvaluator:o}=this.warp;return this.isStateHigherThanAndUpTo(t,h?.sortKey,r)?await o.syncState(this._contractTxId,t.sortKey,t.cachedValue.state,t.cachedValue.validity):h}isStateHigherThanAndUpTo(t,r,h){return t&&(!h||h>=t.sortKey)&&(!r||t.sortKey>r)}setDREState(t,r){let h=new pv.SortKeyCacheResult(r.sortKey,new aot.EvalStateResult(r.state,{},r.errorMessages));return this.getRoot()._dreStates.set(t,h),h}getDreState(t){return this.getRoot()._dreStates.get(t)}hasDreState(t){return this.getRoot()._dreStates.has(t)}async discoverInternalWrites(t,r,h,o,l){let c=await this.callContract(t,"write",void 0,void 0,r,h,o,l,!1);if(o&&c.type!=="ok")throw Error("Cannot create interaction: "+JSON.stringify(c.error||c.errorMessage));let p=this.getCallStack(),w=this._innerWritesEvaluator.eval(p);this.logger.debug("Input",t),this.logger.debug("Callstack",p.print()),w.forEach(m=>{r.push(new lw.Tag(kp.WARP_TAGS.INTERACT_WRITE,m))}),this.logger.debug("Tags with inner calls",r)}clearChildren(){for(let t of this._children)t.clearChildren();this._children=[]}createManifest(t){let r={};return Object.keys(t).forEach(h=>{let o=t[h];if(typeof h!="string")throw new Error("Incorrect manifest data. Manifest key should be of type 'string'");if(typeof o!="string")throw new Error("Incorrect manifest data. Manifest value should be of type 'string'");if(!(0,yl.isTxIdValid)(o))throw new Error(`Incorrect manifest data. Transaction id: ${o} is not valid.`);r[h]=t[h]}),r}};Op.HandlerBasedContract=IO});var OO=De(pw=>{"use strict";Tt();Rt();xt();Object.defineProperty(pw,"__esModule",{value:!0});pw.PstContractImpl=void 0;var dRt=dw(),BO=class extends dRt.HandlerBasedContract{async currentBalance(t){let r=await this.viewState({function:"balance",target:t});if(r.type!=="ok")throw Error(r.errorMessage);return r.result}async currentState(){return(await super.readState()).cachedValue.state}async transfer(t,r){return await this.writeInteraction({function:"transfer",...t},r)}};pw.PstContractImpl=BO});var cot=De(gw=>{"use strict";Tt();Rt();xt();Object.defineProperty(gw,"__esModule",{value:!0});gw.Testing=void 0;var CO=class{constructor(t){this.arweave=t}async mineBlock(){this.validateEnv(),await this.arweave.api.get("mine")}async addFunds(t){let r=await this.arweave.wallets.getAddress(t);await this.arweave.api.get(`/mint/${r}/1000000000000000`)}async isArlocal(){return(await fetch(`${this.arweave.api.config.protocol}://${this.arweave.api.config.host}:${this.arweave.api.config.port}/info`).then(r=>r.ok?r.json():Promise.reject()).catch(r=>{throw new Error(`Unable to get network info: ${r.message}`)})).network.includes("arlocal")}async validateEnv(){if(!await this.isArlocal())throw new Error("Testing features are not available in a non testing environment")}};gw.Testing=CO});var lot=De(mw=>{"use strict";Tt();Rt();xt();Object.defineProperty(mw,"__esModule",{value:!0});mw.DebuggableExecutorFactory=void 0;var PO=class{constructor(t,r){this.baseImplementation=t,this.sourceCode=r}async create(t,r,h,o){return Object.prototype.hasOwnProperty.call(this.sourceCode,t.txId)&&(t={...t,src:this.sourceCode[t.txId]}),await this.baseImplementation.create(t,r,h,o)}checkWhiteListContractSources(t,r){return this.baseImplementation.checkWhiteListContractSources(t,r)}};mw.DebuggableExecutorFactory=PO});var mot=De(vw=>{"use strict";Tt();Rt();xt();Object.defineProperty(vw,"__esModule",{value:!0});vw.CacheableContractDefinitionLoader=void 0;var pRt=Ku(),dot=Vm(),gRt=Xs(),mRt=bn(),pot=Lu(),got=Fm(),NO=class{constructor(t,r,h){this.contractDefinitionLoader=t,this.env=r,this.rLogger=mRt.LoggerFactory.INST.create("CacheableContractDefinitionLoader"),this.definitionCache=new got.LevelDbCache({...h,dbLocation:`${h.dbLocation}/contracts`}),this.srcCache=new got.LevelDbCache({...h,dbLocation:`${h.dbLocation}/source`})}async load(t,r){let h=await this.getFromCache(t,r);if(h)return this.rLogger.debug("Hit from cache!",t,r),h.contractType=="wasm"&&h.srcBinary.data&&(h.srcBinary=pRt.Buffer.from(h.srcBinary.data)),this.verifyEnv(h),h;let o=gRt.Benchmark.measure(),l=await this.contractDefinitionLoader.load(t,r);return this.rLogger.info(`Contract definition loaded in: ${o.elapsed()}`),this.verifyEnv(l),await this.putToCache(t,l,r),l}async loadContractSource(t){return await this.contractDefinitionLoader.loadContractSource(t)}type(){return this.contractDefinitionLoader.type()}setCache(t){this.definitionCache=t}setSrcCache(t){this.srcCache=t}getCache(){return this.definitionCache}getSrcCache(){return this.srcCache}verifyEnv(t){if(t.testnet&&this.env!=="testnet")throw new Error('Trying to use testnet contract in a non-testnet env. Use the "forTestnet" factory method.');if(!t.testnet&&this.env==="testnet")throw new Error("Trying to use non-testnet contract in a testnet env.")}async getFromCache(t,r){let h=await this.definitionCache.get(new pot.CacheKey(t,"cd"));if(!h)return null;let o=r||h.cachedValue.srcTxId,l=await this.srcCache.get(new pot.CacheKey(o,"src"));return l?{...h.cachedValue,...l.cachedValue,srcTxId:o}:null}async putToCache(t,r,h){let o=new dot.SrcCache(r),l=new dot.ContractCache(r);await this.definitionCache.put({key:t,sortKey:"cd"},l),await this.srcCache.put({key:h||l.srcTxId,sortKey:"src"},o)}set warp(t){this.contractDefinitionLoader.warp=t}};vw.CacheableContractDefinitionLoader=NO});var DO=De(yw=>{"use strict";Tt();Rt();xt();Object.defineProperty(yw,"__esModule",{value:!0});yw.WarpBuilder=void 0;var vRt=lot(),yRt=kB(),vot=BB(),bRt=U4(),wRt=EB(),_Rt=Hm(),MRt=bw(),yot=mot(),LO=class{constructor(t,r,h="custom"){this._arweave=t,this._stateCache=r,this._environment=h}setDefinitionLoader(t){return this._definitionLoader=t,this}setInteractionsLoader(t){return this._interactionsLoader=t,this}setExecutorFactory(t){return this._executorFactory=t,this}setStateEvaluator(t){return this._stateEvaluator=t,this}overwriteSource(t){if(this._executorFactory==null)throw new Error("Set base ExecutorFactory first");return this._executorFactory=new vRt.DebuggableExecutorFactory(this._executorFactory,t),this.build()}useWarpGateway(t,r){return this._interactionsLoader=new vot.CacheableInteractionsLoader(new _Rt.WarpGatewayInteractionsLoader(t.confirmationStatus,t.source)),this._definitionLoader=new yot.CacheableContractDefinitionLoader(new wRt.WarpGatewayContractDefinitionLoader(this._arweave,this._environment),this._environment,r),this}useArweaveGateway(t){return this._interactionsLoader=new vot.CacheableInteractionsLoader(new yRt.ArweaveGatewayInteractionsLoader(this._arweave,this._environment)),this._definitionLoader=new yot.CacheableContractDefinitionLoader(new bRt.ArweaveContractDefinitionLoader(this._arweave,this._environment),this._environment,t),this}build(){let t=new MRt.Warp(this._arweave,this._definitionLoader,this._interactionsLoader,this._executorFactory,this._stateEvaluator,this._environment);return this._definitionLoader.warp=t,this._interactionsLoader.warp=t,t}};yw.WarpBuilder=LO});var $O=De(Cp=>{"use strict";Tt();Rt();xt();Object.defineProperty(Cp,"__esModule",{value:!0});Cp.knownWarpPlugins=Cp.knownWarpPluginsPartial=void 0;Cp.knownWarpPluginsPartial=["^smartweave-extension-"];Cp.knownWarpPlugins=["evm-signature-verification","subscription","ivm-handler-api","evaluation-progress","fetch-options","deploy","contract-blacklist","vm2","vrf","quickjs"]});var bw=De(ww=>{"use strict";Tt();Rt();xt();Object.defineProperty(ww,"__esModule",{value:!0});ww.Warp=void 0;var SRt=dw(),ERt=OO(),ARt=cot(),TRt=DO(),bot=$O(),wot=qO(),xRt=Fm(),UO=class{get createContract(){if(!this._createContract)if(this.plugins.has("deploy")){let t=this.loadPlugin("deploy");this._createContract=t.process(this)}else throw new Error("In order to use CreateContract methods please attach DeployPlugin.");return this._createContract}constructor(t,r,h,o,l,c="custom"){this.arweave=t,this.definitionLoader=r,this.interactionsLoader=h,this.executorFactory=o,this.stateEvaluator=l,this.environment=c,this._gwUrl=wot.WARP_GW_URL,this.plugins=new Map,this.testing=new ARt.Testing(t),this.kvStorageFactory=p=>new xRt.LevelDbCache({inMemory:!1,dbLocation:`${wot.DEFAULT_LEVEL_DB_LOCATION}/kv/ldb/${p}`}),this.eventTarget=new EventTarget}static builder(t,r,h){return new TRt.WarpBuilder(t,r,h)}contract(t,r,h){return new SRt.HandlerBasedContract(t,this,r,h)}async deploy(t,r){return await this.createContract.deploy(t,r)}async deployFromSourceTx(t,r){return await this.createContract.deployFromSourceTx(t,r)}async deployBundled(t){return await this.createContract.deployBundled(t)}async register(t,r){return await this.createContract.register(t,r)}async createSource(t,r,h=!1){return await this.createContract.createSource(t,r,h)}async saveSource(t,r){return await this.createContract.saveSource(t,r)}pst(t){return new ERt.PstContractImpl(t,this)}useStateCache(t){return this.stateEvaluator.setCache(t),this}useContractCache(t,r){return this.definitionLoader.setSrcCache(r),this.definitionLoader.setCache(t),this}use(t){let r=t.type();if(!this.isPluginType(r))throw new Error(`Unknown plugin type ${r}.`);return this.plugins.set(r,t),this}hasPlugin(t){return this.plugins.has(t)}matchPlugins(t){return[...this.plugins.keys()].filter(h=>h.match(t))}loadPlugin(t){if(!this.hasPlugin(t))throw new Error(`Plugin ${t} not registered.`);return this.plugins.get(t)}maybeLoadPlugin(t){return this.hasPlugin(t)?this.plugins.get(t):null}async close(){return Promise.all([this.definitionLoader.getSrcCache().close(),this.definitionLoader.getCache().close(),this.stateEvaluator.getCache().close()]).then()}async generateWallet(){let t=await this.arweave.wallets.generate();return await this.testing.isArlocal()&&await this.testing.addFunds(t),{jwk:t,address:await this.arweave.wallets.jwkToAddress(t)}}isPluginType(t){return bot.knownWarpPlugins.includes(t)||bot.knownWarpPluginsPartial.some(r=>t.match(r))}useKVStorageFactory(t){return this.kvStorageFactory=t,this}useGwUrl(t){return this._gwUrl=t,this}gwUrl(){return this._gwUrl}};ww.Warp=UO});var qO=De(Sn=>{"use strict";Tt();Rt();xt();var RRt=Sn&&Sn.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.WarpFactory=Sn.defaultCacheOptions=Sn.DEFAULT_LEVEL_DB_LOCATION=Sn.WARP_GW_URL=Sn.defaultWarpGwOptions=void 0;var FO=RRt(P4()),kRt=Fm(),IRt=WB(),BRt=LB(),ORt=$f(),CRt=Hm(),PRt=bw();Sn.defaultWarpGwOptions={confirmationStatus:{notCorrupted:!0},source:CRt.SourceType.BOTH};Sn.WARP_GW_URL="https://gw.warp.cc";Sn.DEFAULT_LEVEL_DB_LOCATION="./cache/warp";Sn.defaultCacheOptions={inMemory:!1,dbLocation:Sn.DEFAULT_LEVEL_DB_LOCATION};var jO=class{static forLocal(t=1984,r=FO.default.init({host:"localhost",port:t,protocol:"http"}),h={...Sn.defaultCacheOptions,inMemory:!0}){return this.customArweaveGw(r,h,"local")}static forTestnet(t=Sn.defaultCacheOptions,r=!1,h=FO.default.init({host:"arweave.net",port:443,protocol:"https"})){return r?this.customArweaveGw(h,t,"testnet"):this.customWarpGw(h,Sn.defaultWarpGwOptions,t,"testnet")}static forMainnet(t=Sn.defaultCacheOptions,r=!1,h=FO.default.init({host:"arweave.net",port:443,protocol:"https"})){return r?this.customArweaveGw(h,t,"mainnet"):this.customWarpGw(h,Sn.defaultWarpGwOptions,t,"mainnet")}static custom(t,r,h){let o=new kRt.LevelDbCache({...r,dbLocation:`${r.dbLocation}/state`}),l=new ORt.HandlerExecutorFactory(t),c=new BRt.CacheableStateEvaluator(t,o,[new IRt.Evolve]);return PRt.Warp.builder(t,o,h).setExecutorFactory(l).setStateEvaluator(c)}static customArweaveGw(t,r=Sn.defaultCacheOptions,h){return this.custom(t,r,h).useArweaveGateway(r).build()}static customWarpGw(t,r=Sn.defaultWarpGwOptions,h=Sn.defaultCacheOptions,o){return this.custom(t,h,o).useWarpGateway(r,h).build()}};Sn.WarpFactory=jO});var Mot=De(_ot=>{"use strict";Tt();Rt();xt();Object.defineProperty(_ot,"__esModule",{value:!0})});var Eot=De(Sot=>{"use strict";Tt();Rt();xt();Object.defineProperty(Sot,"__esModule",{value:!0})});var Tot=De(Aot=>{"use strict";Tt();Rt();xt();Object.defineProperty(Aot,"__esModule",{value:!0})});var Rot=De(xot=>{"use strict";Tt();Rt();xt();Object.defineProperty(xot,"__esModule",{value:!0})});var Iot=De(kot=>{"use strict";Tt();Rt();xt();Object.defineProperty(kot,"__esModule",{value:!0})});var Bot=De(_w=>{"use strict";Tt();Rt();xt();Object.defineProperty(_w,"__esModule",{value:!0});_w.matchMutClosureDtor=void 0;function NRt(i){let t=/(const|var) ret = makeMutClosure\(arg0, arg1, (\d+?), __wbg_adapter/;return i.match(t)[2]}_w.matchMutClosureDtor=NRt});var Cot=De(Pp=>{"use strict";Tt();Rt();xt();var LRt=Pp&&Pp.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Pp,"__esModule",{value:!0});Pp.ArweaveGatewayBundledContractDefinitionLoader=void 0;var DRt=Vm(),Xa=Hh(),Oot=Xs(),$Rt=bn(),URt=ll(),qRt=j4(),FRt=hv(),jRt=LRt(P4());function Ya(i,t,r=void 0){let h=i.find(({name:o})=>o===t);return h?h.value:r}var zO=class i{constructor(t){this.env=t,this.logger=$Rt.LoggerFactory.INST.create(i.name)}async load(t,r){let h=Oot.Benchmark.measure(),o=await this.fetchContractTx(t);this.logger.debug("Contract tx fetch time",h.elapsed());let l=o.owner.address,c=r||Ya(o.tags,Xa.SMART_WEAVE_TAGS.CONTRACT_SRC_TX_ID),p=Ya(o.tags,Xa.WARP_TAGS.WARP_TESTNET)||null;if(p&&this.env!=="testnet")throw new Error('Trying to use testnet contract in a non-testnet env. Use the "forTestnet" factory method.');if(!p&&this.env==="testnet")throw new Error("Trying to use non-testnet contract in a testnet env.");let w=Ya(o.tags,Xa.SMART_WEAVE_TAGS.MIN_FEE),m=Ya(o.tags,Xa.WARP_TAGS.MANIFEST)?JSON.parse(Ya(o.tags,Xa.WARP_TAGS.MANIFEST)):null;this.logger.debug("Tags decoding",h.elapsed());let y=await this.evalInitialState(o);this.logger.debug("init state",y);let v=JSON.parse(y);this.logger.debug("Parsing src and init state",h.elapsed());let{src:M,srcBinary:T,srcWasmLang:A,contractType:R,metadata:B,srcTx:C}=await this.loadContractSource(c),P={txId:t,srcTxId:c,src:M,srcBinary:T,srcWasmLang:A,initState:v,minFee:w,owner:l,contractType:R,metadata:B,manifest:m,contractTx:await this.convertToWarpCompatibleContractTx(o),srcTx:await this.convertToWarpCompatibleContractTx(C),testnet:p};return this.logger.info(`Contract definition loaded in: ${h.elapsed()}`),P}async fetchContractTx(t){let r=await this.arweaveTransactions.transaction(t);return r??await this.arweaveTransactions.transactionUsingUploaderTag(t)}async convertToWarpCompatibleContractTx(t){return{tags:t.tags.map(({name:h,value:o})=>({name:ge.from(h).toString("base64url"),value:ge.from(o).toString("base64url")})),owner:t.owner.key,target:t.recipient,signature:t.signature,data:(await this.arweaveWrapper.txData(t.id)).toString("base64url")}}async loadContractSource(t){let r=Oot.Benchmark.measure(),h=await this.fetchContractTx(t),o=Ya(h.tags,Xa.SMART_WEAVE_TAGS.CONTENT_TYPE);if(!DRt.SUPPORTED_SRC_CONTENT_TYPES.includes(o))throw new Error(`Contract source content type ${o} not supported`);let l=o==="application/javascript"?"js":"wasm",c=await this.contractSource(h,l),p,w,m;if(l=="wasm"){if(w=new FRt.WasmSrc(c),p=Ya(h.tags,Xa.WARP_TAGS.WASM_LANG),!p)throw new Error(`Wasm lang not set for wasm contract src ${h.id}`);m=JSON.parse(Ya(h.tags,Xa.WARP_TAGS.WASM_META))}return this.logger.debug("Contract src tx load",r.elapsed()),r.reset(),{src:l=="js"?c:null,srcBinary:l=="wasm"?w.wasmBinary():null,srcWasmLang:p,contractType:l,metadata:m,srcTx:h}}async contractSource(t,r){if(Ya(t.tags,Xa.WARP_TAGS.UPLOADER_TX_ID)!=null){let o=await this.arweaveWrapper.txDataString(t.id);if(r==="wasm")throw new Error("WASM contracts in legacy format are not supported using AR GW");return jRt.default.utils.b64UrlToString(JSON.parse(o).data)}return r==="js"?await this.arweaveWrapper.txDataString(t.id):await this.arweaveWrapper.txData(t.id)}async evalInitialState(t){if(Ya(t.tags,Xa.WARP_TAGS.INIT_STATE))return Ya(t.tags,Xa.WARP_TAGS.INIT_STATE);if(Ya(t.tags,Xa.WARP_TAGS.INIT_STATE_TX)){let r=Ya(t.tags,Xa.WARP_TAGS.INIT_STATE_TX);return this.arweaveWrapper.txDataString(r)}else return this.arweaveWrapper.txDataString(t.id)}setCache(){throw new Error("Method not implemented.")}setSrcCache(){throw new Error("Method not implemented.")}getCache(){throw new Error("Method not implemented.")}getSrcCache(){throw new Error("Method not implemented.")}type(){return"arweave"}set warp(t){this.arweaveWrapper=new URt.ArweaveWrapper(t),this.arweaveTransactions=new qRt.ArweaveGQLTxsFetcher(t)}};Pp.ArweaveGatewayBundledContractDefinitionLoader=zO});var Dot=De(Mw=>{"use strict";Tt();Rt();xt();Object.defineProperty(Mw,"__esModule",{value:!0});Mw.ArweaveGatewayBundledInteractionLoader=void 0;var Qa=Hh(),zRt=Xs(),WRt=bn(),KRt=ll(),Pot=Q0(),HRt=j4(),WO=ko(),GRt=Hu(),Not=100,VRt=100,Lot=1057409,KO=class i{constructor(t,r){this.arweave=t,this.environment=r,this.logger=WRt.LoggerFactory.INST.create(i.name),this.tagsParser=new GRt.TagsParser,this.sorter=new Pot.LexicographicalInteractionsSorter(t)}async load(t,r,h,o,l){if(this.logger.debug("Loading interactions for",{contractId:t,fromSortKey:r,toSortKey:h}),o?.transactionsPagesPerBatch)throw new Error(`Loading in batches not yet implemented for ${i.name}`);let c=this.sorter.extractBlockHeight(r)||0,p=this.sorter.extractBlockHeight(h)||await this.currentBlockHeight(),w={tags:[{name:Qa.SMART_WEAVE_TAGS.APP_NAME,values:["SmartWeaveAction"]},{name:Qa.SMART_WEAVE_TAGS.CONTRACT_TX_ID,values:[t]},{name:Qa.WARP_TAGS.SEQUENCER,values:["RedStone"]}],blockFilter:{min:c,max:p+VRt},first:Not},m=zRt.Benchmark.measure(),y=await this.arweaveFetcher.transactions(w,Number.MAX_SAFE_INTEGER,l);o.internalWrites&&(y=await this.appendInternalWriteInteractions(t,c,p,y,l)),m.stop(),this.logger.debug("All loaded interactions:",{from:r,to:h,loaded:y.length,time:m.elapsed()}),y.forEach(A=>{var R,B,C,P;A.node.sortKey=(R=A.node.sortKey)!==null&&R!==void 0?R:(P=(C=(B=A.node)===null||B===void 0?void 0:B.tags)===null||C===void 0?void 0:C.find(N=>N.name===Qa.WARP_TAGS.SEQUENCER_SORT_KEY))===null||P===void 0?void 0:P.value});let v=await this.sorter.sort(y),M=this.environment==="local"||this.environment==="testnet",T=this._warp.maybeLoadPlugin("vrf");return v.filter(A=>this.isNewerThenSortKeyBlockHeight(A)).filter(A=>this.isSortKeyInBounds(r,h,A)).map(A=>this.attachSequencerDataToInteraction(A)).map(A=>this.maybeAddMockVrf(M,A,T)).map((A,R,B)=>this.verifySortKeyIntegrity(A,R,B)).map(({node:A})=>A)}verifySortKeyIntegrity(t,r,h){var o;if(r!==0){let l=h[r-1],c=h[r];if(this.logger.debug(`prev: ${l.node.id} | current: ${c.node.id}`),c.node.block.height<=Lot||((o=c.node.lastSortKey)===null||o===void 0?void 0:o.split(",")[1])===Pot.defaultArweaveMs)return t;l.node.source==="redstone-sequencer"&&l.node.sortKey!==c.node.lastSortKey&&this.logger.warn(`Interaction loading error: interaction ${c.node.id} lastSortKey is not pointing on prev interaction ${l.node.id}`)}return t}isSortKeyInBounds(t,r,h){return t&&r?h.node.sortKey.localeCompare(t)>0&&h.node.sortKey.localeCompare(r)<=0:t&&!r?h.node.sortKey.localeCompare(t)>0:!t&&r?h.node.sortKey.localeCompare(r)<=0:!0}attachSequencerDataToInteraction(t){let r=v=>{var M;return(M=t.node.tags.find(T=>T.name===v))===null||M===void 0?void 0:M.value},h=r(Qa.WARP_TAGS.SEQUENCER_TX_ID),o=r(Qa.WARP_TAGS.SEQUENCER_OWNER),l=r(Qa.WARP_TAGS.SEQUENCER_BLOCK_ID),c=r(Qa.WARP_TAGS.SEQUENCER_BLOCK_HEIGHT),p=r(Qa.WARP_TAGS.SEQUENCER_PREV_SORT_KEY)||r(Qa.WARP_TAGS.SEQUENCER_LAST_SORT_KEY),w=r(Qa.WARP_TAGS.SEQUENCER_SORT_KEY),m=r(Qa.WARP_TAGS.SEQUENCER_BLOCK_TIMESTAMP),y=(0,WO.safeParseInt)(c);if(!o||!l||!c||!p&&y>Lot||!h||!w)throw Error(`Interaction ${t.node.id} is not sequenced by sequencer aborting. Only Sequenced transactions are supported by loader ${i.name}`);return{...t,node:{...t.node,owner:{address:o,key:null},block:{...t.node.block,height:(0,WO.safeParseInt)(c),id:l,timestamp:m?(0,WO.safeParseInt)(m):t.node.block.timestamp},sortKey:w,lastSortKey:p,id:h,source:"redstone-sequencer"}}}async appendInternalWriteInteractions(t,r,h,o,l){let c={tags:[{name:Qa.WARP_TAGS.INTERACT_WRITE,values:[t]}],blockFilter:{min:r,max:h},first:Not},p=await this.arweaveFetcher.transactions(c,Number.MAX_SAFE_INTEGER,l);return this.logger.debug("Inner writes interactions length:",p.length),o=o.concat(p),o}maybeAddMockVrf(t,r,h){return t&&this.tagsParser.hasVrfTag(r.node)&&(h?r.node.vrf=h.process().generateMockVrf(r.node.sortKey):this.logger.warn('Cannot generate mock vrf for interaction - no "warp-contracts-plugin-vrf" attached!')),r}isNewerThenSortKeyBlockHeight(t){if(t.node.sortKey){let r=t.node.sortKey.split(",")[0],h=Number.parseInt(r);return Number(t.node.block.height)-h>=0}return!0}async currentBlockHeight(){return(await this.arweaveWrapper.info()).height}type(){return"arweave"}clearCache(){}set warp(t){this.arweaveWrapper=new KRt.ArweaveWrapper(t),this.arweaveFetcher=new HRt.ArweaveGQLTxsFetcher(t),this._warp=t}};Mw.ArweaveGatewayBundledInteractionLoader=KO});var $ot=De(Mr=>{"use strict";Tt();Rt();xt();var ZRt=Mr&&Mr.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),Ar=Mr&&Mr.__exportStar||function(i,t){for(var r in i)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ZRt(t,i,r)};Object.defineProperty(Mr,"__esModule",{value:!0});Ar(nk(),Mr);Ar(ak(),Mr);Ar(Ret(),Mr);Ar(bn(),Mr);Ar(rk(),Mr);Ar(Xs(),Mr);Ar(Iet(),Mr);Ar(Lu(),Mr);Ar(Oet(),Mr);Ar(Fm(),Mr);Ar(Wrt(),Mr);Ar(Hrt(),Mr);Ar(Vrt(),Mr);Ar(Jrt(),Mr);Ar(Yrt(),Mr);Ar(Gm(),Mr);Ar(U4(),Mr);Ar(EB(),Mr);Ar(kB(),Mr);Ar(Hm(),Mr);Ar(BB(),Mr);Ar(PB(),Mr);Ar(LB(),Mr);Ar($f(),Mr);Ar(Q0(),Mr);Ar(Hu(),Mr);Ar(bI(),Mr);Ar(b4(),Mr);Ar(vp(),Mr);Ar(yI(),Mr);Ar(lnt(),Mr);Ar(Hh(),Mr);Ar(pnt(),Mr);Ar(Vm(),Mr);Ar(UB(),Mr);Ar(qO(),Mr);Ar(bw(),Mr);Ar(DO(),Mr);Ar($O(),Mr);Ar(Km(),Mr);Ar(Mot(),Mr);Ar(dw(),Mr);Ar(Eot(),Mr);Ar(OO(),Mr);Ar(tO(),Mr);Ar(pO(),Mr);Ar(mO(),Mr);Ar(Tot(),Mr);Ar(YB(),Mr);Ar(AO(),Mr);Ar(Rot(),Mr);Ar(Iot(),Mr);Ar(g4(),Mr);Ar(FB(),Mr);Ar(SI(),Mr);Ar(XB(),Mr);Ar(ko(),Mr);Ar(ll(),Mr);Ar(_p(),Mr);Ar(hv(),Mr);Ar(pI(),Mr);Ar(Bot(),Mr);Ar(Cot(),Mr);Ar(Dot(),Mr)});Tt();Rt();xt();var Hot=Sl(U5(),1);Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();var bst=["gateway","gateways","prescribedObservers","record","auction","balance","epoch","priceForInteraction"],wst=["delegateStake","decreaseDelegateStake","joinNetwork","increaseOperatorStake","decreaseOperatorStake","updateGatewaySettings","saveObservations","extendRecord","buyRecord","increaseUndernameCount","transfer"],Akt=[...bst,...wst],ho={GATEWAY:"gateway",GATEWAYS:"gateways",PRESCRIBED_OBSERVERS:"prescribedObservers",DELEGATE_STAKE:"delegateStake",DECREASE_DELEGATE_STAKE:"decreaseDelegateStake",JOIN_NETWORK:"joinNetwork",INCREASE_OPERATOR_STAKE:"increaseOperatorStake",DECREASE_OPERATOR_STAKE:"decreaseOperatorStake",UPDATE_GATEWAY_SETTINGS:"updateGatewaySettings",SAVE_OBSERVATIONS:"saveObservations",EXTEND_RECORD:"extendRecord",INCREASE_UNDERNAME_COUNT:"increaseUndernameCount",RECORD:"record",AUCTION:"auction",TRANSFER:"transfer",BALANCE:"balance",PRICE_FOR_INTERACTION:"priceForInteraction",EPOCH:"epoch",BUY_RECORD:"buyRecord"},vL=(r=>(r.IO="IO",r.MIO="mIO",r))(vL||{}),hc={TRANSFER:"transfer",SET_CONTROLLER:"setController",REMOVE_CONTROLLER:"removeController",SET_NAME:"setName",SET_TICKER:"setTicker",SET_RECORD:"setRecord",REMOVE_RECORD:"removeRecord",BALANCE:"balance",EVOLVE:"evolve"};Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();var yL=new RegExp("^[a-zA-Z0-9_-]{43}$"),Ckt=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),bL=new RegExp("^[0-9]{12},[0-9]{13},[a-fA-F0-9]{64}$"),y6=ve.env.ARNS_REGISTRY_TX??"bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U",Pkt="_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8",Qp="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",q5=1e6,wL="9afQ1PLf2mrshqCTZEzzJTR2gWaC9zNPnYgYEqg1Pt4",_L="obPBMsBWmG5q2qODj3y-zdKiuhZaJC_nuBaQRvORKkU",ML="_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";var F5=class i{constructor(t){this.positiveFiniteInteger=t;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${t}`)}[Symbol.toPrimitive](t){return t==="string"&&this.toString(),this.positiveFiniteInteger}plus(t){return new i(this.positiveFiniteInteger+t.positiveFiniteInteger)}minus(t){return new i(this.positiveFiniteInteger-t.positiveFiniteInteger)}isGreaterThan(t){return this.positiveFiniteInteger>t.positiveFiniteInteger}isGreaterThanOrEqualTo(t){return this.positiveFiniteInteger>=t.positiveFiniteInteger}isLessThan(t){return this.positiveFiniteInteger<t.positiveFiniteInteger}isLessThanOrEqualTo(t){return this.positiveFiniteInteger<=t.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(t){return this.positiveFiniteInteger===t.positiveFiniteInteger}},t2=class{value;constructor(t){if(!Number.isFinite(t)||t<0)throw new Error("IOToken must be a non-negative finite number");this.value=+t.toFixed(6)}valueOf(){return this.value}toMIO(){return new j5(Math.floor(this.value*q5))}toString(){return`${this.value}`}},j5=class i extends F5{constructor(t){super(t)}multiply(t){let r=Math.floor(this.valueOf()*t.valueOf());return new i(r)}divide(t){if(t.valueOf()===0)throw new Error("Cannot divide by zero");let r=Math.floor(this.valueOf()/t.valueOf());return new i(r)}plus(t){let r=super.plus(t);return new i(r.valueOf())}minus(t){let r=super.minus(t);return new i(r.valueOf())}toIO(){return new t2(this.valueOf()/q5)}};Tt();Rt();xt();Tt();Rt();xt();var b6=i=>yL.test(i);function Kkt(i){return i!==void 0&&!isNaN(parseInt(i.toString()))}var Hkt=i=>["id","owner","tags","signature"].every(r=>r in i);function SL(i){return i.reduce((t,r)=>{let h=r.get("name",{decode:!0,string:!0}),o=r.get("value",{decode:!0,string:!0});return t[h]=o,t},{})}function Tl(i){return"process"in i}function xl(i){return"processId"in i&&typeof i.processId=="string"&&b6(i.processId)===!0}function Ykt(i){return i.type==="lease"&&i.endTimestamp!==void 0}Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();function pIt(i){return z5.validate(i)}var z5=class i{_sortKey;constructor(t){if(!i.validate(t))throw new Error(`Invalid sort key: ${t}`);this._sortKey=t}static validate(t){return bL.test(t)}toString(){return this._sortKey}parts(){return this._sortKey.split(",")}blockHeight(){return parseInt(this.parts()[0])}timestamp(){return parseInt(this.parts()[1])}hash(){return this.parts()[2]}};async function EL({arweave:i,contractTxId:t}){let{tags:r}=await i.transactions.get(t).catch(()=>({tags:[]})),o=SL(r)["Contract-Manifest"]??"{}";return JSON.parse(o)}function Jf(i){return"contract"in i}function Xf(i){return"contractTxId"in i&&typeof i.contractTxId=="string"&&b6(i.contractTxId)===!0}Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();function e2(i,t){return function(){return i.apply(t,arguments)}}var{toString:_st}=Object.prototype,{getPrototypeOf:H5}=Object,_6=(i=>t=>{let r=_st.call(t);return i[r]||(i[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),dh=i=>(i=i.toLowerCase(),t=>_6(t)===i),M6=i=>t=>typeof t===i,{isArray:Id}=Array,r2=M6("undefined");function Mst(i){return i!==null&&!r2(i)&&i.constructor!==null&&!r2(i.constructor)&&us(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}var xL=dh("ArrayBuffer");function Sst(i){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(i):t=i&&i.buffer&&xL(i.buffer),t}var Est=M6("string"),us=M6("function"),RL=M6("number"),S6=i=>i!==null&&typeof i=="object",Ast=i=>i===!0||i===!1,w6=i=>{if(_6(i)!=="object")return!1;let t=H5(i);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},Tst=dh("Date"),xst=dh("File"),Rst=dh("Blob"),kst=dh("FileList"),Ist=i=>S6(i)&&us(i.pipe),Bst=i=>{let t;return i&&(typeof FormData=="function"&&i instanceof FormData||us(i.append)&&((t=_6(i))==="formdata"||t==="object"&&us(i.toString)&&i.toString()==="[object FormData]"))},Ost=dh("URLSearchParams"),[Cst,Pst,Nst,Lst]=["ReadableStream","Request","Response","Headers"].map(dh),Dst=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function i2(i,t,{allOwnKeys:r=!1}={}){if(i===null||typeof i>"u")return;let h,o;if(typeof i!="object"&&(i=[i]),Id(i))for(h=0,o=i.length;h<o;h++)t.call(null,i[h],h,i);else{let l=r?Object.getOwnPropertyNames(i):Object.keys(i),c=l.length,p;for(h=0;h<c;h++)p=l[h],t.call(null,i[p],p,i)}}function kL(i,t){t=t.toLowerCase();let r=Object.keys(i),h=r.length,o;for(;h-- >0;)if(o=r[h],t===o.toLowerCase())return o;return null}var IL=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,BL=i=>!r2(i)&&i!==IL;function K5(){let{caseless:i}=BL(this)&&this||{},t={},r=(h,o)=>{let l=i&&kL(t,o)||o;w6(t[l])&&w6(h)?t[l]=K5(t[l],h):w6(h)?t[l]=K5({},h):Id(h)?t[l]=h.slice():t[l]=h};for(let h=0,o=arguments.length;h<o;h++)arguments[h]&&i2(arguments[h],r);return t}var $st=(i,t,r,{allOwnKeys:h}={})=>(i2(t,(o,l)=>{r&&us(o)?i[l]=e2(o,r):i[l]=o},{allOwnKeys:h}),i),Ust=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),qst=(i,t,r,h)=>{i.prototype=Object.create(t.prototype,h),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:t.prototype}),r&&Object.assign(i.prototype,r)},Fst=(i,t,r,h)=>{let o,l,c,p={};if(t=t||{},i==null)return t;do{for(o=Object.getOwnPropertyNames(i),l=o.length;l-- >0;)c=o[l],(!h||h(c,i,t))&&!p[c]&&(t[c]=i[c],p[c]=!0);i=r!==!1&&H5(i)}while(i&&(!r||r(i,t))&&i!==Object.prototype);return t},jst=(i,t,r)=>{i=String(i),(r===void 0||r>i.length)&&(r=i.length),r-=t.length;let h=i.indexOf(t,r);return h!==-1&&h===r},zst=i=>{if(!i)return null;if(Id(i))return i;let t=i.length;if(!RL(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=i[t];return r},Wst=(i=>t=>i&&t instanceof i)(typeof Uint8Array<"u"&&H5(Uint8Array)),Kst=(i,t)=>{let h=(i&&i[Symbol.iterator]).call(i),o;for(;(o=h.next())&&!o.done;){let l=o.value;t.call(i,l[0],l[1])}},Hst=(i,t)=>{let r,h=[];for(;(r=i.exec(t))!==null;)h.push(r);return h},Gst=dh("HTMLFormElement"),Vst=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,h,o){return h.toUpperCase()+o}),AL=(({hasOwnProperty:i})=>(t,r)=>i.call(t,r))(Object.prototype),Zst=dh("RegExp"),OL=(i,t)=>{let r=Object.getOwnPropertyDescriptors(i),h={};i2(r,(o,l)=>{let c;(c=t(o,l,i))!==!1&&(h[l]=c||o)}),Object.defineProperties(i,h)},Jst=i=>{OL(i,(t,r)=>{if(us(i)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let h=i[r];if(us(h)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Xst=(i,t)=>{let r={},h=o=>{o.forEach(l=>{r[l]=!0})};return Id(i)?h(i):h(String(i).split(t)),r},Yst=()=>{},Qst=(i,t)=>i!=null&&Number.isFinite(i=+i)?i:t,W5="abcdefghijklmnopqrstuvwxyz",TL="0123456789",CL={DIGIT:TL,ALPHA:W5,ALPHA_DIGIT:W5+W5.toUpperCase()+TL},tht=(i=16,t=CL.ALPHA_DIGIT)=>{let r="",{length:h}=t;for(;i--;)r+=t[Math.random()*h|0];return r};function eht(i){return!!(i&&us(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}var rht=i=>{let t=new Array(10),r=(h,o)=>{if(S6(h)){if(t.indexOf(h)>=0)return;if(!("toJSON"in h)){t[o]=h;let l=Id(h)?[]:{};return i2(h,(c,p)=>{let w=r(c,o+1);!r2(w)&&(l[p]=w)}),t[o]=void 0,l}}return h};return r(i,0)},iht=dh("AsyncFunction"),nht=i=>i&&(S6(i)||us(i))&&us(i.then)&&us(i.catch),Ke={isArray:Id,isArrayBuffer:xL,isBuffer:Mst,isFormData:Bst,isArrayBufferView:Sst,isString:Est,isNumber:RL,isBoolean:Ast,isObject:S6,isPlainObject:w6,isReadableStream:Cst,isRequest:Pst,isResponse:Nst,isHeaders:Lst,isUndefined:r2,isDate:Tst,isFile:xst,isBlob:Rst,isRegExp:Zst,isFunction:us,isStream:Ist,isURLSearchParams:Ost,isTypedArray:Wst,isFileList:kst,forEach:i2,merge:K5,extend:$st,trim:Dst,stripBOM:Ust,inherits:qst,toFlatObject:Fst,kindOf:_6,kindOfTest:dh,endsWith:jst,toArray:zst,forEachEntry:Kst,matchAll:Hst,isHTMLForm:Gst,hasOwnProperty:AL,hasOwnProp:AL,reduceDescriptors:OL,freezeMethods:Jst,toObjectSet:Xst,toCamelCase:Vst,noop:Yst,toFiniteNumber:Qst,findKey:kL,global:IL,isContextDefined:BL,ALPHABET:CL,generateString:tht,isSpecCompliantForm:eht,toJSONObject:rht,isAsyncFn:iht,isThenable:nht};Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();function Bd(i,t,r,h,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),h&&(this.request=h),o&&(this.response=o)}Ke.inherits(Bd,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ke.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var PL=Bd.prototype,NL={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{NL[i]={value:i}});Object.defineProperties(Bd,NL);Object.defineProperty(PL,"isAxiosError",{value:!0});Bd.from=(i,t,r,h,o,l)=>{let c=Object.create(PL);return Ke.toFlatObject(i,c,function(w){return w!==Error.prototype},p=>p!=="isAxiosError"),Bd.call(c,i.message,t,r,h,o),c.cause=i,c.name=i.name,l&&Object.assign(c,l),c};var Nr=Bd;Tt();Rt();xt();var E6=null;function G5(i){return Ke.isPlainObject(i)||Ke.isArray(i)}function DL(i){return Ke.endsWith(i,"[]")?i.slice(0,-2):i}function LL(i,t,r){return i?i.concat(t).map(function(o,l){return o=DL(o),!r&&l?"["+o+"]":o}).join(r?".":""):t}function oht(i){return Ke.isArray(i)&&!i.some(G5)}var aht=Ke.toFlatObject(Ke,{},null,function(t){return/^is[A-Z]/.test(t)});function sht(i,t,r){if(!Ke.isObject(i))throw new TypeError("target must be an object");t=t||new(E6||FormData),r=Ke.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(R,B){return!Ke.isUndefined(B[R])});let h=r.metaTokens,o=r.visitor||y,l=r.dots,c=r.indexes,w=(r.Blob||typeof Blob<"u"&&Blob)&&Ke.isSpecCompliantForm(t);if(!Ke.isFunction(o))throw new TypeError("visitor must be a function");function m(A){if(A===null)return"";if(Ke.isDate(A))return A.toISOString();if(!w&&Ke.isBlob(A))throw new Nr("Blob is not supported. Use a Buffer instead.");return Ke.isArrayBuffer(A)||Ke.isTypedArray(A)?w&&typeof Blob=="function"?new Blob([A]):ge.from(A):A}function y(A,R,B){let C=A;if(A&&!B&&typeof A=="object"){if(Ke.endsWith(R,"{}"))R=h?R:R.slice(0,-2),A=JSON.stringify(A);else if(Ke.isArray(A)&&oht(A)||(Ke.isFileList(A)||Ke.endsWith(R,"[]"))&&(C=Ke.toArray(A)))return R=DL(R),C.forEach(function(N,q){!(Ke.isUndefined(N)||N===null)&&t.append(c===!0?LL([R],q,l):c===null?R:R+"[]",m(N))}),!1}return G5(A)?!0:(t.append(LL(B,R,l),m(A)),!1)}let v=[],M=Object.assign(aht,{defaultVisitor:y,convertValue:m,isVisitable:G5});function T(A,R){if(!Ke.isUndefined(A)){if(v.indexOf(A)!==-1)throw Error("Circular reference detected in "+R.join("."));v.push(A),Ke.forEach(A,function(C,P){(!(Ke.isUndefined(C)||C===null)&&o.call(t,C,Ke.isString(P)?P.trim():P,R,M))===!0&&T(C,R?R.concat(P):[P])}),v.pop()}}if(!Ke.isObject(i))throw new TypeError("data must be an object");return T(i),t}var fc=sht;function $L(i){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(h){return t[h]})}function UL(i,t){this._pairs=[],i&&fc(i,this,t)}var qL=UL.prototype;qL.append=function(t,r){this._pairs.push([t,r])};qL.toString=function(t){let r=t?function(h){return t.call(this,h,$L)}:$L;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var A6=UL;function hht(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function n2(i,t,r){if(!t)return i;let h=r&&r.encode||hht,o=r&&r.serialize,l;if(o?l=o(t,r):l=Ke.isURLSearchParams(t)?t.toString():new A6(t,r).toString(h),l){let c=i.indexOf("#");c!==-1&&(i=i.slice(0,c)),i+=(i.indexOf("?")===-1?"?":"&")+l}return i}Tt();Rt();xt();var V5=class{constructor(){this.handlers=[]}use(t,r,h){return this.handlers.push({fulfilled:t,rejected:r,synchronous:h?h.synchronous:!1,runWhen:h?h.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Ke.forEach(this.handlers,function(h){h!==null&&t(h)})}},Z5=V5;Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();var T6={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();var FL=typeof URLSearchParams<"u"?URLSearchParams:A6;Tt();Rt();xt();var jL=typeof FormData<"u"?FormData:null;Tt();Rt();xt();var zL=typeof Blob<"u"?Blob:null;var WL={isBrowser:!0,classes:{URLSearchParams:FL,FormData:jL,Blob:zL},protocols:["http","https","file","blob","url","data"]};var X5={};fs(X5,{hasBrowserEnv:()=>J5,hasStandardBrowserEnv:()=>fht,hasStandardBrowserWebWorkerEnv:()=>uht,origin:()=>cht});Tt();Rt();xt();var J5=typeof window<"u"&&typeof document<"u",fht=(i=>J5&&["ReactNative","NativeScript","NS"].indexOf(i)<0)(typeof navigator<"u"&&navigator.product),uht=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",cht=J5&&window.location.href||"http://localhost";var fo={...X5,...WL};function Y5(i,t){return fc(i,new fo.classes.URLSearchParams,Object.assign({visitor:function(r,h,o,l){return fo.isNode&&Ke.isBuffer(r)?(this.append(h,r.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)}},t))}Tt();Rt();xt();function lht(i){return Ke.matchAll(/\w+|\[(\w*)]/g,i).map(t=>t[0]==="[]"?"":t[1]||t[0])}function dht(i){let t={},r=Object.keys(i),h,o=r.length,l;for(h=0;h<o;h++)l=r[h],t[l]=i[l];return t}function pht(i){function t(r,h,o,l){let c=r[l++];if(c==="__proto__")return!0;let p=Number.isFinite(+c),w=l>=r.length;return c=!c&&Ke.isArray(o)?o.length:c,w?(Ke.hasOwnProp(o,c)?o[c]=[o[c],h]:o[c]=h,!p):((!o[c]||!Ke.isObject(o[c]))&&(o[c]=[]),t(r,h,o[c],l)&&Ke.isArray(o[c])&&(o[c]=dht(o[c])),!p)}if(Ke.isFormData(i)&&Ke.isFunction(i.entries)){let r={};return Ke.forEachEntry(i,(h,o)=>{t(lht(h),o,r,0)}),r}return null}var x6=pht;function ght(i,t,r){if(Ke.isString(i))try{return(t||JSON.parse)(i),Ke.trim(i)}catch(h){if(h.name!=="SyntaxError")throw h}return(r||JSON.stringify)(i)}var Q5={transitional:T6,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let h=r.getContentType()||"",o=h.indexOf("application/json")>-1,l=Ke.isObject(t);if(l&&Ke.isHTMLForm(t)&&(t=new FormData(t)),Ke.isFormData(t))return o?JSON.stringify(x6(t)):t;if(Ke.isArrayBuffer(t)||Ke.isBuffer(t)||Ke.isStream(t)||Ke.isFile(t)||Ke.isBlob(t)||Ke.isReadableStream(t))return t;if(Ke.isArrayBufferView(t))return t.buffer;if(Ke.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let p;if(l){if(h.indexOf("application/x-www-form-urlencoded")>-1)return Y5(t,this.formSerializer).toString();if((p=Ke.isFileList(t))||h.indexOf("multipart/form-data")>-1){let w=this.env&&this.env.FormData;return fc(p?{"files[]":t}:t,w&&new w,this.formSerializer)}}return l||o?(r.setContentType("application/json",!1),ght(t)):t}],transformResponse:[function(t){let r=this.transitional||Q5.transitional,h=r&&r.forcedJSONParsing,o=this.responseType==="json";if(Ke.isResponse(t)||Ke.isReadableStream(t))return t;if(t&&Ke.isString(t)&&(h&&!this.responseType||o)){let c=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(p){if(c)throw p.name==="SyntaxError"?Nr.from(p,Nr.ERR_BAD_RESPONSE,this,null,this.response):p}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:fo.classes.FormData,Blob:fo.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ke.forEach(["delete","get","head","post","put","patch"],i=>{Q5.headers[i]={}});var Od=Q5;Tt();Rt();xt();Tt();Rt();xt();var mht=Ke.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),KL=i=>{let t={},r,h,o;return i&&i.split(`
|
|
216
|
+
`))}this.rootOptions=Object.freeze(Object.assign({},t,r||{}))}forForeignContract(t){let r=(0,Nxt.deepCopy)(this.rootOptions);if(t)for(let h in t)r[h]=this.saferEvaluationOptions[h](t);return Object.freeze(r)}};rw.EvaluationOptionsEvaluator=gO});var cv={};fs(cv,{__addDisposableResource:()=>Ynt,__assign:()=>iw,__asyncDelegator:()=>Wnt,__asyncGenerator:()=>znt,__asyncValues:()=>Knt,__await:()=>Rp,__awaiter:()=>Dnt,__classPrivateFieldGet:()=>Znt,__classPrivateFieldIn:()=>Xnt,__classPrivateFieldSet:()=>Jnt,__createBinding:()=>ow,__decorate:()=>Pnt,__disposeResources:()=>Qnt,__esDecorate:()=>Lxt,__exportStar:()=>Unt,__extends:()=>Ont,__generator:()=>$nt,__importDefault:()=>Vnt,__importStar:()=>Gnt,__makeTemplateObject:()=>Hnt,__metadata:()=>Lnt,__param:()=>Nnt,__propKey:()=>$xt,__read:()=>yO,__rest:()=>Cnt,__runInitializers:()=>Dxt,__setFunctionName:()=>Uxt,__spread:()=>qnt,__spreadArray:()=>jnt,__spreadArrays:()=>Fnt,__values:()=>nw,default:()=>jxt});function Ont(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");vO(i,t);function r(){this.constructor=i}i.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Cnt(i,t){var r={};for(var h in i)Object.prototype.hasOwnProperty.call(i,h)&&t.indexOf(h)<0&&(r[h]=i[h]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,h=Object.getOwnPropertySymbols(i);o<h.length;o++)t.indexOf(h[o])<0&&Object.prototype.propertyIsEnumerable.call(i,h[o])&&(r[h[o]]=i[h[o]]);return r}function Pnt(i,t,r,h){var o=arguments.length,l=o<3?t:h===null?h=Object.getOwnPropertyDescriptor(t,r):h,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(i,t,r,h);else for(var p=i.length-1;p>=0;p--)(c=i[p])&&(l=(o<3?c(l):o>3?c(t,r,l):c(t,r))||l);return o>3&&l&&Object.defineProperty(t,r,l),l}function Nnt(i,t){return function(r,h){t(r,h,i)}}function Lxt(i,t,r,h,o,l){function c(C){if(C!==void 0&&typeof C!="function")throw new TypeError("Function expected");return C}for(var p=h.kind,w=p==="getter"?"get":p==="setter"?"set":"value",m=!t&&i?h.static?i:i.prototype:null,y=t||(m?Object.getOwnPropertyDescriptor(m,h.name):{}),v,M=!1,T=r.length-1;T>=0;T--){var A={};for(var R in h)A[R]=R==="access"?{}:h[R];for(var R in h.access)A.access[R]=h.access[R];A.addInitializer=function(C){if(M)throw new TypeError("Cannot add initializers after decoration has completed");l.push(c(C||null))};var B=(0,r[T])(p==="accessor"?{get:y.get,set:y.set}:y[w],A);if(p==="accessor"){if(B===void 0)continue;if(B===null||typeof B!="object")throw new TypeError("Object expected");(v=c(B.get))&&(y.get=v),(v=c(B.set))&&(y.set=v),(v=c(B.init))&&o.unshift(v)}else(v=c(B))&&(p==="field"?o.unshift(v):y[w]=v)}m&&Object.defineProperty(m,h.name,y),M=!0}function Dxt(i,t,r){for(var h=arguments.length>2,o=0;o<t.length;o++)r=h?t[o].call(i,r):t[o].call(i);return h?r:void 0}function $xt(i){return typeof i=="symbol"?i:"".concat(i)}function Uxt(i,t,r){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(i,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function Lnt(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}function Dnt(i,t,r,h){function o(l){return l instanceof r?l:new r(function(c){c(l)})}return new(r||(r=Promise))(function(l,c){function p(y){try{m(h.next(y))}catch(v){c(v)}}function w(y){try{m(h.throw(y))}catch(v){c(v)}}function m(y){y.done?l(y.value):o(y.value).then(p,w)}m((h=h.apply(i,t||[])).next())})}function $nt(i,t){var r={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},h,o,l,c;return c={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function p(m){return function(y){return w([m,y])}}function w(m){if(h)throw new TypeError("Generator is already executing.");for(;c&&(c=0,m[0]&&(r=0)),r;)try{if(h=1,o&&(l=m[0]&2?o.return:m[0]?o.throw||((l=o.return)&&l.call(o),0):o.next)&&!(l=l.call(o,m[1])).done)return l;switch(o=0,l&&(m=[m[0]&2,l.value]),m[0]){case 0:case 1:l=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(l=r.trys,!(l=l.length>0&&l[l.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!l||m[1]>l[0]&&m[1]<l[3])){r.label=m[1];break}if(m[0]===6&&r.label<l[1]){r.label=l[1],l=m;break}if(l&&r.label<l[2]){r.label=l[2],r.ops.push(m);break}l[2]&&r.ops.pop(),r.trys.pop();continue}m=t.call(i,r)}catch(y){m=[6,y],o=0}finally{h=l=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function Unt(i,t){for(var r in i)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ow(t,i,r)}function nw(i){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&i[t],h=0;if(r)return r.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&h>=i.length&&(i=void 0),{value:i&&i[h++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function yO(i,t){var r=typeof Symbol=="function"&&i[Symbol.iterator];if(!r)return i;var h=r.call(i),o,l=[],c;try{for(;(t===void 0||t-- >0)&&!(o=h.next()).done;)l.push(o.value)}catch(p){c={error:p}}finally{try{o&&!o.done&&(r=h.return)&&r.call(h)}finally{if(c)throw c.error}}return l}function qnt(){for(var i=[],t=0;t<arguments.length;t++)i=i.concat(yO(arguments[t]));return i}function Fnt(){for(var i=0,t=0,r=arguments.length;t<r;t++)i+=arguments[t].length;for(var h=Array(i),o=0,t=0;t<r;t++)for(var l=arguments[t],c=0,p=l.length;c<p;c++,o++)h[o]=l[c];return h}function jnt(i,t,r){if(r||arguments.length===2)for(var h=0,o=t.length,l;h<o;h++)(l||!(h in t))&&(l||(l=Array.prototype.slice.call(t,0,h)),l[h]=t[h]);return i.concat(l||Array.prototype.slice.call(t))}function Rp(i){return this instanceof Rp?(this.v=i,this):new Rp(i)}function znt(i,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var h=r.apply(i,t||[]),o,l=[];return o={},p("next"),p("throw"),p("return",c),o[Symbol.asyncIterator]=function(){return this},o;function c(T){return function(A){return Promise.resolve(A).then(T,v)}}function p(T,A){h[T]&&(o[T]=function(R){return new Promise(function(B,C){l.push([T,R,B,C])>1||w(T,R)})},A&&(o[T]=A(o[T])))}function w(T,A){try{m(h[T](A))}catch(R){M(l[0][3],R)}}function m(T){T.value instanceof Rp?Promise.resolve(T.value.v).then(y,v):M(l[0][2],T)}function y(T){w("next",T)}function v(T){w("throw",T)}function M(T,A){T(A),l.shift(),l.length&&w(l[0][0],l[0][1])}}function Wnt(i){var t,r;return t={},h("next"),h("throw",function(o){throw o}),h("return"),t[Symbol.iterator]=function(){return this},t;function h(o,l){t[o]=i[o]?function(c){return(r=!r)?{value:Rp(i[o](c)),done:!1}:l?l(c):c}:l}}function Knt(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],r;return t?t.call(i):(i=typeof nw=="function"?nw(i):i[Symbol.iterator](),r={},h("next"),h("throw"),h("return"),r[Symbol.asyncIterator]=function(){return this},r);function h(l){r[l]=i[l]&&function(c){return new Promise(function(p,w){c=i[l](c),o(p,w,c.done,c.value)})}}function o(l,c,p,w){Promise.resolve(w).then(function(m){l({value:m,done:p})},c)}}function Hnt(i,t){return Object.defineProperty?Object.defineProperty(i,"raw",{value:t}):i.raw=t,i}function Gnt(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var r in i)r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)&&ow(t,i,r);return qxt(t,i),t}function Vnt(i){return i&&i.__esModule?i:{default:i}}function Znt(i,t,r,h){if(r==="a"&&!h)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!h:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?h:r==="a"?h.call(i):h?h.value:t.get(i)}function Jnt(i,t,r,h,o){if(h==="m")throw new TypeError("Private method is not writable");if(h==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!o:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return h==="a"?o.call(i,r):o?o.value=r:t.set(i,r),r}function Xnt(i,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof i=="function"?t===i:i.has(t)}function Ynt(i,t,r){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var h,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");h=t[Symbol.asyncDispose]}if(h===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");h=t[Symbol.dispose],r&&(o=h)}if(typeof h!="function")throw new TypeError("Object not disposable.");o&&(h=function(){try{o.call(this)}catch(l){return Promise.reject(l)}}),i.stack.push({value:t,dispose:h,async:r})}else r&&i.stack.push({async:!0});return t}function Qnt(i){function t(h){i.error=i.hasError?new Fxt(h,i.error,"An error was suppressed during disposal."):h,i.hasError=!0}function r(){for(;i.stack.length;){var h=i.stack.pop();try{var o=h.dispose&&h.dispose.call(h.value);if(h.async)return Promise.resolve(o).then(r,function(l){return t(l),r()})}catch(l){t(l)}}if(i.hasError)throw i.error}return r()}var vO,iw,ow,qxt,Fxt,jxt,lv=Vi(()=>{"use strict";Tt();Rt();xt();vO=function(i,t){return vO=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,h){r.__proto__=h}||function(r,h){for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(r[o]=h[o])},vO(i,t)};iw=function(){return iw=Object.assign||function(t){for(var r,h=1,o=arguments.length;h<o;h++){r=arguments[h];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(t[l]=r[l])}return t},iw.apply(this,arguments)};ow=Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]};qxt=Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t};Fxt=typeof SuppressedError=="function"?SuppressedError:function(i,t,r){var h=new Error(r);return h.name="SuppressedError",h.error=i,h.suppressed=t,h};jxt={__extends:Ont,__assign:iw,__rest:Cnt,__decorate:Pnt,__param:Nnt,__metadata:Lnt,__awaiter:Dnt,__generator:$nt,__createBinding:ow,__exportStar:Unt,__values:nw,__read:yO,__spread:qnt,__spreadArrays:Fnt,__spreadArray:jnt,__await:Rp,__asyncGenerator:znt,__asyncDelegator:Wnt,__asyncValues:Knt,__makeTemplateObject:Hnt,__importStar:Gnt,__importDefault:Vnt,__classPrivateFieldGet:Znt,__classPrivateFieldSet:Jnt,__classPrivateFieldIn:Xnt,__addDisposableResource:Ynt,__disposeResources:Qnt}});var dv=De(vl=>{"use strict";Tt();Rt();xt();Object.defineProperty(vl,"__esModule",{value:!0});vl.E_CANCELED=vl.E_ALREADY_LOCKED=vl.E_TIMEOUT=void 0;vl.E_TIMEOUT=new Error("timeout while waiting for mutex to become available");vl.E_ALREADY_LOCKED=new Error("mutex already locked");vl.E_CANCELED=new Error("request for lock canceled")});var wO=De(bO=>{"use strict";Tt();Rt();xt();Object.defineProperty(bO,"__esModule",{value:!0});var tot=(lv(),Dn(cv)),zxt=dv(),Wxt=function(){function i(t,r){r===void 0&&(r=zxt.E_CANCELED),this._value=t,this._cancelError=r,this._weightedQueues=[],this._weightedWaiters=[]}return i.prototype.acquire=function(t){var r=this;if(t===void 0&&(t=1),t<=0)throw new Error("invalid weight ".concat(t,": must be positive"));return new Promise(function(h,o){r._weightedQueues[t-1]||(r._weightedQueues[t-1]=[]),r._weightedQueues[t-1].push({resolve:h,reject:o}),r._dispatch()})},i.prototype.runExclusive=function(t,r){return r===void 0&&(r=1),tot.__awaiter(this,void 0,void 0,function(){var h,o,l;return tot.__generator(this,function(c){switch(c.label){case 0:return[4,this.acquire(r)];case 1:h=c.sent(),o=h[0],l=h[1],c.label=2;case 2:return c.trys.push([2,,4,5]),[4,t(o)];case 3:return[2,c.sent()];case 4:return l(),[7];case 5:return[2]}})})},i.prototype.waitForUnlock=function(t){var r=this;if(t===void 0&&(t=1),t<=0)throw new Error("invalid weight ".concat(t,": must be positive"));return new Promise(function(h){r._weightedWaiters[t-1]||(r._weightedWaiters[t-1]=[]),r._weightedWaiters[t-1].push(h),r._dispatch()})},i.prototype.isLocked=function(){return this._value<=0},i.prototype.getValue=function(){return this._value},i.prototype.setValue=function(t){this._value=t,this._dispatch()},i.prototype.release=function(t){if(t===void 0&&(t=1),t<=0)throw new Error("invalid weight ".concat(t,": must be positive"));this._value+=t,this._dispatch()},i.prototype.cancel=function(){var t=this;this._weightedQueues.forEach(function(r){return r.forEach(function(h){return h.reject(t._cancelError)})}),this._weightedQueues=[]},i.prototype._dispatch=function(){for(var t,r=this._value;r>0;r--){var h=(t=this._weightedQueues[r-1])===null||t===void 0?void 0:t.shift();if(h){var o=this._value,l=r;this._value-=r,r=this._value+1,h.resolve([o,this._newReleaser(l)])}}this._drainUnlockWaiters()},i.prototype._newReleaser=function(t){var r=this,h=!1;return function(){h||(h=!0,r.release(t))}},i.prototype._drainUnlockWaiters=function(){for(var t=this._value;t>0;t--)this._weightedWaiters[t-1]&&(this._weightedWaiters[t-1].forEach(function(r){return r()}),this._weightedWaiters[t-1]=[])},i}();bO.default=Wxt});var rot=De(_O=>{"use strict";Tt();Rt();xt();Object.defineProperty(_O,"__esModule",{value:!0});var eot=(lv(),Dn(cv)),Kxt=wO(),Hxt=function(){function i(t){this._semaphore=new Kxt.default(1,t)}return i.prototype.acquire=function(){return eot.__awaiter(this,void 0,void 0,function(){var t,r;return eot.__generator(this,function(h){switch(h.label){case 0:return[4,this._semaphore.acquire()];case 1:return t=h.sent(),r=t[1],[2,r]}})})},i.prototype.runExclusive=function(t){return this._semaphore.runExclusive(function(){return t()})},i.prototype.isLocked=function(){return this._semaphore.isLocked()},i.prototype.waitForUnlock=function(){return this._semaphore.waitForUnlock()},i.prototype.release=function(){this._semaphore.isLocked()&&this._semaphore.release()},i.prototype.cancel=function(){return this._semaphore.cancel()},i}();_O.default=Hxt});var MO=De(sw=>{"use strict";Tt();Rt();xt();Object.defineProperty(sw,"__esModule",{value:!0});sw.withTimeout=void 0;var aw=(lv(),Dn(cv)),Gxt=dv();function Vxt(i,t,r){var h=this;return r===void 0&&(r=Gxt.E_TIMEOUT),{acquire:function(o){if(o!==void 0&&o<=0)throw new Error("invalid weight ".concat(o,": must be positive"));return new Promise(function(l,c){return aw.__awaiter(h,void 0,void 0,function(){var p,w,m,y,v;return aw.__generator(this,function(M){switch(M.label){case 0:p=!1,w=setTimeout(function(){p=!0,c(r)},t),M.label=1;case 1:return M.trys.push([1,3,,4]),[4,i.acquire(o)];case 2:return m=M.sent(),p?(y=Array.isArray(m)?m[1]:m,y()):(clearTimeout(w),l(m)),[3,4];case 3:return v=M.sent(),p||(clearTimeout(w),c(v)),[3,4];case 4:return[2]}})})})},runExclusive:function(o,l){return aw.__awaiter(this,void 0,void 0,function(){var c,p;return aw.__generator(this,function(w){switch(w.label){case 0:c=function(){},w.label=1;case 1:return w.trys.push([1,,7,8]),[4,this.acquire(l)];case 2:return p=w.sent(),Array.isArray(p)?(c=p[1],[4,o(p[0])]):[3,4];case 3:return[2,w.sent()];case 4:return c=p,[4,o()];case 5:return[2,w.sent()];case 6:return[3,8];case 7:return c(),[7];case 8:return[2]}})})},release:function(o){i.release(o)},cancel:function(){return i.cancel()},waitForUnlock:function(o){if(o!==void 0&&o<=0)throw new Error("invalid weight ".concat(o,": must be positive"));return new Promise(function(l,c){var p=setTimeout(function(){return c(r)},t);i.waitForUnlock(o).then(function(){clearTimeout(p),l()})})},isLocked:function(){return i.isLocked()},getValue:function(){return i.getValue()},setValue:function(o){return i.setValue(o)}}}sw.withTimeout=Vxt});var iot=De(hw=>{"use strict";Tt();Rt();xt();Object.defineProperty(hw,"__esModule",{value:!0});hw.tryAcquire=void 0;var Zxt=dv(),Jxt=MO();function Xxt(i,t){return t===void 0&&(t=Zxt.E_ALREADY_LOCKED),(0,Jxt.withTimeout)(i,0,t)}hw.tryAcquire=Xxt});var not=De(Xh=>{"use strict";Tt();Rt();xt();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.tryAcquire=Xh.withTimeout=Xh.Semaphore=Xh.Mutex=void 0;var Yxt=(lv(),Dn(cv)),Qxt=rot();Object.defineProperty(Xh,"Mutex",{enumerable:!0,get:function(){return Qxt.default}});var tRt=wO();Object.defineProperty(Xh,"Semaphore",{enumerable:!0,get:function(){return tRt.default}});var eRt=MO();Object.defineProperty(Xh,"withTimeout",{enumerable:!0,get:function(){return eRt.withTimeout}});var rRt=iot();Object.defineProperty(Xh,"tryAcquire",{enumerable:!0,get:function(){return rRt.tryAcquire}});Yxt.__exportStar(dv(),Xh)});var oot=De(fw=>{"use strict";Tt();Rt();xt();Object.defineProperty(fw,"__esModule",{value:!0});fw.SimpleLRUCache=void 0;var SO=class{constructor(t){this.cache=new Map,this.capacity=t||10}has(t){return this.cache.has(t)}size(){return this.cache.size}get(t){if(!this.cache.has(t))return null;let r=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,r),r}set(t,r){this.cache.delete(t),this.cache.size===this.capacity?(this.cache.delete(this.cache.keys().next().value),this.cache.set(t,r)):this.cache.set(t,r)}keys(){return Array.from(this.cache.keys())}};fw.SimpleLRUCache=SO});var AO=De(uw=>{"use strict";Tt();Rt();xt();Object.defineProperty(uw,"__esModule",{value:!0});uw.ContractInteractionState=void 0;var iRt=Lu(),nRt=oot(),EO=class{constructor(t){this._warp=t,this._json=new Map,this._initialJson=new Map,this._kv=new Map}has(t,r){var h;return((h=this._json.get(t))===null||h===void 0?void 0:h.has(r))||!1}get(t,r){var h;return((h=this._json.get(t))===null||h===void 0?void 0:h.get(r))||null}getLessOrEqual(t,r){let h=this._json.get(t);if(h!=null&&h.size()>0){let o=h.keys();r&&(o=o.filter(c=>c.localeCompare(r)<=0)),o=o.sort((c,p)=>c.localeCompare(p));let l=o[o.length-1];if(h.get(l))return new iRt.SortKeyCacheResult(l,h.get(l))}return null}async getKV(t,r){var h;return this._kv.has(t)&&((h=await this._kv.get(t).get(r))===null||h===void 0?void 0:h.cachedValue)||null}async delKV(t,r){this._kv.has(t)&&await this._kv.get(t).del(r)}getKvKeys(t,r,h){return this._warp.kvStorageFactory(t).keys(r,h)}getKvRange(t,r,h){return this._warp.kvStorageFactory(t).kvMap(r,h)}async commit(t,r=!1){if(t.dry)return await this.rollbackKVs(),this.reset();try{let h=new Map;this._json.forEach((o,l)=>{let c=this.getLessOrEqual(l,t.sortKey);c!=null&&h.set(l,c.cachedValue)}),await this.doStoreJson(h,t,r),await this.commitKVs()}finally{this.reset()}}async commitKV(){await this.commitKVs(),this._kv.clear()}async rollback(t,r){try{await this.doStoreJson(this._initialJson,t,r),await this.rollbackKVs()}finally{this.reset()}}setInitial(t,r,h){this._initialJson.set(t,r),this.update(t,r,h)}update(t,r,h){if(!this._json.has(t)){let o=new nRt.SimpleLRUCache(10);this._json.set(t,o)}this._json.get(t).set(h,r)}async updateKV(t,r,h){await(await this.getOrInitKvStorage(t)).put(r,h)}async getOrInitKvStorage(t){if(this._kv.has(t))return this._kv.get(t);let r=this._warp.kvStorageFactory(t);return this._kv.set(t,r),await r.open(),r}reset(){this._json.clear(),this._initialJson.clear(),this._kv.clear()}async doStoreJson(t,r,h=!1){if(t.size>1||h)for(let[o,l]of t)await this._warp.stateEvaluator.putInCache(o,r,l)}async rollbackKVs(){for(let t of this._kv.values())try{await t.rollback()}finally{await t.close()}}async commitKVs(){for(let t of this._kv.values())try{await t.commit()}finally{await t.close()}}};uw.ContractInteractionState=EO});var dw=De(Op=>{"use strict";Tt();Rt();xt();var oRt=Op&&Op.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Op,"__esModule",{value:!0});Op.HandlerBasedContract=void 0;var aRt=oRt(_nt()),pv=Lu(),TO=UB(),xO=$f(),RO=Q0(),aot=Gm(),kp=Hh(),cw=XB(),Ip=Xs(),sot=bn(),hot=WB(),sRt=ll(),yl=ko(),Bp=YB(),hRt=tO(),fRt=pO(),uRt=mO(),cRt=Km(),lRt=not(),lw=_p(),fot=AO(),kO=Ku(),uot=(lO(),Dn(cO)),IO=class{constructor(t,r,h=null,o=null){var l,c;if(this._contractTxId=t,this.warp=r,this._parentContract=h,this._innerCallData=o,this.logger=sot.LoggerFactory.INST.create("HandlerBasedContract"),this.ecLogger=sot.LoggerFactory.INST.create("ExecutionContext"),this._innerWritesEvaluator=new hRt.InnerWritesEvaluator,this._mutex=new lRt.Mutex,this._benchmarkStats=null,this._children=[],this._dreStates=new Map,this.waitForConfirmation=this.waitForConfirmation.bind(this),this._arweaveWrapper=new sRt.ArweaveWrapper(r),this._sorter=new RO.LexicographicalInteractionsSorter(r.arweave),h!=null){this._evaluationOptions=this.getRoot().evaluationOptions(),this._callDepth=h.callDepth()+1;let p=h.getCallStack().getInteraction(o.callingInteraction.id);if(this._callDepth>this._evaluationOptions.maxCallDepth)throw new Error(`Max call depth of ${this._evaluationOptions.maxCallDepth} has been exceeded for interaction ${JSON.stringify(p.interactionInput)}`);if(this.logger.debug("Calling interaction",{id:o.callingInteraction.id,sortKey:o.callingInteraction.sortKey,type:o.callType}),((c=(l=p.interactionInput)===null||l===void 0?void 0:l.foreignContractCalls[t])===null||c===void 0?void 0:c.innerCallType)==="write"&&o.callType==="read")throw new Error("Calling a readContractState after performing an inner write is wrong - instead use a state from the result of an internal write.");let w=new TO.ContractCallRecord(t,this._callDepth,o?.callType);p.interactionInput.foreignContractCalls[t]=w,this._callStack=w,this._rootSortKey=h.rootSortKey,h._children.push(this)}else this._callDepth=0,this._callStack=new TO.ContractCallRecord(t,0),this._rootSortKey=null,this._evaluationOptions=new aot.DefaultEvaluationOptions,this._children=[],this._interactionState=new fot.ContractInteractionState(r);this.getCallStack=this.getCallStack.bind(this),this._warpFetchWrapper=new cRt.WarpFetchWrapper(this.warp)}async readState(t,r,h,o){var l,c,p;if(this.logger.info("Read state for",{contractTxId:this._contractTxId,sortKeyOrBlockHeight:t}),!this.isRoot()&&t==null)throw new Error("SortKey MUST be always set for non-root contract calls");let{stateEvaluator:w}=this.warp,m=typeof t=="number"?this._sorter.generateLastSortKey(t):t;if(m&&!this.isRoot()&&this.interactionState().has(this.txId(),m)){let v=this.interactionState().get(this.txId(),m);return new pv.SortKeyCacheResult(m,v)}let y=await this._mutex.acquire();try{let v=Ip.Benchmark.measure();this.maybeResetRootContract();let M=await this.createExecutionContext(this._contractTxId,m,!1,r,h,o);this.logger.info("Execution Context",{srcTxId:(l=M.contractDefinition)===null||l===void 0?void 0:l.srcTxId,missingInteractions:(c=M.sortedInteractions)===null||c===void 0?void 0:c.length,cachedSortKey:(p=M.cachedState)===null||p===void 0?void 0:p.sortKey}),v.stop();let T=Ip.Benchmark.measure(),A=await w.eval(M);T.stop();let R=v.elapsed(!0)+T.elapsed(!0);return this._benchmarkStats={gatewayCommunication:v.elapsed(!0),stateEvaluation:T.elapsed(!0),total:R},this.logger.info("Benchmark",{"Gateway communication ":v.elapsed(),"Contract evaluation ":T.elapsed(),"Total: ":`${R.toFixed(0)}ms`}),m&&!this.isRoot()&&this.interactionState().update(this.txId(),A.cachedValue,m),A}finally{y()}}async readStateFor(t,r,h,o){return this.readState(t,r,h,o)}async readStateBatch(t=1,r,h){if(!this.isRoot())throw new Error("readStateBatch is only allowed for root contract calls");if(t<1)throw new Error("At least one page per batch is required");if(h?.aborted)throw new xO.AbortError("readStateBatch aborted");let o=this._contractTxId,{interactionsLoader:l,stateEvaluator:c}=this.warp,p=await c.latestAvailableState(o),w={...this._evaluationOptions,transactionsPagesPerBatch:t},m,y=0;do{let v=Ip.Benchmark.measure();if(this.logger.debug(`Loading ${y+1} batch`,w),m=await l.load(o,p?.sortKey,r,w),h?.aborted)throw new xO.AbortError("readStateBatch aborted");if(m.length==0&&y>0)break;if(this.logger.debug(`Evaluating ${m.length} in ${y+1} batch`),p=await this.readStateFor(p?.sortKey||RO.genesisSortKey,m,h),h?.aborted)throw new xO.AbortError("readStateBatch aborted");this.logger.debug(`Batch ${y+1} evaluated in ${v.elapsed()} at sortKey ${p.sortKey}`),y++}while(m.length>0);return p}async viewState(t,r=[],h=Bp.emptyTransfer,o,l,c){return this.logger.info("View state for",this._contractTxId),await this.callContract(t,"view",o,c,r,h,!1,!1,!0,l)}async viewStateForTx(t,r,h){return this.logger.info(`View state for ${this._contractTxId}`),await this.doApplyInputOnTx(t,r,"view",h)}async dryWrite(t,r,h,o,l,c){return this.logger.info("Dry-write for",this._contractTxId),await this.callContract(t,"write",r,c,h,o,void 0,l)}async applyInput(t,r,h){return this.logger.info(`Apply-input from transaction ${r.id} for ${this._contractTxId}`),await this.doApplyInputOnTx(t,r,"write",h)}async writeInteraction(t,r){if(this.logger.info("Write interaction",{input:t,options:r}),!this._signature)throw new Error("Wallet not connected. Use 'connect' method first.");let{arweave:h,interactionsLoader:o,environment:l}=this.warp;await this.warp.definitionLoader.load(this._contractTxId);let c=r?.tags||[],p=r?.transfer||Bp.emptyTransfer,w=r?.strict===!0,m=r?.vrf===!0,y=r?.disableBundling===!0,v=r?.reward,M=r?.manifestData,T=r?.inputFormatAsData,A=o.type()=="warp"&&!y;if(this._signature.checkNonArweaveSigningAvailability(A),this._signature.checkBundlerSignerAvailability(A),A&&p.target!=Bp.emptyTransfer.target&&p.winstonQty!=Bp.emptyTransfer.winstonQty)throw new Error("Ar Transfers are not allowed for bundled interactions");if(m&&!A&&l==="mainnet")throw new Error("Vrf generation is only available for bundle interaction");if(!t)throw new Error(`Input should be a truthy value: ${JSON.stringify(t)}`);if(A)return await this.bundleInteraction(t,{tags:c,strict:w,vrf:m,manifestData:M,inputFormatAsData:T});{let R=await this.createInteraction(t,c,p,w,!1,m&&l!=="mainnet",v),B=await h.transactions.post(R);if(B.status!==200)return this.logger.error("Error while posting transaction",B),null;if(this._evaluationOptions.waitForConfirmation){this.logger.info("Waiting for confirmation of",R.id);let C=Ip.Benchmark.measure();await this.waitForConfirmation(R.id),this.logger.info("Transaction confirmed after",C.elapsed())}return this.warp.environment=="local"&&this._evaluationOptions.mineArLocalBlocks&&await this.warp.testing.mineBlock(),{originalTxId:R.id,interactionTx:R}}}async bundleInteraction(t,r){if(this.logger.info("Bundle interaction input: {}, tag: {}",t,r.tags),!this.maxInteractionDataItemSizeBytes){let c=fetch(`${(0,yl.stripTrailingSlash)(this.warp.gwUrl())}`);this.maxInteractionDataItemSizeBytes=(await(0,yl.getJsonResponse)(c)).maxInteractionDataItemSizeBytes}let h=await this.createInteractionDataItem(t,r.tags,Bp.emptyTransfer,r.strict,r.vrf,r.manifestData,r.inputFormatAsData),o=this._warpFetchWrapper.fetch(`${(0,yl.stripTrailingSlash)(this._evaluationOptions.sequencerUrl)}/gateway/v2/sequencer/register`,{method:"POST",headers:{"Content-Type":"application/octet-stream",Accept:"application/json"},body:h.getRaw()}),l=await h.id;return{bundlrResponse:await(0,yl.getJsonResponse)(o),originalTxId:l,interactionTx:h}}async createInteractionDataItem(t,r,h,o,l=!1,c,p){var w;this._evaluationOptions.internalWrites&&await this.discoverInternalWrites(t,r,h,o,l),l&&r.push(new lw.Tag(kp.WARP_TAGS.REQUEST_VRF,"true"));let m=(0,cw.createInteractionTagsList)(this._contractTxId,t,this.warp.environment==="testnet",r),y;((0,uot.tagsExceedLimit)(m)||p)&&(m=[...m.filter(T=>T.name!=kp.SMART_WEAVE_TAGS.INPUT&&T.name!=kp.WARP_TAGS.INPUT_FORMAT),new lw.Tag(kp.WARP_TAGS.INPUT_FORMAT,"data")],y={input:t}),c&&(y={...y,manifest:this.createManifest(c)}),y=y?JSON.stringify(y):Math.random().toString().slice(-4);let v=this._signature.bundlerSigner;if(!v)throw new Error("Signer not set correctly. If you connect wallet through 'use_wallet', please remember that it only works when bundling is disabled.");let M;if((0,yl.isBrowser)()&&(!((w=v.signer)===null||w===void 0)&&w.signDataItem)?M=await v.signDataItem(y,m):(M=(0,uot.createData)(y,v,{tags:m}),await M.sign(v)),M.getRaw().length>this.maxInteractionDataItemSizeBytes)throw new Error(`Interaction data item size: ${M.getRaw().length} exceeds maximum interactions size limit: ${this.maxInteractionDataItemSizeBytes}.`);return!this._evaluationOptions.internalWrites&&o&&await this.checkInteractionInStrictMode(M.owner,t,r,h,o,l),M}async createInteraction(t,r,h,o,l=!1,c=!1,p){this._evaluationOptions.internalWrites&&await this.discoverInternalWrites(t,r,h,o,c),c&&r.push(new lw.Tag(kp.WARP_TAGS.REQUEST_VRF,"true"));let w=await(0,cw.createInteractionTx)(this.warp.arweave,this._signature.signer,this._contractTxId,t,r,h.target,h.winstonQty,l,this.warp.environment==="testnet",p);return!this._evaluationOptions.internalWrites&&o&&await this.checkInteractionInStrictMode(w.owner,t,r,h,o,c),w}async checkInteractionInStrictMode(t,r,h,o,l,c){let{arweave:p}=this.warp,w=this._signature.type=="arweave"?await p.wallets.ownerToAddress(t):await this._signature.getAddress(),m=await this.callContract(r,"write",w,void 0,h,o,l,c);if(m.type!=="ok")throw Error("Cannot create interaction: "+JSON.stringify(m.error||m.errorMessage))}txId(){return this._contractTxId}getCallStack(){return this._callStack}connect(t){return this._signature=new fRt.Signature(this.warp,t),this}setEvaluationOptions(t){if(!this.isRoot())throw new Error("Evaluation options can be set only for the root contract");return this._evaluationOptions={...this._evaluationOptions,...t},this}async waitForConfirmation(t){let{arweave:r}=this.warp,h=await r.transactions.getStatus(t);return h.confirmed===null?(this.logger.info(`Transaction ${t} not yet confirmed. Waiting another 20 seconds before next check.`),await(0,yl.sleep)(2e4),this.waitForConfirmation(t)):(this.logger.info(`Transaction ${t} confirmed`,h),h)}async createExecutionContext(t,r,h=!1,o,l,c){var p,w,m,y,v;let{definitionLoader:M,interactionsLoader:T,stateEvaluator:A}=this.warp,R,B=Ip.Benchmark.measure();if(this.isRoot()||(R=this.interactionState().getLessOrEqual(this.txId(),r)),R=c||R||await A.latestAvailableState(t,r),r&&this.evaluationOptions().strictSortKey&&R?.sortKey!=r)throw new Error(`State not cached at the exact required ${r} sortKey`);this.logger.debug("cache lookup",B.elapsed()),B.reset();let C=hot.Evolve.evolvedSrcTxId((p=R?.cachedValue)===null||p===void 0?void 0:p.state),P,N,q,W,J=o||[];if(this.logger.debug("Cached state",R,r),R&&R.sortKey==r||r==RO.genesisSortKey&&o?.length)this.logger.debug("State fully cached, not loading interactions."),(h||C||o?.length)&&(N=await M.load(t,C),q=this.resolveEvaluationOptions((w=N.manifest)===null||w===void 0?void 0:w.evaluationOptions),this.warp.executorFactory.checkWhiteListContractSources(N,q),o?.length&&(J=await this.getSortedInteractions(o)));else{if(o?.length)throw new Error(`Cannot apply requested interactions at ${r}`);if(N=await M.load(t,C),q=this.resolveEvaluationOptions((m=N.manifest)===null||m===void 0?void 0:m.evaluationOptions),q.remoteStateSyncEnabled&&!q.useKVStorage){W=await this.getRemoteContractState(t),R=await this.maybeSyncStateWithRemoteSource(W,r,R);let F=hot.Evolve.evolvedSrcTxId((y=R?.cachedValue)===null||y===void 0?void 0:y.state);F&&F!==N.srcTxId&&(N=await M.load(t,F))}this.warp.executorFactory.checkWhiteListContractSources(N,q),!W&&J.length==0&&(J=await T.load(t,R?.sortKey,this.getToSortKey(r),q)),R?.sortKey&&(J=J.filter(F=>F.sortKey.localeCompare(R?.sortKey)>0)),r&&(J=J.filter(F=>F.sortKey.localeCompare(r)<=0)),this.logger.debug("contract and interactions load",B.elapsed()),this.isRoot()&&J.length&&(this._rootSortKey=J[J.length-1].sortKey)}return N&&(q||(q=this.resolveEvaluationOptions((v=N.manifest)===null||v===void 0?void 0:v.evaluationOptions)),this.ecLogger.debug(`Evaluation options ${t}:`,q),P=await this.warp.executorFactory.create(N,q,this.warp,this.interactionState())),{warp:this.warp,contract:this,contractDefinition:N,sortedInteractions:J,evaluationOptions:q||this.evaluationOptions(),handler:P,cachedState:R,requestedSortKey:r,signal:l}}async getSortedInteractions(t){return(await this._sorter.sort(t.map(r=>({node:r,cursor:null})))).map(r=>r.node)}resolveEvaluationOptions(t){return this.isRoot()?(this._eoEvaluator=new uRt.EvaluationOptionsEvaluator(this.evaluationOptions(),t),this._eoEvaluator.rootOptions):this.getRootEoEvaluator().forForeignContract(t)}async getRemoteContractState(t){if(this.hasDreState(t))return this.getDreState(t);{let r=await this.fetchRemoteContractState(t);return r!=null?this.setDREState(t,r):null}}async fetchRemoteContractState(t){return(0,yl.getJsonResponse)(this._warpFetchWrapper.fetch(`${this._evaluationOptions.remoteStateSyncSource}?id=${t}&events=false`))}getToSortKey(t){var r;return!((r=this._parentContract)===null||r===void 0)&&r.rootSortKey?t?this._parentContract.rootSortKey.localeCompare(t)>0?this._parentContract.rootSortKey:t:this._parentContract.rootSortKey:t}async createExecutionContextFromTx(t,r,h){let o=r.owner.address,l=r.sortKey;return{...await this.createExecutionContext(t,l,!0,void 0,h),caller:o}}maybeResetRootContract(){this.isRoot()&&(this.logger.debug("Clearing call stack for the root contract"),this._callStack=new TO.ContractCallRecord(this.txId(),0),this._rootSortKey=null,this.warp.interactionsLoader.clearCache(),this._children=[],this._interactionState=new fot.ContractInteractionState(this.warp),this._dreStates=new Map)}async callContract(t,r,h,o,l=[],c=Bp.emptyTransfer,p=!1,w=!1,m=!0,y){var v;this.logger.info("Call contract input",t),this.maybeResetRootContract(),this._signature||this.logger.warn("Wallet not set.");let{arweave:M,stateEvaluator:T}=this.warp,A=await this.createExecutionContext(this._contractTxId,o,!0,void 0,y),R=o?await this._sorter.extractBlockHeight(o):void 0,B;this.warp.environment=="mainnet"&&this.warp.interactionsLoader.type()!=="arweave"?B=await this._arweaveWrapper.warpGwBlock():R?B=await M.blocks.getByHeight(R):B=await M.blocks.getCurrent();let C;h?C=h:this._signature?C=await this._signature.getAddress():C="",this.logger.info("effectiveCaller",C),A={...A,caller:C};let P=await T.eval(A);this.logger.info("Current state",P.cachedValue.state);let N={input:t,caller:A.caller,interactionType:r};this.logger.debug("interaction",N);let q=await(0,cw.createInteractionTx)(M,m?(v=this._signature)===null||v===void 0?void 0:v.signer:void 0,this._contractTxId,t,l,c.target,c.winstonQty,!0,this.warp.environment==="testnet"),W=(0,cw.createDummyTx)(q,A.caller,B);if(this.logger.debug("Creating sortKey for",{blockId:W.block.id,id:W.id,height:W.block.height}),W.sortKey=await this._sorter.createSortKey(W.block.id,W.id,W.block.height,!0),W.strict=p,w){let F=this.warp.maybeLoadPlugin("vrf");F?W.vrf=F.process().generateMockVrf(W.sortKey):this.logger.warn('Cannot generate mock vrf for interaction - no "warp-contracts-plugin-vrf" attached!')}let J=await this.evalInteraction({interaction:N,interactionTx:W},A,P.cachedValue);return J.type!=="ok"&&this.logger.fatal("Error while interacting with contract",{type:J.type,error:J.errorMessage}),J}async doApplyInputOnTx(t,r,h,o){this.maybeResetRootContract();let l,c=await this.createExecutionContextFromTx(this._contractTxId,r,o);!this.isRoot()&&this.interactionState().has(this.txId(),r.sortKey)?l=new pv.SortKeyCacheResult(r.sortKey,this.interactionState().get(this.txId(),r.sortKey)):(l=await this.warp.stateEvaluator.eval(c),this.interactionState().update(this.txId(),l.cachedValue,r.sortKey)),this.logger.debug("callContractForTx - evalStateResult",{result:l.cachedValue.state,txId:this._contractTxId});let w={interaction:{input:t,caller:this._parentContract.txId(),interactionType:h},interactionTx:r},m=await this.evalInteraction(w,c,l.cachedValue);return m.originalValidity=l.cachedValue.validity,m.originalErrorMessages=l.cachedValue.errorMessages,m}async evalInteraction(t,r,h){let o=this.getCallStack().addInteractionData(t),l=Ip.Benchmark.measure();await r.handler.initState(h.state);let c=await r.handler.handle(r,h,t);return o.update({cacheHit:!1,outputState:this._evaluationOptions.stackTrace.saveState?c.state:void 0,executionTime:l.elapsed(!0),valid:c.type==="ok",errorMessage:c.errorMessage,gasUsed:c.gasUsed}),c}parent(){return this._parentContract}callDepth(){return this._callDepth}evaluationOptions(){return this._evaluationOptions}lastReadStateStats(){return this._benchmarkStats}async stateHash(t){let r=(0,aRt.default)(t),h=await kO.Crypto.subtle.digest("SHA-256",kO.Buffer.from(r,"utf-8"));return kO.Buffer.from(h).toString("hex")}async syncState(t,r){let{stateEvaluator:h}=this.warp,o=await this._warpFetchWrapper.fetch(`${t}?${new URLSearchParams({id:this._contractTxId,...r})}`).then(l=>l.ok?l.json():Promise.reject(l)).catch(l=>{var c,p;throw!((c=l.body)===null||c===void 0)&&c.message&&this.logger.error(l.body.message),new Error(`Unable to retrieve state. ${l.status}: ${(p=l.body)===null||p===void 0?void 0:p.message}`)});return await h.syncState(this._contractTxId,o.sortKey,o.state,o.validity),this}async evolve(t,r){return await this.writeInteraction({function:"evolve",value:t},r)}get rootSortKey(){return this._rootSortKey}getRootEoEvaluator(){return this.getRoot()._eoEvaluator}isRoot(){return this._parentContract==null}async getStorageValues(t){let r=await this.warp.stateEvaluator.getCache().getLast(this.txId());if(r==null)return new pv.SortKeyCacheResult(null,new Map);let h=this.warp.kvStorageFactory(this.txId()),o=new Map;try{await h.open();for(let l of t){let c=await h.getLessOrEqual(l,r.sortKey);o.set(l,c==null?null:c.cachedValue)}return new pv.SortKeyCacheResult(r.sortKey,o)}finally{await h.close()}}interactionState(){return this.getRoot()._interactionState}getRoot(){let t=this;for(;!t.isRoot();)t=t.parent();return t}async maybeSyncStateWithRemoteSource(t,r,h){let{stateEvaluator:o}=this.warp;return this.isStateHigherThanAndUpTo(t,h?.sortKey,r)?await o.syncState(this._contractTxId,t.sortKey,t.cachedValue.state,t.cachedValue.validity):h}isStateHigherThanAndUpTo(t,r,h){return t&&(!h||h>=t.sortKey)&&(!r||t.sortKey>r)}setDREState(t,r){let h=new pv.SortKeyCacheResult(r.sortKey,new aot.EvalStateResult(r.state,{},r.errorMessages));return this.getRoot()._dreStates.set(t,h),h}getDreState(t){return this.getRoot()._dreStates.get(t)}hasDreState(t){return this.getRoot()._dreStates.has(t)}async discoverInternalWrites(t,r,h,o,l){let c=await this.callContract(t,"write",void 0,void 0,r,h,o,l,!1);if(o&&c.type!=="ok")throw Error("Cannot create interaction: "+JSON.stringify(c.error||c.errorMessage));let p=this.getCallStack(),w=this._innerWritesEvaluator.eval(p);this.logger.debug("Input",t),this.logger.debug("Callstack",p.print()),w.forEach(m=>{r.push(new lw.Tag(kp.WARP_TAGS.INTERACT_WRITE,m))}),this.logger.debug("Tags with inner calls",r)}clearChildren(){for(let t of this._children)t.clearChildren();this._children=[]}createManifest(t){let r={};return Object.keys(t).forEach(h=>{let o=t[h];if(typeof h!="string")throw new Error("Incorrect manifest data. Manifest key should be of type 'string'");if(typeof o!="string")throw new Error("Incorrect manifest data. Manifest value should be of type 'string'");if(!(0,yl.isTxIdValid)(o))throw new Error(`Incorrect manifest data. Transaction id: ${o} is not valid.`);r[h]=t[h]}),r}};Op.HandlerBasedContract=IO});var OO=De(pw=>{"use strict";Tt();Rt();xt();Object.defineProperty(pw,"__esModule",{value:!0});pw.PstContractImpl=void 0;var dRt=dw(),BO=class extends dRt.HandlerBasedContract{async currentBalance(t){let r=await this.viewState({function:"balance",target:t});if(r.type!=="ok")throw Error(r.errorMessage);return r.result}async currentState(){return(await super.readState()).cachedValue.state}async transfer(t,r){return await this.writeInteraction({function:"transfer",...t},r)}};pw.PstContractImpl=BO});var cot=De(gw=>{"use strict";Tt();Rt();xt();Object.defineProperty(gw,"__esModule",{value:!0});gw.Testing=void 0;var CO=class{constructor(t){this.arweave=t}async mineBlock(){this.validateEnv(),await this.arweave.api.get("mine")}async addFunds(t){let r=await this.arweave.wallets.getAddress(t);await this.arweave.api.get(`/mint/${r}/1000000000000000`)}async isArlocal(){return(await fetch(`${this.arweave.api.config.protocol}://${this.arweave.api.config.host}:${this.arweave.api.config.port}/info`).then(r=>r.ok?r.json():Promise.reject()).catch(r=>{throw new Error(`Unable to get network info: ${r.message}`)})).network.includes("arlocal")}async validateEnv(){if(!await this.isArlocal())throw new Error("Testing features are not available in a non testing environment")}};gw.Testing=CO});var lot=De(mw=>{"use strict";Tt();Rt();xt();Object.defineProperty(mw,"__esModule",{value:!0});mw.DebuggableExecutorFactory=void 0;var PO=class{constructor(t,r){this.baseImplementation=t,this.sourceCode=r}async create(t,r,h,o){return Object.prototype.hasOwnProperty.call(this.sourceCode,t.txId)&&(t={...t,src:this.sourceCode[t.txId]}),await this.baseImplementation.create(t,r,h,o)}checkWhiteListContractSources(t,r){return this.baseImplementation.checkWhiteListContractSources(t,r)}};mw.DebuggableExecutorFactory=PO});var mot=De(vw=>{"use strict";Tt();Rt();xt();Object.defineProperty(vw,"__esModule",{value:!0});vw.CacheableContractDefinitionLoader=void 0;var pRt=Ku(),dot=Vm(),gRt=Xs(),mRt=bn(),pot=Lu(),got=Fm(),NO=class{constructor(t,r,h){this.contractDefinitionLoader=t,this.env=r,this.rLogger=mRt.LoggerFactory.INST.create("CacheableContractDefinitionLoader"),this.definitionCache=new got.LevelDbCache({...h,dbLocation:`${h.dbLocation}/contracts`}),this.srcCache=new got.LevelDbCache({...h,dbLocation:`${h.dbLocation}/source`})}async load(t,r){let h=await this.getFromCache(t,r);if(h)return this.rLogger.debug("Hit from cache!",t,r),h.contractType=="wasm"&&h.srcBinary.data&&(h.srcBinary=pRt.Buffer.from(h.srcBinary.data)),this.verifyEnv(h),h;let o=gRt.Benchmark.measure(),l=await this.contractDefinitionLoader.load(t,r);return this.rLogger.info(`Contract definition loaded in: ${o.elapsed()}`),this.verifyEnv(l),await this.putToCache(t,l,r),l}async loadContractSource(t){return await this.contractDefinitionLoader.loadContractSource(t)}type(){return this.contractDefinitionLoader.type()}setCache(t){this.definitionCache=t}setSrcCache(t){this.srcCache=t}getCache(){return this.definitionCache}getSrcCache(){return this.srcCache}verifyEnv(t){if(t.testnet&&this.env!=="testnet")throw new Error('Trying to use testnet contract in a non-testnet env. Use the "forTestnet" factory method.');if(!t.testnet&&this.env==="testnet")throw new Error("Trying to use non-testnet contract in a testnet env.")}async getFromCache(t,r){let h=await this.definitionCache.get(new pot.CacheKey(t,"cd"));if(!h)return null;let o=r||h.cachedValue.srcTxId,l=await this.srcCache.get(new pot.CacheKey(o,"src"));return l?{...h.cachedValue,...l.cachedValue,srcTxId:o}:null}async putToCache(t,r,h){let o=new dot.SrcCache(r),l=new dot.ContractCache(r);await this.definitionCache.put({key:t,sortKey:"cd"},l),await this.srcCache.put({key:h||l.srcTxId,sortKey:"src"},o)}set warp(t){this.contractDefinitionLoader.warp=t}};vw.CacheableContractDefinitionLoader=NO});var DO=De(yw=>{"use strict";Tt();Rt();xt();Object.defineProperty(yw,"__esModule",{value:!0});yw.WarpBuilder=void 0;var vRt=lot(),yRt=kB(),vot=BB(),bRt=U4(),wRt=EB(),_Rt=Hm(),MRt=bw(),yot=mot(),LO=class{constructor(t,r,h="custom"){this._arweave=t,this._stateCache=r,this._environment=h}setDefinitionLoader(t){return this._definitionLoader=t,this}setInteractionsLoader(t){return this._interactionsLoader=t,this}setExecutorFactory(t){return this._executorFactory=t,this}setStateEvaluator(t){return this._stateEvaluator=t,this}overwriteSource(t){if(this._executorFactory==null)throw new Error("Set base ExecutorFactory first");return this._executorFactory=new vRt.DebuggableExecutorFactory(this._executorFactory,t),this.build()}useWarpGateway(t,r){return this._interactionsLoader=new vot.CacheableInteractionsLoader(new _Rt.WarpGatewayInteractionsLoader(t.confirmationStatus,t.source)),this._definitionLoader=new yot.CacheableContractDefinitionLoader(new wRt.WarpGatewayContractDefinitionLoader(this._arweave,this._environment),this._environment,r),this}useArweaveGateway(t){return this._interactionsLoader=new vot.CacheableInteractionsLoader(new yRt.ArweaveGatewayInteractionsLoader(this._arweave,this._environment)),this._definitionLoader=new yot.CacheableContractDefinitionLoader(new bRt.ArweaveContractDefinitionLoader(this._arweave,this._environment),this._environment,t),this}build(){let t=new MRt.Warp(this._arweave,this._definitionLoader,this._interactionsLoader,this._executorFactory,this._stateEvaluator,this._environment);return this._definitionLoader.warp=t,this._interactionsLoader.warp=t,t}};yw.WarpBuilder=LO});var $O=De(Cp=>{"use strict";Tt();Rt();xt();Object.defineProperty(Cp,"__esModule",{value:!0});Cp.knownWarpPlugins=Cp.knownWarpPluginsPartial=void 0;Cp.knownWarpPluginsPartial=["^smartweave-extension-"];Cp.knownWarpPlugins=["evm-signature-verification","subscription","ivm-handler-api","evaluation-progress","fetch-options","deploy","contract-blacklist","vm2","vrf","quickjs"]});var bw=De(ww=>{"use strict";Tt();Rt();xt();Object.defineProperty(ww,"__esModule",{value:!0});ww.Warp=void 0;var SRt=dw(),ERt=OO(),ARt=cot(),TRt=DO(),bot=$O(),wot=qO(),xRt=Fm(),UO=class{get createContract(){if(!this._createContract)if(this.plugins.has("deploy")){let t=this.loadPlugin("deploy");this._createContract=t.process(this)}else throw new Error("In order to use CreateContract methods please attach DeployPlugin.");return this._createContract}constructor(t,r,h,o,l,c="custom"){this.arweave=t,this.definitionLoader=r,this.interactionsLoader=h,this.executorFactory=o,this.stateEvaluator=l,this.environment=c,this._gwUrl=wot.WARP_GW_URL,this.plugins=new Map,this.testing=new ARt.Testing(t),this.kvStorageFactory=p=>new xRt.LevelDbCache({inMemory:!1,dbLocation:`${wot.DEFAULT_LEVEL_DB_LOCATION}/kv/ldb/${p}`}),this.eventTarget=new EventTarget}static builder(t,r,h){return new TRt.WarpBuilder(t,r,h)}contract(t,r,h){return new SRt.HandlerBasedContract(t,this,r,h)}async deploy(t,r){return await this.createContract.deploy(t,r)}async deployFromSourceTx(t,r){return await this.createContract.deployFromSourceTx(t,r)}async deployBundled(t){return await this.createContract.deployBundled(t)}async register(t,r){return await this.createContract.register(t,r)}async createSource(t,r,h=!1){return await this.createContract.createSource(t,r,h)}async saveSource(t,r){return await this.createContract.saveSource(t,r)}pst(t){return new ERt.PstContractImpl(t,this)}useStateCache(t){return this.stateEvaluator.setCache(t),this}useContractCache(t,r){return this.definitionLoader.setSrcCache(r),this.definitionLoader.setCache(t),this}use(t){let r=t.type();if(!this.isPluginType(r))throw new Error(`Unknown plugin type ${r}.`);return this.plugins.set(r,t),this}hasPlugin(t){return this.plugins.has(t)}matchPlugins(t){return[...this.plugins.keys()].filter(h=>h.match(t))}loadPlugin(t){if(!this.hasPlugin(t))throw new Error(`Plugin ${t} not registered.`);return this.plugins.get(t)}maybeLoadPlugin(t){return this.hasPlugin(t)?this.plugins.get(t):null}async close(){return Promise.all([this.definitionLoader.getSrcCache().close(),this.definitionLoader.getCache().close(),this.stateEvaluator.getCache().close()]).then()}async generateWallet(){let t=await this.arweave.wallets.generate();return await this.testing.isArlocal()&&await this.testing.addFunds(t),{jwk:t,address:await this.arweave.wallets.jwkToAddress(t)}}isPluginType(t){return bot.knownWarpPlugins.includes(t)||bot.knownWarpPluginsPartial.some(r=>t.match(r))}useKVStorageFactory(t){return this.kvStorageFactory=t,this}useGwUrl(t){return this._gwUrl=t,this}gwUrl(){return this._gwUrl}};ww.Warp=UO});var qO=De(Sn=>{"use strict";Tt();Rt();xt();var RRt=Sn&&Sn.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.WarpFactory=Sn.defaultCacheOptions=Sn.DEFAULT_LEVEL_DB_LOCATION=Sn.WARP_GW_URL=Sn.defaultWarpGwOptions=void 0;var FO=RRt(P4()),kRt=Fm(),IRt=WB(),BRt=LB(),ORt=$f(),CRt=Hm(),PRt=bw();Sn.defaultWarpGwOptions={confirmationStatus:{notCorrupted:!0},source:CRt.SourceType.BOTH};Sn.WARP_GW_URL="https://gw.warp.cc";Sn.DEFAULT_LEVEL_DB_LOCATION="./cache/warp";Sn.defaultCacheOptions={inMemory:!1,dbLocation:Sn.DEFAULT_LEVEL_DB_LOCATION};var jO=class{static forLocal(t=1984,r=FO.default.init({host:"localhost",port:t,protocol:"http"}),h={...Sn.defaultCacheOptions,inMemory:!0}){return this.customArweaveGw(r,h,"local")}static forTestnet(t=Sn.defaultCacheOptions,r=!1,h=FO.default.init({host:"arweave.net",port:443,protocol:"https"})){return r?this.customArweaveGw(h,t,"testnet"):this.customWarpGw(h,Sn.defaultWarpGwOptions,t,"testnet")}static forMainnet(t=Sn.defaultCacheOptions,r=!1,h=FO.default.init({host:"arweave.net",port:443,protocol:"https"})){return r?this.customArweaveGw(h,t,"mainnet"):this.customWarpGw(h,Sn.defaultWarpGwOptions,t,"mainnet")}static custom(t,r,h){let o=new kRt.LevelDbCache({...r,dbLocation:`${r.dbLocation}/state`}),l=new ORt.HandlerExecutorFactory(t),c=new BRt.CacheableStateEvaluator(t,o,[new IRt.Evolve]);return PRt.Warp.builder(t,o,h).setExecutorFactory(l).setStateEvaluator(c)}static customArweaveGw(t,r=Sn.defaultCacheOptions,h){return this.custom(t,r,h).useArweaveGateway(r).build()}static customWarpGw(t,r=Sn.defaultWarpGwOptions,h=Sn.defaultCacheOptions,o){return this.custom(t,h,o).useWarpGateway(r,h).build()}};Sn.WarpFactory=jO});var Mot=De(_ot=>{"use strict";Tt();Rt();xt();Object.defineProperty(_ot,"__esModule",{value:!0})});var Eot=De(Sot=>{"use strict";Tt();Rt();xt();Object.defineProperty(Sot,"__esModule",{value:!0})});var Tot=De(Aot=>{"use strict";Tt();Rt();xt();Object.defineProperty(Aot,"__esModule",{value:!0})});var Rot=De(xot=>{"use strict";Tt();Rt();xt();Object.defineProperty(xot,"__esModule",{value:!0})});var Iot=De(kot=>{"use strict";Tt();Rt();xt();Object.defineProperty(kot,"__esModule",{value:!0})});var Bot=De(_w=>{"use strict";Tt();Rt();xt();Object.defineProperty(_w,"__esModule",{value:!0});_w.matchMutClosureDtor=void 0;function NRt(i){let t=/(const|var) ret = makeMutClosure\(arg0, arg1, (\d+?), __wbg_adapter/;return i.match(t)[2]}_w.matchMutClosureDtor=NRt});var Cot=De(Pp=>{"use strict";Tt();Rt();xt();var LRt=Pp&&Pp.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Pp,"__esModule",{value:!0});Pp.ArweaveGatewayBundledContractDefinitionLoader=void 0;var DRt=Vm(),Xa=Hh(),Oot=Xs(),$Rt=bn(),URt=ll(),qRt=j4(),FRt=hv(),jRt=LRt(P4());function Ya(i,t,r=void 0){let h=i.find(({name:o})=>o===t);return h?h.value:r}var zO=class i{constructor(t){this.env=t,this.logger=$Rt.LoggerFactory.INST.create(i.name)}async load(t,r){let h=Oot.Benchmark.measure(),o=await this.fetchContractTx(t);this.logger.debug("Contract tx fetch time",h.elapsed());let l=o.owner.address,c=r||Ya(o.tags,Xa.SMART_WEAVE_TAGS.CONTRACT_SRC_TX_ID),p=Ya(o.tags,Xa.WARP_TAGS.WARP_TESTNET)||null;if(p&&this.env!=="testnet")throw new Error('Trying to use testnet contract in a non-testnet env. Use the "forTestnet" factory method.');if(!p&&this.env==="testnet")throw new Error("Trying to use non-testnet contract in a testnet env.");let w=Ya(o.tags,Xa.SMART_WEAVE_TAGS.MIN_FEE),m=Ya(o.tags,Xa.WARP_TAGS.MANIFEST)?JSON.parse(Ya(o.tags,Xa.WARP_TAGS.MANIFEST)):null;this.logger.debug("Tags decoding",h.elapsed());let y=await this.evalInitialState(o);this.logger.debug("init state",y);let v=JSON.parse(y);this.logger.debug("Parsing src and init state",h.elapsed());let{src:M,srcBinary:T,srcWasmLang:A,contractType:R,metadata:B,srcTx:C}=await this.loadContractSource(c),P={txId:t,srcTxId:c,src:M,srcBinary:T,srcWasmLang:A,initState:v,minFee:w,owner:l,contractType:R,metadata:B,manifest:m,contractTx:await this.convertToWarpCompatibleContractTx(o),srcTx:await this.convertToWarpCompatibleContractTx(C),testnet:p};return this.logger.info(`Contract definition loaded in: ${h.elapsed()}`),P}async fetchContractTx(t){let r=await this.arweaveTransactions.transaction(t);return r??await this.arweaveTransactions.transactionUsingUploaderTag(t)}async convertToWarpCompatibleContractTx(t){return{tags:t.tags.map(({name:h,value:o})=>({name:ge.from(h).toString("base64url"),value:ge.from(o).toString("base64url")})),owner:t.owner.key,target:t.recipient,signature:t.signature,data:(await this.arweaveWrapper.txData(t.id)).toString("base64url")}}async loadContractSource(t){let r=Oot.Benchmark.measure(),h=await this.fetchContractTx(t),o=Ya(h.tags,Xa.SMART_WEAVE_TAGS.CONTENT_TYPE);if(!DRt.SUPPORTED_SRC_CONTENT_TYPES.includes(o))throw new Error(`Contract source content type ${o} not supported`);let l=o==="application/javascript"?"js":"wasm",c=await this.contractSource(h,l),p,w,m;if(l=="wasm"){if(w=new FRt.WasmSrc(c),p=Ya(h.tags,Xa.WARP_TAGS.WASM_LANG),!p)throw new Error(`Wasm lang not set for wasm contract src ${h.id}`);m=JSON.parse(Ya(h.tags,Xa.WARP_TAGS.WASM_META))}return this.logger.debug("Contract src tx load",r.elapsed()),r.reset(),{src:l=="js"?c:null,srcBinary:l=="wasm"?w.wasmBinary():null,srcWasmLang:p,contractType:l,metadata:m,srcTx:h}}async contractSource(t,r){if(Ya(t.tags,Xa.WARP_TAGS.UPLOADER_TX_ID)!=null){let o=await this.arweaveWrapper.txDataString(t.id);if(r==="wasm")throw new Error("WASM contracts in legacy format are not supported using AR GW");return jRt.default.utils.b64UrlToString(JSON.parse(o).data)}return r==="js"?await this.arweaveWrapper.txDataString(t.id):await this.arweaveWrapper.txData(t.id)}async evalInitialState(t){if(Ya(t.tags,Xa.WARP_TAGS.INIT_STATE))return Ya(t.tags,Xa.WARP_TAGS.INIT_STATE);if(Ya(t.tags,Xa.WARP_TAGS.INIT_STATE_TX)){let r=Ya(t.tags,Xa.WARP_TAGS.INIT_STATE_TX);return this.arweaveWrapper.txDataString(r)}else return this.arweaveWrapper.txDataString(t.id)}setCache(){throw new Error("Method not implemented.")}setSrcCache(){throw new Error("Method not implemented.")}getCache(){throw new Error("Method not implemented.")}getSrcCache(){throw new Error("Method not implemented.")}type(){return"arweave"}set warp(t){this.arweaveWrapper=new URt.ArweaveWrapper(t),this.arweaveTransactions=new qRt.ArweaveGQLTxsFetcher(t)}};Pp.ArweaveGatewayBundledContractDefinitionLoader=zO});var Dot=De(Mw=>{"use strict";Tt();Rt();xt();Object.defineProperty(Mw,"__esModule",{value:!0});Mw.ArweaveGatewayBundledInteractionLoader=void 0;var Qa=Hh(),zRt=Xs(),WRt=bn(),KRt=ll(),Pot=Q0(),HRt=j4(),WO=ko(),GRt=Hu(),Not=100,VRt=100,Lot=1057409,KO=class i{constructor(t,r){this.arweave=t,this.environment=r,this.logger=WRt.LoggerFactory.INST.create(i.name),this.tagsParser=new GRt.TagsParser,this.sorter=new Pot.LexicographicalInteractionsSorter(t)}async load(t,r,h,o,l){if(this.logger.debug("Loading interactions for",{contractId:t,fromSortKey:r,toSortKey:h}),o?.transactionsPagesPerBatch)throw new Error(`Loading in batches not yet implemented for ${i.name}`);let c=this.sorter.extractBlockHeight(r)||0,p=this.sorter.extractBlockHeight(h)||await this.currentBlockHeight(),w={tags:[{name:Qa.SMART_WEAVE_TAGS.APP_NAME,values:["SmartWeaveAction"]},{name:Qa.SMART_WEAVE_TAGS.CONTRACT_TX_ID,values:[t]},{name:Qa.WARP_TAGS.SEQUENCER,values:["RedStone"]}],blockFilter:{min:c,max:p+VRt},first:Not},m=zRt.Benchmark.measure(),y=await this.arweaveFetcher.transactions(w,Number.MAX_SAFE_INTEGER,l);o.internalWrites&&(y=await this.appendInternalWriteInteractions(t,c,p,y,l)),m.stop(),this.logger.debug("All loaded interactions:",{from:r,to:h,loaded:y.length,time:m.elapsed()}),y.forEach(A=>{var R,B,C,P;A.node.sortKey=(R=A.node.sortKey)!==null&&R!==void 0?R:(P=(C=(B=A.node)===null||B===void 0?void 0:B.tags)===null||C===void 0?void 0:C.find(N=>N.name===Qa.WARP_TAGS.SEQUENCER_SORT_KEY))===null||P===void 0?void 0:P.value});let v=await this.sorter.sort(y),M=this.environment==="local"||this.environment==="testnet",T=this._warp.maybeLoadPlugin("vrf");return v.filter(A=>this.isNewerThenSortKeyBlockHeight(A)).filter(A=>this.isSortKeyInBounds(r,h,A)).map(A=>this.attachSequencerDataToInteraction(A)).map(A=>this.maybeAddMockVrf(M,A,T)).map((A,R,B)=>this.verifySortKeyIntegrity(A,R,B)).map(({node:A})=>A)}verifySortKeyIntegrity(t,r,h){var o;if(r!==0){let l=h[r-1],c=h[r];if(this.logger.debug(`prev: ${l.node.id} | current: ${c.node.id}`),c.node.block.height<=Lot||((o=c.node.lastSortKey)===null||o===void 0?void 0:o.split(",")[1])===Pot.defaultArweaveMs)return t;l.node.source==="redstone-sequencer"&&l.node.sortKey!==c.node.lastSortKey&&this.logger.warn(`Interaction loading error: interaction ${c.node.id} lastSortKey is not pointing on prev interaction ${l.node.id}`)}return t}isSortKeyInBounds(t,r,h){return t&&r?h.node.sortKey.localeCompare(t)>0&&h.node.sortKey.localeCompare(r)<=0:t&&!r?h.node.sortKey.localeCompare(t)>0:!t&&r?h.node.sortKey.localeCompare(r)<=0:!0}attachSequencerDataToInteraction(t){let r=v=>{var M;return(M=t.node.tags.find(T=>T.name===v))===null||M===void 0?void 0:M.value},h=r(Qa.WARP_TAGS.SEQUENCER_TX_ID),o=r(Qa.WARP_TAGS.SEQUENCER_OWNER),l=r(Qa.WARP_TAGS.SEQUENCER_BLOCK_ID),c=r(Qa.WARP_TAGS.SEQUENCER_BLOCK_HEIGHT),p=r(Qa.WARP_TAGS.SEQUENCER_PREV_SORT_KEY)||r(Qa.WARP_TAGS.SEQUENCER_LAST_SORT_KEY),w=r(Qa.WARP_TAGS.SEQUENCER_SORT_KEY),m=r(Qa.WARP_TAGS.SEQUENCER_BLOCK_TIMESTAMP),y=(0,WO.safeParseInt)(c);if(!o||!l||!c||!p&&y>Lot||!h||!w)throw Error(`Interaction ${t.node.id} is not sequenced by sequencer aborting. Only Sequenced transactions are supported by loader ${i.name}`);return{...t,node:{...t.node,owner:{address:o,key:null},block:{...t.node.block,height:(0,WO.safeParseInt)(c),id:l,timestamp:m?(0,WO.safeParseInt)(m):t.node.block.timestamp},sortKey:w,lastSortKey:p,id:h,source:"redstone-sequencer"}}}async appendInternalWriteInteractions(t,r,h,o,l){let c={tags:[{name:Qa.WARP_TAGS.INTERACT_WRITE,values:[t]}],blockFilter:{min:r,max:h},first:Not},p=await this.arweaveFetcher.transactions(c,Number.MAX_SAFE_INTEGER,l);return this.logger.debug("Inner writes interactions length:",p.length),o=o.concat(p),o}maybeAddMockVrf(t,r,h){return t&&this.tagsParser.hasVrfTag(r.node)&&(h?r.node.vrf=h.process().generateMockVrf(r.node.sortKey):this.logger.warn('Cannot generate mock vrf for interaction - no "warp-contracts-plugin-vrf" attached!')),r}isNewerThenSortKeyBlockHeight(t){if(t.node.sortKey){let r=t.node.sortKey.split(",")[0],h=Number.parseInt(r);return Number(t.node.block.height)-h>=0}return!0}async currentBlockHeight(){return(await this.arweaveWrapper.info()).height}type(){return"arweave"}clearCache(){}set warp(t){this.arweaveWrapper=new KRt.ArweaveWrapper(t),this.arweaveFetcher=new HRt.ArweaveGQLTxsFetcher(t),this._warp=t}};Mw.ArweaveGatewayBundledInteractionLoader=KO});var $ot=De(Mr=>{"use strict";Tt();Rt();xt();var ZRt=Mr&&Mr.__createBinding||(Object.create?function(i,t,r,h){h===void 0&&(h=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(i,h,o)}:function(i,t,r,h){h===void 0&&(h=r),i[h]=t[r]}),Ar=Mr&&Mr.__exportStar||function(i,t){for(var r in i)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&ZRt(t,i,r)};Object.defineProperty(Mr,"__esModule",{value:!0});Ar(nk(),Mr);Ar(ak(),Mr);Ar(Ret(),Mr);Ar(bn(),Mr);Ar(rk(),Mr);Ar(Xs(),Mr);Ar(Iet(),Mr);Ar(Lu(),Mr);Ar(Oet(),Mr);Ar(Fm(),Mr);Ar(Wrt(),Mr);Ar(Hrt(),Mr);Ar(Vrt(),Mr);Ar(Jrt(),Mr);Ar(Yrt(),Mr);Ar(Gm(),Mr);Ar(U4(),Mr);Ar(EB(),Mr);Ar(kB(),Mr);Ar(Hm(),Mr);Ar(BB(),Mr);Ar(PB(),Mr);Ar(LB(),Mr);Ar($f(),Mr);Ar(Q0(),Mr);Ar(Hu(),Mr);Ar(bI(),Mr);Ar(b4(),Mr);Ar(vp(),Mr);Ar(yI(),Mr);Ar(lnt(),Mr);Ar(Hh(),Mr);Ar(pnt(),Mr);Ar(Vm(),Mr);Ar(UB(),Mr);Ar(qO(),Mr);Ar(bw(),Mr);Ar(DO(),Mr);Ar($O(),Mr);Ar(Km(),Mr);Ar(Mot(),Mr);Ar(dw(),Mr);Ar(Eot(),Mr);Ar(OO(),Mr);Ar(tO(),Mr);Ar(pO(),Mr);Ar(mO(),Mr);Ar(Tot(),Mr);Ar(YB(),Mr);Ar(AO(),Mr);Ar(Rot(),Mr);Ar(Iot(),Mr);Ar(g4(),Mr);Ar(FB(),Mr);Ar(SI(),Mr);Ar(XB(),Mr);Ar(ko(),Mr);Ar(ll(),Mr);Ar(_p(),Mr);Ar(hv(),Mr);Ar(pI(),Mr);Ar(Bot(),Mr);Ar(Cot(),Mr);Ar(Dot(),Mr)});Tt();Rt();xt();var Hot=Sl(U5(),1);Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();var bst=["gateway","gateways","prescribedObservers","record","auction","balance","epoch","priceForInteraction"],wst=["delegateStake","decreaseDelegateStake","joinNetwork","increaseOperatorStake","decreaseOperatorStake","updateGatewaySettings","saveObservations","extendRecord","buyRecord","increaseUndernameCount","transfer"],Akt=[...bst,...wst],ho={GATEWAY:"gateway",GATEWAYS:"gateways",PRESCRIBED_OBSERVERS:"prescribedObservers",DELEGATE_STAKE:"delegateStake",DECREASE_DELEGATE_STAKE:"decreaseDelegateStake",JOIN_NETWORK:"joinNetwork",INCREASE_OPERATOR_STAKE:"increaseOperatorStake",DECREASE_OPERATOR_STAKE:"decreaseOperatorStake",UPDATE_GATEWAY_SETTINGS:"updateGatewaySettings",SAVE_OBSERVATIONS:"saveObservations",EXTEND_RECORD:"extendRecord",INCREASE_UNDERNAME_COUNT:"increaseUndernameCount",RECORD:"record",AUCTION:"auction",TRANSFER:"transfer",BALANCE:"balance",PRICE_FOR_INTERACTION:"priceForInteraction",EPOCH:"epoch",BUY_RECORD:"buyRecord"},vL=(r=>(r.IO="IO",r.MIO="mIO",r))(vL||{}),hc={TRANSFER:"transfer",SET_CONTROLLER:"setController",REMOVE_CONTROLLER:"removeController",SET_NAME:"setName",SET_TICKER:"setTicker",SET_RECORD:"setRecord",REMOVE_RECORD:"removeRecord",BALANCE:"balance",EVOLVE:"evolve"};Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();var yL=new RegExp("^[a-zA-Z0-9_-]{43}$"),Ckt=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),bL=new RegExp("^[0-9]{12},[0-9]{13},[a-fA-F0-9]{64}$"),y6=ve.env.ARNS_REGISTRY_TX??"bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U",Pkt="_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8",Qp="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",q5=1e6,wL="cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk",_L="3OlGzE5mrsN2GsxCYM0Tae1KzWepGOr5a94deOWmApM",ML="_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";var F5=class i{constructor(t){this.positiveFiniteInteger=t;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${t}`)}[Symbol.toPrimitive](t){return t==="string"&&this.toString(),this.positiveFiniteInteger}plus(t){return new i(this.positiveFiniteInteger+t.positiveFiniteInteger)}minus(t){return new i(this.positiveFiniteInteger-t.positiveFiniteInteger)}isGreaterThan(t){return this.positiveFiniteInteger>t.positiveFiniteInteger}isGreaterThanOrEqualTo(t){return this.positiveFiniteInteger>=t.positiveFiniteInteger}isLessThan(t){return this.positiveFiniteInteger<t.positiveFiniteInteger}isLessThanOrEqualTo(t){return this.positiveFiniteInteger<=t.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(t){return this.positiveFiniteInteger===t.positiveFiniteInteger}},t2=class{value;constructor(t){if(!Number.isFinite(t)||t<0)throw new Error("IOToken must be a non-negative finite number");this.value=+t.toFixed(6)}valueOf(){return this.value}toMIO(){return new j5(Math.floor(this.value*q5))}toString(){return`${this.value}`}},j5=class i extends F5{constructor(t){super(t)}multiply(t){let r=Math.floor(this.valueOf()*t.valueOf());return new i(r)}divide(t){if(t.valueOf()===0)throw new Error("Cannot divide by zero");let r=Math.floor(this.valueOf()/t.valueOf());return new i(r)}plus(t){let r=super.plus(t);return new i(r.valueOf())}minus(t){let r=super.minus(t);return new i(r.valueOf())}toIO(){return new t2(this.valueOf()/q5)}};Tt();Rt();xt();Tt();Rt();xt();var b6=i=>yL.test(i);function Kkt(i){return i!==void 0&&!isNaN(parseInt(i.toString()))}var Hkt=i=>["id","owner","tags","signature"].every(r=>r in i);function SL(i){return i.reduce((t,r)=>{let h=r.get("name",{decode:!0,string:!0}),o=r.get("value",{decode:!0,string:!0});return t[h]=o,t},{})}function Tl(i){return"process"in i}function xl(i){return"processId"in i&&typeof i.processId=="string"&&b6(i.processId)===!0}function Ykt(i){return i.type==="lease"&&i.endTimestamp!==void 0}Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();function pIt(i){return z5.validate(i)}var z5=class i{_sortKey;constructor(t){if(!i.validate(t))throw new Error(`Invalid sort key: ${t}`);this._sortKey=t}static validate(t){return bL.test(t)}toString(){return this._sortKey}parts(){return this._sortKey.split(",")}blockHeight(){return parseInt(this.parts()[0])}timestamp(){return parseInt(this.parts()[1])}hash(){return this.parts()[2]}};async function EL({arweave:i,contractTxId:t}){let{tags:r}=await i.transactions.get(t).catch(()=>({tags:[]})),o=SL(r)["Contract-Manifest"]??"{}";return JSON.parse(o)}function Jf(i){return"contract"in i}function Xf(i){return"contractTxId"in i&&typeof i.contractTxId=="string"&&b6(i.contractTxId)===!0}Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();function e2(i,t){return function(){return i.apply(t,arguments)}}var{toString:_st}=Object.prototype,{getPrototypeOf:H5}=Object,_6=(i=>t=>{let r=_st.call(t);return i[r]||(i[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),dh=i=>(i=i.toLowerCase(),t=>_6(t)===i),M6=i=>t=>typeof t===i,{isArray:Id}=Array,r2=M6("undefined");function Mst(i){return i!==null&&!r2(i)&&i.constructor!==null&&!r2(i.constructor)&&us(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}var xL=dh("ArrayBuffer");function Sst(i){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(i):t=i&&i.buffer&&xL(i.buffer),t}var Est=M6("string"),us=M6("function"),RL=M6("number"),S6=i=>i!==null&&typeof i=="object",Ast=i=>i===!0||i===!1,w6=i=>{if(_6(i)!=="object")return!1;let t=H5(i);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},Tst=dh("Date"),xst=dh("File"),Rst=dh("Blob"),kst=dh("FileList"),Ist=i=>S6(i)&&us(i.pipe),Bst=i=>{let t;return i&&(typeof FormData=="function"&&i instanceof FormData||us(i.append)&&((t=_6(i))==="formdata"||t==="object"&&us(i.toString)&&i.toString()==="[object FormData]"))},Ost=dh("URLSearchParams"),[Cst,Pst,Nst,Lst]=["ReadableStream","Request","Response","Headers"].map(dh),Dst=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function i2(i,t,{allOwnKeys:r=!1}={}){if(i===null||typeof i>"u")return;let h,o;if(typeof i!="object"&&(i=[i]),Id(i))for(h=0,o=i.length;h<o;h++)t.call(null,i[h],h,i);else{let l=r?Object.getOwnPropertyNames(i):Object.keys(i),c=l.length,p;for(h=0;h<c;h++)p=l[h],t.call(null,i[p],p,i)}}function kL(i,t){t=t.toLowerCase();let r=Object.keys(i),h=r.length,o;for(;h-- >0;)if(o=r[h],t===o.toLowerCase())return o;return null}var IL=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,BL=i=>!r2(i)&&i!==IL;function K5(){let{caseless:i}=BL(this)&&this||{},t={},r=(h,o)=>{let l=i&&kL(t,o)||o;w6(t[l])&&w6(h)?t[l]=K5(t[l],h):w6(h)?t[l]=K5({},h):Id(h)?t[l]=h.slice():t[l]=h};for(let h=0,o=arguments.length;h<o;h++)arguments[h]&&i2(arguments[h],r);return t}var $st=(i,t,r,{allOwnKeys:h}={})=>(i2(t,(o,l)=>{r&&us(o)?i[l]=e2(o,r):i[l]=o},{allOwnKeys:h}),i),Ust=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),qst=(i,t,r,h)=>{i.prototype=Object.create(t.prototype,h),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:t.prototype}),r&&Object.assign(i.prototype,r)},Fst=(i,t,r,h)=>{let o,l,c,p={};if(t=t||{},i==null)return t;do{for(o=Object.getOwnPropertyNames(i),l=o.length;l-- >0;)c=o[l],(!h||h(c,i,t))&&!p[c]&&(t[c]=i[c],p[c]=!0);i=r!==!1&&H5(i)}while(i&&(!r||r(i,t))&&i!==Object.prototype);return t},jst=(i,t,r)=>{i=String(i),(r===void 0||r>i.length)&&(r=i.length),r-=t.length;let h=i.indexOf(t,r);return h!==-1&&h===r},zst=i=>{if(!i)return null;if(Id(i))return i;let t=i.length;if(!RL(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=i[t];return r},Wst=(i=>t=>i&&t instanceof i)(typeof Uint8Array<"u"&&H5(Uint8Array)),Kst=(i,t)=>{let h=(i&&i[Symbol.iterator]).call(i),o;for(;(o=h.next())&&!o.done;){let l=o.value;t.call(i,l[0],l[1])}},Hst=(i,t)=>{let r,h=[];for(;(r=i.exec(t))!==null;)h.push(r);return h},Gst=dh("HTMLFormElement"),Vst=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,h,o){return h.toUpperCase()+o}),AL=(({hasOwnProperty:i})=>(t,r)=>i.call(t,r))(Object.prototype),Zst=dh("RegExp"),OL=(i,t)=>{let r=Object.getOwnPropertyDescriptors(i),h={};i2(r,(o,l)=>{let c;(c=t(o,l,i))!==!1&&(h[l]=c||o)}),Object.defineProperties(i,h)},Jst=i=>{OL(i,(t,r)=>{if(us(i)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let h=i[r];if(us(h)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Xst=(i,t)=>{let r={},h=o=>{o.forEach(l=>{r[l]=!0})};return Id(i)?h(i):h(String(i).split(t)),r},Yst=()=>{},Qst=(i,t)=>i!=null&&Number.isFinite(i=+i)?i:t,W5="abcdefghijklmnopqrstuvwxyz",TL="0123456789",CL={DIGIT:TL,ALPHA:W5,ALPHA_DIGIT:W5+W5.toUpperCase()+TL},tht=(i=16,t=CL.ALPHA_DIGIT)=>{let r="",{length:h}=t;for(;i--;)r+=t[Math.random()*h|0];return r};function eht(i){return!!(i&&us(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}var rht=i=>{let t=new Array(10),r=(h,o)=>{if(S6(h)){if(t.indexOf(h)>=0)return;if(!("toJSON"in h)){t[o]=h;let l=Id(h)?[]:{};return i2(h,(c,p)=>{let w=r(c,o+1);!r2(w)&&(l[p]=w)}),t[o]=void 0,l}}return h};return r(i,0)},iht=dh("AsyncFunction"),nht=i=>i&&(S6(i)||us(i))&&us(i.then)&&us(i.catch),Ke={isArray:Id,isArrayBuffer:xL,isBuffer:Mst,isFormData:Bst,isArrayBufferView:Sst,isString:Est,isNumber:RL,isBoolean:Ast,isObject:S6,isPlainObject:w6,isReadableStream:Cst,isRequest:Pst,isResponse:Nst,isHeaders:Lst,isUndefined:r2,isDate:Tst,isFile:xst,isBlob:Rst,isRegExp:Zst,isFunction:us,isStream:Ist,isURLSearchParams:Ost,isTypedArray:Wst,isFileList:kst,forEach:i2,merge:K5,extend:$st,trim:Dst,stripBOM:Ust,inherits:qst,toFlatObject:Fst,kindOf:_6,kindOfTest:dh,endsWith:jst,toArray:zst,forEachEntry:Kst,matchAll:Hst,isHTMLForm:Gst,hasOwnProperty:AL,hasOwnProp:AL,reduceDescriptors:OL,freezeMethods:Jst,toObjectSet:Xst,toCamelCase:Vst,noop:Yst,toFiniteNumber:Qst,findKey:kL,global:IL,isContextDefined:BL,ALPHABET:CL,generateString:tht,isSpecCompliantForm:eht,toJSONObject:rht,isAsyncFn:iht,isThenable:nht};Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();function Bd(i,t,r,h,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),h&&(this.request=h),o&&(this.response=o)}Ke.inherits(Bd,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ke.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var PL=Bd.prototype,NL={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{NL[i]={value:i}});Object.defineProperties(Bd,NL);Object.defineProperty(PL,"isAxiosError",{value:!0});Bd.from=(i,t,r,h,o,l)=>{let c=Object.create(PL);return Ke.toFlatObject(i,c,function(w){return w!==Error.prototype},p=>p!=="isAxiosError"),Bd.call(c,i.message,t,r,h,o),c.cause=i,c.name=i.name,l&&Object.assign(c,l),c};var Nr=Bd;Tt();Rt();xt();var E6=null;function G5(i){return Ke.isPlainObject(i)||Ke.isArray(i)}function DL(i){return Ke.endsWith(i,"[]")?i.slice(0,-2):i}function LL(i,t,r){return i?i.concat(t).map(function(o,l){return o=DL(o),!r&&l?"["+o+"]":o}).join(r?".":""):t}function oht(i){return Ke.isArray(i)&&!i.some(G5)}var aht=Ke.toFlatObject(Ke,{},null,function(t){return/^is[A-Z]/.test(t)});function sht(i,t,r){if(!Ke.isObject(i))throw new TypeError("target must be an object");t=t||new(E6||FormData),r=Ke.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(R,B){return!Ke.isUndefined(B[R])});let h=r.metaTokens,o=r.visitor||y,l=r.dots,c=r.indexes,w=(r.Blob||typeof Blob<"u"&&Blob)&&Ke.isSpecCompliantForm(t);if(!Ke.isFunction(o))throw new TypeError("visitor must be a function");function m(A){if(A===null)return"";if(Ke.isDate(A))return A.toISOString();if(!w&&Ke.isBlob(A))throw new Nr("Blob is not supported. Use a Buffer instead.");return Ke.isArrayBuffer(A)||Ke.isTypedArray(A)?w&&typeof Blob=="function"?new Blob([A]):ge.from(A):A}function y(A,R,B){let C=A;if(A&&!B&&typeof A=="object"){if(Ke.endsWith(R,"{}"))R=h?R:R.slice(0,-2),A=JSON.stringify(A);else if(Ke.isArray(A)&&oht(A)||(Ke.isFileList(A)||Ke.endsWith(R,"[]"))&&(C=Ke.toArray(A)))return R=DL(R),C.forEach(function(N,q){!(Ke.isUndefined(N)||N===null)&&t.append(c===!0?LL([R],q,l):c===null?R:R+"[]",m(N))}),!1}return G5(A)?!0:(t.append(LL(B,R,l),m(A)),!1)}let v=[],M=Object.assign(aht,{defaultVisitor:y,convertValue:m,isVisitable:G5});function T(A,R){if(!Ke.isUndefined(A)){if(v.indexOf(A)!==-1)throw Error("Circular reference detected in "+R.join("."));v.push(A),Ke.forEach(A,function(C,P){(!(Ke.isUndefined(C)||C===null)&&o.call(t,C,Ke.isString(P)?P.trim():P,R,M))===!0&&T(C,R?R.concat(P):[P])}),v.pop()}}if(!Ke.isObject(i))throw new TypeError("data must be an object");return T(i),t}var fc=sht;function $L(i){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(h){return t[h]})}function UL(i,t){this._pairs=[],i&&fc(i,this,t)}var qL=UL.prototype;qL.append=function(t,r){this._pairs.push([t,r])};qL.toString=function(t){let r=t?function(h){return t.call(this,h,$L)}:$L;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var A6=UL;function hht(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function n2(i,t,r){if(!t)return i;let h=r&&r.encode||hht,o=r&&r.serialize,l;if(o?l=o(t,r):l=Ke.isURLSearchParams(t)?t.toString():new A6(t,r).toString(h),l){let c=i.indexOf("#");c!==-1&&(i=i.slice(0,c)),i+=(i.indexOf("?")===-1?"?":"&")+l}return i}Tt();Rt();xt();var V5=class{constructor(){this.handlers=[]}use(t,r,h){return this.handlers.push({fulfilled:t,rejected:r,synchronous:h?h.synchronous:!1,runWhen:h?h.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Ke.forEach(this.handlers,function(h){h!==null&&t(h)})}},Z5=V5;Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();var T6={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();var FL=typeof URLSearchParams<"u"?URLSearchParams:A6;Tt();Rt();xt();var jL=typeof FormData<"u"?FormData:null;Tt();Rt();xt();var zL=typeof Blob<"u"?Blob:null;var WL={isBrowser:!0,classes:{URLSearchParams:FL,FormData:jL,Blob:zL},protocols:["http","https","file","blob","url","data"]};var X5={};fs(X5,{hasBrowserEnv:()=>J5,hasStandardBrowserEnv:()=>fht,hasStandardBrowserWebWorkerEnv:()=>uht,origin:()=>cht});Tt();Rt();xt();var J5=typeof window<"u"&&typeof document<"u",fht=(i=>J5&&["ReactNative","NativeScript","NS"].indexOf(i)<0)(typeof navigator<"u"&&navigator.product),uht=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",cht=J5&&window.location.href||"http://localhost";var fo={...X5,...WL};function Y5(i,t){return fc(i,new fo.classes.URLSearchParams,Object.assign({visitor:function(r,h,o,l){return fo.isNode&&Ke.isBuffer(r)?(this.append(h,r.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)}},t))}Tt();Rt();xt();function lht(i){return Ke.matchAll(/\w+|\[(\w*)]/g,i).map(t=>t[0]==="[]"?"":t[1]||t[0])}function dht(i){let t={},r=Object.keys(i),h,o=r.length,l;for(h=0;h<o;h++)l=r[h],t[l]=i[l];return t}function pht(i){function t(r,h,o,l){let c=r[l++];if(c==="__proto__")return!0;let p=Number.isFinite(+c),w=l>=r.length;return c=!c&&Ke.isArray(o)?o.length:c,w?(Ke.hasOwnProp(o,c)?o[c]=[o[c],h]:o[c]=h,!p):((!o[c]||!Ke.isObject(o[c]))&&(o[c]=[]),t(r,h,o[c],l)&&Ke.isArray(o[c])&&(o[c]=dht(o[c])),!p)}if(Ke.isFormData(i)&&Ke.isFunction(i.entries)){let r={};return Ke.forEachEntry(i,(h,o)=>{t(lht(h),o,r,0)}),r}return null}var x6=pht;function ght(i,t,r){if(Ke.isString(i))try{return(t||JSON.parse)(i),Ke.trim(i)}catch(h){if(h.name!=="SyntaxError")throw h}return(r||JSON.stringify)(i)}var Q5={transitional:T6,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let h=r.getContentType()||"",o=h.indexOf("application/json")>-1,l=Ke.isObject(t);if(l&&Ke.isHTMLForm(t)&&(t=new FormData(t)),Ke.isFormData(t))return o?JSON.stringify(x6(t)):t;if(Ke.isArrayBuffer(t)||Ke.isBuffer(t)||Ke.isStream(t)||Ke.isFile(t)||Ke.isBlob(t)||Ke.isReadableStream(t))return t;if(Ke.isArrayBufferView(t))return t.buffer;if(Ke.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let p;if(l){if(h.indexOf("application/x-www-form-urlencoded")>-1)return Y5(t,this.formSerializer).toString();if((p=Ke.isFileList(t))||h.indexOf("multipart/form-data")>-1){let w=this.env&&this.env.FormData;return fc(p?{"files[]":t}:t,w&&new w,this.formSerializer)}}return l||o?(r.setContentType("application/json",!1),ght(t)):t}],transformResponse:[function(t){let r=this.transitional||Q5.transitional,h=r&&r.forcedJSONParsing,o=this.responseType==="json";if(Ke.isResponse(t)||Ke.isReadableStream(t))return t;if(t&&Ke.isString(t)&&(h&&!this.responseType||o)){let c=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(p){if(c)throw p.name==="SyntaxError"?Nr.from(p,Nr.ERR_BAD_RESPONSE,this,null,this.response):p}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:fo.classes.FormData,Blob:fo.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ke.forEach(["delete","get","head","post","put","patch"],i=>{Q5.headers[i]={}});var Od=Q5;Tt();Rt();xt();Tt();Rt();xt();var mht=Ke.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),KL=i=>{let t={},r,h,o;return i&&i.split(`
|
|
217
217
|
`).forEach(function(c){o=c.indexOf(":"),r=c.substring(0,o).trim().toLowerCase(),h=c.substring(o+1).trim(),!(!r||t[r]&&mht[r])&&(r==="set-cookie"?t[r]?t[r].push(h):t[r]=[h]:t[r]=t[r]?t[r]+", "+h:h)}),t};var HL=Symbol("internals");function o2(i){return i&&String(i).trim().toLowerCase()}function R6(i){return i===!1||i==null?i:Ke.isArray(i)?i.map(R6):String(i)}function vht(i){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,h;for(;h=r.exec(i);)t[h[1]]=h[2];return t}var yht=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function t7(i,t,r,h,o){if(Ke.isFunction(h))return h.call(this,t,r);if(o&&(t=r),!!Ke.isString(t)){if(Ke.isString(h))return t.indexOf(h)!==-1;if(Ke.isRegExp(h))return h.test(t)}}function bht(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,h)=>r.toUpperCase()+h)}function wht(i,t){let r=Ke.toCamelCase(" "+t);["get","set","has"].forEach(h=>{Object.defineProperty(i,h+r,{value:function(o,l,c){return this[h].call(this,t,o,l,c)},configurable:!0})})}var Cd=class{constructor(t){t&&this.set(t)}set(t,r,h){let o=this;function l(p,w,m){let y=o2(w);if(!y)throw new Error("header name must be a non-empty string");let v=Ke.findKey(o,y);(!v||o[v]===void 0||m===!0||m===void 0&&o[v]!==!1)&&(o[v||w]=R6(p))}let c=(p,w)=>Ke.forEach(p,(m,y)=>l(m,y,w));if(Ke.isPlainObject(t)||t instanceof this.constructor)c(t,r);else if(Ke.isString(t)&&(t=t.trim())&&!yht(t))c(KL(t),r);else if(Ke.isHeaders(t))for(let[p,w]of t.entries())l(w,p,h);else t!=null&&l(r,t,h);return this}get(t,r){if(t=o2(t),t){let h=Ke.findKey(this,t);if(h){let o=this[h];if(!r)return o;if(r===!0)return vht(o);if(Ke.isFunction(r))return r.call(this,o,h);if(Ke.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=o2(t),t){let h=Ke.findKey(this,t);return!!(h&&this[h]!==void 0&&(!r||t7(this,this[h],h,r)))}return!1}delete(t,r){let h=this,o=!1;function l(c){if(c=o2(c),c){let p=Ke.findKey(h,c);p&&(!r||t7(h,h[p],p,r))&&(delete h[p],o=!0)}}return Ke.isArray(t)?t.forEach(l):l(t),o}clear(t){let r=Object.keys(this),h=r.length,o=!1;for(;h--;){let l=r[h];(!t||t7(this,this[l],l,t,!0))&&(delete this[l],o=!0)}return o}normalize(t){let r=this,h={};return Ke.forEach(this,(o,l)=>{let c=Ke.findKey(h,l);if(c){r[c]=R6(o),delete r[l];return}let p=t?bht(l):String(l).trim();p!==l&&delete r[l],r[p]=R6(o),h[p]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return Ke.forEach(this,(h,o)=>{h!=null&&h!==!1&&(r[o]=t&&Ke.isArray(h)?h.join(", "):h)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
218
218
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let h=new this(t);return r.forEach(o=>h.set(o)),h}static accessor(t){let h=(this[HL]=this[HL]={accessors:{}}).accessors,o=this.prototype;function l(c){let p=o2(c);h[p]||(wht(o,c),h[p]=!0)}return Ke.isArray(t)?t.forEach(l):l(t),this}};Cd.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ke.reduceDescriptors(Cd.prototype,({value:i},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>i,set(h){this[r]=h}}});Ke.freezeMethods(Cd);var Zn=Cd;function a2(i,t){let r=this||Od,h=t||r,o=Zn.from(h.headers),l=h.data;return Ke.forEach(i,function(p){l=p.call(r,l,o.normalize(),t?t.status:void 0)}),o.normalize(),l}Tt();Rt();xt();function s2(i){return!!(i&&i.__CANCEL__)}Tt();Rt();xt();function GL(i,t,r){Nr.call(this,i??"canceled",Nr.ERR_CANCELED,t,r),this.name="CanceledError"}Ke.inherits(GL,Nr,{__CANCEL__:!0});var of=GL;Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();function h2(i,t,r){let h=r.config.validateStatus;!r.status||!h||h(r.status)?i(r):t(new Nr("Request failed with status code "+r.status,[Nr.ERR_BAD_REQUEST,Nr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}Tt();Rt();xt();function e7(i){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return t&&t[1]||""}Tt();Rt();xt();Tt();Rt();xt();function _ht(i,t){i=i||10;let r=new Array(i),h=new Array(i),o=0,l=0,c;return t=t!==void 0?t:1e3,function(w){let m=Date.now(),y=h[l];c||(c=m),r[o]=w,h[o]=m;let v=l,M=0;for(;v!==o;)M+=r[v++],v=v%i;if(o=(o+1)%i,o===l&&(l=(l+1)%i),m-c<t)return;let T=y&&m-y;return T?Math.round(M*1e3/T):void 0}}var VL=_ht;Tt();Rt();xt();function Mht(i,t){let r=0,h=1e3/t,o=null;return function(){let c=this===!0,p=Date.now();if(c||p-r>h)return o&&(clearTimeout(o),o=null),r=p,i.apply(null,arguments);o||(o=setTimeout(()=>(o=null,r=Date.now(),i.apply(null,arguments)),h-(p-r)))}}var ZL=Mht;var Pd=(i,t,r=3)=>{let h=0,o=VL(50,250);return ZL(l=>{let c=l.loaded,p=l.lengthComputable?l.total:void 0,w=c-h,m=o(w),y=c<=p;h=c;let v={loaded:c,total:p,progress:p?c/p:void 0,bytes:w,rate:m||void 0,estimated:m&&p&&y?(p-c)/m:void 0,event:l,lengthComputable:p!=null};v[t?"download":"upload"]=!0,i(v)},r)};Tt();Rt();xt();Tt();Rt();xt();var JL=fo.hasStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),h;function o(l){let c=l;return t&&(r.setAttribute("href",c),c=r.href),r.setAttribute("href",c),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return h=o(window.location.href),function(c){let p=Ke.isString(c)?o(c):c;return p.protocol===h.protocol&&p.host===h.host}}():function(){return function(){return!0}}();Tt();Rt();xt();var XL=fo.hasStandardBrowserEnv?{write(i,t,r,h,o,l){let c=[i+"="+encodeURIComponent(t)];Ke.isNumber(r)&&c.push("expires="+new Date(r).toGMTString()),Ke.isString(h)&&c.push("path="+h),Ke.isString(o)&&c.push("domain="+o),l===!0&&c.push("secure"),document.cookie=c.join("; ")},read(i){let t=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(i){this.write(i,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};Tt();Rt();xt();Tt();Rt();xt();function r7(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}Tt();Rt();xt();function i7(i,t){return t?i.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):i}function f2(i,t){return i&&!r7(t)?i7(i,t):t}Tt();Rt();xt();var YL=i=>i instanceof Zn?{...i}:i;function ph(i,t){t=t||{};let r={};function h(m,y,v){return Ke.isPlainObject(m)&&Ke.isPlainObject(y)?Ke.merge.call({caseless:v},m,y):Ke.isPlainObject(y)?Ke.merge({},y):Ke.isArray(y)?y.slice():y}function o(m,y,v){if(Ke.isUndefined(y)){if(!Ke.isUndefined(m))return h(void 0,m,v)}else return h(m,y,v)}function l(m,y){if(!Ke.isUndefined(y))return h(void 0,y)}function c(m,y){if(Ke.isUndefined(y)){if(!Ke.isUndefined(m))return h(void 0,m)}else return h(void 0,y)}function p(m,y,v){if(v in t)return h(m,y);if(v in i)return h(void 0,m)}let w={url:l,method:l,data:l,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:p,headers:(m,y)=>o(YL(m),YL(y),!0)};return Ke.forEach(Object.keys(Object.assign({},i,t)),function(y){let v=w[y]||o,M=v(i[y],t[y],y);Ke.isUndefined(M)&&v!==p||(r[y]=M)}),r}var k6=i=>{let t=ph({},i),{data:r,withXSRFToken:h,xsrfHeaderName:o,xsrfCookieName:l,headers:c,auth:p}=t;t.headers=c=Zn.from(c),t.url=n2(f2(t.baseURL,t.url),i.params,i.paramsSerializer),p&&c.set("Authorization","Basic "+btoa((p.username||"")+":"+(p.password?unescape(encodeURIComponent(p.password)):"")));let w;if(Ke.isFormData(r)){if(fo.hasStandardBrowserEnv||fo.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if((w=c.getContentType())!==!1){let[m,...y]=w?w.split(";").map(v=>v.trim()).filter(Boolean):[];c.setContentType([m||"multipart/form-data",...y].join("; "))}}if(fo.hasStandardBrowserEnv&&(h&&Ke.isFunction(h)&&(h=h(t)),h||h!==!1&&JL(t.url))){let m=o&&l&&XL.read(l);m&&c.set(o,m)}return t};var Sht=typeof XMLHttpRequest<"u",QL=Sht&&function(i){return new Promise(function(r,h){let o=k6(i),l=o.data,c=Zn.from(o.headers).normalize(),{responseType:p}=o,w;function m(){o.cancelToken&&o.cancelToken.unsubscribe(w),o.signal&&o.signal.removeEventListener("abort",w)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function v(){if(!y)return;let T=Zn.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),R={data:!p||p==="text"||p==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:T,config:i,request:y};h2(function(C){r(C),m()},function(C){h(C),m()},R),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(v)},y.onabort=function(){y&&(h(new Nr("Request aborted",Nr.ECONNABORTED,o,y)),y=null)},y.onerror=function(){h(new Nr("Network Error",Nr.ERR_NETWORK,o,y)),y=null},y.ontimeout=function(){let A=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",R=o.transitional||T6;o.timeoutErrorMessage&&(A=o.timeoutErrorMessage),h(new Nr(A,R.clarifyTimeoutError?Nr.ETIMEDOUT:Nr.ECONNABORTED,o,y)),y=null},l===void 0&&c.setContentType(null),"setRequestHeader"in y&&Ke.forEach(c.toJSON(),function(A,R){y.setRequestHeader(R,A)}),Ke.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),p&&p!=="json"&&(y.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&y.addEventListener("progress",Pd(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&y.upload&&y.upload.addEventListener("progress",Pd(o.onUploadProgress)),(o.cancelToken||o.signal)&&(w=T=>{y&&(h(!T||T.type?new of(null,i,y):T),y.abort(),y=null)},o.cancelToken&&o.cancelToken.subscribe(w),o.signal&&(o.signal.aborted?w():o.signal.addEventListener("abort",w)));let M=e7(o.url);if(M&&fo.protocols.indexOf(M)===-1){h(new Nr("Unsupported protocol "+M+":",Nr.ERR_BAD_REQUEST,i));return}y.send(l||null)})};Tt();Rt();xt();Tt();Rt();xt();var Eht=(i,t)=>{let r=new AbortController,h,o=function(w){if(!h){h=!0,c();let m=w instanceof Error?w:this.reason;r.abort(m instanceof Nr?m:new of(m instanceof Error?m.message:m))}},l=t&&setTimeout(()=>{o(new Nr(`timeout ${t} of ms exceeded`,Nr.ETIMEDOUT))},t),c=()=>{i&&(l&&clearTimeout(l),l=null,i.forEach(w=>{w&&(w.removeEventListener?w.removeEventListener("abort",o):w.unsubscribe(o))}),i=null)};i.forEach(w=>w&&w.addEventListener&&w.addEventListener("abort",o));let{signal:p}=r;return p.unsubscribe=c,[p,()=>{l&&clearTimeout(l),l=null}]},tD=Eht;Tt();Rt();xt();var Aht=function*(i,t){let r=i.byteLength;if(!t||r<t){yield i;return}let h=0,o;for(;h<r;)o=h+t,yield i.slice(h,o),h=o},Tht=async function*(i,t,r){for await(let h of i)yield*Aht(ArrayBuffer.isView(h)?h:await r(String(h)),t)},n7=(i,t,r,h,o)=>{let l=Tht(i,t,o),c=0;return new ReadableStream({type:"bytes",async pull(p){let{done:w,value:m}=await l.next();if(w){p.close(),h();return}let y=m.byteLength;r&&r(c+=y),p.enqueue(new Uint8Array(m))},cancel(p){return h(p),l.return()}},{highWaterMark:2})};var eD=(i,t)=>{let r=i!=null;return h=>setTimeout(()=>t({lengthComputable:r,total:i,loaded:h}))},B6=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",iD=B6&&typeof ReadableStream=="function",o7=B6&&(typeof TextEncoder=="function"?(i=>t=>i.encode(t))(new TextEncoder):async i=>new Uint8Array(await new Response(i).arrayBuffer())),xht=iD&&(()=>{let i=!1,t=new Request(fo.origin,{body:new ReadableStream,method:"POST",get duplex(){return i=!0,"half"}}).headers.has("Content-Type");return i&&!t})(),rD=64*1024,a7=iD&&!!(()=>{try{return Ke.isReadableStream(new Response("").body)}catch{}})(),I6={stream:a7&&(i=>i.body)};B6&&(i=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!I6[t]&&(I6[t]=Ke.isFunction(i[t])?r=>r[t]():(r,h)=>{throw new Nr(`Response type '${t}' is not supported`,Nr.ERR_NOT_SUPPORT,h)})})})(new Response);var Rht=async i=>{if(i==null)return 0;if(Ke.isBlob(i))return i.size;if(Ke.isSpecCompliantForm(i))return(await new Request(i).arrayBuffer()).byteLength;if(Ke.isArrayBufferView(i))return i.byteLength;if(Ke.isURLSearchParams(i)&&(i=i+""),Ke.isString(i))return(await o7(i)).byteLength},kht=async(i,t)=>{let r=Ke.toFiniteNumber(i.getContentLength());return r??Rht(t)},nD=B6&&(async i=>{let{url:t,method:r,data:h,signal:o,cancelToken:l,timeout:c,onDownloadProgress:p,onUploadProgress:w,responseType:m,headers:y,withCredentials:v="same-origin",fetchOptions:M}=k6(i);m=m?(m+"").toLowerCase():"text";let[T,A]=o||l||c?tD([o,l],c):[],R,B,C=()=>{!R&&setTimeout(()=>{T&&T.unsubscribe()}),R=!0},P;try{if(w&&xht&&r!=="get"&&r!=="head"&&(P=await kht(y,h))!==0){let J=new Request(t,{method:"POST",body:h,duplex:"half"}),F;Ke.isFormData(h)&&(F=J.headers.get("content-type"))&&y.setContentType(F),J.body&&(h=n7(J.body,rD,eD(P,Pd(w)),null,o7))}Ke.isString(v)||(v=v?"cors":"omit"),B=new Request(t,{...M,signal:T,method:r.toUpperCase(),headers:y.normalize().toJSON(),body:h,duplex:"half",withCredentials:v});let N=await fetch(B),q=a7&&(m==="stream"||m==="response");if(a7&&(p||q)){let J={};["status","statusText","headers"].forEach(H=>{J[H]=N[H]});let F=Ke.toFiniteNumber(N.headers.get("content-length"));N=new Response(n7(N.body,rD,p&&eD(F,Pd(p,!0)),q&&C,o7),J)}m=m||"text";let W=await I6[Ke.findKey(I6,m)||"text"](N,i);return!q&&C(),A&&A(),await new Promise((J,F)=>{h2(J,F,{data:W,headers:Zn.from(N.headers),status:N.status,statusText:N.statusText,config:i,request:B})})}catch(N){throw C(),N&&N.name==="TypeError"&&/fetch/i.test(N.message)?Object.assign(new Nr("Network Error",Nr.ERR_NETWORK,i,B),{cause:N.cause||N}):Nr.from(N,N&&N.code,i,B)}});var s7={http:E6,xhr:QL,fetch:nD};Ke.forEach(s7,(i,t)=>{if(i){try{Object.defineProperty(i,"name",{value:t})}catch{}Object.defineProperty(i,"adapterName",{value:t})}});var oD=i=>`- ${i}`,Iht=i=>Ke.isFunction(i)||i===null||i===!1,O6={getAdapter:i=>{i=Ke.isArray(i)?i:[i];let{length:t}=i,r,h,o={};for(let l=0;l<t;l++){r=i[l];let c;if(h=r,!Iht(r)&&(h=s7[(c=String(r)).toLowerCase()],h===void 0))throw new Nr(`Unknown adapter '${c}'`);if(h)break;o[c||"#"+l]=h}if(!h){let l=Object.entries(o).map(([p,w])=>`adapter ${p} `+(w===!1?"is not supported by the environment":"is not available in the build")),c=t?l.length>1?`since :
|
|
219
219
|
`+l.map(oD).join(`
|
|
220
220
|
`):" "+oD(l[0]):"as no adapter specified";throw new Nr("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return h},adapters:s7};function h7(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new of(null,i)}function C6(i){return h7(i),i.headers=Zn.from(i.headers),i.data=a2.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),O6.getAdapter(i.adapter||Od.adapter)(i).then(function(h){return h7(i),h.data=a2.call(i,i.transformResponse,h),h.headers=Zn.from(h.headers),h},function(h){return s2(h)||(h7(i),h&&h.response&&(h.response.data=a2.call(i,i.transformResponse,h.response),h.response.headers=Zn.from(h.response.headers))),Promise.reject(h)})}Tt();Rt();xt();Tt();Rt();xt();var P6="1.7.2";var f7={};["object","boolean","number","function","string","symbol"].forEach((i,t)=>{f7[i]=function(h){return typeof h===i||"a"+(t<1?"n ":" ")+i}});var aD={};f7.transitional=function(t,r,h){function o(l,c){return"[Axios v"+P6+"] Transitional option '"+l+"'"+c+(h?". "+h:"")}return(l,c,p)=>{if(t===!1)throw new Nr(o(c," has been removed"+(r?" in "+r:"")),Nr.ERR_DEPRECATED);return r&&!aD[c]&&(aD[c]=!0,console.warn(o(c," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(l,c,p):!0}};function Bht(i,t,r){if(typeof i!="object")throw new Nr("options must be an object",Nr.ERR_BAD_OPTION_VALUE);let h=Object.keys(i),o=h.length;for(;o-- >0;){let l=h[o],c=t[l];if(c){let p=i[l],w=p===void 0||c(p,l,i);if(w!==!0)throw new Nr("option "+l+" must be "+w,Nr.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Nr("Unknown option "+l,Nr.ERR_BAD_OPTION)}}var N6={assertOptions:Bht,validators:f7};var uc=N6.validators,Nd=class{constructor(t){this.defaults=t,this.interceptors={request:new Z5,response:new Z5}}async request(t,r){try{return await this._request(t,r)}catch(h){if(h instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;let l=o.stack?o.stack.replace(/^.+\n/,""):"";try{h.stack?l&&!String(h.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(h.stack+=`
|
|
221
|
-
`+l):h.stack=l}catch{}}throw h}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=ph(this.defaults,r);let{transitional:h,paramsSerializer:o,headers:l}=r;h!==void 0&&N6.assertOptions(h,{silentJSONParsing:uc.transitional(uc.boolean),forcedJSONParsing:uc.transitional(uc.boolean),clarifyTimeoutError:uc.transitional(uc.boolean)},!1),o!=null&&(Ke.isFunction(o)?r.paramsSerializer={serialize:o}:N6.assertOptions(o,{encode:uc.function,serialize:uc.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let c=l&&Ke.merge(l.common,l[r.method]);l&&Ke.forEach(["delete","get","head","post","put","patch","common"],A=>{delete l[A]}),r.headers=Zn.concat(c,l);let p=[],w=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(r)===!1||(w=w&&R.synchronous,p.unshift(R.fulfilled,R.rejected))});let m=[];this.interceptors.response.forEach(function(R){m.push(R.fulfilled,R.rejected)});let y,v=0,M;if(!w){let A=[C6.bind(this),void 0];for(A.unshift.apply(A,p),A.push.apply(A,m),M=A.length,y=Promise.resolve(r);v<M;)y=y.then(A[v++],A[v++]);return y}M=p.length;let T=r;for(v=0;v<M;){let A=p[v++],R=p[v++];try{T=A(T)}catch(B){R.call(this,B);break}}try{y=C6.call(this,T)}catch(A){return Promise.reject(A)}for(v=0,M=m.length;v<M;)y=y.then(m[v++],m[v++]);return y}getUri(t){t=ph(this.defaults,t);let r=f2(t.baseURL,t.url);return n2(r,t.params,t.paramsSerializer)}};Ke.forEach(["delete","get","head","options"],function(t){Nd.prototype[t]=function(r,h){return this.request(ph(h||{},{method:t,url:r,data:(h||{}).data}))}});Ke.forEach(["post","put","patch"],function(t){function r(h){return function(l,c,p){return this.request(ph(p||{},{method:t,headers:h?{"Content-Type":"multipart/form-data"}:{},url:l,data:c}))}}Nd.prototype[t]=r(),Nd.prototype[t+"Form"]=r(!0)});var u2=Nd;Tt();Rt();xt();var u7=class i{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(l){r=l});let h=this;this.promise.then(o=>{if(!h._listeners)return;let l=h._listeners.length;for(;l-- >0;)h._listeners[l](o);h._listeners=null}),this.promise.then=o=>{let l,c=new Promise(p=>{h.subscribe(p),l=p}).then(o);return c.cancel=function(){h.unsubscribe(l)},c},t(function(l,c,p){h.reason||(h.reason=new of(l,c,p),r(h.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new i(function(o){t=o}),cancel:t}}},sD=u7;Tt();Rt();xt();function c7(i){return function(r){return i.apply(null,r)}}Tt();Rt();xt();function l7(i){return Ke.isObject(i)&&i.isAxiosError===!0}Tt();Rt();xt();var d7={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(d7).forEach(([i,t])=>{d7[t]=i});var hD=d7;function fD(i){let t=new u2(i),r=e2(u2.prototype.request,t);return Ke.extend(r,u2.prototype,t,{allOwnKeys:!0}),Ke.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return fD(ph(i,o))},r}var Wn=fD(Od);Wn.Axios=u2;Wn.CanceledError=of;Wn.CancelToken=sD;Wn.isCancel=s2;Wn.VERSION=P6;Wn.toFormData=fc;Wn.AxiosError=Nr;Wn.Cancel=Wn.CanceledError;Wn.all=function(t){return Promise.all(t)};Wn.spread=c7;Wn.isAxiosError=l7;Wn.mergeConfig=ph;Wn.AxiosHeaders=Zn;Wn.formToJSON=i=>x6(Ke.isHTMLForm(i)?new FormData(i):i);Wn.getAdapter=O6.getAdapter;Wn.HttpStatusCode=hD;Wn.default=Wn;var L6=Wn;var{Axios:nLt,AxiosError:oLt,CanceledError:aLt,isCancel:sLt,CancelToken:hLt,VERSION:fLt,all:uLt,Cancel:cLt,isAxiosError:lLt,spread:dLt,toFormData:pLt,AxiosHeaders:gLt,HttpStatusCode:mLt,formToJSON:vLt,getAdapter:yLt,mergeConfig:bLt}=L6;Tt();Rt();xt();var dD=Sl(cD(),1),p7="axios-retry";function pD(i){let t=["ERR_CANCELED","ECONNABORTED"];return i.response||!i.code||t.includes(i.code)?!1:(0,dD.default)(i)}var gD=["get","head","options"],Cht=gD.concat(["put","delete"]);function g7(i){return i.code!=="ECONNABORTED"&&(!i.response||i.response.status===429||i.response.status>=500&&i.response.status<=599)}function Pht(i){return i.config?.method?g7(i)&&gD.indexOf(i.config.method)!==-1:!1}function mD(i){return i.config?.method?g7(i)&&Cht.indexOf(i.config.method)!==-1:!1}function vD(i){return pD(i)||mD(i)}function yD(i=void 0){let t=i?.response?.headers["retry-after"];if(!t)return 0;let r=(Number(t)||0)*1e3;return r===0&&(r=(new Date(t).valueOf()||0)-Date.now()),Math.max(0,r)}function Nht(i=0,t=void 0){return Math.max(0,yD(t))}function Lht(i=0,t=void 0,r=100){let h=2**i*r,o=Math.max(h,yD(t)),l=o*.2*Math.random();return o+l}var Dht={retries:3,retryCondition:vD,retryDelay:Nht,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function $ht(i,t){return{...Dht,...t,...i[p7]}}function lD(i,t){let r=$ht(i,t||{});return r.retryCount=r.retryCount||0,r.lastRequestTime=r.lastRequestTime||Date.now(),i[p7]=r,r}function Uht(i,t){i.defaults.agent===t.agent&&delete t.agent,i.defaults.httpAgent===t.httpAgent&&delete t.httpAgent,i.defaults.httpsAgent===t.httpsAgent&&delete t.httpsAgent}async function qht(i,t){let{retries:r,retryCondition:h}=i,o=(i.retryCount||0)<r&&h(t);if(typeof o=="object")try{return await o!==!1}catch{return!1}return o}async function Fht(i,t,r,h){t.retryCount+=1;let{retryDelay:o,shouldResetTimeout:l,onRetry:c}=t,p=o(t.retryCount,r);if(Uht(i,h),!l&&h.timeout&&t.lastRequestTime){let w=Date.now()-t.lastRequestTime,m=h.timeout-w-p;if(m<=0)return Promise.reject(r);h.timeout=m}return h.transformRequest=[w=>w],await c(t.retryCount,r,h),new Promise(w=>{setTimeout(()=>w(i(h)),p)})}async function jht(i,t){i.retryCount>=i.retries&&await i.onMaxRetryTimesExceeded(t,i.retryCount)}var Rl=(i,t)=>{let r=i.interceptors.request.use(o=>(lD(o,t),o[p7]?.validateResponse&&(o.validateStatus=()=>!1),o)),h=i.interceptors.response.use(null,async o=>{let{config:l}=o;if(!l)return Promise.reject(o);let c=lD(l,t);return o.response&&c.validateResponse?.(o.response)?o.response:await qht(c,o)?Fht(i,c,o,l):(await jht(c,o),Promise.reject(o))});return{requestInterceptorId:r,responseInterceptorId:h}};Rl.isNetworkError=pD;Rl.isSafeRequestError=Pht;Rl.isIdempotentRequestError=mD;Rl.isNetworkOrIdempotentRequestError=vD;Rl.exponentialDelay=Lht;Rl.isRetryableError=g7;var D6=Rl;Tt();Rt();xt();var z9=Sl(Xq(),1);Tt();Rt();xt();var r1="1.2.0-alpha.
|
|
221
|
+
`+l):h.stack=l}catch{}}throw h}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=ph(this.defaults,r);let{transitional:h,paramsSerializer:o,headers:l}=r;h!==void 0&&N6.assertOptions(h,{silentJSONParsing:uc.transitional(uc.boolean),forcedJSONParsing:uc.transitional(uc.boolean),clarifyTimeoutError:uc.transitional(uc.boolean)},!1),o!=null&&(Ke.isFunction(o)?r.paramsSerializer={serialize:o}:N6.assertOptions(o,{encode:uc.function,serialize:uc.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let c=l&&Ke.merge(l.common,l[r.method]);l&&Ke.forEach(["delete","get","head","post","put","patch","common"],A=>{delete l[A]}),r.headers=Zn.concat(c,l);let p=[],w=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(r)===!1||(w=w&&R.synchronous,p.unshift(R.fulfilled,R.rejected))});let m=[];this.interceptors.response.forEach(function(R){m.push(R.fulfilled,R.rejected)});let y,v=0,M;if(!w){let A=[C6.bind(this),void 0];for(A.unshift.apply(A,p),A.push.apply(A,m),M=A.length,y=Promise.resolve(r);v<M;)y=y.then(A[v++],A[v++]);return y}M=p.length;let T=r;for(v=0;v<M;){let A=p[v++],R=p[v++];try{T=A(T)}catch(B){R.call(this,B);break}}try{y=C6.call(this,T)}catch(A){return Promise.reject(A)}for(v=0,M=m.length;v<M;)y=y.then(m[v++],m[v++]);return y}getUri(t){t=ph(this.defaults,t);let r=f2(t.baseURL,t.url);return n2(r,t.params,t.paramsSerializer)}};Ke.forEach(["delete","get","head","options"],function(t){Nd.prototype[t]=function(r,h){return this.request(ph(h||{},{method:t,url:r,data:(h||{}).data}))}});Ke.forEach(["post","put","patch"],function(t){function r(h){return function(l,c,p){return this.request(ph(p||{},{method:t,headers:h?{"Content-Type":"multipart/form-data"}:{},url:l,data:c}))}}Nd.prototype[t]=r(),Nd.prototype[t+"Form"]=r(!0)});var u2=Nd;Tt();Rt();xt();var u7=class i{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(l){r=l});let h=this;this.promise.then(o=>{if(!h._listeners)return;let l=h._listeners.length;for(;l-- >0;)h._listeners[l](o);h._listeners=null}),this.promise.then=o=>{let l,c=new Promise(p=>{h.subscribe(p),l=p}).then(o);return c.cancel=function(){h.unsubscribe(l)},c},t(function(l,c,p){h.reason||(h.reason=new of(l,c,p),r(h.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new i(function(o){t=o}),cancel:t}}},sD=u7;Tt();Rt();xt();function c7(i){return function(r){return i.apply(null,r)}}Tt();Rt();xt();function l7(i){return Ke.isObject(i)&&i.isAxiosError===!0}Tt();Rt();xt();var d7={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(d7).forEach(([i,t])=>{d7[t]=i});var hD=d7;function fD(i){let t=new u2(i),r=e2(u2.prototype.request,t);return Ke.extend(r,u2.prototype,t,{allOwnKeys:!0}),Ke.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return fD(ph(i,o))},r}var Wn=fD(Od);Wn.Axios=u2;Wn.CanceledError=of;Wn.CancelToken=sD;Wn.isCancel=s2;Wn.VERSION=P6;Wn.toFormData=fc;Wn.AxiosError=Nr;Wn.Cancel=Wn.CanceledError;Wn.all=function(t){return Promise.all(t)};Wn.spread=c7;Wn.isAxiosError=l7;Wn.mergeConfig=ph;Wn.AxiosHeaders=Zn;Wn.formToJSON=i=>x6(Ke.isHTMLForm(i)?new FormData(i):i);Wn.getAdapter=O6.getAdapter;Wn.HttpStatusCode=hD;Wn.default=Wn;var L6=Wn;var{Axios:nLt,AxiosError:oLt,CanceledError:aLt,isCancel:sLt,CancelToken:hLt,VERSION:fLt,all:uLt,Cancel:cLt,isAxiosError:lLt,spread:dLt,toFormData:pLt,AxiosHeaders:gLt,HttpStatusCode:mLt,formToJSON:vLt,getAdapter:yLt,mergeConfig:bLt}=L6;Tt();Rt();xt();var dD=Sl(cD(),1),p7="axios-retry";function pD(i){let t=["ERR_CANCELED","ECONNABORTED"];return i.response||!i.code||t.includes(i.code)?!1:(0,dD.default)(i)}var gD=["get","head","options"],Cht=gD.concat(["put","delete"]);function g7(i){return i.code!=="ECONNABORTED"&&(!i.response||i.response.status===429||i.response.status>=500&&i.response.status<=599)}function Pht(i){return i.config?.method?g7(i)&&gD.indexOf(i.config.method)!==-1:!1}function mD(i){return i.config?.method?g7(i)&&Cht.indexOf(i.config.method)!==-1:!1}function vD(i){return pD(i)||mD(i)}function yD(i=void 0){let t=i?.response?.headers["retry-after"];if(!t)return 0;let r=(Number(t)||0)*1e3;return r===0&&(r=(new Date(t).valueOf()||0)-Date.now()),Math.max(0,r)}function Nht(i=0,t=void 0){return Math.max(0,yD(t))}function Lht(i=0,t=void 0,r=100){let h=2**i*r,o=Math.max(h,yD(t)),l=o*.2*Math.random();return o+l}var Dht={retries:3,retryCondition:vD,retryDelay:Nht,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function $ht(i,t){return{...Dht,...t,...i[p7]}}function lD(i,t){let r=$ht(i,t||{});return r.retryCount=r.retryCount||0,r.lastRequestTime=r.lastRequestTime||Date.now(),i[p7]=r,r}function Uht(i,t){i.defaults.agent===t.agent&&delete t.agent,i.defaults.httpAgent===t.httpAgent&&delete t.httpAgent,i.defaults.httpsAgent===t.httpsAgent&&delete t.httpsAgent}async function qht(i,t){let{retries:r,retryCondition:h}=i,o=(i.retryCount||0)<r&&h(t);if(typeof o=="object")try{return await o!==!1}catch{return!1}return o}async function Fht(i,t,r,h){t.retryCount+=1;let{retryDelay:o,shouldResetTimeout:l,onRetry:c}=t,p=o(t.retryCount,r);if(Uht(i,h),!l&&h.timeout&&t.lastRequestTime){let w=Date.now()-t.lastRequestTime,m=h.timeout-w-p;if(m<=0)return Promise.reject(r);h.timeout=m}return h.transformRequest=[w=>w],await c(t.retryCount,r,h),new Promise(w=>{setTimeout(()=>w(i(h)),p)})}async function jht(i,t){i.retryCount>=i.retries&&await i.onMaxRetryTimesExceeded(t,i.retryCount)}var Rl=(i,t)=>{let r=i.interceptors.request.use(o=>(lD(o,t),o[p7]?.validateResponse&&(o.validateStatus=()=>!1),o)),h=i.interceptors.response.use(null,async o=>{let{config:l}=o;if(!l)return Promise.reject(o);let c=lD(l,t);return o.response&&c.validateResponse?.(o.response)?o.response:await qht(c,o)?Fht(i,c,o,l):(await jht(c,o),Promise.reject(o))});return{requestInterceptorId:r,responseInterceptorId:h}};Rl.isNetworkError=pD;Rl.isSafeRequestError=Pht;Rl.isIdempotentRequestError=mD;Rl.isNetworkOrIdempotentRequestError=vD;Rl.exponentialDelay=Lht;Rl.isRetryableError=g7;var D6=Rl;Tt();Rt();xt();var z9=Sl(Xq(),1);Tt();Rt();xt();var r1="1.2.0-alpha.10";var la=class{logger;silent=!1;constructor({level:t="info"}={}){if(t==="none"){this.silent=!0;return}this.logger=z9.default.createLogger({level:t,name:"ar-io-sdk",version:r1,serializers:z9.default.stdSerializers})}info(t,...r){this.silent||this.logger.info(...r,t)}warn(t,...r){this.silent||this.logger.warn(...r,t)}error(t,...r){this.silent||this.logger.error(...r,t)}debug(t,...r){this.silent||this.logger.debug(...r,t)}setLogLevel(t){if(t==="none"){this.silent=!0;return}this.logger.level(t)}};var Yq=({axiosConfig:i={},logger:t=new la,retryConfig:r={retries:5,retryDelay:D6.exponentialDelay,retryCondition:h=>D6.isRetryableError(h),onRetry(h,o,l){t.error(`Retrying request ${l.url} attempt ${h}`,o)}}}={})=>{let h=L6.create({...i,maxRedirects:0,headers:{...i.headers,"x-source-version":`${r1}`,"x-source-identifier":"ar-io-sdk"},validateStatus:()=>!0});return D6(h,r),h};Tt();Rt();xt();Tt();Rt();xt();Tt();Rt();xt();var yh=class extends Error{constructor(t){super(t),this.name=this.constructor.name}},xy=class extends yh{},Qq=class extends yh{},Wl=class extends yh{constructor(t,r){super(`Failed request: ${t}: ${r}`)}},Ry=class extends yh{},i1=class extends yh{},tF=class extends yh{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},No=class extends yh{constructor(){super("Invalid contract configuration")}},eF=class extends yh{constructor(){super("Invalid process configuration")}},n1=class extends yh{};var o1=100;async function xqt({address:i,arweave:t,signal:r=AbortSignal.timeout(1e4)}){let h=!1,o,l=new Set;do{let c={query:`
|
|
222
222
|
{
|
|
223
223
|
transactions (
|
|
224
224
|
owners:["${i}"]
|
package/lib/cjs/constants.js
CHANGED
|
@@ -26,6 +26,6 @@ exports.ARNS_TESTNET_REGISTRY_TX = process.env.ARNS_REGISTRY_TX ?? 'bLAgYxAdX2Ry
|
|
|
26
26
|
exports.ARNS_DEVNET_REGISTRY_TX = '_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8';
|
|
27
27
|
exports.ioDevnetProcessId = 'GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc';
|
|
28
28
|
exports.MIO_PER_IO = 1_000_000;
|
|
29
|
-
exports.AOS_MODULE_ID = '
|
|
30
|
-
exports.ANT_LUA_ID = '
|
|
29
|
+
exports.AOS_MODULE_ID = 'cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk';
|
|
30
|
+
exports.ANT_LUA_ID = '3OlGzE5mrsN2GsxCYM0Tae1KzWepGOr5a94deOWmApM';
|
|
31
31
|
exports.DEFAULT_SCHEDULER_ID = '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA';
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/constants.js
CHANGED
|
@@ -23,6 +23,6 @@ export const ARNS_TESTNET_REGISTRY_TX = process.env.ARNS_REGISTRY_TX ?? 'bLAgYxA
|
|
|
23
23
|
export const ARNS_DEVNET_REGISTRY_TX = '_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8';
|
|
24
24
|
export const ioDevnetProcessId = 'GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc';
|
|
25
25
|
export const MIO_PER_IO = 1_000_000;
|
|
26
|
-
export const AOS_MODULE_ID = '
|
|
27
|
-
export const ANT_LUA_ID = '
|
|
26
|
+
export const AOS_MODULE_ID = 'cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk';
|
|
27
|
+
export const ANT_LUA_ID = '3OlGzE5mrsN2GsxCYM0Tae1KzWepGOr5a94deOWmApM';
|
|
28
28
|
export const DEFAULT_SCHEDULER_ID = '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA';
|
package/lib/esm/version.js
CHANGED
package/lib/types/constants.d.ts
CHANGED
|
@@ -22,6 +22,6 @@ export declare const ARNS_TESTNET_REGISTRY_TX: string;
|
|
|
22
22
|
export declare const ARNS_DEVNET_REGISTRY_TX = "_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8";
|
|
23
23
|
export declare const ioDevnetProcessId = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc";
|
|
24
24
|
export declare const MIO_PER_IO = 1000000;
|
|
25
|
-
export declare const AOS_MODULE_ID = "
|
|
26
|
-
export declare const ANT_LUA_ID = "
|
|
25
|
+
export declare const AOS_MODULE_ID = "cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk";
|
|
26
|
+
export declare const ANT_LUA_ID = "3OlGzE5mrsN2GsxCYM0Tae1KzWepGOr5a94deOWmApM";
|
|
27
27
|
export declare const DEFAULT_SCHEDULER_ID = "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";
|
package/lib/types/version.d.ts
CHANGED