@ar.io/sdk 2.2.3 → 2.3.0-alpha.1

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.
@@ -124,12 +124,12 @@ Found: ${e.toString().split(`
124
124
  -----END RSA `+a+` KEY-----
125
125
  `,c=ge.alloc(0);r?(e.version="two-prime",c=oue.encode(e,"der")):c=iue.encode(e,"der");var d=c.toString("base64").match(/.{1,64}/g).join(`
126
126
  `);return i+d+h}Ks.jwkTopem=Dqe});var lue=ht(oc=>{"use strict";X();ee();Q();var $qe=oc&&oc.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),Uqe=oc&&oc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qqe=oc&&oc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$qe(e,t,r);return Uqe(e,t),e};Object.defineProperty(oc,"__esModule",{value:!0});var cue=hue(),Ws=qqe((Sh(),ei($m))),SO=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";encryptionAlgorithm="aes-256-cbc";generateJWK(){if(typeof Ws.generateKeyPair!="function")throw new Error("Keypair generation not supported in this version of Node, only supported in versions 10+");return new Promise((e,r)=>{Ws.generateKeyPair("rsa",{modulusLength:this.keyLength,publicExponent:this.publicExponent,privateKeyEncoding:{type:"pkcs1",format:"pem"},publicKeyEncoding:{type:"pkcs1",format:"pem"}},(a,i,h)=>{a&&r(a),e(this.pemToJWK(h))})})}sign(e,r,{saltLength:a}={}){return new Promise((i,h)=>{i(Ws.createSign(this.hashAlgorithm).update(r).sign({key:this.jwkToPem(e),padding:Ws.constants.RSA_PKCS1_PSS_PADDING,saltLength:a}))})}verify(e,r,a){return new Promise((i,h)=>{let c={kty:"RSA",e:"AQAB",n:e},d=this.jwkToPem(c);i(Ws.createVerify(this.hashAlgorithm).update(r).verify({key:d,padding:Ws.constants.RSA_PKCS1_PSS_PADDING},a))})}hash(e,r="SHA-256"){if(typeof e=="string")throw new TypeError("Data must be a Uint8Array");return new Promise((a,i)=>{a(Ws.createHash(this.parseHashAlgorithm(r)).update(e).digest())})}async encrypt(e,r,a){let i=Ws.pbkdf2Sync(r,a=a||"salt",1e5,32,this.hashAlgorithm),h=Ws.randomBytes(16),c=Ws.createCipheriv(this.encryptionAlgorithm,i,h);return ge.concat([h,c.update(e),c.final()])}async decrypt(e,r,a){try{let i=Ws.pbkdf2Sync(r,a=a||"salt",1e5,32,this.hashAlgorithm),h=e.slice(0,16),c=e.slice(16),d=Ws.createDecipheriv(this.encryptionAlgorithm,i,h);return ge.concat([d.update(c),d.final()])}catch{throw new Error("Failed to decrypt")}}jwkToPem(e){return(0,cue.jwkTopem)(e)}pemToJWK(e){return(0,cue.pemTojwk)(e)}parseHashAlgorithm(e){switch(e){case"SHA-256":return"sha256";case"SHA-384":return"sha384";default:throw new Error(`Algorithm not supported: ${e}`)}}};oc.default=SO});var due=ht(AO=>{"use strict";X();ee();Q();Object.defineProperty(AO,"__esModule",{value:!0});var EO=class{api;constructor(e){this.api=e}getInfo(){return this.api.get("info").then(e=>e.data)}getPeers(){return this.api.get("peers").then(e=>e.data)}};AO.default=EO});var Ob=ht(Bb=>{"use strict";X();ee();Q();Object.defineProperty(Bb,"__esModule",{value:!0});Bb.getError=void 0;var RO=class extends Error{type;response;constructor(e,r={}){r.message?super(r.message):super(),this.type=e,this.response=r.response}getType(){return this.type}};Bb.default=RO;function Fqe(t){let e=t.data;if(typeof t.data=="string")try{e=JSON.parse(t.data)}catch{}if(t.data instanceof ArrayBuffer||t.data instanceof Uint8Array)try{e=JSON.parse(e.toString())}catch{}return e?e.error||e:t.statusText||"unknown"}Bb.getError=Fqe});var sc=ht(qi=>{"use strict";X();ee();Q();var jqe=qi&&qi.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),zqe=qi&&qi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hqe=qi&&qi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jqe(e,t,r);return zqe(e,t),e};Object.defineProperty(qi,"__esModule",{value:!0});qi.b64UrlDecode=qi.b64UrlEncode=qi.bufferTob64Url=qi.bufferTob64=qi.b64UrlToBuffer=qi.stringToB64Url=qi.stringToBuffer=qi.bufferToString=qi.b64UrlToString=qi.concatBuffers=void 0;var pue=Hqe(tA());function Zqe(t){let e=0;for(let i=0;i<t.length;i++)e+=t[i].byteLength;let r=new Uint8Array(e),a=0;r.set(new Uint8Array(t[0]),a),a+=t[0].byteLength;for(let i=1;i<t.length;i++)r.set(new Uint8Array(t[i]),a),a+=t[i].byteLength;return r}qi.concatBuffers=Zqe;function Kqe(t){let e=gue(t);return vue(e)}qi.b64UrlToString=Kqe;function vue(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}qi.bufferToString=vue;function mue(t){return new TextEncoder().encode(t)}qi.stringToBuffer=mue;function Wqe(t){return yue(mue(t))}qi.stringToB64Url=Wqe;function gue(t){return new Uint8Array(pue.toByteArray(_ue(t)))}qi.b64UrlToBuffer=gue;function bue(t){return pue.fromByteArray(new Uint8Array(t))}qi.bufferTob64=bue;function yue(t){return wue(bue(t))}qi.bufferTob64Url=yue;function wue(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}qi.b64UrlEncode=wue;function _ue(t){t=t.replace(/\-/g,"+").replace(/\_/g,"/");let e;return t.length%4==0?e=0:e=4-t.length%4,t.concat("=".repeat(e))}qi.b64UrlDecode=_ue});var Sue=ht(Pb=>{"use strict";X();ee();Q();var Vqe=Pb&&Pb.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pb,"__esModule",{value:!0});var qo=Vqe(n5());async function Mue(t){if(Array.isArray(t)){let a=qo.default.utils.concatBuffers([qo.default.utils.stringToBuffer("list"),qo.default.utils.stringToBuffer(t.length.toString())]);return await xue(t,await qo.default.crypto.hash(a,"SHA-384"))}let e=qo.default.utils.concatBuffers([qo.default.utils.stringToBuffer("blob"),qo.default.utils.stringToBuffer(t.byteLength.toString())]),r=qo.default.utils.concatBuffers([await qo.default.crypto.hash(e,"SHA-384"),await qo.default.crypto.hash(t,"SHA-384")]);return await qo.default.crypto.hash(r,"SHA-384")}Pb.default=Mue;async function xue(t,e){if(t.length<1)return e;let r=qo.default.utils.concatBuffers([e,await Mue(t[0])]),a=await qo.default.crypto.hash(r,"SHA-384");return await xue(t.slice(1),a)}});var PO=ht(jr=>{"use strict";X();ee();Q();var Gqe=jr&&jr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jr,"__esModule",{value:!0});jr.debug=jr.validatePath=jr.arrayCompare=jr.bufferToInt=jr.intToBuffer=jr.arrayFlatten=jr.generateProofs=jr.buildLayers=jr.generateTransactionChunks=jr.generateTree=jr.computeRootHash=jr.generateLeaves=jr.chunkData=jr.MIN_CHUNK_SIZE=jr.MAX_CHUNK_SIZE=void 0;var a5=Gqe(n5()),Eue=sc();jr.MAX_CHUNK_SIZE=256*1024;jr.MIN_CHUNK_SIZE=32*1024;var Cb=32,Av=32;async function kO(t){let e=[],r=t,a=0;for(;r.byteLength>=jr.MAX_CHUNK_SIZE;){let i=jr.MAX_CHUNK_SIZE,h=r.byteLength-jr.MAX_CHUNK_SIZE;h>0&&h<jr.MIN_CHUNK_SIZE&&(i=Math.ceil(r.byteLength/2));let c=r.slice(0,i),d=await a5.default.crypto.hash(c);a+=c.byteLength,e.push({dataHash:d,minByteRange:a-c.byteLength,maxByteRange:a}),r=r.slice(i)}return e.push({dataHash:await a5.default.crypto.hash(r),minByteRange:a,maxByteRange:a+r.byteLength}),e}jr.chunkData=kO;async function IO(t){return Promise.all(t.map(async({dataHash:e,minByteRange:r,maxByteRange:a})=>({type:"leaf",id:await ha(await Promise.all([ha(e),ha(Lb(a))])),dataHash:e,minByteRange:r,maxByteRange:a})))}jr.generateLeaves=IO;async function Yqe(t){return(await Aue(t)).id}jr.computeRootHash=Yqe;async function Aue(t){return await o5(await IO(await kO(t)))}jr.generateTree=Aue;async function Jqe(t){let e=await kO(t),r=await IO(e),a=await o5(r),i=await Rue(a),h=e.slice(-1)[0];return h.maxByteRange-h.minByteRange===0&&(e.splice(e.length-1,1),i.splice(i.length-1,1)),{data_root:a.id,chunks:e,proofs:i}}jr.generateTransactionChunks=Jqe;async function o5(t,e=0){if(t.length<2)return t[0];let r=[];for(let a=0;a<t.length;a+=2)r.push(await Xqe(t[a],t[a+1]));return o5(r,e+1)}jr.buildLayers=o5;function Rue(t){let e=TO(t);return Array.isArray(e)?BO(e):[e]}jr.generateProofs=Rue;function TO(t,e=new Uint8Array,r=0){if(t.type=="leaf")return{offset:t.maxByteRange-1,proof:(0,Eue.concatBuffers)([e,t.dataHash,Lb(t.maxByteRange)])};if(t.type=="branch"){let a=(0,Eue.concatBuffers)([e,t.leftChild.id,t.rightChild.id,Lb(t.byteRange)]);return[TO(t.leftChild,a,r+1),TO(t.rightChild,a,r+1)]}throw new Error("Unexpected node type")}function BO(t){let e=[];return t.forEach(r=>{Array.isArray(r)?e.push(...BO(r)):e.push(r)}),e}jr.arrayFlatten=BO;async function Xqe(t,e){return e?{type:"branch",id:await ha([await ha(t.id),await ha(e.id),await ha(Lb(t.maxByteRange))]),byteRange:t.maxByteRange,maxByteRange:e.maxByteRange,leftChild:t,rightChild:e}:t}async function ha(t){return Array.isArray(t)&&(t=a5.default.utils.concatBuffers(t)),new Uint8Array(await a5.default.crypto.hash(t))}function Lb(t){let e=new Uint8Array(Cb);for(var r=e.length-1;r>=0;r--){var a=t%256;e[r]=a,t=(t-a)/256}return e}jr.intToBuffer=Lb;function OO(t){let e=0;for(var r=0;r<t.length;r++)e*=256,e+=t[r];return e}jr.bufferToInt=OO;var Qqe=(t,e)=>t.every((r,a)=>e[a]===r);jr.arrayCompare=Qqe;async function Nb(t,e,r,a,i){if(a<=0)return!1;if(e>=a)return Nb(t,0,a-1,a,i);if(e<0)return Nb(t,0,0,a,i);if(i.length==Av+Cb){let M=i.slice(0,Av),x=i.slice(M.length,M.length+Cb),E=await ha([await ha(M),await ha(x)]);return(0,jr.arrayCompare)(t,E)?{offset:a-1,leftBound:r,rightBound:a,chunkSize:a-r}:!1}let h=i.slice(0,Av),c=i.slice(h.length,h.length+Av),d=i.slice(h.length+c.length,h.length+c.length+Cb),b=OO(d),g=i.slice(h.length+c.length+d.length),y=await ha([await ha(h),await ha(c),await ha(d)]);return(0,jr.arrayCompare)(t,y)?e<b?await Nb(h,e,r,Math.min(a,b),g):await Nb(c,e,Math.max(r,b),a,g):!1}jr.validatePath=Nb;async function Tue(t,e=""){if(t.byteLength<1)return e;let r=t.slice(0,Av),a=t.slice(r.length,r.length+Av),i=t.slice(r.length+a.length,r.length+a.length+Cb),h=OO(i),c=t.slice(r.length+a.length+i.length),d=await ha([await ha(r),await ha(a),await ha(i)]),b=`${e}
127
- ${JSON.stringify(ge.from(r))},${JSON.stringify(ge.from(a))},${h} => ${JSON.stringify(d)}`;return Tue(c,b)}jr.debug=Tue});var f5=ht(Fo=>{"use strict";X();ee();Q();var eFe=Fo&&Fo.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),tFe=Fo&&Fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rFe=Fo&&Fo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eFe(e,t,r);return tFe(e,t),e},iFe=Fo&&Fo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Tag=void 0;var Zn=rFe(sc()),nFe=iFe(Sue()),aFe=PO(),s5=class{get(e,r){if(!Object.getOwnPropertyNames(this).includes(e))throw new Error(`Field "${e}" is not a property of the Arweave Transaction class.`);if(this[e]instanceof Uint8Array)return r&&r.decode&&r.string?Zn.bufferToString(this[e]):r&&r.decode&&!r.string?this[e]:Zn.bufferTob64Url(this[e]);if(this[e]instanceof Array){if(r?.decode!==void 0||r?.string!==void 0)throw e==="tags"&&console.warn(`Did you mean to use 'transaction["tags"]' ?`),new Error("Cannot decode or stringify an array.");return this[e]}return r&&r.decode==!0?r&&r.string?Zn.b64UrlToString(this[e]):Zn.b64UrlToBuffer(this[e]):this[e]}},Db=class extends s5{name;value;constructor(e,r,a=!1){super(),this.name=e,this.value=r}};Fo.Tag=Db;var NO=class extends s5{format=2;id="";last_tx="";owner="";tags=[];target="";quantity="0";data_size="0";data=new Uint8Array;data_root="";reward="0";signature="";chunks;constructor(e={}){super(),Object.assign(this,e),typeof this.data=="string"&&(this.data=Zn.b64UrlToBuffer(this.data)),e.tags&&(this.tags=e.tags.map(r=>new Db(r.name,r.value)))}addTag(e,r){this.tags.push(new Db(Zn.stringToB64Url(e),Zn.stringToB64Url(r)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:Zn.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(e){this.owner=e}setSignature({id:e,owner:r,reward:a,tags:i,signature:h}){this.id=e,this.owner=r,a&&(this.reward=a),i&&(this.tags=i),this.signature=h}async prepareChunks(e){!this.chunks&&e.byteLength>0&&(this.chunks=await(0,aFe.generateTransactionChunks)(e),this.data_root=Zn.bufferTob64Url(this.chunks.data_root)),!this.chunks&&e.byteLength===0&&(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(e,r){if(!this.chunks)throw new Error("Chunks have not been prepared");let a=this.chunks.proofs[e],i=this.chunks.chunks[e];return{data_root:this.data_root,data_size:this.data_size,data_path:Zn.bufferTob64Url(a.proof),offset:a.offset.toString(),chunk:Zn.bufferTob64Url(r.slice(i.minByteRange,i.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let e=this.tags.reduce((a,i)=>Zn.concatBuffers([a,i.get("name",{decode:!0,string:!1}),i.get("value",{decode:!0,string:!1})]),new Uint8Array);return Zn.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),Zn.stringToBuffer(this.quantity),Zn.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),e]);case 2:this.data_root||await this.prepareChunks(this.data);let r=this.tags.map(a=>[a.get("name",{decode:!0,string:!1}),a.get("value",{decode:!0,string:!1})]);return await(0,nFe.default)([Zn.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),Zn.stringToBuffer(this.quantity),Zn.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),r,Zn.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}};Fo.default=NO});var Oue=ht(Vs=>{"use strict";X();ee();Q();var oFe=Vs&&Vs.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),sFe=Vs&&Vs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fFe=Vs&&Vs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oFe(e,t,r);return sFe(e,t),e},uFe=Vs&&Vs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.TransactionUploader=void 0;var kue=uFe(f5()),hFe=fFe(sc()),CO=Ob(),cFe=PO(),Iue=1,lFe=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"],Bue=1e3*40,LO=class t{api;chunkIndex=0;txPosted=!1;transaction;lastRequestTimeEnd=0;totalErrors=0;data;lastResponseStatus=0;lastResponseError="";get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}constructor(e,r){if(this.api=e,!r.id)throw new Error("Transaction is not signed");if(!r.chunks)throw new Error("Transaction chunks not prepared");this.data=r.data,this.transaction=new kue.default(Object.assign({},r,{data:new Uint8Array(0)}))}async uploadChunk(e){if(this.isComplete)throw new Error("Upload is already complete");if(this.lastResponseError!==""?this.totalErrors++:this.totalErrors=0,this.totalErrors===100)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let r=this.lastResponseError===""?0:Math.max(this.lastRequestTimeEnd+Bue-Date.now(),Bue);if(r>0&&(r=r-r*Math.random()*.3,await new Promise(c=>setTimeout(c,r))),this.lastResponseError="",!this.txPosted){await this.postTransaction();return}e&&(this.chunkIndex=e);let a=this.transaction.getChunk(e||this.chunkIndex,this.data);if(!await(0,cFe.validatePath)(this.transaction.chunks.data_root,parseInt(a.offset),0,parseInt(a.data_size),hFe.b64UrlToBuffer(a.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);let h=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch(c=>(console.error(c.message),{status:-1,data:{error:c.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=h.status,this.lastResponseStatus==200)this.chunkIndex++;else if(this.lastResponseError=(0,CO.getError)(h),lFe.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(e,r,a){if(!r||typeof r.chunkIndex!="number"||typeof r.transaction!="object")throw new Error("Serialized object does not match expected format.");var i=new kue.default(r.transaction);i.chunks||await i.prepareChunks(a);let h=new t(e,i);if(h.chunkIndex=r.chunkIndex,h.lastRequestTimeEnd=r.lastRequestTimeEnd,h.lastResponseError=r.lastResponseError,h.lastResponseStatus=r.lastResponseStatus,h.txPosted=r.txPosted,h.data=a,h.transaction.data_root!==r.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return h}static async fromTransactionId(e,r){let a=await e.get(`tx/${r}`);if(a.status!==200)throw new Error(`Tx ${r} not found: ${a.status}`);let i=a.data;return i.data=new Uint8Array(0),{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:i}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=Iue){this.transaction.data=this.data;let a=await this.api.post("tx",this.transaction).catch(i=>(console.error(i),{status:-1,data:{error:i.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=a.status,this.transaction.data=new Uint8Array(0),a.status>=200&&a.status<300){this.txPosted=!0,this.chunkIndex=Iue;return}throw this.lastResponseError=(0,CO.getError)(a),new Error(`Unable to upload transaction: ${a.status}, ${this.lastResponseError}`)}let r=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=r.status,!(r.status>=200&&r.status<300))throw this.lastResponseError=(0,CO.getError)(r),new Error(`Unable to upload transaction: ${r.status}, ${this.lastResponseError}`);this.txPosted=!0}};Vs.TransactionUploader=LO});var u5=ht((V6t,Pue)=>{"use strict";X();ee();Q();Pue.exports={}});var Cue=ht(Gf=>{"use strict";X();ee();Q();var dFe=Gf&&Gf.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),pFe=Gf&&Gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vFe=Gf&&Gf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dFe(e,t,r);return pFe(e,t),e},Nue=Gf&&Gf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gf,"__esModule",{value:!0});var DO=Nue(Ob()),fc=Nue(f5()),$b=vFe(sc()),$O=Oue();u5();var UO=class{api;crypto;chunks;constructor(e,r,a){this.api=e,this.crypto=r,this.chunks=a}async getTransactionAnchor(){let e=await this.api.get("tx_anchor");if(!e.data.match(/^[a-z0-9_-]{43,}/i)||!e.ok)throw new Error(`Could not getTransactionAnchor. Received: ${e.data}. Status: ${e.status}, ${e.statusText}`);return e.data}async getPrice(e,r){let a=r?`price/${e}/${r}`:`price/${e}`,i=await this.api.get(a);if(!/^\d+$/.test(i.data)||!i.ok)throw new Error(`Could not getPrice. Received: ${i.data}. Status: ${i.status}, ${i.statusText}`);return i.data}async get(e){let r=await this.api.get(`tx/${e}`);if(r.status==200){let a=parseInt(r.data.data_size);if(r.data.format>=2&&a>0&&a<=1024*1024*12){let i=await this.getData(e);return new fc.default({...r.data,data:i})}return new fc.default({...r.data,format:r.data.format||1})}throw r.status==404?new DO.default("TX_NOT_FOUND"):r.status==410?new DO.default("TX_FAILED"):new DO.default("TX_INVALID")}fromRaw(e){return new fc.default(e)}async search(e,r){return this.api.post("arql",{op:"equals",expr1:e,expr2:r}).then(a=>a.data?a.data:[])}getStatus(e){return this.api.get(`tx/${e}/status`).then(r=>r.status==200?{status:200,confirmed:r.data}:{status:r.status,confirmed:null})}async getData(e,r){let a;try{a=await this.chunks.downloadChunkedData(e)}catch(i){console.error(`Error while trying to download chunked data for ${e}`),console.error(i)}if(!a){console.warn(`Falling back to gateway cache for ${e}`);try{let{data:i,ok:h,status:c,statusText:d}=await this.api.get(`/${e}`,{responseType:"arraybuffer"});if(!h)throw new Error("Bad http status code",{cause:{status:c,statusText:d}});a=i}catch(i){console.error(`Error while trying to download contiguous data from gateway cache for ${e}`),console.error(i)}}if(!a)throw new Error(`${e} data was not found!`);return r&&r.decode&&!r.string?a:r&&r.decode&&r.string?$b.bufferToString(a):$b.bufferTob64Url(a)}async sign(e,r,a){let h=typeof r=="object"&&(d=>{let b=!0;return["n","e","d","p","q","dp","dq","qi"].map(g=>!(g in d)&&(b=!1)),b})(r),c=typeof arweaveWallet=="object";if(!h&&!c)throw new Error("No valid JWK or external wallet found to sign transaction.");if(h){e.setOwner(r.n);let d=await e.getSignatureData(),b=await this.crypto.sign(r,d,a),g=await this.crypto.hash(b);e.setSignature({id:$b.bufferTob64Url(g),owner:r.n,signature:$b.bufferTob64Url(b)})}else if(c){try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}let d=await arweaveWallet.sign(e,a);e.setSignature({id:d.id,owner:d.owner,reward:d.reward,tags:d.tags,signature:d.signature})}else throw new Error("An error occurred while signing. Check wallet is valid")}async verify(e){let r=await e.getSignatureData(),a=e.get("signature",{decode:!0,string:!1}),i=$b.bufferTob64Url(await this.crypto.hash(a));if(e.id!==i)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(e.owner,r,a)}async post(e){if(typeof e=="string"?e=new fc.default(JSON.parse(e)):typeof e.readInt32BE=="function"?e=new fc.default(JSON.parse(e.toString())):typeof e=="object"&&!(e instanceof fc.default)&&(e=new fc.default(e)),!(e instanceof fc.default))throw new Error("Must be Transaction object");e.chunks||await e.prepareChunks(e.data);let r=await this.getUploader(e,e.data);try{for(;!r.isComplete;)await r.uploadChunk()}catch(a){if(r.lastResponseStatus>0)return{status:r.lastResponseStatus,statusText:r.lastResponseError,data:{error:r.lastResponseError}};throw a}return{status:200,statusText:"OK",data:{}}}async getUploader(e,r){let a;if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),e instanceof fc.default){if(r||(r=e.data),!(r instanceof Uint8Array))throw new Error("Data format is invalid");e.chunks||await e.prepareChunks(r),a=new $O.TransactionUploader(this.api,e),(!a.data||a.data.length===0)&&(a.data=r)}else{if(typeof e=="string"&&(e=await $O.TransactionUploader.fromTransactionId(this.api,e)),!r||!(r instanceof Uint8Array))throw new Error("Must provide data when resuming upload");a=await $O.TransactionUploader.fromSerialized(this.api,e,r)}return a}async*upload(e,r){let a=await this.getUploader(e,r);for(;!a.isComplete;)await a.uploadChunk(),yield a;return a}};Gf.default=UO});var Due=ht(uc=>{"use strict";X();ee();Q();var mFe=uc&&uc.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),gFe=uc&&uc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bFe=uc&&uc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mFe(e,t,r);return gFe(e,t),e};Object.defineProperty(uc,"__esModule",{value:!0});var Lue=bFe(sc());u5();var qO=class{api;crypto;constructor(e,r){this.api=e,this.crypto=r}getBalance(e){return this.api.get(`wallet/${e}/balance`).then(r=>r.data)}getLastTransactionID(e){return this.api.get(`wallet/${e}/last_tx`).then(r=>r.data)}generate(){return this.crypto.generateJWK()}async jwkToAddress(e){return!e||e==="use_wallet"?this.getAddress():this.getAddress(e)}async getAddress(e){if(!e||e==="use_wallet"){try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}else return this.ownerToAddress(e.n)}async ownerToAddress(e){return Lue.bufferTob64Url(await this.crypto.hash(Lue.b64UrlToBuffer(e)))}};uc.default=qO});var Uue=ht(Yf=>{"use strict";X();ee();Q();var yFe=Yf&&Yf.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),wFe=Yf&&Yf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Fe=Yf&&Yf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yFe(e,t,r);return wFe(e,t),e};Object.defineProperty(Yf,"__esModule",{value:!0});Yf.SiloResource=void 0;var $ue=_Fe(sc()),FO=class{api;crypto;transactions;constructor(e,r,a){this.api=e,this.crypto=r,this.transactions=a}async get(e){if(!e)throw new Error("No Silo URI specified");let r=await this.parseUri(e),a=await this.transactions.search("Silo-Name",r.getAccessKey());if(a.length==0)throw new Error(`No data could be found for the Silo URI: ${e}`);let i=await this.transactions.get(a[0]);if(!i)throw new Error(`No data could be found for the Silo URI: ${e}`);let h=i.get("data",{decode:!0,string:!1});return this.crypto.decrypt(h,r.getEncryptionKey())}async readTransactionData(e,r){if(!r)throw new Error("No Silo URI specified");let a=await this.parseUri(r),i=e.get("data",{decode:!0,string:!1});return this.crypto.decrypt(i,a.getEncryptionKey())}async parseUri(e){let r=e.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!r)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");let a=r[1],i=Math.pow(2,parseInt(r[2])),h=await this.hash($ue.stringToBuffer(a),i),c=$ue.bufferTob64(h.slice(0,15)),d=await this.hash(h.slice(16,31),1);return new h5(e,c,d)}async hash(e,r){let a=await this.crypto.hash(e);for(let i=0;i<r-1;i++)a=await this.crypto.hash(a);return a}};Yf.default=FO;var h5=class{uri;accessKey;encryptionKey;constructor(e,r,a){this.uri=e,this.accessKey=r,this.encryptionKey=a}getUri(){return this.uri}getAccessKey(){return this.accessKey}getEncryptionKey(){return this.encryptionKey}};Yf.SiloResource=h5});var Fue=ht(hc=>{"use strict";X();ee();Q();var MFe=hc&&hc.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),xFe=hc&&hc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SFe=hc&&hc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MFe(e,t,r);return xFe(e,t),e};Object.defineProperty(hc,"__esModule",{value:!0});var que=Ob(),EFe=SFe(sc()),jO=class{api;constructor(e){this.api=e}async getTransactionOffset(e){let r=await this.api.get(`tx/${e}/offset`);if(r.status===200)return r.data;throw new Error(`Unable to get transaction offset: ${(0,que.getError)(r)}`)}async getChunk(e){let r=await this.api.get(`chunk/${e}`);if(r.status===200)return r.data;throw new Error(`Unable to get chunk: ${(0,que.getError)(r)}`)}async getChunkData(e){let r=await this.getChunk(e);return EFe.b64UrlToBuffer(r.chunk)}firstChunkOffset(e){return parseInt(e.offset)-parseInt(e.size)+1}async downloadChunkedData(e){let r=await this.getTransactionOffset(e),a=parseInt(r.size),h=parseInt(r.offset)-a+1,c=new Uint8Array(a),d=0;for(;d<a;){this.api.config.logging&&console.log(`[chunk] ${d}/${a}`);let b;try{b=await this.getChunkData(h+d)}catch{console.error(`[chunk] Failed to fetch chunk at offset ${h+d}`),console.error("[chunk] This could indicate that the chunk wasn't uploaded or hasn't yet seeded properly to a particular gateway/node")}if(b)c.set(b,d),d+=b.length;else throw new Error(`Couldn't complete data download at ${d}/${a}`)}return c}};hc.default=jO});var zue=ht(Ub=>{"use strict";X();ee();Q();var AFe=Ub&&Ub.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ub,"__esModule",{value:!0});var jue=AFe(Ob());u5();var zO=class t{api;network;static HASH_ENDPOINT="block/hash/";static HEIGHT_ENDPOINT="block/height/";constructor(e,r){this.api=e,this.network=r}async get(e){let r=await this.api.get(`${t.HASH_ENDPOINT}${e}`);if(r.status===200)return r.data;throw r.status===404?new jue.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${r}`)}async getByHeight(e){let r=await this.api.get(`${t.HEIGHT_ENDPOINT}${e}`);if(r.status===200)return r.data;throw r.status===404?new jue.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${r}`)}async getCurrent(){let{current:e}=await this.network.getInfo();return await this.get(e)}};Ub.default=zO});var n5=ht(Jf=>{"use strict";X();ee();Q();var RFe=Jf&&Jf.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),TFe=Jf&&Jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kFe=Jf&&Jf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RFe(e,t,r);return TFe(e,t),e},Xu=Jf&&Jf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Jf,"__esModule",{value:!0});var IFe=Xu(tue()),BFe=Xu(rue()),OFe=Xu(lue()),PFe=Xu(due()),NFe=Xu(Cue()),CFe=Xu(Due()),Hue=Xu(f5()),qb=kFe(sc()),LFe=Xu(Uue()),DFe=Xu(Fue()),$Fe=Xu(zue()),HO=class t{api;wallets;transactions;network;blocks;ar;silo;chunks;static init;static crypto=new OFe.default;static utils=qb;constructor(e){this.api=new BFe.default(e),this.wallets=new CFe.default(this.api,t.crypto),this.chunks=new DFe.default(this.api),this.transactions=new NFe.default(this.api,t.crypto,this.chunks),this.silo=new LFe.default(this.api,this.crypto,this.transactions),this.network=new PFe.default(this.api),this.blocks=new $Fe.default(this.api,this.network),this.ar=new IFe.default}get crypto(){return t.crypto}get utils(){return t.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(e,r){let a={};if(Object.assign(a,e),!e.data&&!(e.target&&e.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(e.owner==null&&r&&r!=="use_wallet"&&(a.owner=r.n),e.last_tx==null&&(a.last_tx=await this.transactions.getTransactionAnchor()),typeof e.data=="string"&&(e.data=qb.stringToBuffer(e.data)),e.data instanceof ArrayBuffer&&(e.data=new Uint8Array(e.data)),e.data&&!(e.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(e.reward==null){let h=e.data?e.data.byteLength:0;a.reward=await this.transactions.getPrice(h,a.target)}a.data_root="",a.data_size=e.data?e.data.byteLength.toString():"0",a.data=e.data||new Uint8Array(0);let i=new Hue.default(a);return await i.getSignatureData(),i}async createSiloTransaction(e,r,a){let i={};if(Object.assign(i,e),!e.data)throw new Error("Silo transactions must have a 'data' value");if(!a)throw new Error("No Silo URI specified.");if(e.target||e.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(e.owner==null){if(!r||!r.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");i.owner=r.n}e.last_tx==null&&(i.last_tx=await this.transactions.getTransactionAnchor());let h=await this.silo.parseUri(a);if(typeof e.data=="string"){let d=await this.crypto.encrypt(qb.stringToBuffer(e.data),h.getEncryptionKey());i.reward=await this.transactions.getPrice(d.byteLength),i.data=qb.bufferTob64Url(d)}if(e.data instanceof Uint8Array){let d=await this.crypto.encrypt(e.data,h.getEncryptionKey());i.reward=await this.transactions.getPrice(d.byteLength),i.data=qb.bufferTob64Url(d)}let c=new Hue.default(i);return c.addTag("Silo-Name",h.getAccessKey()),c.addTag("Silo-Version","0.1.0"),c}arql(e){return this.api.post("/arql",e).then(r=>r.data||[])}};Jf.default=HO});var Kue=ht((KO,Zue)=>{"use strict";X();ee();Q();var UFe=KO&&KO.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},ZO=UFe(n5());ZO.default.init=function(t={}){return new ZO.default(t)};Zue.exports=ZO.default});var Nhe=ht((pMt,Phe)=>{"use strict";X();ee();Q();var rze=new Set(["ENOTFOUND","ENETUNREACH","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_CRL","UNABLE_TO_DECRYPT_CERT_SIGNATURE","UNABLE_TO_DECRYPT_CRL_SIGNATURE","UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY","CERT_SIGNATURE_FAILURE","CRL_SIGNATURE_FAILURE","CERT_NOT_YET_VALID","CERT_HAS_EXPIRED","CRL_NOT_YET_VALID","CRL_HAS_EXPIRED","ERROR_IN_CERT_NOT_BEFORE_FIELD","ERROR_IN_CERT_NOT_AFTER_FIELD","ERROR_IN_CRL_LAST_UPDATE_FIELD","ERROR_IN_CRL_NEXT_UPDATE_FIELD","OUT_OF_MEM","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_CHAIN_TOO_LONG","CERT_REVOKED","INVALID_CA","PATH_LENGTH_EXCEEDED","INVALID_PURPOSE","CERT_UNTRUSTED","CERT_REJECTED","HOSTNAME_MISMATCH"]);Phe.exports=t=>!rze.has(t&&t.code)});var zhe=ht((CMt,EP)=>{"use strict";X();ee();Q();var dze=Object.prototype.hasOwnProperty,Ga="~";function Qb(){}Object.create&&(Qb.prototype=Object.create(null),new Qb().__proto__||(Ga=!1));function pze(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function jhe(t,e,r,a,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var h=new pze(r,a||t,i),c=Ga?Ga+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],h]:t._events[c].push(h):(t._events[c]=h,t._eventsCount++),t}function P5(t,e){--t._eventsCount===0?t._events=new Qb:delete t._events[e]}function Da(){this._events=new Qb,this._eventsCount=0}Da.prototype.eventNames=function(){var e=[],r,a;if(this._eventsCount===0)return e;for(a in r=this._events)dze.call(r,a)&&e.push(Ga?a.slice(1):a);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Da.prototype.listeners=function(e){var r=Ga?Ga+e:e,a=this._events[r];if(!a)return[];if(a.fn)return[a.fn];for(var i=0,h=a.length,c=new Array(h);i<h;i++)c[i]=a[i].fn;return c};Da.prototype.listenerCount=function(e){var r=Ga?Ga+e:e,a=this._events[r];return a?a.fn?1:a.length:0};Da.prototype.emit=function(e,r,a,i,h,c){var d=Ga?Ga+e:e;if(!this._events[d])return!1;var b=this._events[d],g=arguments.length,y,M;if(b.fn){switch(b.once&&this.removeListener(e,b.fn,void 0,!0),g){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,r),!0;case 3:return b.fn.call(b.context,r,a),!0;case 4:return b.fn.call(b.context,r,a,i),!0;case 5:return b.fn.call(b.context,r,a,i,h),!0;case 6:return b.fn.call(b.context,r,a,i,h,c),!0}for(M=1,y=new Array(g-1);M<g;M++)y[M-1]=arguments[M];b.fn.apply(b.context,y)}else{var x=b.length,E;for(M=0;M<x;M++)switch(b[M].once&&this.removeListener(e,b[M].fn,void 0,!0),g){case 1:b[M].fn.call(b[M].context);break;case 2:b[M].fn.call(b[M].context,r);break;case 3:b[M].fn.call(b[M].context,r,a);break;case 4:b[M].fn.call(b[M].context,r,a,i);break;default:if(!y)for(E=1,y=new Array(g-1);E<g;E++)y[E-1]=arguments[E];b[M].fn.apply(b[M].context,y)}}return!0};Da.prototype.on=function(e,r,a){return jhe(this,e,r,a,!1)};Da.prototype.once=function(e,r,a){return jhe(this,e,r,a,!0)};Da.prototype.removeListener=function(e,r,a,i){var h=Ga?Ga+e:e;if(!this._events[h])return this;if(!r)return P5(this,h),this;var c=this._events[h];if(c.fn)c.fn===r&&(!i||c.once)&&(!a||c.context===a)&&P5(this,h);else{for(var d=0,b=[],g=c.length;d<g;d++)(c[d].fn!==r||i&&!c[d].once||a&&c[d].context!==a)&&b.push(c[d]);b.length?this._events[h]=b.length===1?b[0]:b:P5(this,h)}return this};Da.prototype.removeAllListeners=function(e){var r;return e?(r=Ga?Ga+e:e,this._events[r]&&P5(this,r)):(this._events=new Qb,this._eventsCount=0),this};Da.prototype.off=Da.prototype.removeListener;Da.prototype.addListener=Da.prototype.on;Da.prefixed=Ga;Da.EventEmitter=Da;typeof EP<"u"&&(EP.exports=Da)});X();ee();Q();X();ee();Q();var VT={};$a(VT,{AVSCTap:()=>qg,AlgorandSigner:()=>Bg,AptosSigner:()=>Pg,ArconnectSigner:()=>S1,Arweave:()=>OV.default,ArweaveSigner:()=>Xc,Bundle:()=>r4,BundleItem:()=>WT,CryptoDriver:()=>F3,Curve25519:()=>Ro,DataItem:()=>Q8,EthereumSigner:()=>No,HexInjectedSolanaSigner:()=>ad,HexSolanaSigner:()=>Og,InjectedAptosSigner:()=>od,InjectedEthereumSigner:()=>WR,InjectedSolanaSigner:()=>N0,InjectedTypedEthereumSigner:()=>zT,KyveSigner:()=>Lg,MAX_TAG_BYTES:()=>X8,MIN_BINARY_SIZE:()=>e4,MultiSignatureAptosSigner:()=>sd,NearSigner:()=>Ig,PolygonSigner:()=>kg,Rsa4096:()=>O0,SIG_CONFIG:()=>Vr,SignatureConfig:()=>_r,Signer:()=>U5,SolanaSigner:()=>Dh,Transaction:()=>BV.default,TypedEthereumSigner:()=>fd,bundleAndSignData:()=>z5e,byteArrayToLong:()=>_n,concatBuffers:()=>Ni.concatBuffers,createData:()=>jg,deepHash:()=>Wc,deserializeTags:()=>E1,exportForTesting:()=>U5e,getCryptoDriver:()=>En,getSignatureAndId:()=>VQ,indexToType:()=>Dg,keccak256:()=>qT,longTo16ByteArray:()=>F5e,longTo32ByteArray:()=>J8,longTo8ByteArray:()=>Y8,longToNByteArray:()=>Ug,secp256k1:()=>nd,serializeTags:()=>ZT,shortTo2ByteArray:()=>HT,sign:()=>t4,stringToBuffer:()=>Ni.stringToBuffer,unbundleData:()=>j5e});X();ee();Q();X();ee();Q();X();ee();Q();var U5=class{publicKey;signatureType;signatureLength;ownerLength;pem;static verify(e,r,a,i){throw new Error("You must implement verify method on child")}};X();ee();Q();X();ee();Q();var ZW=vi(zo(),1);X();ee();Q();var _r;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM",t[t.KYVE=101]="KYVE"})(_r||(_r={}));var Vr={[_r.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[_r.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[_r.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[_r.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[_r.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[_r.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[_r.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"},[_r.KYVE]:{sigLength:65,pubLength:65,sigName:"kyve"}};X();ee();Q();Sh();var ta=BigInt(0),si=BigInt(1),Hc=BigInt(2),gbe=BigInt(8),DW=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),Yi=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:DW,n:DW,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")});var jW=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),Um=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),_Ze=BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742"),bbe=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),ybe=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),wbe=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),_be=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),Un=class t{constructor(e,r,a,i){this.x=e,this.y=r,this.z=a,this.t=i}static fromAffine(e){if(!(e instanceof Sn))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(Sn.ZERO)?t.ZERO:new t(e.x,e.y,si,At(e.x*e.y))}static toAffineBatch(e){let r=Sbe(e.map(a=>a.z));return e.map((a,i)=>a.toAffine(r[i]))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){UW(e);let{x:r,y:a,z:i}=this,{x:h,y:c,z:d}=e,b=At(r*d),g=At(h*i),y=At(a*d),M=At(c*i);return b===g&&y===M}negate(){return new t(At(-this.x),this.y,this.z,At(-this.t))}double(){let{x:e,y:r,z:a}=this,{a:i}=Yi,h=At(e*e),c=At(r*r),d=At(Hc*At(a*a)),b=At(i*h),g=e+r,y=At(At(g*g)-h-c),M=b+c,x=M-d,E=b-c,A=At(y*x),k=At(M*E),O=At(y*E),N=At(x*M);return new t(A,k,N,O)}add(e){UW(e);let{x:r,y:a,z:i,t:h}=this,{x:c,y:d,z:b,t:g}=e,y=At((a-r)*(d+c)),M=At((a+r)*(d-c)),x=At(M-y);if(x===ta)return this.double();let E=At(i*Hc*g),A=At(h*Hc*b),k=A+E,O=M+y,N=A-E,L=At(k*x),C=At(O*N),Y=At(k*N),G=At(x*O);return new t(L,C,G,Y)}subtract(e){return this.add(e.negate())}precomputeWindow(e){let r=1+256/e,a=[],i=this,h=i;for(let c=0;c<r;c++){h=i,a.push(h);for(let d=1;d<2**(e-1);d++)h=h.add(i),a.push(h);i=h.double()}return a}wNAF(e,r){!r&&this.equals(t.BASE)&&(r=Sn.BASE);let a=r&&r._WINDOW_SIZE||1;if(256%a)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let i=r&&YE.get(r);i||(i=this.precomputeWindow(a),r&&a!==1&&(i=t.normalizeZ(i),YE.set(r,i)));let h=t.ZERO,c=t.BASE,d=1+256/a,b=2**(a-1),g=BigInt(2**a-1),y=2**a,M=BigInt(a);for(let x=0;x<d;x++){let E=x*b,A=Number(e&g);e>>=M,A>b&&(A-=y,e+=si);let k=E,O=E+Math.abs(A)-1,N=x%2!==0,L=A<0;A===0?c=c.add($W(N,i[k])):h=h.add($W(L,i[O]))}return t.normalizeZ([h,c])[0]}multiply(e,r){return this.wNAF(k3(e,Yi.l),r)}multiplyUnsafe(e){let r=k3(e,Yi.l,!1),a=t.BASE,i=t.ZERO;if(r===ta)return i;if(this.equals(i)||r===si)return this;if(this.equals(a))return this.wNAF(r);let h=i,c=this;for(;r>ta;)r&si&&(h=h.add(c)),c=c.double(),r>>=si;return h}isSmallOrder(){return this.multiplyUnsafe(Yi.h).equals(t.ZERO)}isTorsionFree(){let e=this.multiplyUnsafe(Yi.l/Hc).double();return Yi.l%Hc&&(e=e.add(this)),e.equals(t.ZERO)}toAffine(e){let{x:r,y:a,z:i}=this,h=this.equals(t.ZERO);e==null&&(e=h?gbe:I3(i));let c=At(r*e),d=At(a*e),b=At(i*e);if(h)return Sn.ZERO;if(b!==si)throw new Error("invZ was invalid");return new Sn(c,d)}fromRistrettoBytes(){WE()}toRistrettoBytes(){WE()}fromRistrettoHash(){WE()}};Un.BASE=new Un(Yi.Gx,Yi.Gy,si,At(Yi.Gx*Yi.Gy));Un.ZERO=new Un(ta,si,si,ta);function $W(t,e){let r=e.negate();return t?r:e}function UW(t){if(!(t instanceof Un))throw new TypeError("ExtendedPoint expected")}function KE(t){if(!(t instanceof I0))throw new TypeError("RistrettoPoint expected")}function WE(){throw new Error("Legacy method: switch to RistrettoPoint")}var I0=class t{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){let{d:r}=Yi,a=At(Um*e*e),i=At((a+si)*wbe),h=BigInt(-1),c=At((h-r*a)*At(a+r)),{isValid:d,value:b}=XE(i,c),g=At(b*e);zc(g)||(g=At(-g)),d||(b=g),d||(h=a);let y=At(h*(a-si)*_be-c),M=b*b,x=At((b+b)*c),E=At(y*bbe),A=At(si-M),k=At(si+M);return new Un(At(x*k),At(A*E),At(E*k),At(x*A))}static hashToCurve(e){e=Zc(e,64);let r=VE(e.slice(0,32)),a=this.calcElligatorRistrettoMap(r),i=VE(e.slice(32,64)),h=this.calcElligatorRistrettoMap(i);return new t(a.add(h))}static fromHex(e){e=Zc(e,32);let{a:r,d:a}=Yi,i="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",h=VE(e);if(!Abe(Fm(h),e)||zc(h))throw new Error(i);let c=At(h*h),d=At(si+r*c),b=At(si-r*c),g=At(d*d),y=At(b*b),M=At(r*a*g-y),{isValid:x,value:E}=FW(At(M*y)),A=At(E*b),k=At(E*A*M),O=At((h+h)*A);zc(O)&&(O=At(-O));let N=At(d*k),L=At(O*N);if(!x||zc(L)||N===ta)throw new Error(i);return new t(new Un(O,N,si,L))}toRawBytes(){let{x:e,y:r,z:a,t:i}=this.ep,h=At(At(a+r)*At(a-r)),c=At(e*r),d=At(c*c),{value:b}=FW(At(h*d)),g=At(b*h),y=At(b*c),M=At(g*y*i),x;if(zc(i*M)){let A=At(r*Um),k=At(e*Um);e=A,r=k,x=At(g*ybe)}else x=y;zc(e*M)&&(r=At(-r));let E=At((a-r)*x);return zc(E)&&(E=At(-E)),Fm(E)}toHex(){return jm(this.toRawBytes())}toString(){return this.toHex()}equals(e){KE(e);let r=this.ep,a=e.ep,i=At(r.x*a.y)===At(r.y*a.x),h=At(r.y*a.y)===At(r.x*a.x);return i||h}add(e){return KE(e),new t(this.ep.add(e.ep))}subtract(e){return KE(e),new t(this.ep.subtract(e.ep))}multiply(e){return new t(this.ep.multiply(e))}multiplyUnsafe(e){return new t(this.ep.multiplyUnsafe(e))}};I0.BASE=new I0(Un.BASE);I0.ZERO=new I0(Un.ZERO);var YE=new WeakMap,Sn=class t{constructor(e,r){this.x=e,this.y=r}_setWindowSize(e){this._WINDOW_SIZE=e,YE.delete(this)}static fromHex(e,r=!0){let{d:a,P:i}=Yi;e=Zc(e,32);let h=e.slice();h[31]=e[31]&-129;let c=zm(h);if(r&&c>=i)throw new Error("Expected 0 < hex < P");if(!r&&c>=jW)throw new Error("Expected 0 < hex < 2**256");let d=At(c*c),b=At(d-si),g=At(a*d+si),{isValid:y,value:M}=XE(b,g);if(!y)throw new Error("Point.fromHex: invalid y coordinate");let x=(M&si)===si;return(e[31]&128)!==0!==x&&(M=At(-M)),new t(M,c)}static async fromPrivateKey(e){return(await QE(e)).point}toRawBytes(){let e=Fm(this.y);return e[31]|=this.x&si?128:0,e}toHex(){return jm(this.toRawBytes())}toX25519(){let{y:e}=this,r=At((si+e)*I3(si-e));return Fm(r)}isTorsionFree(){return Un.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new t(At(-this.x),this.y)}add(e){return Un.fromAffine(this).add(Un.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return Un.fromAffine(this).multiply(e,this).toAffine()}};Sn.BASE=new Sn(Yi.Gx,Yi.Gy);Sn.ZERO=new Sn(ta,si);var qm=class t{constructor(e,r){this.r=e,this.s=r,this.assertValidity()}static fromHex(e){let r=Zc(e,64),a=Sn.fromHex(r.slice(0,32),!1),i=zm(r.slice(32,64));return new t(a,i)}assertValidity(){let{r:e,s:r}=this;if(!(e instanceof Sn))throw new Error("Expected Point instance");return k3(r,Yi.l,!1),this}toRawBytes(){let e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(Fm(this.s),32),e}toHex(){return jm(this.toRawBytes())}};function qW(...t){if(!t.every(a=>a instanceof Uint8Array))throw new Error("Expected Uint8Array list");if(t.length===1)return t[0];let e=t.reduce((a,i)=>a+i.length,0),r=new Uint8Array(e);for(let a=0,i=0;a<t.length;a++){let h=t[a];r.set(h,i),i+=h.length}return r}var Mbe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function jm(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=Mbe[t[r]];return e}function JE(t){if(typeof t!="string")throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){let a=r*2,i=t.slice(a,a+2),h=Number.parseInt(i,16);if(Number.isNaN(h)||h<0)throw new Error("Invalid byte sequence");e[r]=h}return e}function zW(t){let r=t.toString(16).padStart(64,"0");return JE(r)}function Fm(t){return zW(t).reverse()}function zc(t){return(At(t)&si)===si}function zm(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+jm(Uint8Array.from(t).reverse()))}var xbe=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function VE(t){return At(zm(t)&xbe)}function At(t,e=Yi.P){let r=t%e;return r>=ta?r:e+r}function I3(t,e=Yi.P){if(t===ta||e<=ta)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=At(t,e),a=e,i=ta,h=si,c=si,d=ta;for(;r!==ta;){let g=a/r,y=a%r,M=i-c*g,x=h-d*g;a=r,r=y,i=c,h=d,c=M,d=x}if(a!==si)throw new Error("invert: does not exist");return At(i,e)}function Sbe(t,e=Yi.P){let r=new Array(t.length),a=t.reduce((h,c,d)=>c===ta?h:(r[d]=h,At(h*c,e)),si),i=I3(a,e);return t.reduceRight((h,c,d)=>c===ta?h:(r[d]=At(h*r[d],e),At(h*c,e)),i),r}function yu(t,e){let{P:r}=Yi,a=t;for(;e-- >ta;)a*=a,a%=r;return a}function Ebe(t){let{P:e}=Yi,r=BigInt(5),a=BigInt(10),i=BigInt(20),h=BigInt(40),c=BigInt(80),b=t*t%e*t%e,g=yu(b,Hc)*b%e,y=yu(g,si)*t%e,M=yu(y,r)*y%e,x=yu(M,a)*M%e,E=yu(x,i)*x%e,A=yu(E,h)*E%e,k=yu(A,c)*A%e,O=yu(k,c)*A%e,N=yu(O,a)*M%e;return{pow_p_5_8:yu(N,Hc)*t%e,b2:b}}function XE(t,e){let r=At(e*e*e),a=At(r*r*e),i=Ebe(t*a).pow_p_5_8,h=At(t*r*i),c=At(e*h*h),d=h,b=At(h*Um),g=c===t,y=c===At(-t),M=c===At(-t*Um);return g&&(h=d),(y||M)&&(h=b),zc(h)&&(h=At(-h)),{isValid:g||y,value:h}}function FW(t){return XE(si,t)}function T3(t){return At(zm(t),Yi.l)}function Abe(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function Zc(t,e){let r=t instanceof Uint8Array?Uint8Array.from(t):JE(t);if(typeof e=="number"&&r.length!==e)throw new Error(`Expected ${e} bytes`);return r}function k3(t,e,r=!0){if(!e)throw new TypeError("Specify max value");if(typeof t=="number"&&Number.isSafeInteger(t)&&(t=BigInt(t)),typeof t=="bigint"&&t<e){if(r){if(ta<t)return t}else if(ta<=t)return t}throw new TypeError("Expected valid scalar: 0 < scalar < max")}function Rbe(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function Tbe(t){if(t=typeof t=="bigint"||typeof t=="number"?zW(k3(t,jW)):Zc(t),t.length!==32)throw new Error("Expected 32 bytes");return t}function kbe(t){let e=Rbe(t.slice(0,32)),r=t.slice(32,64),a=T3(e),i=Sn.BASE.multiply(a),h=i.toRawBytes();return{head:e,prefix:r,scalar:a,point:i,pointBytes:h}}var GE;async function QE(t){return kbe(await qp.sha512(Tbe(t)))}async function HW(t,e){t=Zc(t);let{prefix:r,scalar:a,pointBytes:i}=await QE(e),h=T3(await qp.sha512(r,t)),c=Sn.BASE.multiply(h),d=T3(await qp.sha512(c.toRawBytes(),i,t)),b=At(h+d*a,Yi.l);return new qm(c,b).toRawBytes()}function Ibe(t,e,r){e=Zc(e),r instanceof Sn||(r=Sn.fromHex(r,!1));let{r:a,s:i}=t instanceof qm?t.assertValidity():qm.fromHex(t),h=Un.BASE.multiplyUnsafe(i);return{r:a,s:i,SB:h,pub:r,msg:e}}function Bbe(t,e,r,a){let i=T3(a),h=Un.fromAffine(t).multiplyUnsafe(i);return Un.fromAffine(e).add(h).subtract(r).multiplyUnsafe(Yi.h).equals(Un.ZERO)}async function Kc(t,e,r){let{r:a,SB:i,msg:h,pub:c}=Ibe(t,e,r),d=await qp.sha512(a.toRawBytes(),c.toRawBytes(),h);return Bbe(c,a,i,d)}Sn.BASE._setWindowSize(8);var jc={node:$m,web:typeof self=="object"&&"crypto"in self?self.crypto:void 0},qp={bytesToHex:jm,hexToBytes:JE,concatBytes:qW,getExtendedPublicKey:QE,mod:At,invert:I3,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:t=>{if(t=Zc(t),t.length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return At(zm(t),Yi.l-si)+si},randomBytes:(t=32)=>{if(jc.web)return jc.web.getRandomValues(new Uint8Array(t));if(jc.node){let{randomBytes:e}=jc.node;return new Uint8Array(e(t).buffer)}else throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>qp.randomBytes(32),sha512:async(...t)=>{let e=qW(...t);if(jc.web){let r=await jc.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(r)}else{if(jc.node)return Uint8Array.from(jc.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")}},precompute(t=8,e=Sn.BASE){let r=e.equals(Sn.BASE)?e:new Sn(e.x,e.y);return r._setWindowSize(t),r.multiply(Hc),r},sha512Sync:void 0};Object.defineProperties(qp,{sha512Sync:{configurable:!1,get(){return GE},set(t){GE||(GE=t)}}});var Ro=class{_key;pk;ownerLength=Vr[2].pubLength;signatureLength=Vr[2].sigLength;_publicKey;get publicKey(){return this._publicKey}signatureType=2;constructor(e,r){this._key=e,this.pk=r}get key(){throw new Error("You must implement `key`")}sign(e){return HW(ge.from(e),ge.from(this.key))}static async verify(e,r,a){let i=e;return typeof e=="string"&&(i=ZW.default.toBuffer(e)),Kc(ge.from(a),ge.from(r),ge.from(i))}};X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var Ni=vi(bf(),1);X();ee();Q();Sh();async function Wc(t){if(typeof t[Symbol.asyncIterator]=="function"){let i=t,h=xh("sha384"),c=0;for await(let g of i)c+=g.byteLength,h.update(g);let d=(0,Ni.concatBuffers)([(0,Ni.stringToBuffer)("blob"),(0,Ni.stringToBuffer)(c.toString())]),b=(0,Ni.concatBuffers)([await En().hash(d,"SHA-384"),h.digest()]);return await En().hash(b,"SHA-384")}else if(Array.isArray(t)){let i=(0,Ni.concatBuffers)([(0,Ni.stringToBuffer)("list"),(0,Ni.stringToBuffer)(t.length.toString())]);return await rV(t,await En().hash(i,"SHA-384"))}let e=t,r=(0,Ni.concatBuffers)([(0,Ni.stringToBuffer)("blob"),(0,Ni.stringToBuffer)(e.byteLength.toString())]),a=(0,Ni.concatBuffers)([await En().hash(r,"SHA-384"),await En().hash(e,"SHA-384")]);return await En().hash(a,"SHA-384")}async function rV(t,e){if(t.length<1)return e;let r=(0,Ni.concatBuffers)([e,await Wc(t[0])]),a=await En().hash(r,"SHA-384");return await rV(t.slice(1),a)}var q3=vi(nA(),1),BV=vi(Ym(),1),OV=vi(IV(),1),gye=q3.default.default?q3.default.default:q3.default,F3=class extends gye{getPublicKey(e){throw new Error("Unimplemented")}},bye;function En(){return bye??=new F3}var PV=vi(zo(),1);Sh();var O0=class{_key;pk;signatureType=1;ownerLength=Vr[1].pubLength;signatureLength=Vr[1].sigLength;_publicKey;get publicKey(){return this._publicKey}constructor(e,r){this._key=e,this.pk=r,r||(this.pk=En().getPublicKey(JSON.parse(e)))}sign(e){return ZE("sha256").update(e).sign({key:this._key,padding:HE.RSA_PKCS1_PSS_PADDING})}static async verify(e,r,a){return await En().verify(ge.isBuffer(e)?PV.default.encode(e):e,r,a)}};var _G=vi(wG(),1),MG=vi(zo(),1);var Xc=class extends O0{jwk;constructor(e){super((0,_G.jwkTopem)(e),e.n),this.jwk=e}get publicKey(){if(!this.pk)throw new Error("ArweaveSigner - pk is undefined");return MG.default.toBuffer(this.pk)}sign(e){return En().sign(this.jwk,e)}static async verify(e,r,a){return await En().verify(e,r,a)}};X();ee();Q();var xG=vi(zo(),1);var N0=class{_publicKey;ownerLength=Vr[2].pubLength;signatureLength=Vr[2].sigLength;signatureType=2;pem;provider;constructor(e){if(this.provider=e,!this.provider.publicKey)throw new Error("InjectedSolanaSigner - provider.publicKey is undefined");this._publicKey=this.provider.publicKey.toBuffer()}get publicKey(){return this._publicKey}async sign(e){if(!this.provider.signMessage)throw new Error("Selected Wallet does not support message signing");return await this.provider.signMessage(e)}static async verify(e,r,a){let i=e;return typeof e=="string"&&(i=xG.default.toBuffer(e)),Kc(ge.from(a),ge.from(r),ge.from(i))}};X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var NG=vi(SG());X();ee();Q();X();ee();Q();X();ee();Q();var EG="logger/5.7.0";var AG=!1,RG=!1,Y3={debug:1,default:2,info:2,warning:3,error:4,off:5},TG=Y3.default,XA=null;function Xye(){try{let t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var kG=Xye(),QA;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(QA||(QA={}));var wf;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(wf||(wf={}));var IG="0123456789abcdef",tr=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){let a=e.toLowerCase();Y3[a]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(TG>Y3[a])&&console.log.apply(console,r)}debug(...e){this._log(t.levels.DEBUG,e)}info(...e){this._log(t.levels.INFO,e)}warn(...e){this._log(t.levels.WARNING,e)}makeError(e,r,a){if(RG)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),a||(a={});let i=[];Object.keys(a).forEach(b=>{let g=a[b];try{if(g instanceof Uint8Array){let y="";for(let M=0;M<g.length;M++)y+=IG[g[M]>>4],y+=IG[g[M]&15];i.push(b+"=Uint8Array(0x"+y+")")}else i.push(b+"="+JSON.stringify(g))}catch{i.push(b+"="+JSON.stringify(a[b].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);let h=e,c="";switch(r){case wf.NUMERIC_FAULT:{c="NUMERIC_FAULT";let b=e;switch(b){case"overflow":case"underflow":case"division-by-zero":c+="-"+b;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result";break}break}case wf.CALL_EXCEPTION:case wf.INSUFFICIENT_FUNDS:case wf.MISSING_NEW:case wf.NONCE_EXPIRED:case wf.REPLACEMENT_UNDERPRICED:case wf.TRANSACTION_REPLACED:case wf.UNPREDICTABLE_GAS_LIMIT:c=r;break}c&&(e+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),i.length&&(e+=" ("+i.join(", ")+")");let d=new Error(e);return d.reason=h,d.code=r,Object.keys(a).forEach(function(b){d[b]=a[b]}),d}throwError(e,r,a){throw this.makeError(e,r,a)}throwArgumentError(e,r,a){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:a})}assert(e,r,a,i){e||this.throwError(r,a,i)}assertArgument(e,r,a,i){e||this.throwArgumentError(r,a,i)}checkNormalize(e){e==null&&(e="platform missing String.prototype.normalize"),kG&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:kG})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,a){a?a=": "+a:a="",e<r&&this.throwError("missing argument"+a,t.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+a,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return XA||(XA=new t(EG)),XA}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),AG){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}RG=!!e,AG=!!r}static setLogLevel(e){let r=Y3[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}TG=r}static from(e){return new t(e)}};tr.errors=wf;tr.levels=QA;X();ee();Q();var BG="bytes/5.7.0";var An=new tr(BG);function PG(t){return!!t.toHexString}function Jp(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return Jp(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function rg(t){return Fn(t)&&!(t.length%2)||ig(t)}function OG(t){return typeof t=="number"&&t==t&&t%1===0}function ig(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!OG(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){let r=t[e];if(!OG(r)||r<0||r>=256)return!1}return!0}function Lt(t,e){if(e||(e={}),typeof t=="number"){An.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Jp(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),PG(t)&&(t=t.toHexString()),Fn(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":An.throwArgumentError("hex data is odd-length","value",t));let a=[];for(let i=0;i<r.length;i+=2)a.push(parseInt(r.substring(i,i+2),16));return Jp(new Uint8Array(a))}return ig(t)?Jp(new Uint8Array(t)):An.throwArgumentError("invalid arrayify value","value",t)}function Io(t){let e=t.map(i=>Lt(i)),r=e.reduce((i,h)=>i+h.length,0),a=new Uint8Array(r);return e.reduce((i,h)=>(a.set(h,i),i+h.length),0),Jp(a)}function _u(t){let e=Lt(t);if(e.length===0)return e;let r=0;for(;r<e.length&&e[r]===0;)r++;return r&&(e=e.slice(r)),e}function Qye(t,e){t=Lt(t),t.length>e&&An.throwArgumentError("value out of range","value",arguments[0]);let r=new Uint8Array(e);return r.set(t,e-t.length),Jp(r)}function Fn(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var eR="0123456789abcdef";function fr(t,e){if(e||(e={}),typeof t=="number"){An.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=eR[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),PG(t))return t.toHexString();if(Fn(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":An.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(ig(t)){let r="0x";for(let a=0;a<t.length;a++){let i=t[a];r+=eR[(i&240)>>4]+eR[i&15]}return r}return An.throwArgumentError("invalid hexlify value","value",t)}function ng(t){if(typeof t!="string")t=fr(t);else if(!Fn(t)||t.length%2)return null;return(t.length-2)/2}function kh(t,e,r){return typeof t!="string"?t=fr(t):(!Fn(t)||t.length%2)&&An.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Qc(t){let e="0x";return t.forEach(r=>{e+=fr(r).substring(2)}),e}function ka(t,e){for(typeof t!="string"?t=fr(t):Fn(t)||An.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&An.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function el(t){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(rg(t)){let r=Lt(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=fr(r.slice(0,32)),e.s=fr(r.slice(32,64))):r.length===65?(e.r=fr(r.slice(0,32)),e.s=fr(r.slice(32,64)),e.v=r[64]):An.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:An.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=fr(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){let i=Qye(Lt(e._vs),32);e._vs=fr(i);let h=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=h:e.recoveryParam!==h&&An.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;let c=fr(i);e.s==null?e.s=c:e.s!==c&&An.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?An.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{let i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&An.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Fn(e.r)?An.throwArgumentError("signature missing or invalid r","signature",t):e.r=ka(e.r,32),e.s==null||!Fn(e.s)?An.throwArgumentError("signature missing or invalid s","signature",t):e.s=ka(e.s,32);let r=Lt(e.s);r[0]>=128&&An.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);let a=fr(r);e._vs&&(Fn(e._vs)||An.throwArgumentError("signature invalid _vs","signature",t),e._vs=ka(e._vs,32)),e._vs==null?e._vs=a:e._vs!==a&&An.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function tR(t){return t=el(t),fr(Io([t.r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}function an(t){return"0x"+NG.default.keccak_256(Lt(t))}X();ee();Q();X();ee();Q();X();ee();Q();var qG=vi(LG());X();ee();Q();var DG="bignumber/5.7.0";var J3=qG.default.BN,Ih=new tr(DG),iR={},$G=9007199254740991;var UG=!1,on=class t{constructor(e,r){e!==iR&&Ih.throwError("cannot call constructor directly; use BigNumber.from",tr.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return ao(Qr(this).fromTwos(e))}toTwos(e){return ao(Qr(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return ao(Qr(this).add(Qr(e)))}sub(e){return ao(Qr(this).sub(Qr(e)))}div(e){return t.from(e).isZero()&&xs("division-by-zero","div"),ao(Qr(this).div(Qr(e)))}mul(e){return ao(Qr(this).mul(Qr(e)))}mod(e){let r=Qr(e);return r.isNeg()&&xs("division-by-zero","mod"),ao(Qr(this).umod(r))}pow(e){let r=Qr(e);return r.isNeg()&&xs("negative-power","pow"),ao(Qr(this).pow(r))}and(e){let r=Qr(e);return(this.isNegative()||r.isNeg())&&xs("unbound-bitwise-result","and"),ao(Qr(this).and(r))}or(e){let r=Qr(e);return(this.isNegative()||r.isNeg())&&xs("unbound-bitwise-result","or"),ao(Qr(this).or(r))}xor(e){let r=Qr(e);return(this.isNegative()||r.isNeg())&&xs("unbound-bitwise-result","xor"),ao(Qr(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&xs("negative-width","mask"),ao(Qr(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xs("negative-width","shl"),ao(Qr(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xs("negative-width","shr"),ao(Qr(this).shrn(e))}eq(e){return Qr(this).eq(Qr(e))}lt(e){return Qr(this).lt(Qr(e))}lte(e){return Qr(this).lte(Qr(e))}gt(e){return Qr(this).gt(Qr(e))}gte(e){return Qr(this).gte(Qr(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Qr(this).isZero()}toNumber(){try{return Qr(this).toNumber()}catch{xs("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ih.throwError("this platform does not support BigInt",tr.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?UG||(UG=!0,Ih.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ih.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",tr.errors.UNEXPECTED_ARGUMENT,{}):Ih.throwError("BigNumber.toString does not accept parameters",tr.errors.UNEXPECTED_ARGUMENT,{})),Qr(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(iR,ag(e)):e.match(/^-?[0-9]+$/)?new t(iR,ag(new J3(e))):Ih.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&xs("underflow","BigNumber.from",e),(e>=$G||e<=-$G)&&xs("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(ig(r))return t.from(fr(r));if(r)if(r.toHexString){let a=r.toHexString();if(typeof a=="string")return t.from(a)}else{let a=r._hex;if(a==null&&r.type==="BigNumber"&&(a=r.hex),typeof a=="string"&&(Fn(a)||a[0]==="-"&&Fn(a.substring(1))))return t.from(a)}return Ih.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}};function ag(t){if(typeof t!="string")return ag(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ih.throwArgumentError("invalid hex","value",t),t=ag(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function ao(t){return on.from(ag(t))}function Qr(t){let e=on.from(t).toHexString();return e[0]==="-"?new J3("-"+e.substring(3),16):new J3(e.substring(2),16)}function xs(t,e,r){let a={fault:t,operation:e};return r!=null&&(a.value=r),Ih.throwError(t,tr.errors.NUMERIC_FAULT,a)}function nR(t){return new J3(t,36).toString(16)}X();ee();Q();X();ee();Q();var FG="strings/5.7.0";var jG=new tr(FG),Mu;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(Mu||(Mu={}));var C0;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(C0||(C0={}));function t6e(t,e,r,a,i){return jG.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function zG(t,e,r,a,i){if(t===C0.BAD_PREFIX||t===C0.UNEXPECTED_CONTINUE){let h=0;for(let c=e+1;c<r.length&&r[c]>>6===2;c++)h++;return h}return t===C0.OVERRUN?r.length-e-1:0}function r6e(t,e,r,a,i){return t===C0.OVERLONG?(a.push(i),0):(a.push(65533),zG(t,e,r,a,i))}var i6e=Object.freeze({error:t6e,ignore:zG,replace:r6e});function qa(t,e=Mu.current){e!=Mu.current&&(jG.checkNormalize(),t=t.normalize(e));let r=[];for(let a=0;a<t.length;a++){let i=t.charCodeAt(a);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(i&63|128);else if((i&64512)==55296){a++;let h=t.charCodeAt(a);if(a>=t.length||(h&64512)!==56320)throw new Error("invalid utf-8 string");let c=65536+((i&1023)<<10)+(h&1023);r.push(c>>18|240),r.push(c>>12&63|128),r.push(c>>6&63|128),r.push(c&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return Lt(r)}function Xp(t){return an(qa(t))}X();ee();Q();var HG="hash/5.7.0";X();ee();Q();var ZG=`Ethereum Signed Message:
127
+ ${JSON.stringify(ge.from(r))},${JSON.stringify(ge.from(a))},${h} => ${JSON.stringify(d)}`;return Tue(c,b)}jr.debug=Tue});var f5=ht(Fo=>{"use strict";X();ee();Q();var eFe=Fo&&Fo.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),tFe=Fo&&Fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rFe=Fo&&Fo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eFe(e,t,r);return tFe(e,t),e},iFe=Fo&&Fo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Tag=void 0;var Zn=rFe(sc()),nFe=iFe(Sue()),aFe=PO(),s5=class{get(e,r){if(!Object.getOwnPropertyNames(this).includes(e))throw new Error(`Field "${e}" is not a property of the Arweave Transaction class.`);if(this[e]instanceof Uint8Array)return r&&r.decode&&r.string?Zn.bufferToString(this[e]):r&&r.decode&&!r.string?this[e]:Zn.bufferTob64Url(this[e]);if(this[e]instanceof Array){if(r?.decode!==void 0||r?.string!==void 0)throw e==="tags"&&console.warn(`Did you mean to use 'transaction["tags"]' ?`),new Error("Cannot decode or stringify an array.");return this[e]}return r&&r.decode==!0?r&&r.string?Zn.b64UrlToString(this[e]):Zn.b64UrlToBuffer(this[e]):this[e]}},Db=class extends s5{name;value;constructor(e,r,a=!1){super(),this.name=e,this.value=r}};Fo.Tag=Db;var NO=class extends s5{format=2;id="";last_tx="";owner="";tags=[];target="";quantity="0";data_size="0";data=new Uint8Array;data_root="";reward="0";signature="";chunks;constructor(e={}){super(),Object.assign(this,e),typeof this.data=="string"&&(this.data=Zn.b64UrlToBuffer(this.data)),e.tags&&(this.tags=e.tags.map(r=>new Db(r.name,r.value)))}addTag(e,r){this.tags.push(new Db(Zn.stringToB64Url(e),Zn.stringToB64Url(r)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:Zn.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(e){this.owner=e}setSignature({id:e,owner:r,reward:a,tags:i,signature:h}){this.id=e,this.owner=r,a&&(this.reward=a),i&&(this.tags=i),this.signature=h}async prepareChunks(e){!this.chunks&&e.byteLength>0&&(this.chunks=await(0,aFe.generateTransactionChunks)(e),this.data_root=Zn.bufferTob64Url(this.chunks.data_root)),!this.chunks&&e.byteLength===0&&(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(e,r){if(!this.chunks)throw new Error("Chunks have not been prepared");let a=this.chunks.proofs[e],i=this.chunks.chunks[e];return{data_root:this.data_root,data_size:this.data_size,data_path:Zn.bufferTob64Url(a.proof),offset:a.offset.toString(),chunk:Zn.bufferTob64Url(r.slice(i.minByteRange,i.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let e=this.tags.reduce((a,i)=>Zn.concatBuffers([a,i.get("name",{decode:!0,string:!1}),i.get("value",{decode:!0,string:!1})]),new Uint8Array);return Zn.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),Zn.stringToBuffer(this.quantity),Zn.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),e]);case 2:this.data_root||await this.prepareChunks(this.data);let r=this.tags.map(a=>[a.get("name",{decode:!0,string:!1}),a.get("value",{decode:!0,string:!1})]);return await(0,nFe.default)([Zn.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),Zn.stringToBuffer(this.quantity),Zn.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),r,Zn.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}};Fo.default=NO});var Oue=ht(Vs=>{"use strict";X();ee();Q();var oFe=Vs&&Vs.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),sFe=Vs&&Vs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fFe=Vs&&Vs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oFe(e,t,r);return sFe(e,t),e},uFe=Vs&&Vs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.TransactionUploader=void 0;var kue=uFe(f5()),hFe=fFe(sc()),CO=Ob(),cFe=PO(),Iue=1,lFe=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"],Bue=1e3*40,LO=class t{api;chunkIndex=0;txPosted=!1;transaction;lastRequestTimeEnd=0;totalErrors=0;data;lastResponseStatus=0;lastResponseError="";get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}constructor(e,r){if(this.api=e,!r.id)throw new Error("Transaction is not signed");if(!r.chunks)throw new Error("Transaction chunks not prepared");this.data=r.data,this.transaction=new kue.default(Object.assign({},r,{data:new Uint8Array(0)}))}async uploadChunk(e){if(this.isComplete)throw new Error("Upload is already complete");if(this.lastResponseError!==""?this.totalErrors++:this.totalErrors=0,this.totalErrors===100)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let r=this.lastResponseError===""?0:Math.max(this.lastRequestTimeEnd+Bue-Date.now(),Bue);if(r>0&&(r=r-r*Math.random()*.3,await new Promise(c=>setTimeout(c,r))),this.lastResponseError="",!this.txPosted){await this.postTransaction();return}e&&(this.chunkIndex=e);let a=this.transaction.getChunk(e||this.chunkIndex,this.data);if(!await(0,cFe.validatePath)(this.transaction.chunks.data_root,parseInt(a.offset),0,parseInt(a.data_size),hFe.b64UrlToBuffer(a.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);let h=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch(c=>(console.error(c.message),{status:-1,data:{error:c.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=h.status,this.lastResponseStatus==200)this.chunkIndex++;else if(this.lastResponseError=(0,CO.getError)(h),lFe.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(e,r,a){if(!r||typeof r.chunkIndex!="number"||typeof r.transaction!="object")throw new Error("Serialized object does not match expected format.");var i=new kue.default(r.transaction);i.chunks||await i.prepareChunks(a);let h=new t(e,i);if(h.chunkIndex=r.chunkIndex,h.lastRequestTimeEnd=r.lastRequestTimeEnd,h.lastResponseError=r.lastResponseError,h.lastResponseStatus=r.lastResponseStatus,h.txPosted=r.txPosted,h.data=a,h.transaction.data_root!==r.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return h}static async fromTransactionId(e,r){let a=await e.get(`tx/${r}`);if(a.status!==200)throw new Error(`Tx ${r} not found: ${a.status}`);let i=a.data;return i.data=new Uint8Array(0),{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:i}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=Iue){this.transaction.data=this.data;let a=await this.api.post("tx",this.transaction).catch(i=>(console.error(i),{status:-1,data:{error:i.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=a.status,this.transaction.data=new Uint8Array(0),a.status>=200&&a.status<300){this.txPosted=!0,this.chunkIndex=Iue;return}throw this.lastResponseError=(0,CO.getError)(a),new Error(`Unable to upload transaction: ${a.status}, ${this.lastResponseError}`)}let r=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=r.status,!(r.status>=200&&r.status<300))throw this.lastResponseError=(0,CO.getError)(r),new Error(`Unable to upload transaction: ${r.status}, ${this.lastResponseError}`);this.txPosted=!0}};Vs.TransactionUploader=LO});var u5=ht((V6t,Pue)=>{"use strict";X();ee();Q();Pue.exports={}});var Cue=ht(Gf=>{"use strict";X();ee();Q();var dFe=Gf&&Gf.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),pFe=Gf&&Gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vFe=Gf&&Gf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dFe(e,t,r);return pFe(e,t),e},Nue=Gf&&Gf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gf,"__esModule",{value:!0});var DO=Nue(Ob()),fc=Nue(f5()),$b=vFe(sc()),$O=Oue();u5();var UO=class{api;crypto;chunks;constructor(e,r,a){this.api=e,this.crypto=r,this.chunks=a}async getTransactionAnchor(){let e=await this.api.get("tx_anchor");if(!e.data.match(/^[a-z0-9_-]{43,}/i)||!e.ok)throw new Error(`Could not getTransactionAnchor. Received: ${e.data}. Status: ${e.status}, ${e.statusText}`);return e.data}async getPrice(e,r){let a=r?`price/${e}/${r}`:`price/${e}`,i=await this.api.get(a);if(!/^\d+$/.test(i.data)||!i.ok)throw new Error(`Could not getPrice. Received: ${i.data}. Status: ${i.status}, ${i.statusText}`);return i.data}async get(e){let r=await this.api.get(`tx/${e}`);if(r.status==200){let a=parseInt(r.data.data_size);if(r.data.format>=2&&a>0&&a<=1024*1024*12){let i=await this.getData(e);return new fc.default({...r.data,data:i})}return new fc.default({...r.data,format:r.data.format||1})}throw r.status==404?new DO.default("TX_NOT_FOUND"):r.status==410?new DO.default("TX_FAILED"):new DO.default("TX_INVALID")}fromRaw(e){return new fc.default(e)}async search(e,r){return this.api.post("arql",{op:"equals",expr1:e,expr2:r}).then(a=>a.data?a.data:[])}getStatus(e){return this.api.get(`tx/${e}/status`).then(r=>r.status==200?{status:200,confirmed:r.data}:{status:r.status,confirmed:null})}async getData(e,r){let a;try{a=await this.chunks.downloadChunkedData(e)}catch(i){console.error(`Error while trying to download chunked data for ${e}`),console.error(i)}if(!a){console.warn(`Falling back to gateway cache for ${e}`);try{let{data:i,ok:h,status:c,statusText:d}=await this.api.get(`/${e}`,{responseType:"arraybuffer"});if(!h)throw new Error("Bad http status code",{cause:{status:c,statusText:d}});a=i}catch(i){console.error(`Error while trying to download contiguous data from gateway cache for ${e}`),console.error(i)}}if(!a)throw new Error(`${e} data was not found!`);return r&&r.decode&&!r.string?a:r&&r.decode&&r.string?$b.bufferToString(a):$b.bufferTob64Url(a)}async sign(e,r,a){let h=typeof r=="object"&&(d=>{let b=!0;return["n","e","d","p","q","dp","dq","qi"].map(g=>!(g in d)&&(b=!1)),b})(r),c=typeof arweaveWallet=="object";if(!h&&!c)throw new Error("No valid JWK or external wallet found to sign transaction.");if(h){e.setOwner(r.n);let d=await e.getSignatureData(),b=await this.crypto.sign(r,d,a),g=await this.crypto.hash(b);e.setSignature({id:$b.bufferTob64Url(g),owner:r.n,signature:$b.bufferTob64Url(b)})}else if(c){try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}let d=await arweaveWallet.sign(e,a);e.setSignature({id:d.id,owner:d.owner,reward:d.reward,tags:d.tags,signature:d.signature})}else throw new Error("An error occurred while signing. Check wallet is valid")}async verify(e){let r=await e.getSignatureData(),a=e.get("signature",{decode:!0,string:!1}),i=$b.bufferTob64Url(await this.crypto.hash(a));if(e.id!==i)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(e.owner,r,a)}async post(e){if(typeof e=="string"?e=new fc.default(JSON.parse(e)):typeof e.readInt32BE=="function"?e=new fc.default(JSON.parse(e.toString())):typeof e=="object"&&!(e instanceof fc.default)&&(e=new fc.default(e)),!(e instanceof fc.default))throw new Error("Must be Transaction object");e.chunks||await e.prepareChunks(e.data);let r=await this.getUploader(e,e.data);try{for(;!r.isComplete;)await r.uploadChunk()}catch(a){if(r.lastResponseStatus>0)return{status:r.lastResponseStatus,statusText:r.lastResponseError,data:{error:r.lastResponseError}};throw a}return{status:200,statusText:"OK",data:{}}}async getUploader(e,r){let a;if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),e instanceof fc.default){if(r||(r=e.data),!(r instanceof Uint8Array))throw new Error("Data format is invalid");e.chunks||await e.prepareChunks(r),a=new $O.TransactionUploader(this.api,e),(!a.data||a.data.length===0)&&(a.data=r)}else{if(typeof e=="string"&&(e=await $O.TransactionUploader.fromTransactionId(this.api,e)),!r||!(r instanceof Uint8Array))throw new Error("Must provide data when resuming upload");a=await $O.TransactionUploader.fromSerialized(this.api,e,r)}return a}async*upload(e,r){let a=await this.getUploader(e,r);for(;!a.isComplete;)await a.uploadChunk(),yield a;return a}};Gf.default=UO});var Due=ht(uc=>{"use strict";X();ee();Q();var mFe=uc&&uc.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),gFe=uc&&uc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bFe=uc&&uc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mFe(e,t,r);return gFe(e,t),e};Object.defineProperty(uc,"__esModule",{value:!0});var Lue=bFe(sc());u5();var qO=class{api;crypto;constructor(e,r){this.api=e,this.crypto=r}getBalance(e){return this.api.get(`wallet/${e}/balance`).then(r=>r.data)}getLastTransactionID(e){return this.api.get(`wallet/${e}/last_tx`).then(r=>r.data)}generate(){return this.crypto.generateJWK()}async jwkToAddress(e){return!e||e==="use_wallet"?this.getAddress():this.getAddress(e)}async getAddress(e){if(!e||e==="use_wallet"){try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}else return this.ownerToAddress(e.n)}async ownerToAddress(e){return Lue.bufferTob64Url(await this.crypto.hash(Lue.b64UrlToBuffer(e)))}};uc.default=qO});var Uue=ht(Yf=>{"use strict";X();ee();Q();var yFe=Yf&&Yf.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),wFe=Yf&&Yf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Fe=Yf&&Yf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yFe(e,t,r);return wFe(e,t),e};Object.defineProperty(Yf,"__esModule",{value:!0});Yf.SiloResource=void 0;var $ue=_Fe(sc()),FO=class{api;crypto;transactions;constructor(e,r,a){this.api=e,this.crypto=r,this.transactions=a}async get(e){if(!e)throw new Error("No Silo URI specified");let r=await this.parseUri(e),a=await this.transactions.search("Silo-Name",r.getAccessKey());if(a.length==0)throw new Error(`No data could be found for the Silo URI: ${e}`);let i=await this.transactions.get(a[0]);if(!i)throw new Error(`No data could be found for the Silo URI: ${e}`);let h=i.get("data",{decode:!0,string:!1});return this.crypto.decrypt(h,r.getEncryptionKey())}async readTransactionData(e,r){if(!r)throw new Error("No Silo URI specified");let a=await this.parseUri(r),i=e.get("data",{decode:!0,string:!1});return this.crypto.decrypt(i,a.getEncryptionKey())}async parseUri(e){let r=e.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!r)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");let a=r[1],i=Math.pow(2,parseInt(r[2])),h=await this.hash($ue.stringToBuffer(a),i),c=$ue.bufferTob64(h.slice(0,15)),d=await this.hash(h.slice(16,31),1);return new h5(e,c,d)}async hash(e,r){let a=await this.crypto.hash(e);for(let i=0;i<r-1;i++)a=await this.crypto.hash(a);return a}};Yf.default=FO;var h5=class{uri;accessKey;encryptionKey;constructor(e,r,a){this.uri=e,this.accessKey=r,this.encryptionKey=a}getUri(){return this.uri}getAccessKey(){return this.accessKey}getEncryptionKey(){return this.encryptionKey}};Yf.SiloResource=h5});var Fue=ht(hc=>{"use strict";X();ee();Q();var MFe=hc&&hc.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),xFe=hc&&hc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SFe=hc&&hc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MFe(e,t,r);return xFe(e,t),e};Object.defineProperty(hc,"__esModule",{value:!0});var que=Ob(),EFe=SFe(sc()),jO=class{api;constructor(e){this.api=e}async getTransactionOffset(e){let r=await this.api.get(`tx/${e}/offset`);if(r.status===200)return r.data;throw new Error(`Unable to get transaction offset: ${(0,que.getError)(r)}`)}async getChunk(e){let r=await this.api.get(`chunk/${e}`);if(r.status===200)return r.data;throw new Error(`Unable to get chunk: ${(0,que.getError)(r)}`)}async getChunkData(e){let r=await this.getChunk(e);return EFe.b64UrlToBuffer(r.chunk)}firstChunkOffset(e){return parseInt(e.offset)-parseInt(e.size)+1}async downloadChunkedData(e){let r=await this.getTransactionOffset(e),a=parseInt(r.size),h=parseInt(r.offset)-a+1,c=new Uint8Array(a),d=0;for(;d<a;){this.api.config.logging&&console.log(`[chunk] ${d}/${a}`);let b;try{b=await this.getChunkData(h+d)}catch{console.error(`[chunk] Failed to fetch chunk at offset ${h+d}`),console.error("[chunk] This could indicate that the chunk wasn't uploaded or hasn't yet seeded properly to a particular gateway/node")}if(b)c.set(b,d),d+=b.length;else throw new Error(`Couldn't complete data download at ${d}/${a}`)}return c}};hc.default=jO});var zue=ht(Ub=>{"use strict";X();ee();Q();var AFe=Ub&&Ub.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ub,"__esModule",{value:!0});var jue=AFe(Ob());u5();var zO=class t{api;network;static HASH_ENDPOINT="block/hash/";static HEIGHT_ENDPOINT="block/height/";constructor(e,r){this.api=e,this.network=r}async get(e){let r=await this.api.get(`${t.HASH_ENDPOINT}${e}`);if(r.status===200)return r.data;throw r.status===404?new jue.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${r}`)}async getByHeight(e){let r=await this.api.get(`${t.HEIGHT_ENDPOINT}${e}`);if(r.status===200)return r.data;throw r.status===404?new jue.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${r}`)}async getCurrent(){let{current:e}=await this.network.getInfo();return await this.get(e)}};Ub.default=zO});var n5=ht(Jf=>{"use strict";X();ee();Q();var RFe=Jf&&Jf.__createBinding||(Object.create?function(t,e,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,a,i)}:function(t,e,r,a){a===void 0&&(a=r),t[a]=e[r]}),TFe=Jf&&Jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kFe=Jf&&Jf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RFe(e,t,r);return TFe(e,t),e},Xu=Jf&&Jf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Jf,"__esModule",{value:!0});var IFe=Xu(tue()),BFe=Xu(rue()),OFe=Xu(lue()),PFe=Xu(due()),NFe=Xu(Cue()),CFe=Xu(Due()),Hue=Xu(f5()),qb=kFe(sc()),LFe=Xu(Uue()),DFe=Xu(Fue()),$Fe=Xu(zue()),HO=class t{api;wallets;transactions;network;blocks;ar;silo;chunks;static init;static crypto=new OFe.default;static utils=qb;constructor(e){this.api=new BFe.default(e),this.wallets=new CFe.default(this.api,t.crypto),this.chunks=new DFe.default(this.api),this.transactions=new NFe.default(this.api,t.crypto,this.chunks),this.silo=new LFe.default(this.api,this.crypto,this.transactions),this.network=new PFe.default(this.api),this.blocks=new $Fe.default(this.api,this.network),this.ar=new IFe.default}get crypto(){return t.crypto}get utils(){return t.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(e,r){let a={};if(Object.assign(a,e),!e.data&&!(e.target&&e.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(e.owner==null&&r&&r!=="use_wallet"&&(a.owner=r.n),e.last_tx==null&&(a.last_tx=await this.transactions.getTransactionAnchor()),typeof e.data=="string"&&(e.data=qb.stringToBuffer(e.data)),e.data instanceof ArrayBuffer&&(e.data=new Uint8Array(e.data)),e.data&&!(e.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(e.reward==null){let h=e.data?e.data.byteLength:0;a.reward=await this.transactions.getPrice(h,a.target)}a.data_root="",a.data_size=e.data?e.data.byteLength.toString():"0",a.data=e.data||new Uint8Array(0);let i=new Hue.default(a);return await i.getSignatureData(),i}async createSiloTransaction(e,r,a){let i={};if(Object.assign(i,e),!e.data)throw new Error("Silo transactions must have a 'data' value");if(!a)throw new Error("No Silo URI specified.");if(e.target||e.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(e.owner==null){if(!r||!r.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");i.owner=r.n}e.last_tx==null&&(i.last_tx=await this.transactions.getTransactionAnchor());let h=await this.silo.parseUri(a);if(typeof e.data=="string"){let d=await this.crypto.encrypt(qb.stringToBuffer(e.data),h.getEncryptionKey());i.reward=await this.transactions.getPrice(d.byteLength),i.data=qb.bufferTob64Url(d)}if(e.data instanceof Uint8Array){let d=await this.crypto.encrypt(e.data,h.getEncryptionKey());i.reward=await this.transactions.getPrice(d.byteLength),i.data=qb.bufferTob64Url(d)}let c=new Hue.default(i);return c.addTag("Silo-Name",h.getAccessKey()),c.addTag("Silo-Version","0.1.0"),c}arql(e){return this.api.post("/arql",e).then(r=>r.data||[])}};Jf.default=HO});var Kue=ht((KO,Zue)=>{"use strict";X();ee();Q();var UFe=KO&&KO.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},ZO=UFe(n5());ZO.default.init=function(t={}){return new ZO.default(t)};Zue.exports=ZO.default});var Nhe=ht((vMt,Phe)=>{"use strict";X();ee();Q();var rze=new Set(["ENOTFOUND","ENETUNREACH","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_CRL","UNABLE_TO_DECRYPT_CERT_SIGNATURE","UNABLE_TO_DECRYPT_CRL_SIGNATURE","UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY","CERT_SIGNATURE_FAILURE","CRL_SIGNATURE_FAILURE","CERT_NOT_YET_VALID","CERT_HAS_EXPIRED","CRL_NOT_YET_VALID","CRL_HAS_EXPIRED","ERROR_IN_CERT_NOT_BEFORE_FIELD","ERROR_IN_CERT_NOT_AFTER_FIELD","ERROR_IN_CRL_LAST_UPDATE_FIELD","ERROR_IN_CRL_NEXT_UPDATE_FIELD","OUT_OF_MEM","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_CHAIN_TOO_LONG","CERT_REVOKED","INVALID_CA","PATH_LENGTH_EXCEEDED","INVALID_PURPOSE","CERT_UNTRUSTED","CERT_REJECTED","HOSTNAME_MISMATCH"]);Phe.exports=t=>!rze.has(t&&t.code)});var zhe=ht((LMt,EP)=>{"use strict";X();ee();Q();var dze=Object.prototype.hasOwnProperty,Ga="~";function Qb(){}Object.create&&(Qb.prototype=Object.create(null),new Qb().__proto__||(Ga=!1));function pze(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function jhe(t,e,r,a,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var h=new pze(r,a||t,i),c=Ga?Ga+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],h]:t._events[c].push(h):(t._events[c]=h,t._eventsCount++),t}function P5(t,e){--t._eventsCount===0?t._events=new Qb:delete t._events[e]}function Da(){this._events=new Qb,this._eventsCount=0}Da.prototype.eventNames=function(){var e=[],r,a;if(this._eventsCount===0)return e;for(a in r=this._events)dze.call(r,a)&&e.push(Ga?a.slice(1):a);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Da.prototype.listeners=function(e){var r=Ga?Ga+e:e,a=this._events[r];if(!a)return[];if(a.fn)return[a.fn];for(var i=0,h=a.length,c=new Array(h);i<h;i++)c[i]=a[i].fn;return c};Da.prototype.listenerCount=function(e){var r=Ga?Ga+e:e,a=this._events[r];return a?a.fn?1:a.length:0};Da.prototype.emit=function(e,r,a,i,h,c){var d=Ga?Ga+e:e;if(!this._events[d])return!1;var b=this._events[d],g=arguments.length,y,M;if(b.fn){switch(b.once&&this.removeListener(e,b.fn,void 0,!0),g){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,r),!0;case 3:return b.fn.call(b.context,r,a),!0;case 4:return b.fn.call(b.context,r,a,i),!0;case 5:return b.fn.call(b.context,r,a,i,h),!0;case 6:return b.fn.call(b.context,r,a,i,h,c),!0}for(M=1,y=new Array(g-1);M<g;M++)y[M-1]=arguments[M];b.fn.apply(b.context,y)}else{var x=b.length,E;for(M=0;M<x;M++)switch(b[M].once&&this.removeListener(e,b[M].fn,void 0,!0),g){case 1:b[M].fn.call(b[M].context);break;case 2:b[M].fn.call(b[M].context,r);break;case 3:b[M].fn.call(b[M].context,r,a);break;case 4:b[M].fn.call(b[M].context,r,a,i);break;default:if(!y)for(E=1,y=new Array(g-1);E<g;E++)y[E-1]=arguments[E];b[M].fn.apply(b[M].context,y)}}return!0};Da.prototype.on=function(e,r,a){return jhe(this,e,r,a,!1)};Da.prototype.once=function(e,r,a){return jhe(this,e,r,a,!0)};Da.prototype.removeListener=function(e,r,a,i){var h=Ga?Ga+e:e;if(!this._events[h])return this;if(!r)return P5(this,h),this;var c=this._events[h];if(c.fn)c.fn===r&&(!i||c.once)&&(!a||c.context===a)&&P5(this,h);else{for(var d=0,b=[],g=c.length;d<g;d++)(c[d].fn!==r||i&&!c[d].once||a&&c[d].context!==a)&&b.push(c[d]);b.length?this._events[h]=b.length===1?b[0]:b:P5(this,h)}return this};Da.prototype.removeAllListeners=function(e){var r;return e?(r=Ga?Ga+e:e,this._events[r]&&P5(this,r)):(this._events=new Qb,this._eventsCount=0),this};Da.prototype.off=Da.prototype.removeListener;Da.prototype.addListener=Da.prototype.on;Da.prefixed=Ga;Da.EventEmitter=Da;typeof EP<"u"&&(EP.exports=Da)});X();ee();Q();X();ee();Q();var VT={};$a(VT,{AVSCTap:()=>qg,AlgorandSigner:()=>Bg,AptosSigner:()=>Pg,ArconnectSigner:()=>S1,Arweave:()=>OV.default,ArweaveSigner:()=>Xc,Bundle:()=>r4,BundleItem:()=>WT,CryptoDriver:()=>F3,Curve25519:()=>Ro,DataItem:()=>Q8,EthereumSigner:()=>No,HexInjectedSolanaSigner:()=>ad,HexSolanaSigner:()=>Og,InjectedAptosSigner:()=>od,InjectedEthereumSigner:()=>WR,InjectedSolanaSigner:()=>N0,InjectedTypedEthereumSigner:()=>zT,KyveSigner:()=>Lg,MAX_TAG_BYTES:()=>X8,MIN_BINARY_SIZE:()=>e4,MultiSignatureAptosSigner:()=>sd,NearSigner:()=>Ig,PolygonSigner:()=>kg,Rsa4096:()=>O0,SIG_CONFIG:()=>Vr,SignatureConfig:()=>_r,Signer:()=>U5,SolanaSigner:()=>Dh,Transaction:()=>BV.default,TypedEthereumSigner:()=>fd,bundleAndSignData:()=>z5e,byteArrayToLong:()=>_n,concatBuffers:()=>Ni.concatBuffers,createData:()=>jg,deepHash:()=>Wc,deserializeTags:()=>E1,exportForTesting:()=>U5e,getCryptoDriver:()=>En,getSignatureAndId:()=>VQ,indexToType:()=>Dg,keccak256:()=>qT,longTo16ByteArray:()=>F5e,longTo32ByteArray:()=>J8,longTo8ByteArray:()=>Y8,longToNByteArray:()=>Ug,secp256k1:()=>nd,serializeTags:()=>ZT,shortTo2ByteArray:()=>HT,sign:()=>t4,stringToBuffer:()=>Ni.stringToBuffer,unbundleData:()=>j5e});X();ee();Q();X();ee();Q();X();ee();Q();var U5=class{publicKey;signatureType;signatureLength;ownerLength;pem;static verify(e,r,a,i){throw new Error("You must implement verify method on child")}};X();ee();Q();X();ee();Q();var ZW=vi(zo(),1);X();ee();Q();var _r;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM",t[t.KYVE=101]="KYVE"})(_r||(_r={}));var Vr={[_r.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[_r.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[_r.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[_r.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[_r.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[_r.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[_r.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"},[_r.KYVE]:{sigLength:65,pubLength:65,sigName:"kyve"}};X();ee();Q();Sh();var ta=BigInt(0),si=BigInt(1),Hc=BigInt(2),gbe=BigInt(8),DW=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),Yi=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:DW,n:DW,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")});var jW=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),Um=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),_Ze=BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742"),bbe=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),ybe=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),wbe=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),_be=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),Un=class t{constructor(e,r,a,i){this.x=e,this.y=r,this.z=a,this.t=i}static fromAffine(e){if(!(e instanceof Sn))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(Sn.ZERO)?t.ZERO:new t(e.x,e.y,si,At(e.x*e.y))}static toAffineBatch(e){let r=Sbe(e.map(a=>a.z));return e.map((a,i)=>a.toAffine(r[i]))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){UW(e);let{x:r,y:a,z:i}=this,{x:h,y:c,z:d}=e,b=At(r*d),g=At(h*i),y=At(a*d),M=At(c*i);return b===g&&y===M}negate(){return new t(At(-this.x),this.y,this.z,At(-this.t))}double(){let{x:e,y:r,z:a}=this,{a:i}=Yi,h=At(e*e),c=At(r*r),d=At(Hc*At(a*a)),b=At(i*h),g=e+r,y=At(At(g*g)-h-c),M=b+c,x=M-d,E=b-c,A=At(y*x),k=At(M*E),O=At(y*E),N=At(x*M);return new t(A,k,N,O)}add(e){UW(e);let{x:r,y:a,z:i,t:h}=this,{x:c,y:d,z:b,t:g}=e,y=At((a-r)*(d+c)),M=At((a+r)*(d-c)),x=At(M-y);if(x===ta)return this.double();let E=At(i*Hc*g),A=At(h*Hc*b),k=A+E,O=M+y,N=A-E,L=At(k*x),C=At(O*N),Y=At(k*N),G=At(x*O);return new t(L,C,G,Y)}subtract(e){return this.add(e.negate())}precomputeWindow(e){let r=1+256/e,a=[],i=this,h=i;for(let c=0;c<r;c++){h=i,a.push(h);for(let d=1;d<2**(e-1);d++)h=h.add(i),a.push(h);i=h.double()}return a}wNAF(e,r){!r&&this.equals(t.BASE)&&(r=Sn.BASE);let a=r&&r._WINDOW_SIZE||1;if(256%a)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let i=r&&YE.get(r);i||(i=this.precomputeWindow(a),r&&a!==1&&(i=t.normalizeZ(i),YE.set(r,i)));let h=t.ZERO,c=t.BASE,d=1+256/a,b=2**(a-1),g=BigInt(2**a-1),y=2**a,M=BigInt(a);for(let x=0;x<d;x++){let E=x*b,A=Number(e&g);e>>=M,A>b&&(A-=y,e+=si);let k=E,O=E+Math.abs(A)-1,N=x%2!==0,L=A<0;A===0?c=c.add($W(N,i[k])):h=h.add($W(L,i[O]))}return t.normalizeZ([h,c])[0]}multiply(e,r){return this.wNAF(k3(e,Yi.l),r)}multiplyUnsafe(e){let r=k3(e,Yi.l,!1),a=t.BASE,i=t.ZERO;if(r===ta)return i;if(this.equals(i)||r===si)return this;if(this.equals(a))return this.wNAF(r);let h=i,c=this;for(;r>ta;)r&si&&(h=h.add(c)),c=c.double(),r>>=si;return h}isSmallOrder(){return this.multiplyUnsafe(Yi.h).equals(t.ZERO)}isTorsionFree(){let e=this.multiplyUnsafe(Yi.l/Hc).double();return Yi.l%Hc&&(e=e.add(this)),e.equals(t.ZERO)}toAffine(e){let{x:r,y:a,z:i}=this,h=this.equals(t.ZERO);e==null&&(e=h?gbe:I3(i));let c=At(r*e),d=At(a*e),b=At(i*e);if(h)return Sn.ZERO;if(b!==si)throw new Error("invZ was invalid");return new Sn(c,d)}fromRistrettoBytes(){WE()}toRistrettoBytes(){WE()}fromRistrettoHash(){WE()}};Un.BASE=new Un(Yi.Gx,Yi.Gy,si,At(Yi.Gx*Yi.Gy));Un.ZERO=new Un(ta,si,si,ta);function $W(t,e){let r=e.negate();return t?r:e}function UW(t){if(!(t instanceof Un))throw new TypeError("ExtendedPoint expected")}function KE(t){if(!(t instanceof I0))throw new TypeError("RistrettoPoint expected")}function WE(){throw new Error("Legacy method: switch to RistrettoPoint")}var I0=class t{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){let{d:r}=Yi,a=At(Um*e*e),i=At((a+si)*wbe),h=BigInt(-1),c=At((h-r*a)*At(a+r)),{isValid:d,value:b}=XE(i,c),g=At(b*e);zc(g)||(g=At(-g)),d||(b=g),d||(h=a);let y=At(h*(a-si)*_be-c),M=b*b,x=At((b+b)*c),E=At(y*bbe),A=At(si-M),k=At(si+M);return new Un(At(x*k),At(A*E),At(E*k),At(x*A))}static hashToCurve(e){e=Zc(e,64);let r=VE(e.slice(0,32)),a=this.calcElligatorRistrettoMap(r),i=VE(e.slice(32,64)),h=this.calcElligatorRistrettoMap(i);return new t(a.add(h))}static fromHex(e){e=Zc(e,32);let{a:r,d:a}=Yi,i="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",h=VE(e);if(!Abe(Fm(h),e)||zc(h))throw new Error(i);let c=At(h*h),d=At(si+r*c),b=At(si-r*c),g=At(d*d),y=At(b*b),M=At(r*a*g-y),{isValid:x,value:E}=FW(At(M*y)),A=At(E*b),k=At(E*A*M),O=At((h+h)*A);zc(O)&&(O=At(-O));let N=At(d*k),L=At(O*N);if(!x||zc(L)||N===ta)throw new Error(i);return new t(new Un(O,N,si,L))}toRawBytes(){let{x:e,y:r,z:a,t:i}=this.ep,h=At(At(a+r)*At(a-r)),c=At(e*r),d=At(c*c),{value:b}=FW(At(h*d)),g=At(b*h),y=At(b*c),M=At(g*y*i),x;if(zc(i*M)){let A=At(r*Um),k=At(e*Um);e=A,r=k,x=At(g*ybe)}else x=y;zc(e*M)&&(r=At(-r));let E=At((a-r)*x);return zc(E)&&(E=At(-E)),Fm(E)}toHex(){return jm(this.toRawBytes())}toString(){return this.toHex()}equals(e){KE(e);let r=this.ep,a=e.ep,i=At(r.x*a.y)===At(r.y*a.x),h=At(r.y*a.y)===At(r.x*a.x);return i||h}add(e){return KE(e),new t(this.ep.add(e.ep))}subtract(e){return KE(e),new t(this.ep.subtract(e.ep))}multiply(e){return new t(this.ep.multiply(e))}multiplyUnsafe(e){return new t(this.ep.multiplyUnsafe(e))}};I0.BASE=new I0(Un.BASE);I0.ZERO=new I0(Un.ZERO);var YE=new WeakMap,Sn=class t{constructor(e,r){this.x=e,this.y=r}_setWindowSize(e){this._WINDOW_SIZE=e,YE.delete(this)}static fromHex(e,r=!0){let{d:a,P:i}=Yi;e=Zc(e,32);let h=e.slice();h[31]=e[31]&-129;let c=zm(h);if(r&&c>=i)throw new Error("Expected 0 < hex < P");if(!r&&c>=jW)throw new Error("Expected 0 < hex < 2**256");let d=At(c*c),b=At(d-si),g=At(a*d+si),{isValid:y,value:M}=XE(b,g);if(!y)throw new Error("Point.fromHex: invalid y coordinate");let x=(M&si)===si;return(e[31]&128)!==0!==x&&(M=At(-M)),new t(M,c)}static async fromPrivateKey(e){return(await QE(e)).point}toRawBytes(){let e=Fm(this.y);return e[31]|=this.x&si?128:0,e}toHex(){return jm(this.toRawBytes())}toX25519(){let{y:e}=this,r=At((si+e)*I3(si-e));return Fm(r)}isTorsionFree(){return Un.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new t(At(-this.x),this.y)}add(e){return Un.fromAffine(this).add(Un.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return Un.fromAffine(this).multiply(e,this).toAffine()}};Sn.BASE=new Sn(Yi.Gx,Yi.Gy);Sn.ZERO=new Sn(ta,si);var qm=class t{constructor(e,r){this.r=e,this.s=r,this.assertValidity()}static fromHex(e){let r=Zc(e,64),a=Sn.fromHex(r.slice(0,32),!1),i=zm(r.slice(32,64));return new t(a,i)}assertValidity(){let{r:e,s:r}=this;if(!(e instanceof Sn))throw new Error("Expected Point instance");return k3(r,Yi.l,!1),this}toRawBytes(){let e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(Fm(this.s),32),e}toHex(){return jm(this.toRawBytes())}};function qW(...t){if(!t.every(a=>a instanceof Uint8Array))throw new Error("Expected Uint8Array list");if(t.length===1)return t[0];let e=t.reduce((a,i)=>a+i.length,0),r=new Uint8Array(e);for(let a=0,i=0;a<t.length;a++){let h=t[a];r.set(h,i),i+=h.length}return r}var Mbe=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function jm(t){if(!(t instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=Mbe[t[r]];return e}function JE(t){if(typeof t!="string")throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){let a=r*2,i=t.slice(a,a+2),h=Number.parseInt(i,16);if(Number.isNaN(h)||h<0)throw new Error("Invalid byte sequence");e[r]=h}return e}function zW(t){let r=t.toString(16).padStart(64,"0");return JE(r)}function Fm(t){return zW(t).reverse()}function zc(t){return(At(t)&si)===si}function zm(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+jm(Uint8Array.from(t).reverse()))}var xbe=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function VE(t){return At(zm(t)&xbe)}function At(t,e=Yi.P){let r=t%e;return r>=ta?r:e+r}function I3(t,e=Yi.P){if(t===ta||e<=ta)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=At(t,e),a=e,i=ta,h=si,c=si,d=ta;for(;r!==ta;){let g=a/r,y=a%r,M=i-c*g,x=h-d*g;a=r,r=y,i=c,h=d,c=M,d=x}if(a!==si)throw new Error("invert: does not exist");return At(i,e)}function Sbe(t,e=Yi.P){let r=new Array(t.length),a=t.reduce((h,c,d)=>c===ta?h:(r[d]=h,At(h*c,e)),si),i=I3(a,e);return t.reduceRight((h,c,d)=>c===ta?h:(r[d]=At(h*r[d],e),At(h*c,e)),i),r}function yu(t,e){let{P:r}=Yi,a=t;for(;e-- >ta;)a*=a,a%=r;return a}function Ebe(t){let{P:e}=Yi,r=BigInt(5),a=BigInt(10),i=BigInt(20),h=BigInt(40),c=BigInt(80),b=t*t%e*t%e,g=yu(b,Hc)*b%e,y=yu(g,si)*t%e,M=yu(y,r)*y%e,x=yu(M,a)*M%e,E=yu(x,i)*x%e,A=yu(E,h)*E%e,k=yu(A,c)*A%e,O=yu(k,c)*A%e,N=yu(O,a)*M%e;return{pow_p_5_8:yu(N,Hc)*t%e,b2:b}}function XE(t,e){let r=At(e*e*e),a=At(r*r*e),i=Ebe(t*a).pow_p_5_8,h=At(t*r*i),c=At(e*h*h),d=h,b=At(h*Um),g=c===t,y=c===At(-t),M=c===At(-t*Um);return g&&(h=d),(y||M)&&(h=b),zc(h)&&(h=At(-h)),{isValid:g||y,value:h}}function FW(t){return XE(si,t)}function T3(t){return At(zm(t),Yi.l)}function Abe(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function Zc(t,e){let r=t instanceof Uint8Array?Uint8Array.from(t):JE(t);if(typeof e=="number"&&r.length!==e)throw new Error(`Expected ${e} bytes`);return r}function k3(t,e,r=!0){if(!e)throw new TypeError("Specify max value");if(typeof t=="number"&&Number.isSafeInteger(t)&&(t=BigInt(t)),typeof t=="bigint"&&t<e){if(r){if(ta<t)return t}else if(ta<=t)return t}throw new TypeError("Expected valid scalar: 0 < scalar < max")}function Rbe(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function Tbe(t){if(t=typeof t=="bigint"||typeof t=="number"?zW(k3(t,jW)):Zc(t),t.length!==32)throw new Error("Expected 32 bytes");return t}function kbe(t){let e=Rbe(t.slice(0,32)),r=t.slice(32,64),a=T3(e),i=Sn.BASE.multiply(a),h=i.toRawBytes();return{head:e,prefix:r,scalar:a,point:i,pointBytes:h}}var GE;async function QE(t){return kbe(await qp.sha512(Tbe(t)))}async function HW(t,e){t=Zc(t);let{prefix:r,scalar:a,pointBytes:i}=await QE(e),h=T3(await qp.sha512(r,t)),c=Sn.BASE.multiply(h),d=T3(await qp.sha512(c.toRawBytes(),i,t)),b=At(h+d*a,Yi.l);return new qm(c,b).toRawBytes()}function Ibe(t,e,r){e=Zc(e),r instanceof Sn||(r=Sn.fromHex(r,!1));let{r:a,s:i}=t instanceof qm?t.assertValidity():qm.fromHex(t),h=Un.BASE.multiplyUnsafe(i);return{r:a,s:i,SB:h,pub:r,msg:e}}function Bbe(t,e,r,a){let i=T3(a),h=Un.fromAffine(t).multiplyUnsafe(i);return Un.fromAffine(e).add(h).subtract(r).multiplyUnsafe(Yi.h).equals(Un.ZERO)}async function Kc(t,e,r){let{r:a,SB:i,msg:h,pub:c}=Ibe(t,e,r),d=await qp.sha512(a.toRawBytes(),c.toRawBytes(),h);return Bbe(c,a,i,d)}Sn.BASE._setWindowSize(8);var jc={node:$m,web:typeof self=="object"&&"crypto"in self?self.crypto:void 0},qp={bytesToHex:jm,hexToBytes:JE,concatBytes:qW,getExtendedPublicKey:QE,mod:At,invert:I3,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:t=>{if(t=Zc(t),t.length<40||t.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return At(zm(t),Yi.l-si)+si},randomBytes:(t=32)=>{if(jc.web)return jc.web.getRandomValues(new Uint8Array(t));if(jc.node){let{randomBytes:e}=jc.node;return new Uint8Array(e(t).buffer)}else throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>qp.randomBytes(32),sha512:async(...t)=>{let e=qW(...t);if(jc.web){let r=await jc.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(r)}else{if(jc.node)return Uint8Array.from(jc.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")}},precompute(t=8,e=Sn.BASE){let r=e.equals(Sn.BASE)?e:new Sn(e.x,e.y);return r._setWindowSize(t),r.multiply(Hc),r},sha512Sync:void 0};Object.defineProperties(qp,{sha512Sync:{configurable:!1,get(){return GE},set(t){GE||(GE=t)}}});var Ro=class{_key;pk;ownerLength=Vr[2].pubLength;signatureLength=Vr[2].sigLength;_publicKey;get publicKey(){return this._publicKey}signatureType=2;constructor(e,r){this._key=e,this.pk=r}get key(){throw new Error("You must implement `key`")}sign(e){return HW(ge.from(e),ge.from(this.key))}static async verify(e,r,a){let i=e;return typeof e=="string"&&(i=ZW.default.toBuffer(e)),Kc(ge.from(a),ge.from(r),ge.from(i))}};X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var Ni=vi(bf(),1);X();ee();Q();Sh();async function Wc(t){if(typeof t[Symbol.asyncIterator]=="function"){let i=t,h=xh("sha384"),c=0;for await(let g of i)c+=g.byteLength,h.update(g);let d=(0,Ni.concatBuffers)([(0,Ni.stringToBuffer)("blob"),(0,Ni.stringToBuffer)(c.toString())]),b=(0,Ni.concatBuffers)([await En().hash(d,"SHA-384"),h.digest()]);return await En().hash(b,"SHA-384")}else if(Array.isArray(t)){let i=(0,Ni.concatBuffers)([(0,Ni.stringToBuffer)("list"),(0,Ni.stringToBuffer)(t.length.toString())]);return await rV(t,await En().hash(i,"SHA-384"))}let e=t,r=(0,Ni.concatBuffers)([(0,Ni.stringToBuffer)("blob"),(0,Ni.stringToBuffer)(e.byteLength.toString())]),a=(0,Ni.concatBuffers)([await En().hash(r,"SHA-384"),await En().hash(e,"SHA-384")]);return await En().hash(a,"SHA-384")}async function rV(t,e){if(t.length<1)return e;let r=(0,Ni.concatBuffers)([e,await Wc(t[0])]),a=await En().hash(r,"SHA-384");return await rV(t.slice(1),a)}var q3=vi(nA(),1),BV=vi(Ym(),1),OV=vi(IV(),1),gye=q3.default.default?q3.default.default:q3.default,F3=class extends gye{getPublicKey(e){throw new Error("Unimplemented")}},bye;function En(){return bye??=new F3}var PV=vi(zo(),1);Sh();var O0=class{_key;pk;signatureType=1;ownerLength=Vr[1].pubLength;signatureLength=Vr[1].sigLength;_publicKey;get publicKey(){return this._publicKey}constructor(e,r){this._key=e,this.pk=r,r||(this.pk=En().getPublicKey(JSON.parse(e)))}sign(e){return ZE("sha256").update(e).sign({key:this._key,padding:HE.RSA_PKCS1_PSS_PADDING})}static async verify(e,r,a){return await En().verify(ge.isBuffer(e)?PV.default.encode(e):e,r,a)}};var _G=vi(wG(),1),MG=vi(zo(),1);var Xc=class extends O0{jwk;constructor(e){super((0,_G.jwkTopem)(e),e.n),this.jwk=e}get publicKey(){if(!this.pk)throw new Error("ArweaveSigner - pk is undefined");return MG.default.toBuffer(this.pk)}sign(e){return En().sign(this.jwk,e)}static async verify(e,r,a){return await En().verify(e,r,a)}};X();ee();Q();var xG=vi(zo(),1);var N0=class{_publicKey;ownerLength=Vr[2].pubLength;signatureLength=Vr[2].sigLength;signatureType=2;pem;provider;constructor(e){if(this.provider=e,!this.provider.publicKey)throw new Error("InjectedSolanaSigner - provider.publicKey is undefined");this._publicKey=this.provider.publicKey.toBuffer()}get publicKey(){return this._publicKey}async sign(e){if(!this.provider.signMessage)throw new Error("Selected Wallet does not support message signing");return await this.provider.signMessage(e)}static async verify(e,r,a){let i=e;return typeof e=="string"&&(i=xG.default.toBuffer(e)),Kc(ge.from(a),ge.from(r),ge.from(i))}};X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var NG=vi(SG());X();ee();Q();X();ee();Q();X();ee();Q();var EG="logger/5.7.0";var AG=!1,RG=!1,Y3={debug:1,default:2,info:2,warning:3,error:4,off:5},TG=Y3.default,XA=null;function Xye(){try{let t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var kG=Xye(),QA;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(QA||(QA={}));var wf;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(wf||(wf={}));var IG="0123456789abcdef",tr=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){let a=e.toLowerCase();Y3[a]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(TG>Y3[a])&&console.log.apply(console,r)}debug(...e){this._log(t.levels.DEBUG,e)}info(...e){this._log(t.levels.INFO,e)}warn(...e){this._log(t.levels.WARNING,e)}makeError(e,r,a){if(RG)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),a||(a={});let i=[];Object.keys(a).forEach(b=>{let g=a[b];try{if(g instanceof Uint8Array){let y="";for(let M=0;M<g.length;M++)y+=IG[g[M]>>4],y+=IG[g[M]&15];i.push(b+"=Uint8Array(0x"+y+")")}else i.push(b+"="+JSON.stringify(g))}catch{i.push(b+"="+JSON.stringify(a[b].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);let h=e,c="";switch(r){case wf.NUMERIC_FAULT:{c="NUMERIC_FAULT";let b=e;switch(b){case"overflow":case"underflow":case"division-by-zero":c+="-"+b;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result";break}break}case wf.CALL_EXCEPTION:case wf.INSUFFICIENT_FUNDS:case wf.MISSING_NEW:case wf.NONCE_EXPIRED:case wf.REPLACEMENT_UNDERPRICED:case wf.TRANSACTION_REPLACED:case wf.UNPREDICTABLE_GAS_LIMIT:c=r;break}c&&(e+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),i.length&&(e+=" ("+i.join(", ")+")");let d=new Error(e);return d.reason=h,d.code=r,Object.keys(a).forEach(function(b){d[b]=a[b]}),d}throwError(e,r,a){throw this.makeError(e,r,a)}throwArgumentError(e,r,a){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:a})}assert(e,r,a,i){e||this.throwError(r,a,i)}assertArgument(e,r,a,i){e||this.throwArgumentError(r,a,i)}checkNormalize(e){e==null&&(e="platform missing String.prototype.normalize"),kG&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:kG})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,a){a?a=": "+a:a="",e<r&&this.throwError("missing argument"+a,t.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+a,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return XA||(XA=new t(EG)),XA}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),AG){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}RG=!!e,AG=!!r}static setLogLevel(e){let r=Y3[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}TG=r}static from(e){return new t(e)}};tr.errors=wf;tr.levels=QA;X();ee();Q();var BG="bytes/5.7.0";var An=new tr(BG);function PG(t){return!!t.toHexString}function Jp(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return Jp(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function rg(t){return Fn(t)&&!(t.length%2)||ig(t)}function OG(t){return typeof t=="number"&&t==t&&t%1===0}function ig(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!OG(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){let r=t[e];if(!OG(r)||r<0||r>=256)return!1}return!0}function Lt(t,e){if(e||(e={}),typeof t=="number"){An.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Jp(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),PG(t)&&(t=t.toHexString()),Fn(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":An.throwArgumentError("hex data is odd-length","value",t));let a=[];for(let i=0;i<r.length;i+=2)a.push(parseInt(r.substring(i,i+2),16));return Jp(new Uint8Array(a))}return ig(t)?Jp(new Uint8Array(t)):An.throwArgumentError("invalid arrayify value","value",t)}function Io(t){let e=t.map(i=>Lt(i)),r=e.reduce((i,h)=>i+h.length,0),a=new Uint8Array(r);return e.reduce((i,h)=>(a.set(h,i),i+h.length),0),Jp(a)}function _u(t){let e=Lt(t);if(e.length===0)return e;let r=0;for(;r<e.length&&e[r]===0;)r++;return r&&(e=e.slice(r)),e}function Qye(t,e){t=Lt(t),t.length>e&&An.throwArgumentError("value out of range","value",arguments[0]);let r=new Uint8Array(e);return r.set(t,e-t.length),Jp(r)}function Fn(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var eR="0123456789abcdef";function fr(t,e){if(e||(e={}),typeof t=="number"){An.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=eR[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),PG(t))return t.toHexString();if(Fn(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":An.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(ig(t)){let r="0x";for(let a=0;a<t.length;a++){let i=t[a];r+=eR[(i&240)>>4]+eR[i&15]}return r}return An.throwArgumentError("invalid hexlify value","value",t)}function ng(t){if(typeof t!="string")t=fr(t);else if(!Fn(t)||t.length%2)return null;return(t.length-2)/2}function kh(t,e,r){return typeof t!="string"?t=fr(t):(!Fn(t)||t.length%2)&&An.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Qc(t){let e="0x";return t.forEach(r=>{e+=fr(r).substring(2)}),e}function ka(t,e){for(typeof t!="string"?t=fr(t):Fn(t)||An.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&An.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function el(t){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(rg(t)){let r=Lt(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=fr(r.slice(0,32)),e.s=fr(r.slice(32,64))):r.length===65?(e.r=fr(r.slice(0,32)),e.s=fr(r.slice(32,64)),e.v=r[64]):An.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:An.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=fr(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){let i=Qye(Lt(e._vs),32);e._vs=fr(i);let h=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=h:e.recoveryParam!==h&&An.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;let c=fr(i);e.s==null?e.s=c:e.s!==c&&An.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?An.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{let i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&An.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Fn(e.r)?An.throwArgumentError("signature missing or invalid r","signature",t):e.r=ka(e.r,32),e.s==null||!Fn(e.s)?An.throwArgumentError("signature missing or invalid s","signature",t):e.s=ka(e.s,32);let r=Lt(e.s);r[0]>=128&&An.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);let a=fr(r);e._vs&&(Fn(e._vs)||An.throwArgumentError("signature invalid _vs","signature",t),e._vs=ka(e._vs,32)),e._vs==null?e._vs=a:e._vs!==a&&An.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function tR(t){return t=el(t),fr(Io([t.r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}function an(t){return"0x"+NG.default.keccak_256(Lt(t))}X();ee();Q();X();ee();Q();X();ee();Q();var qG=vi(LG());X();ee();Q();var DG="bignumber/5.7.0";var J3=qG.default.BN,Ih=new tr(DG),iR={},$G=9007199254740991;var UG=!1,on=class t{constructor(e,r){e!==iR&&Ih.throwError("cannot call constructor directly; use BigNumber.from",tr.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return ao(Qr(this).fromTwos(e))}toTwos(e){return ao(Qr(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return ao(Qr(this).add(Qr(e)))}sub(e){return ao(Qr(this).sub(Qr(e)))}div(e){return t.from(e).isZero()&&xs("division-by-zero","div"),ao(Qr(this).div(Qr(e)))}mul(e){return ao(Qr(this).mul(Qr(e)))}mod(e){let r=Qr(e);return r.isNeg()&&xs("division-by-zero","mod"),ao(Qr(this).umod(r))}pow(e){let r=Qr(e);return r.isNeg()&&xs("negative-power","pow"),ao(Qr(this).pow(r))}and(e){let r=Qr(e);return(this.isNegative()||r.isNeg())&&xs("unbound-bitwise-result","and"),ao(Qr(this).and(r))}or(e){let r=Qr(e);return(this.isNegative()||r.isNeg())&&xs("unbound-bitwise-result","or"),ao(Qr(this).or(r))}xor(e){let r=Qr(e);return(this.isNegative()||r.isNeg())&&xs("unbound-bitwise-result","xor"),ao(Qr(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&xs("negative-width","mask"),ao(Qr(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xs("negative-width","shl"),ao(Qr(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xs("negative-width","shr"),ao(Qr(this).shrn(e))}eq(e){return Qr(this).eq(Qr(e))}lt(e){return Qr(this).lt(Qr(e))}lte(e){return Qr(this).lte(Qr(e))}gt(e){return Qr(this).gt(Qr(e))}gte(e){return Qr(this).gte(Qr(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Qr(this).isZero()}toNumber(){try{return Qr(this).toNumber()}catch{xs("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ih.throwError("this platform does not support BigInt",tr.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?UG||(UG=!0,Ih.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ih.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",tr.errors.UNEXPECTED_ARGUMENT,{}):Ih.throwError("BigNumber.toString does not accept parameters",tr.errors.UNEXPECTED_ARGUMENT,{})),Qr(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(iR,ag(e)):e.match(/^-?[0-9]+$/)?new t(iR,ag(new J3(e))):Ih.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&xs("underflow","BigNumber.from",e),(e>=$G||e<=-$G)&&xs("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(ig(r))return t.from(fr(r));if(r)if(r.toHexString){let a=r.toHexString();if(typeof a=="string")return t.from(a)}else{let a=r._hex;if(a==null&&r.type==="BigNumber"&&(a=r.hex),typeof a=="string"&&(Fn(a)||a[0]==="-"&&Fn(a.substring(1))))return t.from(a)}return Ih.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}};function ag(t){if(typeof t!="string")return ag(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ih.throwArgumentError("invalid hex","value",t),t=ag(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function ao(t){return on.from(ag(t))}function Qr(t){let e=on.from(t).toHexString();return e[0]==="-"?new J3("-"+e.substring(3),16):new J3(e.substring(2),16)}function xs(t,e,r){let a={fault:t,operation:e};return r!=null&&(a.value=r),Ih.throwError(t,tr.errors.NUMERIC_FAULT,a)}function nR(t){return new J3(t,36).toString(16)}X();ee();Q();X();ee();Q();var FG="strings/5.7.0";var jG=new tr(FG),Mu;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(Mu||(Mu={}));var C0;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(C0||(C0={}));function t6e(t,e,r,a,i){return jG.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function zG(t,e,r,a,i){if(t===C0.BAD_PREFIX||t===C0.UNEXPECTED_CONTINUE){let h=0;for(let c=e+1;c<r.length&&r[c]>>6===2;c++)h++;return h}return t===C0.OVERRUN?r.length-e-1:0}function r6e(t,e,r,a,i){return t===C0.OVERLONG?(a.push(i),0):(a.push(65533),zG(t,e,r,a,i))}var i6e=Object.freeze({error:t6e,ignore:zG,replace:r6e});function qa(t,e=Mu.current){e!=Mu.current&&(jG.checkNormalize(),t=t.normalize(e));let r=[];for(let a=0;a<t.length;a++){let i=t.charCodeAt(a);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(i&63|128);else if((i&64512)==55296){a++;let h=t.charCodeAt(a);if(a>=t.length||(h&64512)!==56320)throw new Error("invalid utf-8 string");let c=65536+((i&1023)<<10)+(h&1023);r.push(c>>18|240),r.push(c>>12&63|128),r.push(c>>6&63|128),r.push(c&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return Lt(r)}function Xp(t){return an(qa(t))}X();ee();Q();var HG="hash/5.7.0";X();ee();Q();var ZG=`Ethereum Signed Message:
128
128
  `;function tl(t){return typeof t=="string"&&(t=qa(t)),an(Io([qa(ZG),qa(String(t.length)),t]))}X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var KG="rlp/5.7.0";var n6e=new tr(KG);function WG(t){let e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function VG(t){if(Array.isArray(t)){let a=[];if(t.forEach(function(h){a=a.concat(VG(h))}),a.length<=55)return a.unshift(192+a.length),a;let i=WG(a.length);return i.unshift(247+i.length),i.concat(a)}rg(t)||n6e.throwArgumentError("RLP object must be BytesLike","object",t);let e=Array.prototype.slice.call(Lt(t));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;let r=WG(e.length);return r.unshift(183+r.length),r.concat(e)}function og(t){return fr(VG(t))}X();ee();Q();var GG="address/5.7.0";var sg=new tr(GG);function YG(t){Fn(t,20)||sg.throwArgumentError("invalid address","address",t),t=t.toLowerCase();let e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);let a=Lt(an(r));for(let i=0;i<40;i+=2)a[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(a[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}var o6e=9007199254740991;function s6e(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var aR={};for(let t=0;t<10;t++)aR[String(t)]=String(t);for(let t=0;t<26;t++)aR[String.fromCharCode(65+t)]=String(10+t);var JG=Math.floor(s6e(o6e));function f6e(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(a=>aR[a]).join("");for(;e.length>=JG;){let a=e.substring(0,JG);e=parseInt(a,10)%97+e.substring(a.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function Ia(t){let e=null;if(typeof t!="string"&&sg.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=YG(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&sg.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==f6e(t)&&sg.throwArgumentError("bad icap checksum","address",t),e=nR(t.substring(4));e.length<40;)e="0"+e;e=YG("0x"+e)}else sg.throwArgumentError("invalid address","address",t);return e}X();ee();Q();X();ee();Q();var XG="properties/5.7.0";var u6e=function(t,e,r,a){function i(h){return h instanceof r?h:new r(function(c){c(h)})}return new(r||(r=Promise))(function(h,c){function d(y){try{g(a.next(y))}catch(M){c(M)}}function b(y){try{g(a.throw(y))}catch(M){c(M)}}function g(y){y.done?h(y.value):i(y.value).then(d,b)}g((a=a.apply(t,e||[])).next())})},X3=new tr(XG);function hr(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function Bh(t){return u6e(this,void 0,void 0,function*(){let e=Object.keys(t).map(a=>{let i=t[a];return Promise.resolve(i).then(h=>({key:a,value:h}))});return(yield Promise.all(e)).reduce((a,i)=>(a[i.key]=i.value,a),{})})}function QG(t,e){(!t||typeof t!="object")&&X3.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||X3.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function ug(t){let e={};for(let r in t)e[r]=t[r];return e}var h6e={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function eY(t){if(t==null||h6e[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;let e=Object.keys(t);for(let r=0;r<e.length;r++){let a=null;try{a=t[e[r]]}catch{continue}if(!eY(a))return!1}return!0}return X3.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function c6e(t){if(eY(t))return t;if(Array.isArray(t))return Object.freeze(t.map(e=>fg(e)));if(typeof t=="object"){let e={};for(let r in t){let a=t[r];a!==void 0&&hr(e,r,fg(a))}return e}return X3.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function fg(t){return c6e(t)}var L0=class{constructor(e){for(let r in e)this[r]=fg(e[r])}};var l6e=function(t,e,r,a){function i(h){return h instanceof r?h:new r(function(c){c(h)})}return new(r||(r=Promise))(function(h,c){function d(y){try{g(a.next(y))}catch(M){c(M)}}function b(y){try{g(a.throw(y))}catch(M){c(M)}}function g(y){y.done?h(y.value):i(y.value).then(d,b)}g((a=a.apply(t,e||[])).next())})},sn=new tr(HG),nY=new Uint8Array(32);nY.fill(0);var d6e=on.from(-1),aY=on.from(0),oY=on.from(1),p6e=on.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function v6e(t){let e=Lt(t),r=e.length%32;return r?Qc([e,nY.slice(r)]):fr(e)}var m6e=ka(oY.toHexString(),32),g6e=ka(aY.toHexString(),32),tY={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},oR=["name","version","chainId","verifyingContract","salt"];function rY(t){return function(e){return typeof e!="string"&&sn.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}var b6e={name:rY("name"),version:rY("version"),chainId:function(t){try{return on.from(t).toString()}catch{}return sn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Ia(t).toLowerCase()}catch{}return sn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{let e=Lt(t);if(e.length!==32)throw new Error("bad length");return fr(e)}catch{}return sn.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function sR(t){{let e=t.match(/^(u?)int(\d*)$/);if(e){let r=e[1]==="",a=parseInt(e[2]||"256");(a%8!==0||a>256||e[2]&&e[2]!==String(a))&&sn.throwArgumentError("invalid numeric width","type",t);let i=p6e.mask(r?a-1:a),h=r?i.add(oY).mul(d6e):aY;return function(c){let d=on.from(c);return(d.lt(h)||d.gt(i))&&sn.throwArgumentError(`value out-of-bounds for ${t}`,"value",c),ka(d.toTwos(256).toHexString(),32)}}}{let e=t.match(/^bytes(\d+)$/);if(e){let r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&&sn.throwArgumentError("invalid bytes width","type",t),function(a){return Lt(a).length!==r&&sn.throwArgumentError(`invalid length for ${t}`,"value",a),v6e(a)}}}switch(t){case"address":return function(e){return ka(Ia(e),32)};case"bool":return function(e){return e?m6e:g6e};case"bytes":return function(e){return an(e)};case"string":return function(e){return Xp(e)}}return null}function iY(t,e){return`${t}(${e.map(({name:r,type:a})=>a+" "+r).join(",")})`}var D0=class t{constructor(e){hr(this,"types",Object.freeze(fg(e))),hr(this,"_encoderCache",{}),hr(this,"_types",{});let r={},a={},i={};Object.keys(e).forEach(d=>{r[d]={},a[d]=[],i[d]={}});for(let d in e){let b={};e[d].forEach(g=>{b[g.name]&&sn.throwArgumentError(`duplicate variable name ${JSON.stringify(g.name)} in ${JSON.stringify(d)}`,"types",e),b[g.name]=!0;let y=g.type.match(/^([^\x5b]*)(\x5b|$)/)[1];y===d&&sn.throwArgumentError(`circular type reference to ${JSON.stringify(y)}`,"types",e),!sR(y)&&(a[y]||sn.throwArgumentError(`unknown type ${JSON.stringify(y)}`,"types",e),a[y].push(d),r[d][y]=!0)})}let h=Object.keys(a).filter(d=>a[d].length===0);h.length===0?sn.throwArgumentError("missing primary type","types",e):h.length>1&&sn.throwArgumentError(`ambiguous primary types or unused types: ${h.map(d=>JSON.stringify(d)).join(", ")}`,"types",e),hr(this,"primaryType",h[0]);function c(d,b){b[d]&&sn.throwArgumentError(`circular type reference to ${JSON.stringify(d)}`,"types",e),b[d]=!0,Object.keys(r[d]).forEach(g=>{a[g]&&(c(g,b),Object.keys(b).forEach(y=>{i[y][g]=!0}))}),delete b[d]}c(this.primaryType,{});for(let d in i){let b=Object.keys(i[d]);b.sort(),this._types[d]=iY(d,e[d])+b.map(g=>iY(g,e[g])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{let i=sR(e);if(i)return i}let r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){let i=r[1],h=this.getEncoder(i),c=parseInt(r[3]);return d=>{c>=0&&d.length!==c&&sn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",d);let b=d.map(h);return this._types[i]&&(b=b.map(an)),an(Qc(b))}}let a=this.types[e];if(a){let i=Xp(this._types[e]);return h=>{let c=a.map(({name:d,type:b})=>{let g=this.getEncoder(b)(h[d]);return this._types[b]?an(g):g});return c.unshift(i),Qc(c)}}return sn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){let r=this._types[e];return r||sn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return an(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,a){if(sR(e))return a(e,r);let i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){let c=i[1],d=parseInt(i[3]);return d>=0&&r.length!==d&&sn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(b=>this._visit(c,b,a))}let h=this.types[e];return h?h.reduce((c,{name:d,type:b})=>(c[d]=this._visit(b,r[d],a),c),{}):sn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new t(e)}static getPrimaryType(e){return t.from(e).primaryType}static hashStruct(e,r,a){return t.from(r).hashStruct(e,a)}static hashDomain(e){let r=[];for(let a in e){let i=tY[a];i||sn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(a)}`,"domain",e),r.push({name:a,type:i})}return r.sort((a,i)=>oR.indexOf(a.name)-oR.indexOf(i.name)),t.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,a){return Qc(["0x1901",t.hashDomain(e),t.from(r).hash(a)])}static hash(e,r,a){return an(t.encode(e,r,a))}static resolveNames(e,r,a,i){return l6e(this,void 0,void 0,function*(){e=ug(e);let h={};e.verifyingContract&&!Fn(e.verifyingContract,20)&&(h[e.verifyingContract]="0x");let c=t.from(r);c.visit(a,(d,b)=>(d==="address"&&!Fn(b,20)&&(h[b]="0x"),b));for(let d in h)h[d]=yield i(d);return e.verifyingContract&&h[e.verifyingContract]&&(e.verifyingContract=h[e.verifyingContract]),a=c.visit(a,(d,b)=>d==="address"&&h[b]?h[b]:b),{domain:e,value:a}})}static getPayload(e,r,a){t.hashDomain(e);let i={},h=[];oR.forEach(b=>{let g=e[b];g!=null&&(i[b]=b6e[b](g),h.push({name:b,type:tY[b]}))});let c=t.from(r),d=ug(r);return d.EIP712Domain?sn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):d.EIP712Domain=h,c.encode(a),{types:d,domain:i,primaryType:c.primaryType,message:c.visit(a,(b,g)=>{if(b.match(/^bytes(\d*)/))return fr(Lt(g));if(b.match(/^u?int/))return on.from(g).toString();switch(b){case"address":return g.toLowerCase();case"bool":return!!g;case"string":return typeof g!="string"&&sn.throwArgumentError("invalid string","value",g),g}return sn.throwArgumentError("unsupported type","type",b)})}}};X();ee();Q();X();ee();Q();var Br=vi(fY()),ku=vi(a1());function o1(t,e,r){return r={path:e,exports:{},require:function(a,i){return F3e(a,i??r.path)}},t(r,r.exports),r.exports}function F3e(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var wR=zY;function zY(t,e){if(!t)throw new Error(e||"Assertion failed")}zY.equal=function(e,r,a){if(e!=r)throw new Error(a||"Assertion failed: "+e+" != "+r)};var Sf=o1(function(t,e){"use strict";var r=e;function a(c,d){if(Array.isArray(c))return c.slice();if(!c)return[];var b=[];if(typeof c!="string"){for(var g=0;g<c.length;g++)b[g]=c[g]|0;return b}if(d==="hex"){c=c.replace(/[^a-z0-9]+/ig,""),c.length%2!==0&&(c="0"+c);for(var g=0;g<c.length;g+=2)b.push(parseInt(c[g]+c[g+1],16))}else for(var g=0;g<c.length;g++){var y=c.charCodeAt(g),M=y>>8,x=y&255;M?b.push(M,x):b.push(x)}return b}r.toArray=a;function i(c){return c.length===1?"0"+c:c}r.zero2=i;function h(c){for(var d="",b=0;b<c.length;b++)d+=i(c[b].toString(16));return d}r.toHex=h,r.encode=function(d,b){return b==="hex"?h(d):d}}),Bo=o1(function(t,e){"use strict";var r=e;r.assert=wR,r.toArray=Sf.toArray,r.zero2=Sf.zero2,r.toHex=Sf.toHex,r.encode=Sf.encode;function a(b,g,y){var M=new Array(Math.max(b.bitLength(),y)+1);M.fill(0);for(var x=1<<g+1,E=b.clone(),A=0;A<M.length;A++){var k,O=E.andln(x-1);E.isOdd()?(O>(x>>1)-1?k=(x>>1)-O:k=O,E.isubn(k)):k=0,M[A]=k,E.iushrn(1)}return M}r.getNAF=a;function i(b,g){var y=[[],[]];b=b.clone(),g=g.clone();for(var M=0,x=0,E;b.cmpn(-M)>0||g.cmpn(-x)>0;){var A=b.andln(3)+M&3,k=g.andln(3)+x&3;A===3&&(A=-1),k===3&&(k=-1);var O;A&1?(E=b.andln(7)+M&7,(E===3||E===5)&&k===2?O=-A:O=A):O=0,y[0].push(O);var N;k&1?(E=g.andln(7)+x&7,(E===3||E===5)&&A===2?N=-k:N=k):N=0,y[1].push(N),2*M===O+1&&(M=1-M),2*x===N+1&&(x=1-x),b.iushrn(1),g.iushrn(1)}return y}r.getJSF=i;function h(b,g,y){var M="_"+g;b.prototype[g]=function(){return this[M]!==void 0?this[M]:this[M]=y.call(this)}}r.cachedProperty=h;function c(b){return typeof b=="string"?r.toArray(b,"hex"):b}r.parseBytes=c;function d(b){return new Br.default(b,"hex","le")}r.intFromLE=d}),i8=Bo.getNAF,j3e=Bo.getJSF,n8=Bo.assert;function nl(t,e){this.type=t,this.p=new Br.default(e.p,16),this.red=e.prime?Br.default.red(e.prime):Br.default.mont(this.p),this.zero=new Br.default(0).toRed(this.red),this.one=new Br.default(1).toRed(this.red),this.two=new Br.default(2).toRed(this.red),this.n=e.n&&new Br.default(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var U0=nl;nl.prototype.point=function(){throw new Error("Not implemented")};nl.prototype.validate=function(){throw new Error("Not implemented")};nl.prototype._fixedNafMul=function(e,r){n8(e.precomputed);var a=e._getDoubles(),i=i8(r,1,this._bitLength),h=(1<<a.step+1)-(a.step%2===0?2:1);h/=3;var c=[],d,b;for(d=0;d<i.length;d+=a.step){b=0;for(var g=d+a.step-1;g>=d;g--)b=(b<<1)+i[g];c.push(b)}for(var y=this.jpoint(null,null,null),M=this.jpoint(null,null,null),x=h;x>0;x--){for(d=0;d<c.length;d++)b=c[d],b===x?M=M.mixedAdd(a.points[d]):b===-x&&(M=M.mixedAdd(a.points[d].neg()));y=y.add(M)}return y.toP()};nl.prototype._wnafMul=function(e,r){var a=4,i=e._getNAFPoints(a);a=i.wnd;for(var h=i.points,c=i8(r,a,this._bitLength),d=this.jpoint(null,null,null),b=c.length-1;b>=0;b--){for(var g=0;b>=0&&c[b]===0;b--)g++;if(b>=0&&g++,d=d.dblp(g),b<0)break;var y=c[b];n8(y!==0),e.type==="affine"?y>0?d=d.mixedAdd(h[y-1>>1]):d=d.mixedAdd(h[-y-1>>1].neg()):y>0?d=d.add(h[y-1>>1]):d=d.add(h[-y-1>>1].neg())}return e.type==="affine"?d.toP():d};nl.prototype._wnafMulAdd=function(e,r,a,i,h){var c=this._wnafT1,d=this._wnafT2,b=this._wnafT3,g=0,y,M,x;for(y=0;y<i;y++){x=r[y];var E=x._getNAFPoints(e);c[y]=E.wnd,d[y]=E.points}for(y=i-1;y>=1;y-=2){var A=y-1,k=y;if(c[A]!==1||c[k]!==1){b[A]=i8(a[A],c[A],this._bitLength),b[k]=i8(a[k],c[k],this._bitLength),g=Math.max(b[A].length,g),g=Math.max(b[k].length,g);continue}var O=[r[A],null,null,r[k]];r[A].y.cmp(r[k].y)===0?(O[1]=r[A].add(r[k]),O[2]=r[A].toJ().mixedAdd(r[k].neg())):r[A].y.cmp(r[k].y.redNeg())===0?(O[1]=r[A].toJ().mixedAdd(r[k]),O[2]=r[A].add(r[k].neg())):(O[1]=r[A].toJ().mixedAdd(r[k]),O[2]=r[A].toJ().mixedAdd(r[k].neg()));var N=[-3,-1,-5,-7,0,7,5,1,3],L=j3e(a[A],a[k]);for(g=Math.max(L[0].length,g),b[A]=new Array(g),b[k]=new Array(g),M=0;M<g;M++){var C=L[0][M]|0,Y=L[1][M]|0;b[A][M]=N[(C+1)*3+(Y+1)],b[k][M]=0,d[A]=O}}var G=this.jpoint(null,null,null),ie=this._wnafT4;for(y=g;y>=0;y--){for(var D=0;y>=0;){var q=!0;for(M=0;M<i;M++)ie[M]=b[M][y]|0,ie[M]!==0&&(q=!1);if(!q)break;D++,y--}if(y>=0&&D++,G=G.dblp(D),y<0)break;for(M=0;M<i;M++){var V=ie[M];V!==0&&(V>0?x=d[M][V-1>>1]:V<0&&(x=d[M][-V-1>>1].neg()),x.type==="affine"?G=G.mixedAdd(x):G=G.add(x))}}for(y=0;y<i;y++)d[y]=null;return h?G:G.toP()};function Es(t,e){this.curve=t,this.type=e,this.precomputed=null}nl.BasePoint=Es;Es.prototype.eq=function(){throw new Error("Not implemented")};Es.prototype.validate=function(){return this.curve.validate(this)};nl.prototype.decodePoint=function(e,r){e=Bo.toArray(e,r);var a=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*a){e[0]===6?n8(e[e.length-1]%2===0):e[0]===7&&n8(e[e.length-1]%2===1);var i=this.point(e.slice(1,1+a),e.slice(1+a,1+2*a));return i}else if((e[0]===2||e[0]===3)&&e.length-1===a)return this.pointFromX(e.slice(1,1+a),e[0]===3);throw new Error("Unknown point format")};Es.prototype.encodeCompressed=function(e){return this.encode(e,!0)};Es.prototype._encode=function(e){var r=this.curve.p.byteLength(),a=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(a):[4].concat(a,this.getY().toArray("be",r))};Es.prototype.encode=function(e,r){return Bo.encode(this._encode(r),e)};Es.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this};Es.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1};Es.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var a=[this],i=this,h=0;h<r;h+=e){for(var c=0;c<e;c++)i=i.dbl();a.push(i)}return{step:e,points:a}};Es.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],a=(1<<e)-1,i=a===1?null:this.dbl(),h=1;h<a;h++)r[h]=r[h-1].add(i);return{wnd:e,points:r}};Es.prototype._getBeta=function(){return null};Es.prototype.dblp=function(e){for(var r=this,a=0;a<e;a++)r=r.dbl();return r};var _R=o1(function(t){typeof Object.create=="function"?t.exports=function(r,a){a&&(r.super_=a,r.prototype=Object.create(a.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(r,a){if(a){r.super_=a;var i=function(){};i.prototype=a.prototype,r.prototype=new i,r.prototype.constructor=r}}}),z3e=Bo.assert;function As(t){U0.call(this,"short",t),this.a=new Br.default(t.a,16).toRed(this.red),this.b=new Br.default(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}_R(As,U0);var H3e=As;As.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,a;if(e.beta)r=new Br.default(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);r=i[0].cmp(i[1])<0?i[0]:i[1],r=r.toRed(this.red)}if(e.lambda)a=new Br.default(e.lambda,16);else{var h=this._getEndoRoots(this.n);this.g.mul(h[0]).x.cmp(this.g.x.redMul(r))===0?a=h[0]:(a=h[1],z3e(this.g.mul(a).x.cmp(this.g.x.redMul(r))===0))}var c;return e.basis?c=e.basis.map(function(d){return{a:new Br.default(d.a,16),b:new Br.default(d.b,16)}}):c=this._getEndoBasis(a),{beta:r,lambda:a,basis:c}}};As.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:Br.default.mont(e),a=new Br.default(2).toRed(r).redInvm(),i=a.redNeg(),h=new Br.default(3).toRed(r).redNeg().redSqrt().redMul(a),c=i.redAdd(h).fromRed(),d=i.redSub(h).fromRed();return[c,d]};As.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),a=e,i=this.n.clone(),h=new Br.default(1),c=new Br.default(0),d=new Br.default(0),b=new Br.default(1),g,y,M,x,E,A,k,O=0,N,L;a.cmpn(0)!==0;){var C=i.div(a);N=i.sub(C.mul(a)),L=d.sub(C.mul(h));var Y=b.sub(C.mul(c));if(!M&&N.cmp(r)<0)g=k.neg(),y=h,M=N.neg(),x=L;else if(M&&++O===2)break;k=N,i=a,a=N,d=h,h=L,b=c,c=Y}E=N.neg(),A=L;var G=M.sqr().add(x.sqr()),ie=E.sqr().add(A.sqr());return ie.cmp(G)>=0&&(E=g,A=y),M.negative&&(M=M.neg(),x=x.neg()),E.negative&&(E=E.neg(),A=A.neg()),[{a:M,b:x},{a:E,b:A}]};As.prototype._endoSplit=function(e){var r=this.endo.basis,a=r[0],i=r[1],h=i.b.mul(e).divRound(this.n),c=a.b.neg().mul(e).divRound(this.n),d=h.mul(a.a),b=c.mul(i.a),g=h.mul(a.b),y=c.mul(i.b),M=e.sub(d).sub(b),x=g.add(y).neg();return{k1:M,k2:x}};As.prototype.pointFromX=function(e,r){e=new Br.default(e,16),e.red||(e=e.toRed(this.red));var a=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=a.redSqrt();if(i.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var h=i.fromRed().isOdd();return(r&&!h||!r&&h)&&(i=i.redNeg()),this.point(e,i)};As.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,a=e.y,i=this.a.redMul(r),h=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return a.redSqr().redISub(h).cmpn(0)===0};As.prototype._endoWnafMulAdd=function(e,r,a){for(var i=this._endoWnafT1,h=this._endoWnafT2,c=0;c<e.length;c++){var d=this._endoSplit(r[c]),b=e[c],g=b._getBeta();d.k1.negative&&(d.k1.ineg(),b=b.neg(!0)),d.k2.negative&&(d.k2.ineg(),g=g.neg(!0)),i[c*2]=b,i[c*2+1]=g,h[c*2]=d.k1,h[c*2+1]=d.k2}for(var y=this._wnafMulAdd(1,i,h,c*2,a),M=0;M<c*2;M++)i[M]=null,h[M]=null;return y};function ia(t,e,r,a){U0.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Br.default(e,16),this.y=new Br.default(r,16),a&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}_R(ia,U0.BasePoint);As.prototype.point=function(e,r,a){return new ia(this,e,r,a)};As.prototype.pointFromJSON=function(e,r){return ia.fromJSON(this,e,r)};ia.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var a=this.curve,i=function(h){return a.point(h.x.redMul(a.endo.beta),h.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return r}};ia.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};ia.fromJSON=function(e,r,a){typeof r=="string"&&(r=JSON.parse(r));var i=e.point(r[0],r[1],a);if(!r[2])return i;function h(d){return e.point(d[0],d[1],a)}var c=r[2];return i.precomputed={beta:null,doubles:c.doubles&&{step:c.doubles.step,points:[i].concat(c.doubles.points.map(h))},naf:c.naf&&{wnd:c.naf.wnd,points:[i].concat(c.naf.points.map(h))}},i};ia.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};ia.prototype.isInfinity=function(){return this.inf};ia.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var a=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,i)};ia.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,a=this.x.redSqr(),i=e.redInvm(),h=a.redAdd(a).redIAdd(a).redIAdd(r).redMul(i),c=h.redSqr().redISub(this.x.redAdd(this.x)),d=h.redMul(this.x.redSub(c)).redISub(this.y);return this.curve.point(c,d)};ia.prototype.getX=function(){return this.x.fromRed()};ia.prototype.getY=function(){return this.y.fromRed()};ia.prototype.mul=function(e){return e=new Br.default(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};ia.prototype.mulAdd=function(e,r,a){var i=[this,r],h=[e,a];return this.curve.endo?this.curve._endoWnafMulAdd(i,h):this.curve._wnafMulAdd(1,i,h,2)};ia.prototype.jmulAdd=function(e,r,a){var i=[this,r],h=[e,a];return this.curve.endo?this.curve._endoWnafMulAdd(i,h,!0):this.curve._wnafMulAdd(1,i,h,2,!0)};ia.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};ia.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var a=this.precomputed,i=function(h){return h.neg()};r.precomputed={naf:a.naf&&{wnd:a.naf.wnd,points:a.naf.points.map(i)},doubles:a.doubles&&{step:a.doubles.step,points:a.doubles.points.map(i)}}}return r};ia.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function va(t,e,r,a){U0.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&a===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Br.default(0)):(this.x=new Br.default(e,16),this.y=new Br.default(r,16),this.z=new Br.default(a,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}_R(va,U0.BasePoint);As.prototype.jpoint=function(e,r,a){return new va(this,e,r,a)};va.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),a=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(a,i)};va.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};va.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),a=this.z.redSqr(),i=this.x.redMul(r),h=e.x.redMul(a),c=this.y.redMul(r.redMul(e.z)),d=e.y.redMul(a.redMul(this.z)),b=i.redSub(h),g=c.redSub(d);if(b.cmpn(0)===0)return g.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var y=b.redSqr(),M=y.redMul(b),x=i.redMul(y),E=g.redSqr().redIAdd(M).redISub(x).redISub(x),A=g.redMul(x.redISub(E)).redISub(c.redMul(M)),k=this.z.redMul(e.z).redMul(b);return this.curve.jpoint(E,A,k)};va.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),a=this.x,i=e.x.redMul(r),h=this.y,c=e.y.redMul(r).redMul(this.z),d=a.redSub(i),b=h.redSub(c);if(d.cmpn(0)===0)return b.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=d.redSqr(),y=g.redMul(d),M=a.redMul(g),x=b.redSqr().redIAdd(y).redISub(M).redISub(M),E=b.redMul(M.redISub(x)).redISub(h.redMul(y)),A=this.z.redMul(d);return this.curve.jpoint(x,E,A)};va.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var a=this;for(r=0;r<e;r++)a=a.dbl();return a}var i=this.curve.a,h=this.curve.tinv,c=this.x,d=this.y,b=this.z,g=b.redSqr().redSqr(),y=d.redAdd(d);for(r=0;r<e;r++){var M=c.redSqr(),x=y.redSqr(),E=x.redSqr(),A=M.redAdd(M).redIAdd(M).redIAdd(i.redMul(g)),k=c.redMul(x),O=A.redSqr().redISub(k.redAdd(k)),N=k.redISub(O),L=A.redMul(N);L=L.redIAdd(L).redISub(E);var C=y.redMul(b);r+1<e&&(g=g.redMul(E)),c=O,b=C,y=L}return this.curve.jpoint(c,y.redMul(h),b)};va.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};va.prototype._zeroDbl=function(){var e,r,a;if(this.zOne){var i=this.x.redSqr(),h=this.y.redSqr(),c=h.redSqr(),d=this.x.redAdd(h).redSqr().redISub(i).redISub(c);d=d.redIAdd(d);var b=i.redAdd(i).redIAdd(i),g=b.redSqr().redISub(d).redISub(d),y=c.redIAdd(c);y=y.redIAdd(y),y=y.redIAdd(y),e=g,r=b.redMul(d.redISub(g)).redISub(y),a=this.y.redAdd(this.y)}else{var M=this.x.redSqr(),x=this.y.redSqr(),E=x.redSqr(),A=this.x.redAdd(x).redSqr().redISub(M).redISub(E);A=A.redIAdd(A);var k=M.redAdd(M).redIAdd(M),O=k.redSqr(),N=E.redIAdd(E);N=N.redIAdd(N),N=N.redIAdd(N),e=O.redISub(A).redISub(A),r=k.redMul(A.redISub(e)).redISub(N),a=this.y.redMul(this.z),a=a.redIAdd(a)}return this.curve.jpoint(e,r,a)};va.prototype._threeDbl=function(){var e,r,a;if(this.zOne){var i=this.x.redSqr(),h=this.y.redSqr(),c=h.redSqr(),d=this.x.redAdd(h).redSqr().redISub(i).redISub(c);d=d.redIAdd(d);var b=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),g=b.redSqr().redISub(d).redISub(d);e=g;var y=c.redIAdd(c);y=y.redIAdd(y),y=y.redIAdd(y),r=b.redMul(d.redISub(g)).redISub(y),a=this.y.redAdd(this.y)}else{var M=this.z.redSqr(),x=this.y.redSqr(),E=this.x.redMul(x),A=this.x.redSub(M).redMul(this.x.redAdd(M));A=A.redAdd(A).redIAdd(A);var k=E.redIAdd(E);k=k.redIAdd(k);var O=k.redAdd(k);e=A.redSqr().redISub(O),a=this.y.redAdd(this.z).redSqr().redISub(x).redISub(M);var N=x.redSqr();N=N.redIAdd(N),N=N.redIAdd(N),N=N.redIAdd(N),r=A.redMul(k.redISub(e)).redISub(N)}return this.curve.jpoint(e,r,a)};va.prototype._dbl=function(){var e=this.curve.a,r=this.x,a=this.y,i=this.z,h=i.redSqr().redSqr(),c=r.redSqr(),d=a.redSqr(),b=c.redAdd(c).redIAdd(c).redIAdd(e.redMul(h)),g=r.redAdd(r);g=g.redIAdd(g);var y=g.redMul(d),M=b.redSqr().redISub(y.redAdd(y)),x=y.redISub(M),E=d.redSqr();E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E);var A=b.redMul(x).redISub(E),k=a.redAdd(a).redMul(i);return this.curve.jpoint(M,A,k)};va.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),a=this.z.redSqr(),i=r.redSqr(),h=e.redAdd(e).redIAdd(e),c=h.redSqr(),d=this.x.redAdd(r).redSqr().redISub(e).redISub(i);d=d.redIAdd(d),d=d.redAdd(d).redIAdd(d),d=d.redISub(c);var b=d.redSqr(),g=i.redIAdd(i);g=g.redIAdd(g),g=g.redIAdd(g),g=g.redIAdd(g);var y=h.redIAdd(d).redSqr().redISub(c).redISub(b).redISub(g),M=r.redMul(y);M=M.redIAdd(M),M=M.redIAdd(M);var x=this.x.redMul(b).redISub(M);x=x.redIAdd(x),x=x.redIAdd(x);var E=this.y.redMul(y.redMul(g.redISub(y)).redISub(d.redMul(b)));E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E);var A=this.z.redAdd(d).redSqr().redISub(a).redISub(b);return this.curve.jpoint(x,E,A)};va.prototype.mul=function(e,r){return e=new Br.default(e,r),this.curve._wnafMul(this,e)};va.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),a=e.z.redSqr();if(this.x.redMul(a).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var i=r.redMul(this.z),h=a.redMul(e.z);return this.y.redMul(h).redISub(e.y.redMul(i)).cmpn(0)===0};va.prototype.eqXToP=function(e){var r=this.z.redSqr(),a=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(a)===0)return!0;for(var i=e.clone(),h=this.curve.redN.redMul(r);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(a.redIAdd(h),this.x.cmp(a)===0)return!0}};va.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};va.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var t8=o1(function(t,e){"use strict";var r=e;r.base=U0,r.short=H3e,r.mont=null,r.edwards=null}),r8=o1(function(t,e){"use strict";var r=e,a=Bo.assert;function i(d){d.type==="short"?this.curve=new t8.short(d):d.type==="edwards"?this.curve=new t8.edwards(d):this.curve=new t8.mont(d),this.g=this.curve.g,this.n=this.curve.n,this.hash=d.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function h(d,b){Object.defineProperty(r,d,{configurable:!0,enumerable:!0,get:function(){var g=new i(b);return Object.defineProperty(r,d,{configurable:!0,enumerable:!0,value:g}),g}})}h("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:ku.default.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:ku.default.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:ku.default.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:ku.default.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),h("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:ku.default.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ku.default.sha256,gRed:!1,g:["9"]}),h("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ku.default.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=null.crash()}catch{c=void 0}h("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:ku.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function il(t){if(!(this instanceof il))return new il(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Sf.toArray(t.entropy,t.entropyEnc||"hex"),r=Sf.toArray(t.nonce,t.nonceEnc||"hex"),a=Sf.toArray(t.pers,t.persEnc||"hex");wR(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,a)}var HY=il;il.prototype._init=function(e,r,a){var i=e.concat(r).concat(a);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var h=0;h<this.V.length;h++)this.K[h]=0,this.V[h]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656};il.prototype._hmac=function(){return new ku.default.hmac(this.hash,this.K)};il.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())};il.prototype.reseed=function(e,r,a,i){typeof r!="string"&&(i=a,a=r,r=null),e=Sf.toArray(e,r),a=Sf.toArray(a,i),wR(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(a||[])),this._reseed=1};il.prototype.generate=function(e,r,a,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=a,a=r,r=null),a&&(a=Sf.toArray(a,i||"hex"),this._update(a));for(var h=[];h.length<e;)this.V=this._hmac().update(this.V).digest(),h=h.concat(this.V);var c=h.slice(0,e);return this._update(a),this._reseed++,Sf.encode(c,r)};var yR=Bo.assert;function Ba(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var MR=Ba;Ba.fromPublic=function(e,r,a){return r instanceof Ba?r:new Ba(e,{pub:r,pubEnc:a})};Ba.fromPrivate=function(e,r,a){return r instanceof Ba?r:new Ba(e,{priv:r,privEnc:a})};Ba.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};Ba.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};Ba.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};Ba.prototype._importPrivate=function(e,r){this.priv=new Br.default(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};Ba.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?yR(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&yR(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)};Ba.prototype.derive=function(e){return e.validate()||yR(e.validate(),"public point not validated"),e.mul(this.priv).getX()};Ba.prototype.sign=function(e,r,a){return this.ec.sign(e,this,r,a)};Ba.prototype.verify=function(e,r){return this.ec.verify(e,r,this)};Ba.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Z3e=Bo.assert;function a8(t,e){if(t instanceof a8)return t;this._importDER(t,e)||(Z3e(t.r&&t.s,"Signature without r or s"),this.r=new Br.default(t.r,16),this.s=new Br.default(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var o8=a8;function K3e(){this.place=0}function gR(t,e){var r=t[e.place++];if(!(r&128))return r;var a=r&15;if(a===0||a>4)return!1;for(var i=0,h=0,c=e.place;h<a;h++,c++)i<<=8,i|=t[c],i>>>=0;return i<=127?!1:(e.place=c,i)}function jY(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}a8.prototype._importDER=function(e,r){e=Bo.toArray(e,r);var a=new K3e;if(e[a.place++]!==48)return!1;var i=gR(e,a);if(i===!1||i+a.place!==e.length||e[a.place++]!==2)return!1;var h=gR(e,a);if(h===!1)return!1;var c=e.slice(a.place,h+a.place);if(a.place+=h,e[a.place++]!==2)return!1;var d=gR(e,a);if(d===!1||e.length!==d+a.place)return!1;var b=e.slice(a.place,d+a.place);if(c[0]===0)if(c[1]&128)c=c.slice(1);else return!1;if(b[0]===0)if(b[1]&128)b=b.slice(1);else return!1;return this.r=new Br.default(c),this.s=new Br.default(b),this.recoveryParam=null,!0};function bR(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}a8.prototype.toDER=function(e){var r=this.r.toArray(),a=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),a[0]&128&&(a=[0].concat(a)),r=jY(r),a=jY(a);!a[0]&&!(a[1]&128);)a=a.slice(1);var i=[2];bR(i,r.length),i=i.concat(r),i.push(2),bR(i,a.length);var h=i.concat(a),c=[48];return bR(c,h.length),c=c.concat(h),Bo.encode(c,e)};var W3e=function(){throw new Error("unsupported")},ZY=Bo.assert;function Ss(t){if(!(this instanceof Ss))return new Ss(t);typeof t=="string"&&(ZY(Object.prototype.hasOwnProperty.call(r8,t),"Unknown curve "+t),t=r8[t]),t instanceof r8.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var V3e=Ss;Ss.prototype.keyPair=function(e){return new MR(this,e)};Ss.prototype.keyFromPrivate=function(e,r){return MR.fromPrivate(this,e,r)};Ss.prototype.keyFromPublic=function(e,r){return MR.fromPublic(this,e,r)};Ss.prototype.genKeyPair=function(e){e||(e={});for(var r=new HY({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||W3e(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),a=this.n.byteLength(),i=this.n.sub(new Br.default(2));;){var h=new Br.default(r.generate(a));if(!(h.cmp(i)>0))return h.iaddn(1),this.keyFromPrivate(h)}};Ss.prototype._truncateToN=function(e,r){var a=e.byteLength()*8-this.n.bitLength();return a>0&&(e=e.ushrn(a)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Ss.prototype.sign=function(e,r,a,i){typeof a=="object"&&(i=a,a=null),i||(i={}),r=this.keyFromPrivate(r,a),e=this._truncateToN(new Br.default(e,16));for(var h=this.n.byteLength(),c=r.getPrivate().toArray("be",h),d=e.toArray("be",h),b=new HY({hash:this.hash,entropy:c,nonce:d,pers:i.pers,persEnc:i.persEnc||"utf8"}),g=this.n.sub(new Br.default(1)),y=0;;y++){var M=i.k?i.k(y):new Br.default(b.generate(this.n.byteLength()));if(M=this._truncateToN(M,!0),!(M.cmpn(1)<=0||M.cmp(g)>=0)){var x=this.g.mul(M);if(!x.isInfinity()){var E=x.getX(),A=E.umod(this.n);if(A.cmpn(0)!==0){var k=M.invm(this.n).mul(A.mul(r.getPrivate()).iadd(e));if(k=k.umod(this.n),k.cmpn(0)!==0){var O=(x.getY().isOdd()?1:0)|(E.cmp(A)!==0?2:0);return i.canonical&&k.cmp(this.nh)>0&&(k=this.n.sub(k),O^=1),new o8({r:A,s:k,recoveryParam:O})}}}}}};Ss.prototype.verify=function(e,r,a,i){e=this._truncateToN(new Br.default(e,16)),a=this.keyFromPublic(a,i),r=new o8(r,"hex");var h=r.r,c=r.s;if(h.cmpn(1)<0||h.cmp(this.n)>=0||c.cmpn(1)<0||c.cmp(this.n)>=0)return!1;var d=c.invm(this.n),b=d.mul(e).umod(this.n),g=d.mul(h).umod(this.n),y;return this.curve._maxwellTrick?(y=this.g.jmulAdd(b,a.getPublic(),g),y.isInfinity()?!1:y.eqXToP(h)):(y=this.g.mulAdd(b,a.getPublic(),g),y.isInfinity()?!1:y.getX().umod(this.n).cmp(h)===0)};Ss.prototype.recoverPubKey=function(t,e,r,a){ZY((3&r)===r,"The recovery param is more than two bits"),e=new o8(e,a);var i=this.n,h=new Br.default(t),c=e.r,d=e.s,b=r&1,g=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&g)throw new Error("Unable to find sencond key candinate");g?c=this.curve.pointFromX(c.add(this.curve.n),b):c=this.curve.pointFromX(c,b);var y=e.r.invm(i),M=i.sub(h).mul(y).umod(i),x=d.mul(y).umod(i);return this.g.mulAdd(M,c,x)};Ss.prototype.getKeyRecoveryParam=function(t,e,r,a){if(e=new o8(e,a),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var h;try{h=this.recoverPubKey(t,e,i)}catch{continue}if(h.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var G3e=o1(function(t,e){"use strict";var r=e;r.version="6.5.4",r.utils=Bo,r.rand=function(){throw new Error("unsupported")},r.curve=t8,r.curves=r8,r.ec=V3e,r.eddsa=null}),KY=G3e.ec;X();ee();Q();var WY="signing-key/5.7.0";var SR=new tr(WY),xR=null;function Iu(){return xR||(xR=new KY("secp256k1")),xR}var Bu=class{constructor(e){hr(this,"curve","secp256k1"),hr(this,"privateKey",fr(e)),ng(this.privateKey)!==32&&SR.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let r=Iu().keyFromPrivate(Lt(this.privateKey));hr(this,"publicKey","0x"+r.getPublic(!1,"hex")),hr(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),hr(this,"_isSigningKey",!0)}_addPoint(e){let r=Iu().keyFromPublic(Lt(this.publicKey)),a=Iu().keyFromPublic(Lt(e));return"0x"+r.pub.add(a.pub).encodeCompressed("hex")}signDigest(e){let r=Iu().keyFromPrivate(Lt(this.privateKey)),a=Lt(e);a.length!==32&&SR.throwArgumentError("bad digest length","digest",e);let i=r.sign(a,{canonical:!0});return el({recoveryParam:i.recoveryParam,r:ka("0x"+i.r.toString(16),32),s:ka("0x"+i.s.toString(16),32)})}computeSharedSecret(e){let r=Iu().keyFromPrivate(Lt(this.privateKey)),a=Iu().keyFromPublic(Lt(ER(e)));return ka("0x"+r.derive(a.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}};function s8(t,e){let r=el(e),a={r:Lt(r.r),s:Lt(r.s)};return"0x"+Iu().recoverPubKey(Lt(t),a,r.recoveryParam).encode("hex",!1)}function ER(t,e){let r=Lt(t);if(r.length===32){let a=new Bu(r);return e?"0x"+Iu().keyFromPrivate(r).getPublic(!0,"hex"):a.publicKey}else{if(r.length===33)return e?fr(r):"0x"+Iu().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+Iu().keyFromPublic(r).getPublic(!0,"hex"):fr(r)}return SR.throwArgumentError("invalid public or private key","key","[REDACTED]")}X();ee();Q();X();ee();Q();var VY="transactions/5.7.0";var Ef=new tr(VY),GY;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(GY||(GY={}));var Y3e=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],J3e={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function Rs(t){let e=ER(t);return Ia(kh(an(kh(e,1)),12))}function RR(t,e){return Rs(s8(Lt(t),e))}function Oo(t,e){let r=_u(on.from(t).toHexString());return r.length>32&&Ef.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function AR(t,e){return{address:Ia(t),storageKeys:(e||[]).map((r,a)=>(ng(r)!==32&&Ef.throwArgumentError("invalid access list storageKey",`accessList[${t}:${a}]`,r),r.toLowerCase()))}}function X3e(t){if(Array.isArray(t))return t.map((r,a)=>Array.isArray(r)?(r.length>2&&Ef.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${a}]`,r),AR(r[0],r[1])):AR(r.address,r.storageKeys));let e=Object.keys(t).map(r=>{let a=t[r].reduce((i,h)=>(i[h]=!0,i),{});return AR(r,Object.keys(a).sort())});return e.sort((r,a)=>r.address.localeCompare(a.address)),e}function YY(t){return X3e(t).map(e=>[e.address,e.storageKeys])}function Q3e(t,e){if(t.gasPrice!=null){let a=on.from(t.gasPrice),i=on.from(t.maxFeePerGas||0);a.eq(i)||Ef.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:a,maxFeePerGas:i})}let r=[Oo(t.chainId||0,"chainId"),Oo(t.nonce||0,"nonce"),Oo(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Oo(t.maxFeePerGas||0,"maxFeePerGas"),Oo(t.gasLimit||0,"gasLimit"),t.to!=null?Ia(t.to):"0x",Oo(t.value||0,"value"),t.data||"0x",YY(t.accessList||[])];if(e){let a=el(e);r.push(Oo(a.recoveryParam,"recoveryParam")),r.push(_u(a.r)),r.push(_u(a.s))}return Qc(["0x02",og(r)])}function e8e(t,e){let r=[Oo(t.chainId||0,"chainId"),Oo(t.nonce||0,"nonce"),Oo(t.gasPrice||0,"gasPrice"),Oo(t.gasLimit||0,"gasLimit"),t.to!=null?Ia(t.to):"0x",Oo(t.value||0,"value"),t.data||"0x",YY(t.accessList||[])];if(e){let a=el(e);r.push(Oo(a.recoveryParam,"recoveryParam")),r.push(_u(a.r)),r.push(_u(a.s))}return Qc(["0x01",og(r)])}function t8e(t,e){QG(t,J3e);let r=[];Y3e.forEach(function(c){let d=t[c.name]||[],b={};c.numeric&&(b.hexPad="left"),d=Lt(fr(d,b)),c.length&&d.length!==c.length&&d.length>0&&Ef.throwArgumentError("invalid length for "+c.name,"transaction:"+c.name,d),c.maxLength&&(d=_u(d),d.length>c.maxLength&&Ef.throwArgumentError("invalid length for "+c.name,"transaction:"+c.name,d)),r.push(fr(d))});let a=0;if(t.chainId!=null?(a=t.chainId,typeof a!="number"&&Ef.throwArgumentError("invalid transaction.chainId","transaction",t)):e&&!rg(e)&&e.v>28&&(a=Math.floor((e.v-35)/2)),a!==0&&(r.push(fr(a)),r.push("0x"),r.push("0x")),!e)return og(r);let i=el(e),h=27+i.recoveryParam;return a!==0?(r.pop(),r.pop(),r.pop(),h+=a*2+8,i.v>28&&i.v!==h&&Ef.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e)):i.v!==h&&Ef.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e),r.push(fr(h)),r.push(_u(Lt(i.r))),r.push(_u(Lt(i.s))),og(r)}function TR(t,e){if(t.type==null||t.type===0)return t.accessList!=null&&Ef.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",t),t8e(t,e);switch(t.type){case 1:return e8e(t,e);case 2:return Q3e(t,e);default:break}return Ef.throwError(`unsupported transaction type: ${t.type}`,tr.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:t.type})}X();ee();Q();X();ee();Q();X();ee();Q();var JY="abstract-provider/5.7.0";var r8e=function(t,e,r,a){function i(h){return h instanceof r?h:new r(function(c){c(h)})}return new(r||(r=Promise))(function(h,c){function d(y){try{g(a.next(y))}catch(M){c(M)}}function b(y){try{g(a.throw(y))}catch(M){c(M)}}function g(y){y.done?h(y.value):i(y.value).then(d,b)}g((a=a.apply(t,e||[])).next())})},i8e=new tr(JY);var f8=class t{constructor(){i8e.checkAbstract(new.target,t),hr(this,"_isProvider",!0)}getFeeData(){return r8e(this,void 0,void 0,function*(){let{block:e,gasPrice:r}=yield Bh({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(c=>null)}),a=null,i=null,h=null;return e&&e.baseFeePerGas&&(a=e.baseFeePerGas,h=on.from("1500000000"),i=e.baseFeePerGas.mul(2).add(h)),{lastBaseFeePerGas:a,maxFeePerGas:i,maxPriorityFeePerGas:h,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}};X();ee();Q();X();ee();Q();var XY="abstract-signer/5.7.0";var Af=function(t,e,r,a){function i(h){return h instanceof r?h:new r(function(c){c(h)})}return new(r||(r=Promise))(function(h,c){function d(y){try{g(a.next(y))}catch(M){c(M)}}function b(y){try{g(a.throw(y))}catch(M){c(M)}}function g(y){y.done?h(y.value):i(y.value).then(d,b)}g((a=a.apply(t,e||[])).next())})},Rf=new tr(XY),n8e=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],a8e=[tr.errors.INSUFFICIENT_FUNDS,tr.errors.NONCE_EXPIRED,tr.errors.REPLACEMENT_UNDERPRICED],u8=class t{constructor(){Rf.checkAbstract(new.target,t),hr(this,"_isSigner",!0)}getBalance(e){return Af(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Af(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Af(this,void 0,void 0,function*(){this._checkProvider("estimateGas");let r=yield Bh(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Af(this,void 0,void 0,function*(){this._checkProvider("call");let a=yield Bh(this.checkTransaction(e));return yield this.provider.call(a,r)})}sendTransaction(e){return Af(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");let r=yield this.populateTransaction(e),a=yield this.signTransaction(r);return yield this.provider.sendTransaction(a)})}getChainId(){return Af(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Af(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Af(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Af(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(let a in e)n8e.indexOf(a)===-1&&Rf.throwArgumentError("invalid transaction key: "+a,"transaction",e);let r=ug(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(a=>(a[0].toLowerCase()!==a[1].toLowerCase()&&Rf.throwArgumentError("from address mismatch","transaction",e),a[0])),r}populateTransaction(e){return Af(this,void 0,void 0,function*(){let r=yield Bh(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Af(this,void 0,void 0,function*(){if(i==null)return null;let h=yield this.resolveName(i);return h==null&&Rf.throwArgumentError("provided ENS name resolves to null","tx.to",i),h})),r.to.catch(i=>{}));let a=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||a)?Rf.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&a&&Rf.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{let i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){let h=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=h,r.maxPriorityFeePerGas=h}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(a&&Rf.throwError("network does not support EIP-1559",tr.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Rf.throwError("failed to get consistent fee data",tr.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(a8e.indexOf(i.code)>=0)throw i;return Rf.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",tr.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Rf.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield Bh(r)})}_checkProvider(e){this.provider||Rf.throwError("missing provider",tr.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}};X();ee();Q();X();ee();Q();var h8=class{constructor(e){hr(this,"alphabet",e),hr(this,"base",e.length),hr(this,"_alphabetMap",{}),hr(this,"_leader",e.charAt(0));for(let r=0;r<e.length;r++)this._alphabetMap[e.charAt(r)]=r}encode(e){let r=Lt(e);if(r.length===0)return"";let a=[0];for(let h=0;h<r.length;++h){let c=r[h];for(let d=0;d<a.length;++d)c+=a[d]<<8,a[d]=c%this.base,c=c/this.base|0;for(;c>0;)a.push(c%this.base),c=c/this.base|0}let i="";for(let h=0;r[h]===0&&h<r.length-1;++h)i+=this._leader;for(let h=a.length-1;h>=0;--h)i+=this.alphabet[a[h]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let a=0;a<e.length;a++){let i=this._alphabetMap[e[a]];if(i===void 0)throw new Error("Non-base"+this.base+" character");let h=i;for(let c=0;c<r.length;++c)h+=r[c]*this.base,r[c]=h&255,h>>=8;for(;h>0;)r.push(h&255),h>>=8}for(let a=0;e[a]===this._leader&&a<e.length-1;++a)r.push(0);return Lt(new Uint8Array(r.reverse()))}},NQe=new h8("abcdefghijklmnopqrstuvwxyz234567"),kR=new h8("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var lg=vi(a1());X();ee();Q();var al;(function(t){t.sha256="sha256",t.sha512="sha512"})(al||(al={}));X();ee();Q();var QY="sha2/5.7.0";var o8e=new tr(QY);function IR(t){return"0x"+lg.default.ripemd160().update(Lt(t)).digest("hex")}function q0(t){return"0x"+lg.default.sha256().update(Lt(t)).digest("hex")}function F0(t,e,r){return al[t]||o8e.throwError("unsupported algorithm "+t,tr.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+lg.default.hmac(lg.default[t],Lt(e)).update(Lt(r)).digest("hex")}function j0(t,e,r,a,i){t=Lt(t),e=Lt(e);let h,c=1,d=new Uint8Array(a),b=new Uint8Array(e.length+4);b.set(e);let g,y;for(let M=1;M<=c;M++){b[e.length]=M>>24&255,b[e.length+1]=M>>16&255,b[e.length+2]=M>>8&255,b[e.length+3]=M&255;let x=Lt(F0(i,t,b));h||(h=x.length,y=new Uint8Array(h),c=Math.ceil(a/h),g=a-(c-1)*h),y.set(x);for(let k=1;k<r;k++){x=Lt(F0(i,t,x));for(let O=0;O<h;O++)y[O]^=x[O]}let E=(M-1)*h,A=M===c?g:h;d.set(Lt(y).slice(0,A),E)}return fr(d)}X();ee();Q();X();ee();Q();X();ee();Q();var eJ="wordlists/5.7.0";var s8e=!1,f8e=new tr(eJ),s1=class t{constructor(e){f8e.checkAbstract(new.target,t),hr(this,"locale",e)}split(e){return e.toLowerCase().split(/ +/g)}join(e){return e.join(" ")}static check(e){let r=[];for(let a=0;a<2048;a++){let i=e.getWord(a);if(a!==e.getWordIndex(i))return"0x";r.push(i)}return Xp(r.join(`
129
129
  `)+`
130
130
  `)}static register(e,r){if(r||(r=e.locale),s8e)try{let a=window;a._ethers&&a._ethers.wordlists&&(a._ethers.wordlists[r]||hr(a._ethers.wordlists,r,e))}catch{}}};X();ee();Q();X();ee();Q();var u8e="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo",dg=null;function tJ(t){if(dg==null&&(dg=u8e.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),s1.check(t)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw dg=null,new Error("BIP39 Wordlist for en (English) FAILED")}var BR=class extends s1{constructor(){super("en")}getWord(e){return tJ(this),dg[e]}getWordIndex(e){return tJ(this),dg.indexOf(e)}},OR=new BR;s1.register(OR);var c8={en:OR};X();ee();Q();var rJ="hdnode/5.7.0";var d8=new tr(rJ),h8e=on.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),c8e=qa("Bitcoin seed"),pg=2147483648;function nJ(t){return(1<<t)-1<<8-t}function l8e(t){return(1<<t)-1}function l8(t){return ka(fr(t),32)}function iJ(t){return kR.encode(Io([t,kh(q0(q0(t)),0,4)]))}function PR(t){if(t==null)return c8.en;if(typeof t=="string"){let e=c8[t];return e==null&&d8.throwArgumentError("unknown locale","wordlist",t),e}return t}var f1={},z0="m/44'/60'/0'/0/0",ol=class t{constructor(e,r,a,i,h,c,d,b){if(e!==f1)throw new Error("HDNode constructor cannot be called directly");if(r){let g=new Bu(r);hr(this,"privateKey",g.privateKey),hr(this,"publicKey",g.compressedPublicKey)}else hr(this,"privateKey",null),hr(this,"publicKey",fr(a));hr(this,"parentFingerprint",i),hr(this,"fingerprint",kh(IR(q0(this.publicKey)),0,4)),hr(this,"address",Rs(this.publicKey)),hr(this,"chainCode",h),hr(this,"index",c),hr(this,"depth",d),b==null?(hr(this,"mnemonic",null),hr(this,"path",null)):typeof b=="string"?(hr(this,"mnemonic",null),hr(this,"path",b)):(hr(this,"mnemonic",b),hr(this,"path",b.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return iJ(Io([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",fr(this.depth),this.parentFingerprint,ka(fr(this.index),4),this.chainCode,this.privateKey!=null?Io(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new t(f1,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let r=this.path;r&&(r+="/"+(e&~pg));let a=new Uint8Array(37);if(e&pg){if(!this.privateKey)throw new Error("cannot derive child of neutered node");a.set(Lt(this.privateKey),1),r&&(r+="'")}else a.set(Lt(this.publicKey));for(let M=24;M>=0;M-=8)a[33+(M>>3)]=e>>24-M&255;let i=Lt(F0(al.sha512,this.chainCode,a)),h=i.slice(0,32),c=i.slice(32),d=null,b=null;this.privateKey?d=l8(on.from(h).add(this.privateKey).mod(h8e)):b=new Bu(fr(h))._addPoint(this.publicKey);let g=r,y=this.mnemonic;return y&&(g=Object.freeze({phrase:y.phrase,path:r,locale:y.locale||"en"})),new t(f1,d,b,this.fingerprint,l8(c),e,this.depth+1,g)}derivePath(e){let r=e.split("/");if(r.length===0||r[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+e);r[0]==="m"&&r.shift();let a=this;for(let i=0;i<r.length;i++){let h=r[i];if(h.match(/^[0-9]+'$/)){let c=parseInt(h.substring(0,h.length-1));if(c>=pg)throw new Error("invalid path index - "+h);a=a._derive(pg+c)}else if(h.match(/^[0-9]+$/)){let c=parseInt(h);if(c>=pg)throw new Error("invalid path index - "+h);a=a._derive(c)}else throw new Error("invalid path component - "+h)}return a}static _fromSeed(e,r){let a=Lt(e);if(a.length<16||a.length>64)throw new Error("invalid seed");let i=Lt(F0(al.sha512,c8e,a));return new t(f1,l8(i.slice(0,32)),null,"0x00000000",l8(i.slice(32)),0,0,r)}static fromMnemonic(e,r,a){return a=PR(a),e=vg(NR(e,a),a),t._fromSeed(d8e(e,r),{phrase:e,path:"m",locale:a.locale})}static fromSeed(e){return t._fromSeed(e,null)}static fromExtendedKey(e){let r=kR.decode(e);(r.length!==82||iJ(r.slice(0,78))!==e)&&d8.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");let a=r[4],i=fr(r.slice(5,9)),h=parseInt(fr(r.slice(9,13)).substring(2),16),c=fr(r.slice(13,45)),d=r.slice(45,78);switch(fr(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new t(f1,null,fr(d),i,c,h,a,null);case"0x0488ade4":case"0x04358394 ":if(d[0]!==0)break;return new t(f1,fr(d.slice(1)),null,i,c,h,a,null)}return d8.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}};function d8e(t,e){e||(e="");let r=qa("mnemonic"+e,Mu.NFKD);return j0(qa(t,Mu.NFKD),r,2048,64,"sha512")}function NR(t,e){e=PR(e),d8.checkNormalize();let r=e.split(t);if(r.length%3!==0)throw new Error("invalid mnemonic");let a=Lt(new Uint8Array(Math.ceil(11*r.length/8))),i=0;for(let g=0;g<r.length;g++){let y=e.getWordIndex(r[g].normalize("NFKD"));if(y===-1)throw new Error("invalid mnemonic");for(let M=0;M<11;M++)y&1<<10-M&&(a[i>>3]|=1<<7-i%8),i++}let h=32*r.length/3,c=r.length/3,d=nJ(c);if((Lt(q0(a.slice(0,h/8)))[0]&d)!==(a[a.length-1]&d))throw new Error("invalid checksum");return fr(a.slice(0,h/8))}function vg(t,e){if(e=PR(e),t=Lt(t),t.length%4!==0||t.length<16||t.length>32)throw new Error("invalid entropy");let r=[0],a=11;for(let c=0;c<t.length;c++)a>8?(r[r.length-1]<<=8,r[r.length-1]|=t[c],a-=8):(r[r.length-1]<<=a,r[r.length-1]|=t[c]>>8-a,r.push(t[c]&l8e(8-a)),a+=3);let i=t.length/4,h=Lt(q0(t))[0]&nJ(i);return r[r.length-1]<<=i,r[r.length-1]|=h>>8-i,e.join(r.map(c=>e.getWord(c)))}X();ee();Q();X();ee();Q();X();ee();Q();var aJ="random/5.7.0";var CR=new tr(aJ);function p8e(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}var oJ=p8e(),p8=oJ.crypto||oJ.msCrypto;(!p8||!p8.getRandomValues)&&(CR.warn("WARNING: Missing strong random number source"),p8={getRandomValues:function(t){return CR.throwError("no secure random source avaialble",tr.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function sl(t){(t<=0||t>1024||t%1||t!=t)&&CR.throwArgumentError("invalid length","length",t);let e=new Uint8Array(t);return p8.getRandomValues(e),Lt(e)}X();ee();Q();X();ee();Q();var $R=vi(DR());X();ee();Q();var v8="json-wallets/5.7.0";X();ee();Q();function Ch(t){return typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Lt(t)}function u1(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function mg(t){return typeof t=="string"?qa(t,Mu.NFKC):Lt(t)}function fn(t,e){let r=t,a=e.toLowerCase().split("/");for(let i=0;i<a.length;i++){let h=null;for(let c in r)if(c.toLowerCase()===a[i]){h=r[c];break}if(h===null)return null;r=h}return r}function fJ(t){let e=Lt(t);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let r=fr(e);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}var v8e=new tr(v8),UR=class extends L0{isCrowdsaleAccount(e){return!!(e&&e._isCrowdsaleAccount)}};function qR(t,e){let r=JSON.parse(t);e=mg(e);let a=Ia(fn(r,"ethaddr")),i=Ch(fn(r,"encseed"));(!i||i.length%16!==0)&&v8e.throwArgumentError("invalid encseed","json",t);let h=Lt(j0(e,e,2e3,32,"sha256")).slice(0,16),c=i.slice(0,16),d=i.slice(16),b=new $R.default.ModeOfOperation.cbc(h,c),g=$R.default.padding.pkcs7.strip(Lt(b.decrypt(d))),y="";for(let E=0;E<g.length;E++)y+=String.fromCharCode(g[E]);let M=qa(y),x=an(M);return new UR({_isCrowdsaleAccount:!0,address:a,privateKey:x})}X();ee();Q();function FR(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return e.encseed&&e.ethaddr}function jR(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return!(!e.version||parseInt(e.version)!==e.version||parseInt(e.version)!==3)}X();ee();Q();var Lh=vi(DR()),m8=vi(hJ());var m8e=function(t,e,r,a){function i(h){return h instanceof r?h:new r(function(c){c(h)})}return new(r||(r=Promise))(function(h,c){function d(y){try{g(a.next(y))}catch(M){c(M)}}function b(y){try{g(a.throw(y))}catch(M){c(M)}}function g(y){y.done?h(y.value):i(y.value).then(d,b)}g((a=a.apply(t,e||[])).next())})},HR=new tr(v8);function cJ(t){return t!=null&&t.mnemonic&&t.mnemonic.phrase}var ZR=class extends L0{isKeystoreAccount(e){return!!(e&&e._isKeystoreAccount)}};function g8e(t,e,r){if(fn(t,"crypto/cipher")==="aes-128-ctr"){let i=Ch(fn(t,"crypto/cipherparams/iv")),h=new Lh.default.Counter(i),c=new Lh.default.ModeOfOperation.ctr(e,h);return Lt(c.decrypt(r))}return null}function lJ(t,e){let r=Ch(fn(t,"crypto/ciphertext"));if(fr(an(Io([e.slice(16,32),r]))).substring(2)!==fn(t,"crypto/mac").toLowerCase())throw new Error("invalid password");let i=g8e(t,e.slice(0,16),r);i||HR.throwError("unsupported cipher",tr.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});let h=e.slice(32,64),c=Rs(i);if(t.address){let b=t.address.toLowerCase();if(b.substring(0,2)!=="0x"&&(b="0x"+b),Ia(b)!==c)throw new Error("address mismatch")}let d={_isKeystoreAccount:!0,address:c,privateKey:fr(i)};if(fn(t,"x-ethers/version")==="0.1"){let b=Ch(fn(t,"x-ethers/mnemonicCiphertext")),g=Ch(fn(t,"x-ethers/mnemonicCounter")),y=new Lh.default.Counter(g),M=new Lh.default.ModeOfOperation.ctr(h,y),x=fn(t,"x-ethers/path")||z0,E=fn(t,"x-ethers/locale")||"en",A=Lt(M.decrypt(b));try{let k=vg(A,E),O=ol.fromMnemonic(k,null,E).derivePath(x);if(O.privateKey!=d.privateKey)throw new Error("mnemonic mismatch");d.mnemonic=O.mnemonic}catch(k){if(k.code!==tr.errors.INVALID_ARGUMENT||k.argument!=="wordlist")throw k}}return new ZR(d)}function dJ(t,e,r,a,i){return Lt(j0(t,e,r,a,i))}function b8e(t,e,r,a,i){return Promise.resolve(dJ(t,e,r,a,i))}function pJ(t,e,r,a,i){let h=mg(e),c=fn(t,"crypto/kdf");if(c&&typeof c=="string"){let d=function(b,g){return HR.throwArgumentError("invalid key-derivation function parameters",b,g)};if(c.toLowerCase()==="scrypt"){let b=Ch(fn(t,"crypto/kdfparams/salt")),g=parseInt(fn(t,"crypto/kdfparams/n")),y=parseInt(fn(t,"crypto/kdfparams/r")),M=parseInt(fn(t,"crypto/kdfparams/p"));(!g||!y||!M)&&d("kdf",c),g&g-1&&d("N",g);let x=parseInt(fn(t,"crypto/kdfparams/dklen"));return x!==32&&d("dklen",x),a(h,b,g,y,M,64,i)}else if(c.toLowerCase()==="pbkdf2"){let b=Ch(fn(t,"crypto/kdfparams/salt")),g=null,y=fn(t,"crypto/kdfparams/prf");y==="hmac-sha256"?g="sha256":y==="hmac-sha512"?g="sha512":d("prf",y);let M=parseInt(fn(t,"crypto/kdfparams/c")),x=parseInt(fn(t,"crypto/kdfparams/dklen"));return x!==32&&d("dklen",x),r(h,b,M,x,g)}}return HR.throwArgumentError("unsupported key-derivation function","kdf",c)}function vJ(t,e){let r=JSON.parse(t),a=pJ(r,e,dJ,m8.default.syncScrypt);return lJ(r,a)}function mJ(t,e,r){return m8e(this,void 0,void 0,function*(){let a=JSON.parse(t),i=yield pJ(a,e,b8e,m8.default.scrypt,r);return lJ(a,i)})}function KR(t,e,r,a){try{if(Ia(t.address)!==Rs(t.privateKey))throw new Error("address/privateKey mismatch");if(cJ(t)){let O=t.mnemonic;if(ol.fromMnemonic(O.phrase,null,O.locale).derivePath(O.path||z0).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(O){return Promise.reject(O)}typeof r=="function"&&!a&&(a=r,r={}),r||(r={});let i=Lt(t.privateKey),h=mg(e),c=null,d=null,b=null;if(cJ(t)){let O=t.mnemonic;c=Lt(NR(O.phrase,O.locale||"en")),d=O.path||z0,b=O.locale||"en"}let g=r.client;g||(g="ethers.js");let y=null;r.salt?y=Lt(r.salt):y=sl(32);let M=null;if(r.iv){if(M=Lt(r.iv),M.length!==16)throw new Error("invalid iv")}else M=sl(16);let x=null;if(r.uuid){if(x=Lt(r.uuid),x.length!==16)throw new Error("invalid uuid")}else x=sl(16);let E=1<<17,A=8,k=1;return r.scrypt&&(r.scrypt.N&&(E=r.scrypt.N),r.scrypt.r&&(A=r.scrypt.r),r.scrypt.p&&(k=r.scrypt.p)),m8.default.scrypt(h,y,E,A,k,64,a).then(O=>{O=Lt(O);let N=O.slice(0,16),L=O.slice(16,32),C=O.slice(32,64),Y=new Lh.default.Counter(M),G=new Lh.default.ModeOfOperation.ctr(N,Y),ie=Lt(G.encrypt(i)),D=an(Io([L,ie])),q={address:t.address.substring(2).toLowerCase(),id:fJ(x),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:fr(M).substring(2)},ciphertext:fr(ie).substring(2),kdf:"scrypt",kdfparams:{salt:fr(y).substring(2),n:E,dklen:32,p:k,r:A},mac:D.substring(2)}};if(c){let V=sl(16),_=new Lh.default.Counter(V),n=new Lh.default.ModeOfOperation.ctr(C,_),s=Lt(n.encrypt(c)),f=new Date,u=f.getUTCFullYear()+"-"+u1(f.getUTCMonth()+1,2)+"-"+u1(f.getUTCDate(),2)+"T"+u1(f.getUTCHours(),2)+"-"+u1(f.getUTCMinutes(),2)+"-"+u1(f.getUTCSeconds(),2)+".0Z";q["x-ethers"]={client:g,gethFilename:"UTC--"+u+"--"+q.address,mnemonicCounter:fr(V).substring(2),mnemonicCiphertext:fr(s).substring(2),path:d,locale:b,version:"0.1"}}return JSON.stringify(q)})}function gJ(t,e,r){if(FR(t)){r&&r(0);let a=qR(t,e);return r&&r(1),Promise.resolve(a)}return jR(t)?mJ(t,e,r):Promise.reject(new Error("invalid JSON wallet"))}function bJ(t,e){if(FR(t))return qR(t,e);if(jR(t))return vJ(t,e);throw new Error("invalid JSON wallet")}X();ee();Q();var yJ="wallet/5.7.0";var wJ=function(t,e,r,a){function i(h){return h instanceof r?h:new r(function(c){c(h)})}return new(r||(r=Promise))(function(h,c){function d(y){try{g(a.next(y))}catch(M){c(M)}}function b(y){try{g(a.throw(y))}catch(M){c(M)}}function g(y){y.done?h(y.value):i(y.value).then(d,b)}g((a=a.apply(t,e||[])).next())})},h1=new tr(yJ);function y8e(t){return t!=null&&Fn(t.privateKey,32)&&t.address!=null}function w8e(t){let e=t.mnemonic;return e&&e.phrase}var c1=class t extends u8{constructor(e,r){if(super(),y8e(e)){let a=new Bu(e.privateKey);if(hr(this,"_signingKey",()=>a),hr(this,"address",Rs(this.publicKey)),this.address!==Ia(e.address)&&h1.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),w8e(e)){let i=e.mnemonic;hr(this,"_mnemonic",()=>({phrase:i.phrase,path:i.path||z0,locale:i.locale||"en"}));let h=this.mnemonic,c=ol.fromMnemonic(h.phrase,null,h.locale).derivePath(h.path);Rs(c.privateKey)!==this.address&&h1.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else hr(this,"_mnemonic",()=>null)}else{if(Bu.isSigningKey(e))e.curve!=="secp256k1"&&h1.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),hr(this,"_signingKey",()=>e);else{typeof e=="string"&&e.match(/^[0-9a-f]*$/i)&&e.length===64&&(e="0x"+e);let a=new Bu(e);hr(this,"_signingKey",()=>a)}hr(this,"_mnemonic",()=>null),hr(this,"address",Rs(this.publicKey))}r&&!f8.isProvider(r)&&h1.throwArgumentError("invalid provider","provider",r),hr(this,"provider",r||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new t(this,e)}signTransaction(e){return Bh(e).then(r=>{r.from!=null&&(Ia(r.from)!==this.address&&h1.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete r.from);let a=this._signingKey().signDigest(an(TR(r)));return TR(r,a)})}signMessage(e){return wJ(this,void 0,void 0,function*(){return tR(this._signingKey().signDigest(tl(e)))})}_signTypedData(e,r,a){return wJ(this,void 0,void 0,function*(){let i=yield D0.resolveNames(e,r,a,h=>(this.provider==null&&h1.throwError("cannot resolve ENS names without a provider",tr.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:h}),this.provider.resolveName(h)));return tR(this._signingKey().signDigest(D0.hash(i.domain,r,i.value)))})}encrypt(e,r,a){if(typeof r=="function"&&!a&&(a=r,r={}),a&&typeof a!="function")throw new Error("invalid callback");return r||(r={}),KR(this,e,r,a)}static createRandom(e){let r=sl(16);e||(e={}),e.extraEntropy&&(r=Lt(kh(an(Io([r,e.extraEntropy])),0,16)));let a=vg(r,e.locale);return t.fromMnemonic(a,e.path,e.locale)}static fromEncryptedJson(e,r,a){return gJ(e,r,a).then(i=>new t(i))}static fromEncryptedJsonSync(e,r){return new t(bJ(e,r))}static fromMnemonic(e,r,a){return r||(r=z0),new t(ol.fromMnemonic(e,null,a).derivePath(r))}};function _J(t,e){return RR(tl(t),e)}function g8(t,e,r,a){return RR(D0.hash(t,e,r),a)}var WR=class{signer;publicKey;ownerLength=Vr[_r.ETHEREUM].pubLength;signatureLength=Vr[_r.ETHEREUM].sigLength;signatureType=_r.ETHEREUM;constructor(e){this.signer=e.getSigner()}async setPublicKey(){let e="sign this message to connect to Bundlr.Network",r=await this.signer.signMessage(e),a=await tl(e),i=s8(Lt(a),r);this.publicKey=ge.from(Lt(i))}async sign(e){this.publicKey||await this.setPublicKey();let r=await this.signer.signMessage(e);return ge.from(r.slice(2),"hex")}static verify(e,r,a){let i=Rs(e);return _J(r,a)===i}};X();ee();Q();var l1=vi(RJ(),1),Dh=class extends Ro{get publicKey(){return l1.default.decode(this.pk)}get key(){return l1.default.decode(this._key)}constructor(e){let r=l1.default.decode(e);super(l1.default.encode(r.subarray(0,32)),l1.default.encode(r.subarray(32,64)))}};X();ee();Q();X();ee();Q();X();ee();Q();var ZQ=vi(zo(),1),FT=vi(lT(),1);X();ee();Q();mo();var $Q=vi(DQ(),1);function qT(t){return t=UQ(t),(0,$Q.default)("keccak256").update(t).digest()}function UQ(t){if(!ge.isBuffer(t))if(Array.isArray(t))t=ge.from(t);else if(typeof t=="string")qQ(t)?t=ge.from(G8(FQ(t)),"hex"):t=ge.from(t);else if(typeof t=="number")t=zQ(t);else if(typeof t=="bigint")t=$5e(t);else if(t==null)t=ge.allocUnsafe(0);else throw new Error("invalid type");return t}function qQ(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function G8(t){if(typeof t!="string")throw new Error(`while padding to even, value must be string, is currently ${typeof t}, while padToEven.`);return t.length%2&&(t=`0${t}`),t}function FQ(t){return typeof t!="string"?t:jQ(t)?t.slice(2):t}function jQ(t){if(typeof t!="string")throw new Error("value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return t.startsWith("0x")}function zQ(t){let e=HQ(t);return ge.from(G8(e.slice(2)),"hex")}function HQ(t){return`0x${t.toString(16)}`}function $5e(t){let e=t.toString(16);return ge.from(G8(e),"hex")}typeof window<"u"&&(window.keccak256=qT);var Tg=qT,U5e={intToBuffer:zQ,intToHex:HQ,isHexPrefixed:jQ,stripHexPrefix:FQ,padToEven:G8,isHexString:qQ,toBuffer:UQ};var nd=class{_key;ownerLength=Vr[_r.ETHEREUM].pubLength;signatureLength=Vr[_r.ETHEREUM].sigLength;signatureType=_r.ETHEREUM;pk;constructor(e,r){this._key=e,this.pk=r.toString("hex")}get publicKey(){throw new Error("You must implement `publicKey`")}get key(){return ge.from(this._key,"hex")}static async verify(e,r,a){let i=e;typeof e=="string"&&(i=ZQ.default.toBuffer(e));let h=!1;try{h=FT.default.ecdsaVerify(a,Tg(ge.from(r)),i)}catch{}return h}async sign(e){return FT.default.ecdsaSign(Tg(ge.from(e)),ge.from(this.key)).signature}};var jT=vi(lT(),1),KQ=vi(zo(),1);var No=class extends nd{get publicKey(){return ge.from(this.pk,"hex")}constructor(e){e.startsWith("0x")&&(e=e.slice(2));let r=ge.from(e,"hex"),a=jT.default.publicKeyCreate(r,!1);super(e,ge.from(a))}async sign(e){return new c1(this._key).signMessage(e).then(a=>ge.from(a.slice(2),"hex"))}static async verify(e,r,a){return jT.default.ecdsaVerify(a.length===65?a.slice(0,-1):a,Lt(tl(r)),typeof e=="string"?KQ.default.toBuffer(e):e)}};var kg=class extends No{};X();ee();Q();var Ig=class extends Dh{constructor(e){super(e.replace("ed25519:",""))}};X();ee();Q();var Bg=class extends Ro{get publicKey(){return ge.from(this.pk)}get key(){return ge.from(this._key)}constructor(e,r){super(e.subarray(0,32),r)}};X();ee();Q();var ad=class extends N0{signatureType=4;constructor(e){super(e)}async sign(e){return super.sign(ge.from(ge.from(e).toString("hex")))}static async verify(e,r,a){return super.verify(e,ge.from(ge.from(r).toString("hex")),a)}};X();ee();Q();var Og=class extends Dh{signatureType=4;constructor(e){super(e)}async sign(e){return super.sign(ge.from(ge.from(e).toString("hex")))}static async verify(e,r,a){return super.verify(e,ge.from(ge.from(r).toString("hex")),a)}};X();ee();Q();var Pg=class extends Ro{constructor(e,r){super(e,r)}get publicKey(){return ge.from(this.pk.slice(2),"hex")}get key(){return ge.from(this._key.slice(2),"hex")}};X();ee();Q();var od=class{_publicKey;ownerLength=Vr[_r.INJECTEDAPTOS].pubLength;signatureLength=Vr[_r.INJECTEDAPTOS].sigLength;signatureType=_r.INJECTEDAPTOS;pem;provider;constructor(e,r){this.provider=e,this._publicKey=r}get publicKey(){return this._publicKey}async sign(e){if(!this.provider.signMessage)throw new Error("Selected Wallet does not support message signing");let a=(await this.provider.signMessage({message:ge.from(e).toString("hex"),nonce:"bundlr"})).signature;return typeof a=="string"?ge.from(a,"hex"):a.data.toUint8Array()}static async verify(e,r,a){let i=e;return Kc(ge.from(a),ge.from(`APTOS
131
131
  message: ${ge.from(r).toString("hex")}
132
- nonce: bundlr`),ge.from(i))}};X();ee();Q();var sd=class{_publicKey;ownerLength=Vr[_r.MULTIAPTOS].pubLength;signatureLength=Vr[_r.MULTIAPTOS].sigLength;signatureType=_r.MULTIAPTOS;collectSignatures;provider;constructor(e,r){this._publicKey=e,this.collectSignatures=r}get publicKey(){return this._publicKey}async sign(e){let{signatures:r,bitmap:a}=await this.collectSignatures(e),i=128,h=new Uint8Array([0,0,0,0]),c=new Set;a.forEach(g=>{if(g>=32)throw new Error(`Invalid bit value ${g}.`);if(c.has(g))throw new Error("Duplicated bits detected.");c.add(g);let y=Math.floor(g/8),M=h[y];M|=i>>g%8,h[y]=M});let d=ge.alloc(this.signatureLength),b=0;for(let g=0;g<32;g++)a.includes(g)&&d.set(r[b++],g*64);return d.set(h,this.signatureLength-4),d}static async verify(e,r,a){let h=Vr[_r.MULTIAPTOS].sigLength-4,c=a.slice(0,h),d=a.slice(h),b=!1;for(let g=0;g<32;g++){let y=Math.floor(g/8),M=g-y*8;if((d[y]&128>>M)!==0){let E=c.slice(g*64,(g+1)*64),A=e.slice(g*32,(g+1)*32);await Kc(ge.from(E),ge.from(r),ge.from(A))||(b=!0)}}return!b}};X();ee();Q();var fd=class extends No{ownerLength=Vr[_r.TYPEDETHEREUM].pubLength;signatureLength=Vr[_r.TYPEDETHEREUM].sigLength;signatureType=_r.TYPEDETHEREUM;address;signer;constructor(e){super(e),this.address="0x"+Tg(super.publicKey.slice(1)).slice(-20).toString("hex"),this.signer=new c1(e)}get publicKey(){return ge.from(this.address)}async sign(e){let r=await this.signer._signTypedData(Ng,Cg,{address:this.address,"Transaction hash":e});return ge.from(r.slice(2),"hex")}static async verify(e,r,a){let i=e.toString(),h=g8(Ng,Cg,{address:i,"Transaction hash":r},a);return i.toLowerCase()===h.toLowerCase()}},Ng={name:"Bundlr",version:"1"},Cg={Bundlr:[{name:"Transaction hash",type:"bytes"},{name:"address",type:"address"}]};X();ee();Q();var zT=class{ownerLength=Vr[_r.TYPEDETHEREUM].pubLength;signatureLength=Vr[_r.TYPEDETHEREUM].sigLength;signatureType=_r.TYPEDETHEREUM;address;signer;publicKey;constructor(e){this.signer=e.getSigner()}async ready(){this.address=(await this.signer.getAddress()).toString().toLowerCase(),this.publicKey=ge.from(this.address)}async sign(e){let r=await this.signer._signTypedData(Ng,Cg,{address:this.address,"Transaction hash":e});return ge.from(r.slice(2),"hex")}static verify(e,r,a){let i=e.toString(),h=g8(Ng,Cg,{address:i,"Transaction hash":r},a);return i.toLowerCase()===h.toLowerCase()}};X();ee();Q();var WQ=vi(zo(),1);var S1=class{signer;publicKey;ownerLength=Vr[_r.ARWEAVE].pubLength;signatureLength=Vr[_r.ARWEAVE].sigLength;signatureType=_r.ARWEAVE;constructor(e){this.signer=e}async setPublicKey(){let e=await this.signer.getActivePublicKey();this.publicKey=WQ.default.toBuffer(e)}async sign(e){this.publicKey||await this.setPublicKey();let r={name:"RSA-PSS",saltLength:32},a=await this.signer.signature(e,r);return new Uint8Array(Object.values(a).map(h=>+h))}static async verify(e,r,a){return await En().verify(e,r,a)}};X();ee();Q();var Lg=class extends No{signatureType=_r.KYVE};var Dg={1:Xc,2:Ro,3:No,4:ad,5:od,6:sd,7:fd};X();ee();Q();X();ee();Q();async function q5e(t){return Wc([(0,Ni.stringToBuffer)("dataitem"),(0,Ni.stringToBuffer)("1"),(0,Ni.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}var $g=q5e;X();ee();Q();X();ee();Q();function Ug(t,e){let r=new Uint8Array(t);if(e<0)throw new Error("Array is unsigned, cannot represent -ve numbers");if(e>2**(t*8)-1)throw new Error(`Number ${e} is too large for an array of ${t} bytes`);for(let a=0;a<r.length;a++){let i=e&255;r[a]=i,e=(e-i)/256}return r}function Y8(t){return Ug(8,t)}function HT(t){return Ug(2,t)}function F5e(t){return Ug(16,t)}function J8(t){return Ug(32,t)}function _n(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}X();ee();Q();var Fg=vi(zo(),1);X();ee();Q();var Ns=vi(zo(),1);mo();X();ee();Q();var qg=class{buf;pos;constructor(e=ge.alloc(X8),r=0){this.buf=e,this.pos=r}writeTags(e){if(!Array.isArray(e))throw new Error("input must be array");let r=e.length,a;if(r)for(this.writeLong(r),a=0;a<r;a++){let i=e[a];if(typeof i?.name!="string"||typeof i?.value!="string")throw new Error(`Invalid tag format for ${i}, expected {name:string, value: string}`);this.writeString(i.name),this.writeString(i.value)}this.writeLong(0)}toBuffer(){let e=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(e,0,0,this.pos),e}writeLong(e){let r=this.buf,a,i;if(e>=-1073741824&&e<1073741824){i=e>=0?e<<1:~e<<1|1;do r[this.pos]=i&127,i>>=7;while(i&&(r[this.pos++]|=128))}else{a=e>=0?e*2:-e*2-1;do r[this.pos]=a&127,a/=128;while(a>=1&&(r[this.pos++]|=128))}this.pos++,this.buf=r}writeString(e){let r=ge.byteLength(e),a=this.buf;this.writeLong(r);let i=this.pos;if(this.pos+=r,!(this.pos>a.length)){if(r>64)this.buf.write(e,this.pos-r,r,"utf8");else{let h,c,d,b;for(h=0,c=r;h<c;h++)d=e.charCodeAt(h),d<128?a[i++]=d:d<2048?(a[i++]=d>>6|192,a[i++]=d&63|128):(d&64512)===55296&&((b=e.charCodeAt(h+1))&64512)===56320?(d=65536+((d&1023)<<10)+(b&1023),h++,a[i++]=d>>18|240,a[i++]=d>>12&63|128,a[i++]=d>>6&63|128,a[i++]=d&63|128):(a[i++]=d>>12|224,a[i++]=d>>6&63|128,a[i++]=d&63|128)}this.buf=a}}readLong(){let e=0,r=0,a=this.buf,i,h,c,d;do i=a[this.pos++],h=i&128,e|=(i&127)<<r,r+=7;while(h&&r<28);if(h){c=e,d=268435456;do i=a[this.pos++],c+=(i&127)*d,d*=128;while(i&128);return(c%2?-(c+1):c)/2}return e>>1^-(e&1)}skipLong(){let e=this.buf;for(;e[this.pos++]&128;);}readTags(){let e=[],r;for(;r=this.readLong();)for(r<0&&(r=-r,this.skipLong());r--;){let a=this.readString(),i=this.readString();e.push({name:a,value:i})}return e}readString(){let e=this.readLong(),r=this.pos,a=this.buf;if(this.pos+=e,this.pos>a.length)throw new Error("TAP Position out of range");return this.buf.slice(r,r+e).toString()}};function ZT(t){if(t?.length===0)return ge.allocUnsafe(0);let e=new qg;return e.writeTags(t),e.toBuffer()}function E1(t){return new qg(t).readTags()}Sh();var e4=80,X8=4096,Q8=class t{binary;_id;constructor(e){this.binary=e}static isDataItem(e){return e.binary!==void 0}get signatureType(){let e=_n(this.binary.subarray(0,2));if(_r?.[e]!==void 0)return e;throw new Error("Unknown signature type: "+e)}async isValid(){return t.verify(this.binary)}get id(){return Ns.default.encode(this.rawId)}set id(e){this._id=Ns.default.toBuffer(e)}get rawId(){return xh("sha256").update(this.rawSignature).digest()}set rawId(e){this._id=e}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Ns.default.encode(this.rawSignature)}set rawOwner(e){if(e.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${e.byteLength} bytes.`);this.binary.set(e,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return Vr[this.signatureType].sigLength}get owner(){return Ns.default.encode(this.rawOwner)}get ownerLength(){return Vr[this.signatureType].pubLength}get rawTarget(){let e=this.getTargetStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):ge.alloc(0)}get target(){return Ns.default.encode(this.rawTarget)}get rawAnchor(){let e=this.getAnchorStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):ge.alloc(0)}get anchor(){return Ns.default.encode(this.rawAnchor)}get rawTags(){let e=this.getTagsStart(),r=_n(this.binary.subarray(e+8,e+16));return this.binary.subarray(e+16,e+16+r)}get tags(){let e=this.getTagsStart();if(_n(this.binary.subarray(e,e+8))==0)return[];let a=_n(this.binary.subarray(e+8,e+16));return E1(ge.from(this.binary.subarray(e+16,e+16+a)))}get tagsB64Url(){return this.tags.map(r=>({name:Ns.default.encode(r.name),value:Ns.default.encode(r.value)}))}getStartOfData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),a=_n(r);return e+16+a}get rawData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),a=_n(r),i=e+16+a;return this.binary.subarray(i,this.binary.length)}get data(){return Ns.default.encode(this.rawData)}getRaw(){return this.binary}async sign(e){return this._id=await t4(this,e),this.rawId}async setSignature(e){this.binary.set(e,2),this._id=ge.from(await En().hash(e))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(e=>({name:Ns.default.encode(e.name),value:Ns.default.encode(e.value)})),data:this.data}}static async verify(e){if(e.byteLength<e4)return!1;let r=new t(e),a=r.signatureType,i=r.getTagsStart(),h=_n(e.subarray(i,i+8)),c=e.subarray(i+8,i+16),d=_n(c);if(d>X8)return!1;if(h>0)try{if(E1(ge.from(e.subarray(i+16,i+16+d))).length!==h)return!1}catch{return!1}let b=Dg[a],g=await $g(r);return await b.verify(r.rawOwner,g,r.rawSignature)}async getSignatureData(){return $g(this)}getTagsStart(){let e=this.getTargetStart(),r=this.binary[e]==1,a=e+(r?33:1),i=this.binary[a]==1;return a+=i?33:1,a}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let e=this.getTargetStart()+1,r=this.binary[this.getTargetStart()]==1;return e+=r?32:0,e}},A1=Q8;Sh();var Lu=32,r4=class{length;items;binary;constructor(e){this.binary=e,this.length=this.getDataItemCount(),this.items=this.getItems()}getRaw(){return this.binary}get(e){if(typeof e=="number"){if(e>=this.length)throw new RangeError("Index out of range");return this.getByIndex(e)}else return this.getById(e)}getSizes(){let e=[];for(let r=Lu;r<Lu+64*this.length;r+=64)e.push(_n(this.binary.subarray(r,r+32)));return e}getIds(){let e=[];for(let r=Lu;r<Lu+64*this.length;r+=64){let a=this.binary.subarray(r+32,r+64);if(a.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");e.push(Fg.default.encode(a))}return e}getIdBy(e){if(e>this.length-1)throw new RangeError("Index of bundle out of range");let r=64+64*e;return Fg.default.encode(this.binary.subarray(r,r+32))}async toTransaction(e,r,a){let i=await r.createTransaction({data:this.binary,...e},a);return i.addTag("Bundle-Format","binary"),i.addTag("Bundle-Version","2.0.0"),i}async verify(){for(let e of this.items){let r=await e.isValid(),a=(0,Fg.default)(xh("sha256").update(e.rawSignature).digest());if(!(r&&e.id===a))return!1}return!0}getOffset(e){let r=0;for(let a=Lu;a<Lu+64*this.length;a+=64){let i=_n(this.binary.subarray(a,a+32));r+=i;let h=this.binary.subarray(a+32,a+64);if(ge.compare(h,e)===0)return{startOffset:r,size:i}}return{startOffset:-1,size:-1}}getByIndex(e){let r=0,a=this.getBundleStart(),i=0,h,c;for(let y=Lu;y<Lu+64*this.length;y+=64){if(h=_n(this.binary.subarray(y,y+32)),i++===e){c=this.binary.subarray(y+32,y+64);break}r+=h}let d=a+r,b=this.binary.subarray(d,d+h),g=new A1(b);return g.rawId=c,g}getById(e){let r=Fg.default.toBuffer(e),a=this.getOffset(r);if(a.startOffset===-1)throw new Error("Transaction not found");let h=this.getBundleStart()+a.startOffset;return new A1(this.binary.subarray(h,h+a.size))}getDataItemCount(){return _n(this.binary.subarray(0,32))}getBundleStart(){return 32+64*this.length}getItems(){let e=new Array(this.length),r=0,a=this.getBundleStart(),i=0;for(let h=Lu;h<Lu+64*this.length;h+=64){let c=_n(this.binary.subarray(h,h+32)),d=this.binary.subarray(h+32,h+64);if(d.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");let b=a+r,g=this.binary.subarray(b,b+c);r+=c;let y=new A1(g);y.rawId=d,e[i]=y,i++}return e}},KT=r4;function j5e(t){return new KT(t)}async function z5e(t,e){let r=new Uint8Array(64*t.length),a=await Promise.all(t.map(async(h,c)=>{let d=h.isSigned()?h.rawId:await t4(h,e),b=new Uint8Array(64);return b.set(J8(h.getRaw().byteLength),0),b.set(d,32),r.set(b,64*c),h.getRaw()})).then(h=>ge.concat(h)),i=ge.concat([ge.from(J8(t.length)),ge.from(r),a]);return new KT(i)}async function VQ(t,e){let r=await $g(t),a=await e.sign(r),i=await En().hash(a);return{signature:ge.from(a),id:ge.from(i)}}async function t4(t,e){let{signature:r,id:a}=await VQ(t,e);return t.getRaw().set(r,2),a}X();ee();Q();var GQ=vi(zo(),1);function jg(t,e,r){let a=e.publicKey,i=r?.target?GQ.default.toBuffer(r.target):null,h=1+(i?.byteLength??0),c=r?.anchor?ge.from(r.anchor):null,d=1+(c?.byteLength??0),b=(r?.tags?.length??0)>0?ZT(r?.tags):null,g=16+(b?b.byteLength:0),y=typeof t=="string"?ge.from(t):ge.from(t),M=y.byteLength,x=2+e.signatureLength+e.ownerLength+h+d+g+M,E=ge.alloc(x);if(E.set(HT(e.signatureType),0),E.set(new Uint8Array(e.signatureLength).fill(0),2),a.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${a.byteLength}`);E.set(a,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(E[A]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);E.set(i,A+1)}let k=A+h,O=k+1;if(E[k]=c?1:0,c){if(O+=c.byteLength,c.byteLength!==32)throw new Error("Anchor must be 32 bytes");E.set(c,k+1)}E.set(Y8(r?.tags?.length??0),O);let N=Y8(b?.byteLength??0);E.set(N,O+8),b&&E.set(b,O+16);let L=O+g;return E.set(y,L),new A1(E)}X();ee();Q();X();ee();Q();var WT=class{signatureType;rawSignature;signature;signatureLength;rawOwner;owner;ownerLength;rawTarget;target;rawAnchor;anchor;rawTags;tags;rawData;data;static async verify(...e){throw new Error("You must implement `verify`")}};X();ee();Q();X();ee();Q();var JT={};$a(JT,{default:()=>K5e,processStream:()=>eee,streamExportForTesting:()=>W5e,streamSigner:()=>Z5e});X();ee();Q();i4();var ud=vi(zo(),1);Sh();async function eee(t){let e=tee(t),r=(await e.next()).value;r=await Fa(e,r,32);let a=_n(r.subarray(0,32));r=r.subarray(32);let i=64*a;r=await Fa(e,r,i);let h=new Array(a);for(let b=0;b<i;b+=64)h[b/64]=[_n(r.subarray(b,b+32)),(0,ud.default)(ge.from(r.subarray(b+32,b+64)))];r=r.subarray(i);let c=32+i,d=[];for(let[b,g]of h){r=await Fa(e,r,e4),r=await Fa(e,r,2);let y=_n(r.subarray(0,2));r=r.subarray(2);let{sigLength:M,pubLength:x,sigName:E}=Vr[y];r=await Fa(e,r,M);let A=r.subarray(0,M);r=r.subarray(M),r=await Fa(e,r,x);let k=r.subarray(0,x);r=r.subarray(x),r=await Fa(e,r,1);let O=r[0]===1;O&&(r=await Fa(e,r,33));let N=O?r.subarray(1,33):ge.allocUnsafe(0);r=r.subarray(O?33:1),r=await Fa(e,r,1);let L=r[0]===1;L&&(r=await Fa(e,r,33));let C=L?r.subarray(1,33):ge.allocUnsafe(0);r=r.subarray(L?33:1),r=await Fa(e,r,8);let Y=_n(r.subarray(0,8));r=r.subarray(8),r=await Fa(e,r,8);let G=_n(r.subarray(0,8));r=r.subarray(8),r=await Fa(e,r,G);let ie=r.subarray(0,G),D=Y!==0&&G!==0?E1(ge.from(ie)):[];if(D.length!==Y)throw new Error("Tags lengths don't match");r=r.subarray(G);let q=new XQ;q._transform=function(f,u,l){this.push(f),l()};let V=Wc([(0,Ni.stringToBuffer)("dataitem"),(0,Ni.stringToBuffer)("1"),(0,Ni.stringToBuffer)(y.toString()),k,N,C,ie,q]),_=2+M+x+(O?33:1)+(L?33:1)+16+G,n=b-_;if(r.byteLength>n)q.write(r.subarray(0,n)),r=r.subarray(n);else{let f=r.byteLength;for(q.write(r);n>f;){if(r=(await e.next()).value,!r)throw new Error(`Not enough data bytes expected: ${n} received: ${f}`);f+=r.byteLength,f>n?q.write(r.subarray(0,r.byteLength-(f-n))):q.write(r)}r=r.subarray(r.byteLength-(f-n))}if(q.end(),g!==(0,ud.default)(xh("sha256").update(A).digest()))throw new Error("ID doesn't match signature");if(!await Dg[y].verify(k,await V,A))throw new Error("Invalid signature");d.push({id:g,sigName:E,signature:(0,ud.default)(ge.from(A)),target:(0,ud.default)(ge.from(N)),anchor:(0,ud.default)(ge.from(C)),owner:(0,ud.default)(ge.from(k)),tags:D,dataOffset:c+_,dataSize:n}),c+=_+n}return d}async function Z5e(t,e,r,a){let i=jg("",r,a),h=new QQ,c=[(0,Ni.stringToBuffer)("dataitem"),(0,Ni.stringToBuffer)("1"),(0,Ni.stringToBuffer)(i.signatureType.toString()),i.rawOwner,i.rawTarget,i.rawAnchor,i.rawTags,t],d=await Wc(c),b=ge.from(await r.sign(d));return i.setSignature(b),h.write(i.getRaw()),e.pipe(h)}async function Fa(t,e,r){if(e.byteLength>=r)return e;let{done:a,value:i}=await t.next();if(a&&!i)throw new Error("Invalid buffer");return Fa(t,ge.concat([ge.from(e),ge.from(i)]),r)}async function*tee(t){for await(let e of t)yield e}var K5e=eee,W5e={readBytes:Fa,getReader:tee};var V5e={...VT,stream:JT};globalThis.arbundles??=V5e;X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var ree=new RegExp("^[a-zA-Z0-9_-]{43}$"),zct=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),Hct=new RegExp("^[0-9]{12},[0-9]{13},[a-fA-F0-9]{64}$"),Zct=xe.env.ARNS_REGISTRY_TX??"bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U",Kct="_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8",G5e="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",Wct=G5e,R1="agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA",n4="i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc",XT=1e6,iee="cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk",QT="zeglqubvIKvBEZaxAUuenLGGtQ1pJp9LZjd5hDe0-J0",nee="_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";var ek=class t{constructor(e){this.positiveFiniteInteger=e;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${e}`)}[Symbol.toPrimitive](e){return e==="string"&&this.toString(),this.positiveFiniteInteger}plus(e){return new t(this.positiveFiniteInteger+e.positiveFiniteInteger)}minus(e){return new t(this.positiveFiniteInteger-e.positiveFiniteInteger)}isGreaterThan(e){return this.positiveFiniteInteger>e.positiveFiniteInteger}isGreaterThanOrEqualTo(e){return this.positiveFiniteInteger>=e.positiveFiniteInteger}isLessThan(e){return this.positiveFiniteInteger<e.positiveFiniteInteger}isLessThanOrEqualTo(e){return this.positiveFiniteInteger<=e.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(e){return this.positiveFiniteInteger===e.positiveFiniteInteger}},tk=class{value;constructor(e){if(!Number.isFinite(e)||e<0)throw new Error("IOToken must be a non-negative finite number");this.value=+e.toFixed(6)}valueOf(){return this.value}toMIO(){return new rk(Math.floor(this.value*XT))}toString(){return`${this.value}`}},rk=class t extends ek{constructor(e){super(e)}multiply(e){let r=Math.floor(this.valueOf()*e.valueOf());return new t(r)}divide(e){if(e.valueOf()===0)throw new Error("Cannot divide by zero");let r=Math.floor(this.valueOf()/e.valueOf());return new t(r)}plus(e){let r=super.plus(e);return new t(r.valueOf())}minus(e){let r=super.minus(e);return new t(r.valueOf())}toIO(){return new tk(this.valueOf()/XT)}};X();ee();Q();X();ee();Q();var aee=t=>ree.test(t);function nlt(t){return t!==void 0&&!isNaN(parseInt(t.toString()))}function Fh(t){return"process"in t}function jh(t){return"processId"in t&&typeof t.processId=="string"&&aee(t.processId)===!0}function hlt(t){return t.type==="lease"}X();ee();Q();X();ee();Q();var Bf=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},oee=class extends Bf{},see=class extends Bf{},fee=class extends Bf{constructor(e,r){super(`Failed request: ${e}: ${r}`)}},uee=class extends Bf{},a4=class extends Bf{},hee=class extends Bf{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},Du=class extends Bf{constructor(){super("Invalid contract configuration")}},cee=class extends Bf{constructor(){super("Invalid process configuration")}},lee=class extends Bf{};X();ee();Q();var qf=vi(Ooe(),1);X();ee();Q();var V1="2.2.3-alpha.1";var Ff=class t{logger;silent=!1;static default=new t;constructor({level:e="info"}={}){e==="none"&&(this.silent=!0),typeof window<"u"?this.logger=console:this.logger=(0,qf.createLogger)({level:e,silent:this.silent,defaultMeta:{name:"ar-io-sdk",version:V1},format:qf.format.combine(qf.format.timestamp(),qf.format.json()),transports:[new qf.transports.Console({format:qf.format.combine(qf.format.timestamp(),qf.format.json())})]})}info(e,...r){this.silent||this.logger.info(e,...r)}warn(e,...r){this.silent||this.logger.warn(e,...r)}error(e,...r){this.silent||this.logger.error(e,...r)}debug(e,...r){this.silent||this.logger.debug(e,...r)}setLogLevel(e){this.silent=e==="none","silent"in this.logger&&(this.logger.silent=e==="none"),"level"in this.logger&&(this.logger.level=e)}};X();ee();Q();X();ee();Q();X();ee();Q();var GBe=Object.create,$B=Object.defineProperty,YBe=Object.getOwnPropertyDescriptor,nse=Object.getOwnPropertyNames,JBe=Object.getPrototypeOf,XBe=Object.prototype.hasOwnProperty,Do=(t,e)=>function(){return e||(0,t[nse(t)[0]])((e={exports:{}}).exports,e),e.exports},ase=(t,e)=>{for(var r in e)$B(t,r,{get:e[r],enumerable:!0})},QBe=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of nse(e))!XBe.call(t,i)&&i!==r&&$B(t,i,{get:()=>e[i],enumerable:!(a=YBe(e,i))||a.enumerable});return t},UB=(t,e,r)=>(r=t!=null?GBe(JBe(t)):{},QBe(e||!t||!t.__esModule?$B(r,"default",{value:t,enumerable:!0}):r,t)),eOe=Do({"node_modules/obliterator/iterator.js"(t,e){function r(a){if(typeof a!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=a}typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var a=arguments,i=a.length,h=0;return new r(function(){return h>=i?{done:!0}:{done:!1,value:a[h++]}})},r.empty=function(){var a=new r(function(){return{done:!0}});return a},r.fromSequence=function(a){var i=0,h=a.length;return new r(function(){return i>=h?{done:!0}:{done:!1,value:a[i++]}})},r.is=function(a){return a instanceof r?!0:typeof a=="object"&&a!==null&&typeof a.next=="function"},e.exports=r}}),tOe=Do({"node_modules/obliterator/support.js"(t){t.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",t.SYMBOL_SUPPORT=typeof Symbol<"u"}}),qB=Do({"node_modules/obliterator/foreach.js"(t,e){var r=tOe(),a=r.ARRAY_BUFFER_SUPPORT,i=r.SYMBOL_SUPPORT;e.exports=function(c,d){var b,g,y,M,x;if(!c)throw new Error("obliterator/forEach: invalid iterable.");if(typeof d!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(c)||a&&ArrayBuffer.isView(c)||typeof c=="string"||c.toString()==="[object Arguments]"){for(y=0,M=c.length;y<M;y++)d(c[y],y);return}if(typeof c.forEach=="function"){c.forEach(d);return}if(i&&Symbol.iterator in c&&typeof c.next!="function"&&(c=c[Symbol.iterator]()),typeof c.next=="function"){for(b=c,y=0;x=b.next(),x.done!==!0;)d(x.value,y),y++;return}for(g in c)c.hasOwnProperty(g)&&d(c[g],g)}}}),FB=Do({"node_modules/mnemonist/utils/typed-arrays.js"(t){var e=Math.pow(2,8)-1,r=Math.pow(2,16)-1,a=Math.pow(2,32)-1,i=Math.pow(2,7)-1,h=Math.pow(2,15)-1,c=Math.pow(2,31)-1;t.getPointerArray=function(b){var g=b-1;if(g<=e)return Uint8Array;if(g<=r)return Uint16Array;if(g<=a)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},t.getSignedPointerArray=function(b){var g=b-1;return g<=i?Int8Array:g<=h?Int16Array:g<=c?Int32Array:Float64Array},t.getNumberType=function(b){return b===(b|0)?Math.sign(b)===-1?b<=127&&b>=-128?Int8Array:b<=32767&&b>=-32768?Int16Array:Int32Array:b<=255?Uint8Array:b<=65535?Uint16Array:Uint32Array:Float64Array};var d={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};t.getMinimalRepresentation=function(b,g){var y=null,M=0,x,E,A,k,O;for(k=0,O=b.length;k<O;k++)A=g?g(b[k]):b[k],E=t.getNumberType(A),x=d[E.name],x>M&&(M=x,y=E);return y},t.isTypedArray=function(b){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(b)},t.concat=function(){var b=0,g,y,M;for(g=0,M=arguments.length;g<M;g++)b+=arguments[g].length;var x=new arguments[0].constructor(b);for(g=0,y=0;g<M;g++)x.set(arguments[g],y),y+=arguments[g].length;return x},t.indices=function(b){for(var g=t.getPointerArray(b),y=new g(b),M=0;M<b;M++)y[M]=M;return y}}}),ose=Do({"node_modules/mnemonist/utils/iterables.js"(t){var e=qB(),r=FB();function a(d){return Array.isArray(d)||r.isTypedArray(d)}function i(d){if(typeof d.length=="number")return d.length;if(typeof d.size=="number")return d.size}function h(d){var b=i(d),g=typeof b=="number"?new Array(b):[],y=0;return e(d,function(M){g[y++]=M}),g}function c(d){var b=i(d),g=typeof b=="number"?r.getPointerArray(b):Array,y=typeof b=="number"?new Array(b):[],M=typeof b=="number"?new g(b):[],x=0;return e(d,function(E){y[x]=E,M[x]=x++}),[y,M]}t.isArrayLike=a,t.guessLength=i,t.toArray=h,t.toArrayWithIndices=c}}),rOe=Do({"node_modules/mnemonist/lru-cache.js"(t,e){var r=eOe(),a=qB(),i=FB(),h=ose();function c(d,b,g){if(arguments.length<2&&(g=d,d=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var y=i.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof d=="function"?new d(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items={}}c.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},c.prototype.splayOnTop=function(d){var b=this.head;if(this.head===d)return this;var g=this.backward[d],y=this.forward[d];return this.tail===d?this.tail=g:this.backward[y]=g,this.forward[g]=y,this.backward[b]=d,this.head=d,this.forward[d]=b,this},c.prototype.set=function(d,b){var g=this.items[d];if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],delete this.items[this.K[g]]),this.items[d]=g,this.K[g]=d,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},c.prototype.setpop=function(d,b){var g=null,y=null,M=this.items[d];return typeof M<"u"?(this.splayOnTop(M),g=this.V[M],this.V[M]=b,{evicted:!1,key:d,value:g}):(this.size<this.capacity?M=this.size++:(M=this.tail,this.tail=this.backward[M],g=this.V[M],y=this.K[M],delete this.items[y]),this.items[d]=M,this.K[M]=d,this.V[M]=b,this.forward[M]=this.head,this.backward[this.head]=M,this.head=M,y?{evicted:!0,key:y,value:g}:null)},c.prototype.has=function(d){return d in this.items},c.prototype.get=function(d){var b=this.items[d];if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},c.prototype.peek=function(d){var b=this.items[d];if(!(typeof b>"u"))return this.V[b]},c.prototype.forEach=function(d,b){b=arguments.length>1?b:this;for(var g=0,y=this.size,M=this.head,x=this.K,E=this.V,A=this.forward;g<y;)d.call(b,E[M],x[M],this),M=A[M],g++},c.prototype.keys=function(){var d=0,b=this.size,g=this.head,y=this.K,M=this.forward;return new r(function(){if(d>=b)return{done:!0};var x=y[g];return d++,d<b&&(g=M[g]),{done:!1,value:x}})},c.prototype.values=function(){var d=0,b=this.size,g=this.head,y=this.V,M=this.forward;return new r(function(){if(d>=b)return{done:!0};var x=y[g];return d++,d<b&&(g=M[g]),{done:!1,value:x}})},c.prototype.entries=function(){var d=0,b=this.size,g=this.head,y=this.K,M=this.V,x=this.forward;return new r(function(){if(d>=b)return{done:!0};var E=y[g],A=M[g];return d++,d<b&&(g=x[g]),{done:!1,value:[E,A]}})},typeof Symbol<"u"&&(c.prototype[Symbol.iterator]=c.prototype.entries),c.prototype.inspect=function(){for(var d=new Map,b=this.entries(),g;g=b.next(),!g.done;)d.set(g.value[0],g.value[1]);return Object.defineProperty(d,"constructor",{value:c,enumerable:!1}),d},typeof Symbol<"u"&&(c.prototype[Symbol.for("nodejs.util.inspect.custom")]=c.prototype.inspect),c.from=function(d,b,g,y){if(arguments.length<2){if(y=h.guessLength(d),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var M=new c(b,g,y);return a(d,function(x,E){M.set(E,x)}),M},e.exports=c}}),iOe=Do({"node_modules/mnemonist/lru-map.js"(t,e){var r=rOe(),a=qB(),i=FB(),h=ose();function c(d,b,g){if(arguments.length<2&&(g=d,d=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var y=i.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof d=="function"?new d(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items=new Map}c.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},c.prototype.set=function(d,b){var g=this.items.get(d);if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],this.items.delete(this.K[g])),this.items.set(d,g),this.K[g]=d,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},c.prototype.setpop=function(d,b){var g=null,y=null,M=this.items.get(d);return typeof M<"u"?(this.splayOnTop(M),g=this.V[M],this.V[M]=b,{evicted:!1,key:d,value:g}):(this.size<this.capacity?M=this.size++:(M=this.tail,this.tail=this.backward[M],g=this.V[M],y=this.K[M],this.items.delete(y)),this.items.set(d,M),this.K[M]=d,this.V[M]=b,this.forward[M]=this.head,this.backward[this.head]=M,this.head=M,y?{evicted:!0,key:y,value:g}:null)},c.prototype.has=function(d){return this.items.has(d)},c.prototype.get=function(d){var b=this.items.get(d);if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},c.prototype.peek=function(d){var b=this.items.get(d);if(!(typeof b>"u"))return this.V[b]},c.prototype.splayOnTop=r.prototype.splayOnTop,c.prototype.forEach=r.prototype.forEach,c.prototype.keys=r.prototype.keys,c.prototype.values=r.prototype.values,c.prototype.entries=r.prototype.entries,typeof Symbol<"u"&&(c.prototype[Symbol.iterator]=c.prototype.entries),c.prototype.inspect=r.prototype.inspect,c.from=function(d,b,g,y){if(arguments.length<2){if(y=h.guessLength(d),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var M=new c(b,g,y);return a(d,function(x,E){M.set(E,x)}),M},e.exports=c}}),nOe=Do({"node_modules/ms/index.js"(t,e){var r=1e3,a=r*60,i=a*60,h=i*24,c=h*7,d=h*365.25;e.exports=function(x,E){E=E||{};var A=typeof x;if(A==="string"&&x.length>0)return b(x);if(A==="number"&&isFinite(x))return E.long?y(x):g(x);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(x))};function b(x){if(x=String(x),!(x.length>100)){var E=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(x);if(E){var A=parseFloat(E[1]),k=(E[2]||"ms").toLowerCase();switch(k){case"years":case"year":case"yrs":case"yr":case"y":return A*d;case"weeks":case"week":case"w":return A*c;case"days":case"day":case"d":return A*h;case"hours":case"hour":case"hrs":case"hr":case"h":return A*i;case"minutes":case"minute":case"mins":case"min":case"m":return A*a;case"seconds":case"second":case"secs":case"sec":case"s":return A*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}function g(x){var E=Math.abs(x);return E>=h?Math.round(x/h)+"d":E>=i?Math.round(x/i)+"h":E>=a?Math.round(x/a)+"m":E>=r?Math.round(x/r)+"s":x+"ms"}function y(x){var E=Math.abs(x);return E>=h?M(x,E,h,"day"):E>=i?M(x,E,i,"hour"):E>=a?M(x,E,a,"minute"):E>=r?M(x,E,r,"second"):x+" ms"}function M(x,E,A,k){var O=E>=A*1.5;return Math.round(x/A)+" "+k+(O?"s":"")}}}),aOe=Do({"node_modules/debug/src/common.js"(t,e){function r(a){h.debug=h,h.default=h,h.coerce=M,h.disable=b,h.enable=d,h.enabled=g,h.humanize=nOe(),h.destroy=x,Object.keys(a).forEach(E=>{h[E]=a[E]}),h.names=[],h.skips=[],h.formatters={};function i(E){let A=0;for(let k=0;k<E.length;k++)A=(A<<5)-A+E.charCodeAt(k),A|=0;return h.colors[Math.abs(A)%h.colors.length]}h.selectColor=i;function h(E){let A,k=null,O,N;function L(...C){if(!L.enabled)return;let Y=L,G=Number(new Date),ie=G-(A||G);Y.diff=ie,Y.prev=A,Y.curr=G,A=G,C[0]=h.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let D=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(V,_)=>{if(V==="%%")return"%";D++;let n=h.formatters[_];if(typeof n=="function"){let s=C[D];V=n.call(Y,s),C.splice(D,1),D--}return V}),h.formatArgs.call(Y,C),(Y.log||h.log).apply(Y,C)}return L.namespace=E,L.useColors=h.useColors(),L.color=h.selectColor(E),L.extend=c,L.destroy=h.destroy,Object.defineProperty(L,"enabled",{enumerable:!0,configurable:!1,get:()=>k!==null?k:(O!==h.namespaces&&(O=h.namespaces,N=h.enabled(E)),N),set:C=>{k=C}}),typeof h.init=="function"&&h.init(L),L}function c(E,A){let k=h(this.namespace+(typeof A>"u"?":":A)+E);return k.log=this.log,k}function d(E){h.save(E),h.namespaces=E,h.names=[],h.skips=[];let A,k=(typeof E=="string"?E:"").split(/[\s,]+/),O=k.length;for(A=0;A<O;A++)k[A]&&(E=k[A].replace(/\*/g,".*?"),E[0]==="-"?h.skips.push(new RegExp("^"+E.slice(1)+"$")):h.names.push(new RegExp("^"+E+"$")))}function b(){let E=[...h.names.map(y),...h.skips.map(y).map(A=>"-"+A)].join(",");return h.enable(""),E}function g(E){if(E[E.length-1]==="*")return!0;let A,k;for(A=0,k=h.skips.length;A<k;A++)if(h.skips[A].test(E))return!1;for(A=0,k=h.names.length;A<k;A++)if(h.names[A].test(E))return!0;return!1}function y(E){return E.toString().substring(2,E.toString().length-2).replace(/\.\*\?$/,"*")}function M(E){return E instanceof Error?E.stack||E.message:E}function x(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return h.enable(h.load()),h}e.exports=r}}),oOe=Do({"node_modules/debug/src/browser.js"(t,e){t.formatArgs=a,t.save=i,t.load=h,t.useColors=r,t.storage=c(),t.destroy=(()=>{let b=!1;return()=>{b||(b=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function a(b){if(b[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+b[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let g="color: "+this.color;b.splice(1,0,g,"color: inherit");let y=0,M=0;b[0].replace(/%[a-zA-Z%]/g,x=>{x!=="%%"&&(y++,x==="%c"&&(M=y))}),b.splice(M,0,g)}t.log=console.debug||console.log||(()=>{});function i(b){try{b?t.storage.setItem("debug",b):t.storage.removeItem("debug")}catch{}}function h(){let b;try{b=t.storage.getItem("debug")}catch{}return!b&&typeof xe<"u"&&"env"in xe&&(b=xe.env.DEBUG),b}function c(){try{return localStorage}catch{}}e.exports=aOe()(t);var{formatters:d}=e.exports;d.j=function(b){try{return JSON.stringify(b)}catch(g){return"[UnexpectedJSONParseError]: "+g.message}}}}),sOe=Do({"node_modules/base64-js/index.js"(t){"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=E;var e=[],r=[],a=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(h=0,c=i.length;h<c;++h)e[h]=i[h],r[i.charCodeAt(h)]=h;var h,c;r[45]=62,r[95]=63;function d(A){var k=A.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var O=A.indexOf("=");O===-1&&(O=k);var N=O===k?0:4-O%4;return[O,N]}function b(A){var k=d(A),O=k[0],N=k[1];return(O+N)*3/4-N}function g(A,k,O){return(k+O)*3/4-O}function y(A){var k,O=d(A),N=O[0],L=O[1],C=new a(g(A,N,L)),Y=0,G=L>0?N-4:N,ie;for(ie=0;ie<G;ie+=4)k=r[A.charCodeAt(ie)]<<18|r[A.charCodeAt(ie+1)]<<12|r[A.charCodeAt(ie+2)]<<6|r[A.charCodeAt(ie+3)],C[Y++]=k>>16&255,C[Y++]=k>>8&255,C[Y++]=k&255;return L===2&&(k=r[A.charCodeAt(ie)]<<2|r[A.charCodeAt(ie+1)]>>4,C[Y++]=k&255),L===1&&(k=r[A.charCodeAt(ie)]<<10|r[A.charCodeAt(ie+1)]<<4|r[A.charCodeAt(ie+2)]>>2,C[Y++]=k>>8&255,C[Y++]=k&255),C}function M(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function x(A,k,O){for(var N,L=[],C=k;C<O;C+=3)N=(A[C]<<16&16711680)+(A[C+1]<<8&65280)+(A[C+2]&255),L.push(M(N));return L.join("")}function E(A){for(var k,O=A.length,N=O%3,L=[],C=16383,Y=0,G=O-N;Y<G;Y+=C)L.push(x(A,Y,Y+C>G?G:Y+C));return N===1?(k=A[O-1],L.push(e[k>>2]+e[k<<4&63]+"==")):N===2&&(k=(A[O-2]<<8)+A[O-1],L.push(e[k>>10]+e[k>>4&63]+e[k<<2&63]+"=")),L.join("")}}}),fOe=Do({"node_modules/ieee754/index.js"(t){t.read=function(e,r,a,i,h){var c,d,b=h*8-i-1,g=(1<<b)-1,y=g>>1,M=-7,x=a?h-1:0,E=a?-1:1,A=e[r+x];for(x+=E,c=A&(1<<-M)-1,A>>=-M,M+=b;M>0;c=c*256+e[r+x],x+=E,M-=8);for(d=c&(1<<-M)-1,c>>=-M,M+=i;M>0;d=d*256+e[r+x],x+=E,M-=8);if(c===0)c=1-y;else{if(c===g)return d?NaN:(A?-1:1)*(1/0);d=d+Math.pow(2,i),c=c-y}return(A?-1:1)*d*Math.pow(2,c-i)},t.write=function(e,r,a,i,h,c){var d,b,g,y=c*8-h-1,M=(1<<y)-1,x=M>>1,E=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=i?0:c-1,k=i?1:-1,O=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,d=M):(d=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-d))<1&&(d--,g*=2),d+x>=1?r+=E/g:r+=E*Math.pow(2,1-x),r*g>=2&&(d++,g/=2),d+x>=M?(b=0,d=M):d+x>=1?(b=(r*g-1)*Math.pow(2,h),d=d+x):(b=r*Math.pow(2,x-1)*Math.pow(2,h),d=0));h>=8;e[a+A]=b&255,A+=k,b/=256,h-=8);for(d=d<<h|b,y+=h;y>0;e[a+A]=d&255,A+=k,d/=256,y-=8);e[a+A-k]|=O*128}}}),uOe=Do({"node_modules/buffer/index.js"(t){"use strict";var e=sOe(),r=fOe(),a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=d,t.SlowBuffer=L,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,d.TYPED_ARRAY_SUPPORT=h(),!d.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 h(){try{let T=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(T,I),T.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function c(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');let I=new Uint8Array(T);return Object.setPrototypeOf(I,d.prototype),I}function d(T,I,P){if(typeof T=="number"){if(typeof I=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(T)}return b(T,I,P)}d.poolSize=8192;function b(T,I,P){if(typeof T=="string")return x(T,I);if(ArrayBuffer.isView(T))return A(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(ut(T,ArrayBuffer)||T&&ut(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ut(T,SharedArrayBuffer)||T&&ut(T.buffer,SharedArrayBuffer)))return k(T,I,P);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let U=T.valueOf&&T.valueOf();if(U!=null&&U!==T)return d.from(U,I,P);let Z=O(T);if(Z)return Z;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return d.from(T[Symbol.toPrimitive]("string"),I,P);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}d.from=function(T,I,P){return b(T,I,P)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array);function g(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function y(T,I,P){return g(T),T<=0?c(T):I!==void 0?typeof P=="string"?c(T).fill(I,P):c(T).fill(I):c(T)}d.alloc=function(T,I,P){return y(T,I,P)};function M(T){return g(T),c(T<0?0:N(T)|0)}d.allocUnsafe=function(T){return M(T)},d.allocUnsafeSlow=function(T){return M(T)};function x(T,I){if((typeof I!="string"||I==="")&&(I="utf8"),!d.isEncoding(I))throw new TypeError("Unknown encoding: "+I);let P=C(T,I)|0,U=c(P),Z=U.write(T,I);return Z!==P&&(U=U.slice(0,Z)),U}function E(T){let I=T.length<0?0:N(T.length)|0,P=c(I);for(let U=0;U<I;U+=1)P[U]=T[U]&255;return P}function A(T){if(ut(T,Uint8Array)){let I=new Uint8Array(T);return k(I.buffer,I.byteOffset,I.byteLength)}return E(T)}function k(T,I,P){if(I<0||T.byteLength<I)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<I+(P||0))throw new RangeError('"length" is outside of buffer bounds');let U;return I===void 0&&P===void 0?U=new Uint8Array(T):P===void 0?U=new Uint8Array(T,I):U=new Uint8Array(T,I,P),Object.setPrototypeOf(U,d.prototype),U}function O(T){if(d.isBuffer(T)){let I=N(T.length)|0,P=c(I);return P.length===0||T.copy(P,0,0,I),P}if(T.length!==void 0)return typeof T.length!="number"||Ze(T.length)?c(0):E(T);if(T.type==="Buffer"&&Array.isArray(T.data))return E(T.data)}function N(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function L(T){return+T!=T&&(T=0),d.alloc(+T)}d.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==d.prototype},d.compare=function(I,P){if(ut(I,Uint8Array)&&(I=d.from(I,I.offset,I.byteLength)),ut(P,Uint8Array)&&(P=d.from(P,P.offset,P.byteLength)),!d.isBuffer(I)||!d.isBuffer(P))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===P)return 0;let U=I.length,Z=P.length;for(let W=0,fe=Math.min(U,Z);W<fe;++W)if(I[W]!==P[W]){U=I[W],Z=P[W];break}return U<Z?-1:Z<U?1:0},d.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}},d.concat=function(I,P){if(!Array.isArray(I))throw new TypeError('"list" argument must be an Array of Buffers');if(I.length===0)return d.alloc(0);let U;if(P===void 0)for(P=0,U=0;U<I.length;++U)P+=I[U].length;let Z=d.allocUnsafe(P),W=0;for(U=0;U<I.length;++U){let fe=I[U];if(ut(fe,Uint8Array))W+fe.length>Z.length?(d.isBuffer(fe)||(fe=d.from(fe)),fe.copy(Z,W)):Uint8Array.prototype.set.call(Z,fe,W);else if(d.isBuffer(fe))fe.copy(Z,W);else throw new TypeError('"list" argument must be an Array of Buffers');W+=fe.length}return Z};function C(T,I){if(d.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||ut(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let P=T.length,U=arguments.length>2&&arguments[2]===!0;if(!U&&P===0)return 0;let Z=!1;for(;;)switch(I){case"ascii":case"latin1":case"binary":return P;case"utf8":case"utf-8":return oe(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P*2;case"hex":return P>>>1;case"base64":return be(T).length;default:if(Z)return U?-1:oe(T).length;I=(""+I).toLowerCase(),Z=!0}}d.byteLength=C;function Y(T,I,P){let U=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((P===void 0||P>this.length)&&(P=this.length),P<=0)||(P>>>=0,I>>>=0,P<=I))return"";for(T||(T="utf8");;)switch(T){case"hex":return o(this,I,P);case"utf8":case"utf-8":return u(this,I,P);case"ascii":return w(this,I,P);case"latin1":case"binary":return p(this,I,P);case"base64":return f(this,I,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,I,P);default:if(U)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),U=!0}}d.prototype._isBuffer=!0;function G(T,I,P){let U=T[I];T[I]=T[P],T[P]=U}d.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 P=0;P<I;P+=2)G(this,P,P+1);return this},d.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 P=0;P<I;P+=4)G(this,P,P+3),G(this,P+1,P+2);return this},d.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 P=0;P<I;P+=8)G(this,P,P+7),G(this,P+1,P+6),G(this,P+2,P+5),G(this,P+3,P+4);return this},d.prototype.toString=function(){let I=this.length;return I===0?"":arguments.length===0?u(this,0,I):Y.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(I){if(!d.isBuffer(I))throw new TypeError("Argument must be a Buffer");return this===I?!0:d.compare(this,I)===0},d.prototype.inspect=function(){let I="",P=t.INSPECT_MAX_BYTES;return I=this.toString("hex",0,P).replace(/(.{2})/g,"$1 ").trim(),this.length>P&&(I+=" ... "),"<Buffer "+I+">"},a&&(d.prototype[a]=d.prototype.inspect),d.prototype.compare=function(I,P,U,Z,W){if(ut(I,Uint8Array)&&(I=d.from(I,I.offset,I.byteLength)),!d.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(P===void 0&&(P=0),U===void 0&&(U=I?I.length:0),Z===void 0&&(Z=0),W===void 0&&(W=this.length),P<0||U>I.length||Z<0||W>this.length)throw new RangeError("out of range index");if(Z>=W&&P>=U)return 0;if(Z>=W)return-1;if(P>=U)return 1;if(P>>>=0,U>>>=0,Z>>>=0,W>>>=0,this===I)return 0;let fe=W-Z,st=U-P,ue=Math.min(fe,st),me=this.slice(Z,W),pe=I.slice(P,U);for(let ye=0;ye<ue;++ye)if(me[ye]!==pe[ye]){fe=me[ye],st=pe[ye];break}return fe<st?-1:st<fe?1:0};function ie(T,I,P,U,Z){if(T.length===0)return-1;if(typeof P=="string"?(U=P,P=0):P>2147483647?P=2147483647:P<-2147483648&&(P=-2147483648),P=+P,Ze(P)&&(P=Z?0:T.length-1),P<0&&(P=T.length+P),P>=T.length){if(Z)return-1;P=T.length-1}else if(P<0)if(Z)P=0;else return-1;if(typeof I=="string"&&(I=d.from(I,U)),d.isBuffer(I))return I.length===0?-1:D(T,I,P,U,Z);if(typeof I=="number")return I=I&255,typeof Uint8Array.prototype.indexOf=="function"?Z?Uint8Array.prototype.indexOf.call(T,I,P):Uint8Array.prototype.lastIndexOf.call(T,I,P):D(T,[I],P,U,Z);throw new TypeError("val must be string, number or Buffer")}function D(T,I,P,U,Z){let W=1,fe=T.length,st=I.length;if(U!==void 0&&(U=String(U).toLowerCase(),U==="ucs2"||U==="ucs-2"||U==="utf16le"||U==="utf-16le")){if(T.length<2||I.length<2)return-1;W=2,fe/=2,st/=2,P/=2}function ue(pe,ye){return W===1?pe[ye]:pe.readUInt16BE(ye*W)}let me;if(Z){let pe=-1;for(me=P;me<fe;me++)if(ue(T,me)===ue(I,pe===-1?0:me-pe)){if(pe===-1&&(pe=me),me-pe+1===st)return pe*W}else pe!==-1&&(me-=me-pe),pe=-1}else for(P+st>fe&&(P=fe-st),me=P;me>=0;me--){let pe=!0;for(let ye=0;ye<st;ye++)if(ue(T,me+ye)!==ue(I,ye)){pe=!1;break}if(pe)return me}return-1}d.prototype.includes=function(I,P,U){return this.indexOf(I,P,U)!==-1},d.prototype.indexOf=function(I,P,U){return ie(this,I,P,U,!0)},d.prototype.lastIndexOf=function(I,P,U){return ie(this,I,P,U,!1)};function q(T,I,P,U){P=Number(P)||0;let Z=T.length-P;U?(U=Number(U),U>Z&&(U=Z)):U=Z;let W=I.length;U>W/2&&(U=W/2);let fe;for(fe=0;fe<U;++fe){let st=parseInt(I.substr(fe*2,2),16);if(Ze(st))return fe;T[P+fe]=st}return fe}function V(T,I,P,U){return Ee(oe(I,T.length-P),T,P,U)}function _(T,I,P,U){return Ee(le(I),T,P,U)}function n(T,I,P,U){return Ee(be(I),T,P,U)}function s(T,I,P,U){return Ee(ot(I,T.length-P),T,P,U)}d.prototype.write=function(I,P,U,Z){if(P===void 0)Z="utf8",U=this.length,P=0;else if(U===void 0&&typeof P=="string")Z=P,U=this.length,P=0;else if(isFinite(P))P=P>>>0,isFinite(U)?(U=U>>>0,Z===void 0&&(Z="utf8")):(Z=U,U=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let W=this.length-P;if((U===void 0||U>W)&&(U=W),I.length>0&&(U<0||P<0)||P>this.length)throw new RangeError("Attempt to write outside buffer bounds");Z||(Z="utf8");let fe=!1;for(;;)switch(Z){case"hex":return q(this,I,P,U);case"utf8":case"utf-8":return V(this,I,P,U);case"ascii":case"latin1":case"binary":return _(this,I,P,U);case"base64":return n(this,I,P,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s(this,I,P,U);default:if(fe)throw new TypeError("Unknown encoding: "+Z);Z=(""+Z).toLowerCase(),fe=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f(T,I,P){return I===0&&P===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(I,P))}function u(T,I,P){P=Math.min(T.length,P);let U=[],Z=I;for(;Z<P;){let W=T[Z],fe=null,st=W>239?4:W>223?3:W>191?2:1;if(Z+st<=P){let ue,me,pe,ye;switch(st){case 1:W<128&&(fe=W);break;case 2:ue=T[Z+1],(ue&192)===128&&(ye=(W&31)<<6|ue&63,ye>127&&(fe=ye));break;case 3:ue=T[Z+1],me=T[Z+2],(ue&192)===128&&(me&192)===128&&(ye=(W&15)<<12|(ue&63)<<6|me&63,ye>2047&&(ye<55296||ye>57343)&&(fe=ye));break;case 4:ue=T[Z+1],me=T[Z+2],pe=T[Z+3],(ue&192)===128&&(me&192)===128&&(pe&192)===128&&(ye=(W&15)<<18|(ue&63)<<12|(me&63)<<6|pe&63,ye>65535&&ye<1114112&&(fe=ye))}}fe===null?(fe=65533,st=1):fe>65535&&(fe-=65536,U.push(fe>>>10&1023|55296),fe=56320|fe&1023),U.push(fe),Z+=st}return m(U)}var l=4096;function m(T){let I=T.length;if(I<=l)return String.fromCharCode.apply(String,T);let P="",U=0;for(;U<I;)P+=String.fromCharCode.apply(String,T.slice(U,U+=l));return P}function w(T,I,P){let U="";P=Math.min(T.length,P);for(let Z=I;Z<P;++Z)U+=String.fromCharCode(T[Z]&127);return U}function p(T,I,P){let U="";P=Math.min(T.length,P);for(let Z=I;Z<P;++Z)U+=String.fromCharCode(T[Z]);return U}function o(T,I,P){let U=T.length;(!I||I<0)&&(I=0),(!P||P<0||P>U)&&(P=U);let Z="";for(let W=I;W<P;++W)Z+=Ye[T[W]];return Z}function v(T,I,P){let U=T.slice(I,P),Z="";for(let W=0;W<U.length-1;W+=2)Z+=String.fromCharCode(U[W]+U[W+1]*256);return Z}d.prototype.slice=function(I,P){let U=this.length;I=~~I,P=P===void 0?U:~~P,I<0?(I+=U,I<0&&(I=0)):I>U&&(I=U),P<0?(P+=U,P<0&&(P=0)):P>U&&(P=U),P<I&&(P=I);let Z=this.subarray(I,P);return Object.setPrototypeOf(Z,d.prototype),Z};function R(T,I,P){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+I>P)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(I,P,U){I=I>>>0,P=P>>>0,U||R(I,P,this.length);let Z=this[I],W=1,fe=0;for(;++fe<P&&(W*=256);)Z+=this[I+fe]*W;return Z},d.prototype.readUintBE=d.prototype.readUIntBE=function(I,P,U){I=I>>>0,P=P>>>0,U||R(I,P,this.length);let Z=this[I+--P],W=1;for(;P>0&&(W*=256);)Z+=this[I+--P]*W;return Z},d.prototype.readUint8=d.prototype.readUInt8=function(I,P){return I=I>>>0,P||R(I,1,this.length),this[I]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(I,P){return I=I>>>0,P||R(I,2,this.length),this[I]|this[I+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(I,P){return I=I>>>0,P||R(I,2,this.length),this[I]<<8|this[I+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(I,P){return I=I>>>0,P||R(I,4,this.length),(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(I,P){return I=I>>>0,P||R(I,4,this.length),this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},d.prototype.readBigUInt64LE=ct(function(I){I=I>>>0,J(I,"offset");let P=this[I],U=this[I+7];(P===void 0||U===void 0)&&te(I,this.length-8);let Z=P+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24,W=this[++I]+this[++I]*2**8+this[++I]*2**16+U*2**24;return BigInt(Z)+(BigInt(W)<<BigInt(32))}),d.prototype.readBigUInt64BE=ct(function(I){I=I>>>0,J(I,"offset");let P=this[I],U=this[I+7];(P===void 0||U===void 0)&&te(I,this.length-8);let Z=P*2**24+this[++I]*2**16+this[++I]*2**8+this[++I],W=this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+U;return(BigInt(Z)<<BigInt(32))+BigInt(W)}),d.prototype.readIntLE=function(I,P,U){I=I>>>0,P=P>>>0,U||R(I,P,this.length);let Z=this[I],W=1,fe=0;for(;++fe<P&&(W*=256);)Z+=this[I+fe]*W;return W*=128,Z>=W&&(Z-=Math.pow(2,8*P)),Z},d.prototype.readIntBE=function(I,P,U){I=I>>>0,P=P>>>0,U||R(I,P,this.length);let Z=P,W=1,fe=this[I+--Z];for(;Z>0&&(W*=256);)fe+=this[I+--Z]*W;return W*=128,fe>=W&&(fe-=Math.pow(2,8*P)),fe},d.prototype.readInt8=function(I,P){return I=I>>>0,P||R(I,1,this.length),this[I]&128?(255-this[I]+1)*-1:this[I]},d.prototype.readInt16LE=function(I,P){I=I>>>0,P||R(I,2,this.length);let U=this[I]|this[I+1]<<8;return U&32768?U|4294901760:U},d.prototype.readInt16BE=function(I,P){I=I>>>0,P||R(I,2,this.length);let U=this[I+1]|this[I]<<8;return U&32768?U|4294901760:U},d.prototype.readInt32LE=function(I,P){return I=I>>>0,P||R(I,4,this.length),this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},d.prototype.readInt32BE=function(I,P){return I=I>>>0,P||R(I,4,this.length),this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},d.prototype.readBigInt64LE=ct(function(I){I=I>>>0,J(I,"offset");let P=this[I],U=this[I+7];(P===void 0||U===void 0)&&te(I,this.length-8);let Z=this[I+4]+this[I+5]*2**8+this[I+6]*2**16+(U<<24);return(BigInt(Z)<<BigInt(32))+BigInt(P+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24)}),d.prototype.readBigInt64BE=ct(function(I){I=I>>>0,J(I,"offset");let P=this[I],U=this[I+7];(P===void 0||U===void 0)&&te(I,this.length-8);let Z=(P<<24)+this[++I]*2**16+this[++I]*2**8+this[++I];return(BigInt(Z)<<BigInt(32))+BigInt(this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+U)}),d.prototype.readFloatLE=function(I,P){return I=I>>>0,P||R(I,4,this.length),r.read(this,I,!0,23,4)},d.prototype.readFloatBE=function(I,P){return I=I>>>0,P||R(I,4,this.length),r.read(this,I,!1,23,4)},d.prototype.readDoubleLE=function(I,P){return I=I>>>0,P||R(I,8,this.length),r.read(this,I,!0,52,8)},d.prototype.readDoubleBE=function(I,P){return I=I>>>0,P||R(I,8,this.length),r.read(this,I,!1,52,8)};function S(T,I,P,U,Z,W){if(!d.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>Z||I<W)throw new RangeError('"value" argument is out of bounds');if(P+U>T.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(I,P,U,Z){if(I=+I,P=P>>>0,U=U>>>0,!Z){let st=Math.pow(2,8*U)-1;S(this,I,P,U,st,0)}let W=1,fe=0;for(this[P]=I&255;++fe<U&&(W*=256);)this[P+fe]=I/W&255;return P+U},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(I,P,U,Z){if(I=+I,P=P>>>0,U=U>>>0,!Z){let st=Math.pow(2,8*U)-1;S(this,I,P,U,st,0)}let W=U-1,fe=1;for(this[P+W]=I&255;--W>=0&&(fe*=256);)this[P+W]=I/fe&255;return P+U},d.prototype.writeUint8=d.prototype.writeUInt8=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,1,255,0),this[P]=I&255,P+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,2,65535,0),this[P]=I&255,this[P+1]=I>>>8,P+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,2,65535,0),this[P]=I>>>8,this[P+1]=I&255,P+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,4,4294967295,0),this[P+3]=I>>>24,this[P+2]=I>>>16,this[P+1]=I>>>8,this[P]=I&255,P+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,4,4294967295,0),this[P]=I>>>24,this[P+1]=I>>>16,this[P+2]=I>>>8,this[P+3]=I&255,P+4};function B(T,I,P,U,Z){j(I,U,Z,T,P,7);let W=Number(I&BigInt(4294967295));T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[P++]=fe,fe=fe>>8,T[P++]=fe,fe=fe>>8,T[P++]=fe,fe=fe>>8,T[P++]=fe,P}function F(T,I,P,U,Z){j(I,U,Z,T,P,7);let W=Number(I&BigInt(4294967295));T[P+7]=W,W=W>>8,T[P+6]=W,W=W>>8,T[P+5]=W,W=W>>8,T[P+4]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[P+3]=fe,fe=fe>>8,T[P+2]=fe,fe=fe>>8,T[P+1]=fe,fe=fe>>8,T[P]=fe,P+8}d.prototype.writeBigUInt64LE=ct(function(I,P=0){return B(this,I,P,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeBigUInt64BE=ct(function(I,P=0){return F(this,I,P,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeIntLE=function(I,P,U,Z){if(I=+I,P=P>>>0,!Z){let ue=Math.pow(2,8*U-1);S(this,I,P,U,ue-1,-ue)}let W=0,fe=1,st=0;for(this[P]=I&255;++W<U&&(fe*=256);)I<0&&st===0&&this[P+W-1]!==0&&(st=1),this[P+W]=(I/fe>>0)-st&255;return P+U},d.prototype.writeIntBE=function(I,P,U,Z){if(I=+I,P=P>>>0,!Z){let ue=Math.pow(2,8*U-1);S(this,I,P,U,ue-1,-ue)}let W=U-1,fe=1,st=0;for(this[P+W]=I&255;--W>=0&&(fe*=256);)I<0&&st===0&&this[P+W+1]!==0&&(st=1),this[P+W]=(I/fe>>0)-st&255;return P+U},d.prototype.writeInt8=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,1,127,-128),I<0&&(I=255+I+1),this[P]=I&255,P+1},d.prototype.writeInt16LE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,2,32767,-32768),this[P]=I&255,this[P+1]=I>>>8,P+2},d.prototype.writeInt16BE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,2,32767,-32768),this[P]=I>>>8,this[P+1]=I&255,P+2},d.prototype.writeInt32LE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,4,2147483647,-2147483648),this[P]=I&255,this[P+1]=I>>>8,this[P+2]=I>>>16,this[P+3]=I>>>24,P+4},d.prototype.writeInt32BE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,4,2147483647,-2147483648),I<0&&(I=4294967295+I+1),this[P]=I>>>24,this[P+1]=I>>>16,this[P+2]=I>>>8,this[P+3]=I&255,P+4},d.prototype.writeBigInt64LE=ct(function(I,P=0){return B(this,I,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),d.prototype.writeBigInt64BE=ct(function(I,P=0){return F(this,I,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $(T,I,P,U,Z,W){if(P+U>T.length)throw new RangeError("Index out of range");if(P<0)throw new RangeError("Index out of range")}function ae(T,I,P,U,Z){return I=+I,P=P>>>0,Z||$(T,I,P,4,34028234663852886e22,-34028234663852886e22),r.write(T,I,P,U,23,4),P+4}d.prototype.writeFloatLE=function(I,P,U){return ae(this,I,P,!0,U)},d.prototype.writeFloatBE=function(I,P,U){return ae(this,I,P,!1,U)};function re(T,I,P,U,Z){return I=+I,P=P>>>0,Z||$(T,I,P,8,17976931348623157e292,-17976931348623157e292),r.write(T,I,P,U,52,8),P+8}d.prototype.writeDoubleLE=function(I,P,U){return re(this,I,P,!0,U)},d.prototype.writeDoubleBE=function(I,P,U){return re(this,I,P,!1,U)},d.prototype.copy=function(I,P,U,Z){if(!d.isBuffer(I))throw new TypeError("argument should be a Buffer");if(U||(U=0),!Z&&Z!==0&&(Z=this.length),P>=I.length&&(P=I.length),P||(P=0),Z>0&&Z<U&&(Z=U),Z===U||I.length===0||this.length===0)return 0;if(P<0)throw new RangeError("targetStart out of bounds");if(U<0||U>=this.length)throw new RangeError("Index out of range");if(Z<0)throw new RangeError("sourceEnd out of bounds");Z>this.length&&(Z=this.length),I.length-P<Z-U&&(Z=I.length-P+U);let W=Z-U;return this===I&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(P,U,Z):Uint8Array.prototype.set.call(I,this.subarray(U,Z),P),W},d.prototype.fill=function(I,P,U,Z){if(typeof I=="string"){if(typeof P=="string"?(Z=P,P=0,U=this.length):typeof U=="string"&&(Z=U,U=this.length),Z!==void 0&&typeof Z!="string")throw new TypeError("encoding must be a string");if(typeof Z=="string"&&!d.isEncoding(Z))throw new TypeError("Unknown encoding: "+Z);if(I.length===1){let fe=I.charCodeAt(0);(Z==="utf8"&&fe<128||Z==="latin1")&&(I=fe)}}else typeof I=="number"?I=I&255:typeof I=="boolean"&&(I=Number(I));if(P<0||this.length<P||this.length<U)throw new RangeError("Out of range index");if(U<=P)return this;P=P>>>0,U=U===void 0?this.length:U>>>0,I||(I=0);let W;if(typeof I=="number")for(W=P;W<U;++W)this[W]=I;else{let fe=d.isBuffer(I)?I:d.from(I,Z),st=fe.length;if(st===0)throw new TypeError('The value "'+I+'" is invalid for argument "value"');for(W=0;W<U-P;++W)this[W+P]=fe[W%st]}return this};var H={};function K(T,I,P){H[T]=class extends P{constructor(){super(),Object.defineProperty(this,"message",{value:I.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(Z){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Z,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}K("ERR_BUFFER_OUT_OF_BOUNDS",function(T){return T?`${T} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),K("ERR_INVALID_ARG_TYPE",function(T,I){return`The "${T}" argument must be of type number. Received type ${typeof I}`},TypeError),K("ERR_OUT_OF_RANGE",function(T,I,P){let U=`The value of "${T}" is out of range.`,Z=P;return Number.isInteger(P)&&Math.abs(P)>2**32?Z=ce(String(P)):typeof P=="bigint"&&(Z=String(P),(P>BigInt(2)**BigInt(32)||P<-(BigInt(2)**BigInt(32)))&&(Z=ce(Z)),Z+="n"),U+=` It must be ${I}. Received ${Z}`,U},RangeError);function ce(T){let I="",P=T.length,U=T[0]==="-"?1:0;for(;P>=U+4;P-=3)I=`_${T.slice(P-3,P)}${I}`;return`${T.slice(0,P)}${I}`}function ne(T,I,P){J(I,"offset"),(T[I]===void 0||T[I+P]===void 0)&&te(I,T.length-(P+1))}function j(T,I,P,U,Z,W){if(T>P||T<I){let fe=typeof I=="bigint"?"n":"",st;throw W>3?I===0||I===BigInt(0)?st=`>= 0${fe} and < 2${fe} ** ${(W+1)*8}${fe}`:st=`>= -(2${fe} ** ${(W+1)*8-1}${fe}) and < 2 ** ${(W+1)*8-1}${fe}`:st=`>= ${I}${fe} and <= ${P}${fe}`,new H.ERR_OUT_OF_RANGE("value",st,T)}ne(U,Z,W)}function J(T,I){if(typeof T!="number")throw new H.ERR_INVALID_ARG_TYPE(I,"number",T)}function te(T,I,P){throw Math.floor(T)!==T?(J(T,P),new H.ERR_OUT_OF_RANGE(P||"offset","an integer",T)):I<0?new H.ERR_BUFFER_OUT_OF_BOUNDS:new H.ERR_OUT_OF_RANGE(P||"offset",`>= ${P?1:0} and <= ${I}`,T)}var he=/[^+/0-9A-Za-z-_]/g;function ke(T){if(T=T.split("=")[0],T=T.trim().replace(he,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function oe(T,I){I=I||1/0;let P,U=T.length,Z=null,W=[];for(let fe=0;fe<U;++fe){if(P=T.charCodeAt(fe),P>55295&&P<57344){if(!Z){if(P>56319){(I-=3)>-1&&W.push(239,191,189);continue}else if(fe+1===U){(I-=3)>-1&&W.push(239,191,189);continue}Z=P;continue}if(P<56320){(I-=3)>-1&&W.push(239,191,189),Z=P;continue}P=(Z-55296<<10|P-56320)+65536}else Z&&(I-=3)>-1&&W.push(239,191,189);if(Z=null,P<128){if((I-=1)<0)break;W.push(P)}else if(P<2048){if((I-=2)<0)break;W.push(P>>6|192,P&63|128)}else if(P<65536){if((I-=3)<0)break;W.push(P>>12|224,P>>6&63|128,P&63|128)}else if(P<1114112){if((I-=4)<0)break;W.push(P>>18|240,P>>12&63|128,P>>6&63|128,P&63|128)}else throw new Error("Invalid code point")}return W}function le(T){let I=[];for(let P=0;P<T.length;++P)I.push(T.charCodeAt(P)&255);return I}function ot(T,I){let P,U,Z,W=[];for(let fe=0;fe<T.length&&!((I-=2)<0);++fe)P=T.charCodeAt(fe),U=P>>8,Z=P%256,W.push(Z),W.push(U);return W}function be(T){return e.toByteArray(ke(T))}function Ee(T,I,P,U){let Z;for(Z=0;Z<U&&!(Z+P>=I.length||Z>=T.length);++Z)I[Z+P]=T[Z];return Z}function ut(T,I){return T instanceof I||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===I.name}function Ze(T){return T!==T}var Ye=function(){let T="0123456789abcdef",I=new Array(256);for(let P=0;P<16;++P){let U=P*16;for(let Z=0;Z<16;++Z)I[U+Z]=T[P]+T[Z]}return I}();function ct(T){return typeof BigInt>"u"?z:T}function z(){throw new Error("BigInt not supported")}}}),hOe={"@@functional/placeholder":!0};function Xi(t){return t===hOe}function Za(t){return function e(r){return arguments.length===0||Xi(r)?e:t.apply(this,arguments)}}function Hn(t){return function e(r,a){switch(arguments.length){case 0:return e;case 1:return Xi(r)?e:Za(function(i){return t(r,i)});default:return Xi(r)&&Xi(a)?e:Xi(r)?Za(function(i){return t(i,a)}):Xi(a)?Za(function(i){return t(r,i)}):t(r,a)}}}function jw(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(r){return e.apply(this,arguments)};case 2:return function(r,a){return e.apply(this,arguments)};case 3:return function(r,a,i){return e.apply(this,arguments)};case 4:return function(r,a,i,h){return e.apply(this,arguments)};case 5:return function(r,a,i,h,c){return e.apply(this,arguments)};case 6:return function(r,a,i,h,c,d){return e.apply(this,arguments)};case 7:return function(r,a,i,h,c,d,b){return e.apply(this,arguments)};case 8:return function(r,a,i,h,c,d,b,g){return e.apply(this,arguments)};case 9:return function(r,a,i,h,c,d,b,g,y){return e.apply(this,arguments)};case 10:return function(r,a,i,h,c,d,b,g,y,M){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function sse(t,e,r){return function(){for(var a=[],i=0,h=t,c=0,d=!1;c<e.length||i<arguments.length;){var b;c<e.length&&(!Xi(e[c])||i>=arguments.length)?b=e[c]:(b=arguments[i],i+=1),a[c]=b,Xi(b)?d=!0:h-=1,c+=1}return!d&&h<=0?r.apply(this,a):jw(Math.max(0,h),sse(t,a,r))}}var cOe=Hn(function(t,e){return t===1?Za(e):jw(t,sse(t,[],e))}),fse=cOe;function jB(t){return function e(r,a,i){switch(arguments.length){case 0:return e;case 1:return Xi(r)?e:Hn(function(h,c){return t(r,h,c)});case 2:return Xi(r)&&Xi(a)?e:Xi(r)?Hn(function(h,c){return t(h,a,c)}):Xi(a)?Hn(function(h,c){return t(r,h,c)}):Za(function(h){return t(r,a,h)});default:return Xi(r)&&Xi(a)&&Xi(i)?e:Xi(r)&&Xi(a)?Hn(function(h,c){return t(h,c,i)}):Xi(r)&&Xi(i)?Hn(function(h,c){return t(h,a,c)}):Xi(a)&&Xi(i)?Hn(function(h,c){return t(r,h,c)}):Xi(r)?Za(function(h){return t(h,a,i)}):Xi(a)?Za(function(h){return t(r,h,i)}):Xi(i)?Za(function(h){return t(r,a,h)}):t(r,a,i)}}}var zB=Array.isArray||function(t){return t!=null&&t.length>=0&&Object.prototype.toString.call(t)==="[object Array]"};function lOe(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function HB(t,e,r){return function(){if(arguments.length===0)return r();var a=arguments[arguments.length-1];if(!zB(a)){for(var i=0;i<t.length;){if(typeof a[t[i]]=="function")return a[t[i]].apply(a,Array.prototype.slice.call(arguments,0,-1));i+=1}if(lOe(a)){var h=e.apply(null,Array.prototype.slice.call(arguments,0,-1));return h(a)}}return r.apply(this,arguments)}}function dOe(t){return t&&t["@@transducer/reduced"]?t:{"@@transducer/value":t,"@@transducer/reduced":!0}}var F2={init:function(){return this.xf["@@transducer/init"]()},result:function(t){return this.xf["@@transducer/result"](t)}};function Poe(t){for(var e=[],r;!(r=t.next()).done;)e.push(r.value);return e}function Noe(t,e,r){for(var a=0,i=r.length;a<i;){if(t(e,r[a]))return!0;a+=1}return!1}function pOe(t){var e=String(t).match(/^function (\w*)/);return e==null?"":e[1]}function bw(t,e){return Object.prototype.hasOwnProperty.call(e,t)}function vOe(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var nB=typeof Object.is=="function"?Object.is:vOe,Coe=Object.prototype.toString,mOe=function(){return Coe.call(arguments)==="[object Arguments]"?function(t){return Coe.call(t)==="[object Arguments]"}:function(t){return bw("callee",t)}}(),gOe=mOe,bOe=!{toString:null}.propertyIsEnumerable("toString"),Loe=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Doe=function(){"use strict";return arguments.propertyIsEnumerable("length")}(),yOe=function(t,e){for(var r=0;r<t.length;){if(t[r]===e)return!0;r+=1}return!1},wOe=Za(typeof Object.keys=="function"&&!Doe?function(t){return Object(t)!==t?[]:Object.keys(t)}:function(t){if(Object(t)!==t)return[];var e,r,a=[],i=Doe&&gOe(t);for(e in t)bw(e,t)&&(!i||e!=="length")&&(a[a.length]=e);if(bOe)for(r=Loe.length-1;r>=0;)e=Loe[r],bw(e,t)&&!yOe(a,e)&&(a[a.length]=e),r-=1;return a}),rv=wOe,_Oe=Za(function(t){return t===null?"Null":t===void 0?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),$oe=_Oe;function Uoe(t,e,r,a){var i=Poe(t),h=Poe(e);function c(d,b){return ZB(d,b,r.slice(),a.slice())}return!Noe(function(d,b){return!Noe(c,b,d)},h,i)}function ZB(t,e,r,a){if(nB(t,e))return!0;var i=$oe(t);if(i!==$oe(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(i){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&pOe(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&nB(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!nB(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var h=r.length-1;h>=0;){if(r[h]===t)return a[h]===e;h-=1}switch(i){case"Map":return t.size!==e.size?!1:Uoe(t.entries(),e.entries(),r.concat([t]),a.concat([e]));case"Set":return t.size!==e.size?!1:Uoe(t.values(),e.values(),r.concat([t]),a.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=rv(t);if(c.length!==rv(e).length)return!1;var d=r.concat([t]),b=a.concat([e]);for(h=c.length-1;h>=0;){var g=c[h];if(!(bw(g,e)&&ZB(e[g],t[g],d,b)))return!1;h-=1}return!0}var MOe=Hn(function(t,e){return ZB(t,e,[],[])}),use=MOe;function xOe(t,e,r){var a,i;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(a=1/e;r<t.length;){if(i=t[r],i===0&&1/i===a)return r;r+=1}return-1}else if(e!==e){for(;r<t.length;){if(i=t[r],typeof i=="number"&&i!==i)return r;r+=1}return-1}return t.indexOf(e,r);case"string":case"boolean":case"function":case"undefined":return t.indexOf(e,r);case"object":if(e===null)return t.indexOf(e,r)}for(;r<t.length;){if(use(t[r],e))return r;r+=1}return-1}function SOe(t,e){return xOe(e,t,0)>=0}function U2(t,e){for(var r=0,a=e.length,i=Array(a);r<a;)i[r]=t(e[r]),r+=1;return i}function aB(t){var e=t.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return'"'+e.replace(/"/g,'\\"')+'"'}var T2=function(t){return(t<10?"0":"")+t},EOe=typeof Date.prototype.toISOString=="function"?function(t){return t.toISOString()}:function(t){return t.getUTCFullYear()+"-"+T2(t.getUTCMonth()+1)+"-"+T2(t.getUTCDate())+"T"+T2(t.getUTCHours())+":"+T2(t.getUTCMinutes())+":"+T2(t.getUTCSeconds())+"."+(t.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"},AOe=EOe;function ROe(t){return function(){return!t.apply(this,arguments)}}function hse(t,e,r){for(var a=0,i=r.length;a<i;)e=t(e,r[a]),a+=1;return e}function TOe(t,e){for(var r=0,a=e.length,i=[];r<a;)t(e[r])&&(i[i.length]=e[r]),r+=1;return i}function kOe(t){return Object.prototype.toString.call(t)==="[object Object]"}var IOe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=F2.init,t.prototype["@@transducer/result"]=F2.result,t.prototype["@@transducer/step"]=function(e,r){return this.f(r)?this.xf["@@transducer/step"](e,r):e},t}();function BOe(t){return function(e){return new IOe(t,e)}}var OOe=Hn(HB(["fantasy-land/filter","filter"],BOe,function(t,e){return kOe(e)?hse(function(r,a){return t(e[a])&&(r[a]=e[a]),r},{},rv(e)):TOe(t,e)})),POe=OOe,NOe=Hn(function(t,e){return POe(ROe(t),e)}),COe=NOe;function cse(t,e){var r=function(h){var c=e.concat([t]);return SOe(h,c)?"<Circular>":cse(h,c)},a=function(h,c){return U2(function(d){return aB(d)+": "+r(h[d])},c.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+U2(r,t).join(", ")+"))";case"[object Array]":return"["+U2(r,t).concat(a(t,COe(function(h){return/^\d+$/.test(h)},rv(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):aB(AOe(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":aB(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var i=t.toString();if(i!=="[object Object]")return i}return"{"+a(t,rv(t)).join(", ")+"}"}}var LOe=Za(function(t){return cse(t,[])}),qoe=LOe,DOe=Hn(function(t,e){if(t===e)return e;function r(d,b){if(d>b!=b>d)return b>d?b:d}var a=r(t,e);if(a!==void 0)return a;var i=r(typeof t,typeof e);if(i!==void 0)return i===typeof t?t:e;var h=qoe(t),c=r(h,qoe(e));return c!==void 0&&c===h?t:e}),$Oe=DOe,UOe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=F2.init,t.prototype["@@transducer/result"]=F2.result,t.prototype["@@transducer/step"]=function(e,r){return this.xf["@@transducer/step"](e,this.f(r))},t}(),qOe=function(t){return function(e){return new UOe(t,e)}},FOe=qOe,jOe=Hn(HB(["fantasy-land/map","map"],FOe,function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return fse(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return hse(function(r,a){return r[a]=t(e[a]),r},{},rv(e));default:return U2(t,e)}})),zOe=jOe,lse=Number.isInteger||function(t){return t<<0===t};function dse(t){return Object.prototype.toString.call(t)==="[object String]"}function pse(t,e){var r=t<0?e.length+t:t;return dse(e)?e.charAt(r):e[r]}var HOe=Hn(function(t,e){if(e!=null)return lse(t)?pse(t,e):e[t]}),zw=HOe,ZOe=Hn(function(t,e){return zOe(zw(t),e)}),KOe=ZOe,WOe=Za(function(t){return zB(t)?!0:!t||typeof t!="object"||dse(t)?!1:t.length===0?!0:t.length>0?t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1):!1}),VOe=WOe,Foe=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function GOe(t,e,r){return function(a,i,h){if(VOe(h))return t(a,i,h);if(h==null)return i;if(typeof h["fantasy-land/reduce"]=="function")return e(a,i,h,"fantasy-land/reduce");if(h[Foe]!=null)return r(a,i,h[Foe]());if(typeof h.next=="function")return r(a,i,h);if(typeof h.reduce=="function")return e(a,i,h,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function YOe(t,e,r){for(var a=0,i=r.length;a<i;){if(e=t["@@transducer/step"](e,r[a]),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}a+=1}return t["@@transducer/result"](e)}var JOe=Hn(function(t,e){return jw(t.length,function(){return t.apply(e,arguments)})}),XOe=JOe;function QOe(t,e,r){for(var a=r.next();!a.done;){if(e=t["@@transducer/step"](e,a.value),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}a=r.next()}return t["@@transducer/result"](e)}function ePe(t,e,r,a){return t["@@transducer/result"](r[a](XOe(t["@@transducer/step"],t),e))}var tPe=GOe(YOe,ePe,QOe),rPe=tPe,iPe=function(){function t(e){this.f=e}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(e){return e},t.prototype["@@transducer/step"]=function(e,r){return this.f(e,r)},t}();function nPe(t){return new iPe(t)}var aPe=jB(function(t,e,r){return rPe(typeof t=="function"?nPe(t):t,e,r)}),vse=aPe;function oPe(t,e){return function(){return e.call(this,t.apply(this,arguments))}}function mse(t,e){return function(){var r=arguments.length;if(r===0)return e();var a=arguments[r-1];return zB(a)||typeof a[t]!="function"?e.apply(this,arguments):a[t].apply(a,Array.prototype.slice.call(arguments,0,r-1))}}var sPe=jB(mse("slice",function(t,e,r){return Array.prototype.slice.call(r,t,e)})),fPe=sPe,uPe=Za(mse("tail",fPe(1,1/0))),hPe=uPe;function gse(){if(arguments.length===0)throw new Error("pipe requires at least one argument");return jw(arguments[0].length,vse(oPe,arguments[0],hPe(arguments)))}var cPe=Hn(function(t,e){return fse(vse($Oe,0,KOe("length",e)),function(){var r=arguments,a=this;return t.apply(a,U2(function(i){return i.apply(a,r)},e))})}),lPe=cPe,dPe=Hn(function(t,e){return e==null||e!==e?t:e}),dB=dPe,pPe=function(){function t(e,r){this.xf=r,this.f=e,this.found=!1}return t.prototype["@@transducer/init"]=F2.init,t.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,void 0)),this.xf["@@transducer/result"](e)},t.prototype["@@transducer/step"]=function(e,r){return this.f(r)&&(this.found=!0,e=dOe(this.xf["@@transducer/step"](e,r))),e},t}();function vPe(t){return function(e){return new pPe(t,e)}}var mPe=Hn(HB(["find"],vPe,function(t,e){for(var r=0,a=e.length;r<a;){if(t(e[r]))return e[r];r+=1}})),gPe=mPe,bPe=Za(function(t){return lPe(function(){return Array.prototype.slice.call(arguments,0)},t)}),yPe=bPe;function wPe(t,e){for(var r=e,a=0;a<t.length;a+=1){if(r==null)return;var i=t[a];lse(i)?r=pse(i,r):r=r[i]}return r}var _Pe=Hn(wPe),bse=_Pe,MPe=jB(function(t,e,r){return use(t,zw(e,r))}),xPe=MPe,yw=class extends Error{name="InvalidSchedulerLocation"},SPe=class extends Error{name="SchedulerTagNotFound"},EPe=class extends Error{name="TransactionNotFound"},APe="Url",RPe="Time-To-Live",TPe="Scheduler",pB=t=>gse(dB([]),gPe(xPe(t,"name")),dB({}),zw("value")),yse=t=>gse(e=>{if(!e)throw new EPe(t);return e},zw("tags"),dB([]));function wse({fetch:t,GRAPHQL_URL:e}){return async({query:r,variables:a})=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:r,variables:a})}).then(i=>i.json())}function kPe({fetch:t,GRAPHQL_URL:e}){let r=wse({fetch:t,GRAPHQL_URL:e}),a=_se({fetch:t,GRAPHQL_URL:e}),i=`
132
+ nonce: bundlr`),ge.from(i))}};X();ee();Q();var sd=class{_publicKey;ownerLength=Vr[_r.MULTIAPTOS].pubLength;signatureLength=Vr[_r.MULTIAPTOS].sigLength;signatureType=_r.MULTIAPTOS;collectSignatures;provider;constructor(e,r){this._publicKey=e,this.collectSignatures=r}get publicKey(){return this._publicKey}async sign(e){let{signatures:r,bitmap:a}=await this.collectSignatures(e),i=128,h=new Uint8Array([0,0,0,0]),c=new Set;a.forEach(g=>{if(g>=32)throw new Error(`Invalid bit value ${g}.`);if(c.has(g))throw new Error("Duplicated bits detected.");c.add(g);let y=Math.floor(g/8),M=h[y];M|=i>>g%8,h[y]=M});let d=ge.alloc(this.signatureLength),b=0;for(let g=0;g<32;g++)a.includes(g)&&d.set(r[b++],g*64);return d.set(h,this.signatureLength-4),d}static async verify(e,r,a){let h=Vr[_r.MULTIAPTOS].sigLength-4,c=a.slice(0,h),d=a.slice(h),b=!1;for(let g=0;g<32;g++){let y=Math.floor(g/8),M=g-y*8;if((d[y]&128>>M)!==0){let E=c.slice(g*64,(g+1)*64),A=e.slice(g*32,(g+1)*32);await Kc(ge.from(E),ge.from(r),ge.from(A))||(b=!0)}}return!b}};X();ee();Q();var fd=class extends No{ownerLength=Vr[_r.TYPEDETHEREUM].pubLength;signatureLength=Vr[_r.TYPEDETHEREUM].sigLength;signatureType=_r.TYPEDETHEREUM;address;signer;constructor(e){super(e),this.address="0x"+Tg(super.publicKey.slice(1)).slice(-20).toString("hex"),this.signer=new c1(e)}get publicKey(){return ge.from(this.address)}async sign(e){let r=await this.signer._signTypedData(Ng,Cg,{address:this.address,"Transaction hash":e});return ge.from(r.slice(2),"hex")}static async verify(e,r,a){let i=e.toString(),h=g8(Ng,Cg,{address:i,"Transaction hash":r},a);return i.toLowerCase()===h.toLowerCase()}},Ng={name:"Bundlr",version:"1"},Cg={Bundlr:[{name:"Transaction hash",type:"bytes"},{name:"address",type:"address"}]};X();ee();Q();var zT=class{ownerLength=Vr[_r.TYPEDETHEREUM].pubLength;signatureLength=Vr[_r.TYPEDETHEREUM].sigLength;signatureType=_r.TYPEDETHEREUM;address;signer;publicKey;constructor(e){this.signer=e.getSigner()}async ready(){this.address=(await this.signer.getAddress()).toString().toLowerCase(),this.publicKey=ge.from(this.address)}async sign(e){let r=await this.signer._signTypedData(Ng,Cg,{address:this.address,"Transaction hash":e});return ge.from(r.slice(2),"hex")}static verify(e,r,a){let i=e.toString(),h=g8(Ng,Cg,{address:i,"Transaction hash":r},a);return i.toLowerCase()===h.toLowerCase()}};X();ee();Q();var WQ=vi(zo(),1);var S1=class{signer;publicKey;ownerLength=Vr[_r.ARWEAVE].pubLength;signatureLength=Vr[_r.ARWEAVE].sigLength;signatureType=_r.ARWEAVE;constructor(e){this.signer=e}async setPublicKey(){let e=await this.signer.getActivePublicKey();this.publicKey=WQ.default.toBuffer(e)}async sign(e){this.publicKey||await this.setPublicKey();let r={name:"RSA-PSS",saltLength:32},a=await this.signer.signature(e,r);return new Uint8Array(Object.values(a).map(h=>+h))}static async verify(e,r,a){return await En().verify(e,r,a)}};X();ee();Q();var Lg=class extends No{signatureType=_r.KYVE};var Dg={1:Xc,2:Ro,3:No,4:ad,5:od,6:sd,7:fd};X();ee();Q();X();ee();Q();async function q5e(t){return Wc([(0,Ni.stringToBuffer)("dataitem"),(0,Ni.stringToBuffer)("1"),(0,Ni.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}var $g=q5e;X();ee();Q();X();ee();Q();function Ug(t,e){let r=new Uint8Array(t);if(e<0)throw new Error("Array is unsigned, cannot represent -ve numbers");if(e>2**(t*8)-1)throw new Error(`Number ${e} is too large for an array of ${t} bytes`);for(let a=0;a<r.length;a++){let i=e&255;r[a]=i,e=(e-i)/256}return r}function Y8(t){return Ug(8,t)}function HT(t){return Ug(2,t)}function F5e(t){return Ug(16,t)}function J8(t){return Ug(32,t)}function _n(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}X();ee();Q();var Fg=vi(zo(),1);X();ee();Q();var Ns=vi(zo(),1);mo();X();ee();Q();var qg=class{buf;pos;constructor(e=ge.alloc(X8),r=0){this.buf=e,this.pos=r}writeTags(e){if(!Array.isArray(e))throw new Error("input must be array");let r=e.length,a;if(r)for(this.writeLong(r),a=0;a<r;a++){let i=e[a];if(typeof i?.name!="string"||typeof i?.value!="string")throw new Error(`Invalid tag format for ${i}, expected {name:string, value: string}`);this.writeString(i.name),this.writeString(i.value)}this.writeLong(0)}toBuffer(){let e=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(e,0,0,this.pos),e}writeLong(e){let r=this.buf,a,i;if(e>=-1073741824&&e<1073741824){i=e>=0?e<<1:~e<<1|1;do r[this.pos]=i&127,i>>=7;while(i&&(r[this.pos++]|=128))}else{a=e>=0?e*2:-e*2-1;do r[this.pos]=a&127,a/=128;while(a>=1&&(r[this.pos++]|=128))}this.pos++,this.buf=r}writeString(e){let r=ge.byteLength(e),a=this.buf;this.writeLong(r);let i=this.pos;if(this.pos+=r,!(this.pos>a.length)){if(r>64)this.buf.write(e,this.pos-r,r,"utf8");else{let h,c,d,b;for(h=0,c=r;h<c;h++)d=e.charCodeAt(h),d<128?a[i++]=d:d<2048?(a[i++]=d>>6|192,a[i++]=d&63|128):(d&64512)===55296&&((b=e.charCodeAt(h+1))&64512)===56320?(d=65536+((d&1023)<<10)+(b&1023),h++,a[i++]=d>>18|240,a[i++]=d>>12&63|128,a[i++]=d>>6&63|128,a[i++]=d&63|128):(a[i++]=d>>12|224,a[i++]=d>>6&63|128,a[i++]=d&63|128)}this.buf=a}}readLong(){let e=0,r=0,a=this.buf,i,h,c,d;do i=a[this.pos++],h=i&128,e|=(i&127)<<r,r+=7;while(h&&r<28);if(h){c=e,d=268435456;do i=a[this.pos++],c+=(i&127)*d,d*=128;while(i&128);return(c%2?-(c+1):c)/2}return e>>1^-(e&1)}skipLong(){let e=this.buf;for(;e[this.pos++]&128;);}readTags(){let e=[],r;for(;r=this.readLong();)for(r<0&&(r=-r,this.skipLong());r--;){let a=this.readString(),i=this.readString();e.push({name:a,value:i})}return e}readString(){let e=this.readLong(),r=this.pos,a=this.buf;if(this.pos+=e,this.pos>a.length)throw new Error("TAP Position out of range");return this.buf.slice(r,r+e).toString()}};function ZT(t){if(t?.length===0)return ge.allocUnsafe(0);let e=new qg;return e.writeTags(t),e.toBuffer()}function E1(t){return new qg(t).readTags()}Sh();var e4=80,X8=4096,Q8=class t{binary;_id;constructor(e){this.binary=e}static isDataItem(e){return e.binary!==void 0}get signatureType(){let e=_n(this.binary.subarray(0,2));if(_r?.[e]!==void 0)return e;throw new Error("Unknown signature type: "+e)}async isValid(){return t.verify(this.binary)}get id(){return Ns.default.encode(this.rawId)}set id(e){this._id=Ns.default.toBuffer(e)}get rawId(){return xh("sha256").update(this.rawSignature).digest()}set rawId(e){this._id=e}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Ns.default.encode(this.rawSignature)}set rawOwner(e){if(e.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${e.byteLength} bytes.`);this.binary.set(e,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return Vr[this.signatureType].sigLength}get owner(){return Ns.default.encode(this.rawOwner)}get ownerLength(){return Vr[this.signatureType].pubLength}get rawTarget(){let e=this.getTargetStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):ge.alloc(0)}get target(){return Ns.default.encode(this.rawTarget)}get rawAnchor(){let e=this.getAnchorStart();return this.binary[e]==1?this.binary.subarray(e+1,e+33):ge.alloc(0)}get anchor(){return Ns.default.encode(this.rawAnchor)}get rawTags(){let e=this.getTagsStart(),r=_n(this.binary.subarray(e+8,e+16));return this.binary.subarray(e+16,e+16+r)}get tags(){let e=this.getTagsStart();if(_n(this.binary.subarray(e,e+8))==0)return[];let a=_n(this.binary.subarray(e+8,e+16));return E1(ge.from(this.binary.subarray(e+16,e+16+a)))}get tagsB64Url(){return this.tags.map(r=>({name:Ns.default.encode(r.name),value:Ns.default.encode(r.value)}))}getStartOfData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),a=_n(r);return e+16+a}get rawData(){let e=this.getTagsStart(),r=this.binary.subarray(e+8,e+16),a=_n(r),i=e+16+a;return this.binary.subarray(i,this.binary.length)}get data(){return Ns.default.encode(this.rawData)}getRaw(){return this.binary}async sign(e){return this._id=await t4(this,e),this.rawId}async setSignature(e){this.binary.set(e,2),this._id=ge.from(await En().hash(e))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(e=>({name:Ns.default.encode(e.name),value:Ns.default.encode(e.value)})),data:this.data}}static async verify(e){if(e.byteLength<e4)return!1;let r=new t(e),a=r.signatureType,i=r.getTagsStart(),h=_n(e.subarray(i,i+8)),c=e.subarray(i+8,i+16),d=_n(c);if(d>X8)return!1;if(h>0)try{if(E1(ge.from(e.subarray(i+16,i+16+d))).length!==h)return!1}catch{return!1}let b=Dg[a],g=await $g(r);return await b.verify(r.rawOwner,g,r.rawSignature)}async getSignatureData(){return $g(this)}getTagsStart(){let e=this.getTargetStart(),r=this.binary[e]==1,a=e+(r?33:1),i=this.binary[a]==1;return a+=i?33:1,a}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let e=this.getTargetStart()+1,r=this.binary[this.getTargetStart()]==1;return e+=r?32:0,e}},A1=Q8;Sh();var Lu=32,r4=class{length;items;binary;constructor(e){this.binary=e,this.length=this.getDataItemCount(),this.items=this.getItems()}getRaw(){return this.binary}get(e){if(typeof e=="number"){if(e>=this.length)throw new RangeError("Index out of range");return this.getByIndex(e)}else return this.getById(e)}getSizes(){let e=[];for(let r=Lu;r<Lu+64*this.length;r+=64)e.push(_n(this.binary.subarray(r,r+32)));return e}getIds(){let e=[];for(let r=Lu;r<Lu+64*this.length;r+=64){let a=this.binary.subarray(r+32,r+64);if(a.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");e.push(Fg.default.encode(a))}return e}getIdBy(e){if(e>this.length-1)throw new RangeError("Index of bundle out of range");let r=64+64*e;return Fg.default.encode(this.binary.subarray(r,r+32))}async toTransaction(e,r,a){let i=await r.createTransaction({data:this.binary,...e},a);return i.addTag("Bundle-Format","binary"),i.addTag("Bundle-Version","2.0.0"),i}async verify(){for(let e of this.items){let r=await e.isValid(),a=(0,Fg.default)(xh("sha256").update(e.rawSignature).digest());if(!(r&&e.id===a))return!1}return!0}getOffset(e){let r=0;for(let a=Lu;a<Lu+64*this.length;a+=64){let i=_n(this.binary.subarray(a,a+32));r+=i;let h=this.binary.subarray(a+32,a+64);if(ge.compare(h,e)===0)return{startOffset:r,size:i}}return{startOffset:-1,size:-1}}getByIndex(e){let r=0,a=this.getBundleStart(),i=0,h,c;for(let y=Lu;y<Lu+64*this.length;y+=64){if(h=_n(this.binary.subarray(y,y+32)),i++===e){c=this.binary.subarray(y+32,y+64);break}r+=h}let d=a+r,b=this.binary.subarray(d,d+h),g=new A1(b);return g.rawId=c,g}getById(e){let r=Fg.default.toBuffer(e),a=this.getOffset(r);if(a.startOffset===-1)throw new Error("Transaction not found");let h=this.getBundleStart()+a.startOffset;return new A1(this.binary.subarray(h,h+a.size))}getDataItemCount(){return _n(this.binary.subarray(0,32))}getBundleStart(){return 32+64*this.length}getItems(){let e=new Array(this.length),r=0,a=this.getBundleStart(),i=0;for(let h=Lu;h<Lu+64*this.length;h+=64){let c=_n(this.binary.subarray(h,h+32)),d=this.binary.subarray(h+32,h+64);if(d.length===0)throw new Error("Invalid bundle, id specified in headers doesn't exist");let b=a+r,g=this.binary.subarray(b,b+c);r+=c;let y=new A1(g);y.rawId=d,e[i]=y,i++}return e}},KT=r4;function j5e(t){return new KT(t)}async function z5e(t,e){let r=new Uint8Array(64*t.length),a=await Promise.all(t.map(async(h,c)=>{let d=h.isSigned()?h.rawId:await t4(h,e),b=new Uint8Array(64);return b.set(J8(h.getRaw().byteLength),0),b.set(d,32),r.set(b,64*c),h.getRaw()})).then(h=>ge.concat(h)),i=ge.concat([ge.from(J8(t.length)),ge.from(r),a]);return new KT(i)}async function VQ(t,e){let r=await $g(t),a=await e.sign(r),i=await En().hash(a);return{signature:ge.from(a),id:ge.from(i)}}async function t4(t,e){let{signature:r,id:a}=await VQ(t,e);return t.getRaw().set(r,2),a}X();ee();Q();var GQ=vi(zo(),1);function jg(t,e,r){let a=e.publicKey,i=r?.target?GQ.default.toBuffer(r.target):null,h=1+(i?.byteLength??0),c=r?.anchor?ge.from(r.anchor):null,d=1+(c?.byteLength??0),b=(r?.tags?.length??0)>0?ZT(r?.tags):null,g=16+(b?b.byteLength:0),y=typeof t=="string"?ge.from(t):ge.from(t),M=y.byteLength,x=2+e.signatureLength+e.ownerLength+h+d+g+M,E=ge.alloc(x);if(E.set(HT(e.signatureType),0),E.set(new Uint8Array(e.signatureLength).fill(0),2),a.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${a.byteLength}`);E.set(a,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(E[A]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);E.set(i,A+1)}let k=A+h,O=k+1;if(E[k]=c?1:0,c){if(O+=c.byteLength,c.byteLength!==32)throw new Error("Anchor must be 32 bytes");E.set(c,k+1)}E.set(Y8(r?.tags?.length??0),O);let N=Y8(b?.byteLength??0);E.set(N,O+8),b&&E.set(b,O+16);let L=O+g;return E.set(y,L),new A1(E)}X();ee();Q();X();ee();Q();var WT=class{signatureType;rawSignature;signature;signatureLength;rawOwner;owner;ownerLength;rawTarget;target;rawAnchor;anchor;rawTags;tags;rawData;data;static async verify(...e){throw new Error("You must implement `verify`")}};X();ee();Q();X();ee();Q();var JT={};$a(JT,{default:()=>K5e,processStream:()=>eee,streamExportForTesting:()=>W5e,streamSigner:()=>Z5e});X();ee();Q();i4();var ud=vi(zo(),1);Sh();async function eee(t){let e=tee(t),r=(await e.next()).value;r=await Fa(e,r,32);let a=_n(r.subarray(0,32));r=r.subarray(32);let i=64*a;r=await Fa(e,r,i);let h=new Array(a);for(let b=0;b<i;b+=64)h[b/64]=[_n(r.subarray(b,b+32)),(0,ud.default)(ge.from(r.subarray(b+32,b+64)))];r=r.subarray(i);let c=32+i,d=[];for(let[b,g]of h){r=await Fa(e,r,e4),r=await Fa(e,r,2);let y=_n(r.subarray(0,2));r=r.subarray(2);let{sigLength:M,pubLength:x,sigName:E}=Vr[y];r=await Fa(e,r,M);let A=r.subarray(0,M);r=r.subarray(M),r=await Fa(e,r,x);let k=r.subarray(0,x);r=r.subarray(x),r=await Fa(e,r,1);let O=r[0]===1;O&&(r=await Fa(e,r,33));let N=O?r.subarray(1,33):ge.allocUnsafe(0);r=r.subarray(O?33:1),r=await Fa(e,r,1);let L=r[0]===1;L&&(r=await Fa(e,r,33));let C=L?r.subarray(1,33):ge.allocUnsafe(0);r=r.subarray(L?33:1),r=await Fa(e,r,8);let Y=_n(r.subarray(0,8));r=r.subarray(8),r=await Fa(e,r,8);let G=_n(r.subarray(0,8));r=r.subarray(8),r=await Fa(e,r,G);let ie=r.subarray(0,G),D=Y!==0&&G!==0?E1(ge.from(ie)):[];if(D.length!==Y)throw new Error("Tags lengths don't match");r=r.subarray(G);let q=new XQ;q._transform=function(f,u,l){this.push(f),l()};let V=Wc([(0,Ni.stringToBuffer)("dataitem"),(0,Ni.stringToBuffer)("1"),(0,Ni.stringToBuffer)(y.toString()),k,N,C,ie,q]),_=2+M+x+(O?33:1)+(L?33:1)+16+G,n=b-_;if(r.byteLength>n)q.write(r.subarray(0,n)),r=r.subarray(n);else{let f=r.byteLength;for(q.write(r);n>f;){if(r=(await e.next()).value,!r)throw new Error(`Not enough data bytes expected: ${n} received: ${f}`);f+=r.byteLength,f>n?q.write(r.subarray(0,r.byteLength-(f-n))):q.write(r)}r=r.subarray(r.byteLength-(f-n))}if(q.end(),g!==(0,ud.default)(xh("sha256").update(A).digest()))throw new Error("ID doesn't match signature");if(!await Dg[y].verify(k,await V,A))throw new Error("Invalid signature");d.push({id:g,sigName:E,signature:(0,ud.default)(ge.from(A)),target:(0,ud.default)(ge.from(N)),anchor:(0,ud.default)(ge.from(C)),owner:(0,ud.default)(ge.from(k)),tags:D,dataOffset:c+_,dataSize:n}),c+=_+n}return d}async function Z5e(t,e,r,a){let i=jg("",r,a),h=new QQ,c=[(0,Ni.stringToBuffer)("dataitem"),(0,Ni.stringToBuffer)("1"),(0,Ni.stringToBuffer)(i.signatureType.toString()),i.rawOwner,i.rawTarget,i.rawAnchor,i.rawTags,t],d=await Wc(c),b=ge.from(await r.sign(d));return i.setSignature(b),h.write(i.getRaw()),e.pipe(h)}async function Fa(t,e,r){if(e.byteLength>=r)return e;let{done:a,value:i}=await t.next();if(a&&!i)throw new Error("Invalid buffer");return Fa(t,ge.concat([ge.from(e),ge.from(i)]),r)}async function*tee(t){for await(let e of t)yield e}var K5e=eee,W5e={readBytes:Fa,getReader:tee};var V5e={...VT,stream:JT};globalThis.arbundles??=V5e;X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var ree=new RegExp("^[a-zA-Z0-9_-]{43}$"),zct=new RegExp("^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$"),Hct=new RegExp("^[0-9]{12},[0-9]{13},[a-fA-F0-9]{64}$"),Zct=xe.env.ARNS_REGISTRY_TX??"bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U",Kct="_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8",G5e="GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",Wct=G5e,R1="agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA",n4="i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc",XT=1e6,iee="cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk",QT="zeglqubvIKvBEZaxAUuenLGGtQ1pJp9LZjd5hDe0-J0",nee="_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";var ek=class t{constructor(e){this.positiveFiniteInteger=e;if(!Number.isFinite(this.positiveFiniteInteger)||!Number.isInteger(this.positiveFiniteInteger)||this.positiveFiniteInteger<0)throw new Error(`Number must be a non-negative integer value! ${e}`)}[Symbol.toPrimitive](e){return e==="string"&&this.toString(),this.positiveFiniteInteger}plus(e){return new t(this.positiveFiniteInteger+e.positiveFiniteInteger)}minus(e){return new t(this.positiveFiniteInteger-e.positiveFiniteInteger)}isGreaterThan(e){return this.positiveFiniteInteger>e.positiveFiniteInteger}isGreaterThanOrEqualTo(e){return this.positiveFiniteInteger>=e.positiveFiniteInteger}isLessThan(e){return this.positiveFiniteInteger<e.positiveFiniteInteger}isLessThanOrEqualTo(e){return this.positiveFiniteInteger<=e.positiveFiniteInteger}toString(){return`${this.positiveFiniteInteger}`}valueOf(){return this.positiveFiniteInteger}toJSON(){return this.positiveFiniteInteger}equals(e){return this.positiveFiniteInteger===e.positiveFiniteInteger}},tk=class{value;constructor(e){if(!Number.isFinite(e)||e<0)throw new Error("IOToken must be a non-negative finite number");this.value=+e.toFixed(6)}valueOf(){return this.value}toMIO(){return new rk(Math.floor(this.value*XT))}toString(){return`${this.value}`}},rk=class t extends ek{constructor(e){super(e)}multiply(e){let r=Math.floor(this.valueOf()*e.valueOf());return new t(r)}divide(e){if(e.valueOf()===0)throw new Error("Cannot divide by zero");let r=Math.floor(this.valueOf()/e.valueOf());return new t(r)}plus(e){let r=super.plus(e);return new t(r.valueOf())}minus(e){let r=super.minus(e);return new t(r.valueOf())}toIO(){return new tk(this.valueOf()/XT)}};X();ee();Q();X();ee();Q();var aee=t=>ree.test(t);function nlt(t){return t!==void 0&&!isNaN(parseInt(t.toString()))}function Fh(t){return"process"in t}function jh(t){return"processId"in t&&typeof t.processId=="string"&&aee(t.processId)===!0}function hlt(t){return t.type==="lease"}X();ee();Q();X();ee();Q();var Bf=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},oee=class extends Bf{},see=class extends Bf{},fee=class extends Bf{constructor(e,r){super(`Failed request: ${e}: ${r}`)}},uee=class extends Bf{},a4=class extends Bf{},hee=class extends Bf{constructor(){super("Invalid signer. Please provide a valid signer to interact with the contract.")}},Du=class extends Bf{constructor(){super("Invalid contract configuration")}},cee=class extends Bf{constructor(){super("Invalid process configuration")}},lee=class extends Bf{};X();ee();Q();var qf=vi(Ooe(),1);X();ee();Q();var V1="2.2.3";var Ff=class t{logger;silent=!1;static default=new t;constructor({level:e="info"}={}){e==="none"&&(this.silent=!0),typeof window<"u"?this.logger=console:this.logger=(0,qf.createLogger)({level:e,silent:this.silent,defaultMeta:{name:"ar-io-sdk",version:V1},format:qf.format.combine(qf.format.timestamp(),qf.format.json()),transports:[new qf.transports.Console({format:qf.format.combine(qf.format.timestamp(),qf.format.json())})]})}info(e,...r){this.silent||this.logger.info(e,...r)}warn(e,...r){this.silent||this.logger.warn(e,...r)}error(e,...r){this.silent||this.logger.error(e,...r)}debug(e,...r){this.silent||this.logger.debug(e,...r)}setLogLevel(e){this.silent=e==="none","silent"in this.logger&&(this.logger.silent=e==="none"),"level"in this.logger&&(this.logger.level=e)}};X();ee();Q();X();ee();Q();X();ee();Q();var GBe=Object.create,$B=Object.defineProperty,YBe=Object.getOwnPropertyDescriptor,nse=Object.getOwnPropertyNames,JBe=Object.getPrototypeOf,XBe=Object.prototype.hasOwnProperty,Do=(t,e)=>function(){return e||(0,t[nse(t)[0]])((e={exports:{}}).exports,e),e.exports},ase=(t,e)=>{for(var r in e)$B(t,r,{get:e[r],enumerable:!0})},QBe=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of nse(e))!XBe.call(t,i)&&i!==r&&$B(t,i,{get:()=>e[i],enumerable:!(a=YBe(e,i))||a.enumerable});return t},UB=(t,e,r)=>(r=t!=null?GBe(JBe(t)):{},QBe(e||!t||!t.__esModule?$B(r,"default",{value:t,enumerable:!0}):r,t)),eOe=Do({"node_modules/obliterator/iterator.js"(t,e){function r(a){if(typeof a!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=a}typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var a=arguments,i=a.length,h=0;return new r(function(){return h>=i?{done:!0}:{done:!1,value:a[h++]}})},r.empty=function(){var a=new r(function(){return{done:!0}});return a},r.fromSequence=function(a){var i=0,h=a.length;return new r(function(){return i>=h?{done:!0}:{done:!1,value:a[i++]}})},r.is=function(a){return a instanceof r?!0:typeof a=="object"&&a!==null&&typeof a.next=="function"},e.exports=r}}),tOe=Do({"node_modules/obliterator/support.js"(t){t.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",t.SYMBOL_SUPPORT=typeof Symbol<"u"}}),qB=Do({"node_modules/obliterator/foreach.js"(t,e){var r=tOe(),a=r.ARRAY_BUFFER_SUPPORT,i=r.SYMBOL_SUPPORT;e.exports=function(c,d){var b,g,y,M,x;if(!c)throw new Error("obliterator/forEach: invalid iterable.");if(typeof d!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(c)||a&&ArrayBuffer.isView(c)||typeof c=="string"||c.toString()==="[object Arguments]"){for(y=0,M=c.length;y<M;y++)d(c[y],y);return}if(typeof c.forEach=="function"){c.forEach(d);return}if(i&&Symbol.iterator in c&&typeof c.next!="function"&&(c=c[Symbol.iterator]()),typeof c.next=="function"){for(b=c,y=0;x=b.next(),x.done!==!0;)d(x.value,y),y++;return}for(g in c)c.hasOwnProperty(g)&&d(c[g],g)}}}),FB=Do({"node_modules/mnemonist/utils/typed-arrays.js"(t){var e=Math.pow(2,8)-1,r=Math.pow(2,16)-1,a=Math.pow(2,32)-1,i=Math.pow(2,7)-1,h=Math.pow(2,15)-1,c=Math.pow(2,31)-1;t.getPointerArray=function(b){var g=b-1;if(g<=e)return Uint8Array;if(g<=r)return Uint16Array;if(g<=a)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},t.getSignedPointerArray=function(b){var g=b-1;return g<=i?Int8Array:g<=h?Int16Array:g<=c?Int32Array:Float64Array},t.getNumberType=function(b){return b===(b|0)?Math.sign(b)===-1?b<=127&&b>=-128?Int8Array:b<=32767&&b>=-32768?Int16Array:Int32Array:b<=255?Uint8Array:b<=65535?Uint16Array:Uint32Array:Float64Array};var d={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};t.getMinimalRepresentation=function(b,g){var y=null,M=0,x,E,A,k,O;for(k=0,O=b.length;k<O;k++)A=g?g(b[k]):b[k],E=t.getNumberType(A),x=d[E.name],x>M&&(M=x,y=E);return y},t.isTypedArray=function(b){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(b)},t.concat=function(){var b=0,g,y,M;for(g=0,M=arguments.length;g<M;g++)b+=arguments[g].length;var x=new arguments[0].constructor(b);for(g=0,y=0;g<M;g++)x.set(arguments[g],y),y+=arguments[g].length;return x},t.indices=function(b){for(var g=t.getPointerArray(b),y=new g(b),M=0;M<b;M++)y[M]=M;return y}}}),ose=Do({"node_modules/mnemonist/utils/iterables.js"(t){var e=qB(),r=FB();function a(d){return Array.isArray(d)||r.isTypedArray(d)}function i(d){if(typeof d.length=="number")return d.length;if(typeof d.size=="number")return d.size}function h(d){var b=i(d),g=typeof b=="number"?new Array(b):[],y=0;return e(d,function(M){g[y++]=M}),g}function c(d){var b=i(d),g=typeof b=="number"?r.getPointerArray(b):Array,y=typeof b=="number"?new Array(b):[],M=typeof b=="number"?new g(b):[],x=0;return e(d,function(E){y[x]=E,M[x]=x++}),[y,M]}t.isArrayLike=a,t.guessLength=i,t.toArray=h,t.toArrayWithIndices=c}}),rOe=Do({"node_modules/mnemonist/lru-cache.js"(t,e){var r=eOe(),a=qB(),i=FB(),h=ose();function c(d,b,g){if(arguments.length<2&&(g=d,d=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var y=i.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof d=="function"?new d(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items={}}c.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},c.prototype.splayOnTop=function(d){var b=this.head;if(this.head===d)return this;var g=this.backward[d],y=this.forward[d];return this.tail===d?this.tail=g:this.backward[y]=g,this.forward[g]=y,this.backward[b]=d,this.head=d,this.forward[d]=b,this},c.prototype.set=function(d,b){var g=this.items[d];if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],delete this.items[this.K[g]]),this.items[d]=g,this.K[g]=d,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},c.prototype.setpop=function(d,b){var g=null,y=null,M=this.items[d];return typeof M<"u"?(this.splayOnTop(M),g=this.V[M],this.V[M]=b,{evicted:!1,key:d,value:g}):(this.size<this.capacity?M=this.size++:(M=this.tail,this.tail=this.backward[M],g=this.V[M],y=this.K[M],delete this.items[y]),this.items[d]=M,this.K[M]=d,this.V[M]=b,this.forward[M]=this.head,this.backward[this.head]=M,this.head=M,y?{evicted:!0,key:y,value:g}:null)},c.prototype.has=function(d){return d in this.items},c.prototype.get=function(d){var b=this.items[d];if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},c.prototype.peek=function(d){var b=this.items[d];if(!(typeof b>"u"))return this.V[b]},c.prototype.forEach=function(d,b){b=arguments.length>1?b:this;for(var g=0,y=this.size,M=this.head,x=this.K,E=this.V,A=this.forward;g<y;)d.call(b,E[M],x[M],this),M=A[M],g++},c.prototype.keys=function(){var d=0,b=this.size,g=this.head,y=this.K,M=this.forward;return new r(function(){if(d>=b)return{done:!0};var x=y[g];return d++,d<b&&(g=M[g]),{done:!1,value:x}})},c.prototype.values=function(){var d=0,b=this.size,g=this.head,y=this.V,M=this.forward;return new r(function(){if(d>=b)return{done:!0};var x=y[g];return d++,d<b&&(g=M[g]),{done:!1,value:x}})},c.prototype.entries=function(){var d=0,b=this.size,g=this.head,y=this.K,M=this.V,x=this.forward;return new r(function(){if(d>=b)return{done:!0};var E=y[g],A=M[g];return d++,d<b&&(g=x[g]),{done:!1,value:[E,A]}})},typeof Symbol<"u"&&(c.prototype[Symbol.iterator]=c.prototype.entries),c.prototype.inspect=function(){for(var d=new Map,b=this.entries(),g;g=b.next(),!g.done;)d.set(g.value[0],g.value[1]);return Object.defineProperty(d,"constructor",{value:c,enumerable:!1}),d},typeof Symbol<"u"&&(c.prototype[Symbol.for("nodejs.util.inspect.custom")]=c.prototype.inspect),c.from=function(d,b,g,y){if(arguments.length<2){if(y=h.guessLength(d),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var M=new c(b,g,y);return a(d,function(x,E){M.set(E,x)}),M},e.exports=c}}),iOe=Do({"node_modules/mnemonist/lru-map.js"(t,e){var r=rOe(),a=qB(),i=FB(),h=ose();function c(d,b,g){if(arguments.length<2&&(g=d,d=null,b=null),this.capacity=g,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var y=i.getPointerArray(g);this.forward=new y(g),this.backward=new y(g),this.K=typeof d=="function"?new d(g):new Array(g),this.V=typeof b=="function"?new b(g):new Array(g),this.size=0,this.head=0,this.tail=0,this.items=new Map}c.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},c.prototype.set=function(d,b){var g=this.items.get(d);if(typeof g<"u"){this.splayOnTop(g),this.V[g]=b;return}this.size<this.capacity?g=this.size++:(g=this.tail,this.tail=this.backward[g],this.items.delete(this.K[g])),this.items.set(d,g),this.K[g]=d,this.V[g]=b,this.forward[g]=this.head,this.backward[this.head]=g,this.head=g},c.prototype.setpop=function(d,b){var g=null,y=null,M=this.items.get(d);return typeof M<"u"?(this.splayOnTop(M),g=this.V[M],this.V[M]=b,{evicted:!1,key:d,value:g}):(this.size<this.capacity?M=this.size++:(M=this.tail,this.tail=this.backward[M],g=this.V[M],y=this.K[M],this.items.delete(y)),this.items.set(d,M),this.K[M]=d,this.V[M]=b,this.forward[M]=this.head,this.backward[this.head]=M,this.head=M,y?{evicted:!0,key:y,value:g}:null)},c.prototype.has=function(d){return this.items.has(d)},c.prototype.get=function(d){var b=this.items.get(d);if(!(typeof b>"u"))return this.splayOnTop(b),this.V[b]},c.prototype.peek=function(d){var b=this.items.get(d);if(!(typeof b>"u"))return this.V[b]},c.prototype.splayOnTop=r.prototype.splayOnTop,c.prototype.forEach=r.prototype.forEach,c.prototype.keys=r.prototype.keys,c.prototype.values=r.prototype.values,c.prototype.entries=r.prototype.entries,typeof Symbol<"u"&&(c.prototype[Symbol.iterator]=c.prototype.entries),c.prototype.inspect=r.prototype.inspect,c.from=function(d,b,g,y){if(arguments.length<2){if(y=h.guessLength(d),typeof y!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(y=b,b=null,g=null);var M=new c(b,g,y);return a(d,function(x,E){M.set(E,x)}),M},e.exports=c}}),nOe=Do({"node_modules/ms/index.js"(t,e){var r=1e3,a=r*60,i=a*60,h=i*24,c=h*7,d=h*365.25;e.exports=function(x,E){E=E||{};var A=typeof x;if(A==="string"&&x.length>0)return b(x);if(A==="number"&&isFinite(x))return E.long?y(x):g(x);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(x))};function b(x){if(x=String(x),!(x.length>100)){var E=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(x);if(E){var A=parseFloat(E[1]),k=(E[2]||"ms").toLowerCase();switch(k){case"years":case"year":case"yrs":case"yr":case"y":return A*d;case"weeks":case"week":case"w":return A*c;case"days":case"day":case"d":return A*h;case"hours":case"hour":case"hrs":case"hr":case"h":return A*i;case"minutes":case"minute":case"mins":case"min":case"m":return A*a;case"seconds":case"second":case"secs":case"sec":case"s":return A*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}function g(x){var E=Math.abs(x);return E>=h?Math.round(x/h)+"d":E>=i?Math.round(x/i)+"h":E>=a?Math.round(x/a)+"m":E>=r?Math.round(x/r)+"s":x+"ms"}function y(x){var E=Math.abs(x);return E>=h?M(x,E,h,"day"):E>=i?M(x,E,i,"hour"):E>=a?M(x,E,a,"minute"):E>=r?M(x,E,r,"second"):x+" ms"}function M(x,E,A,k){var O=E>=A*1.5;return Math.round(x/A)+" "+k+(O?"s":"")}}}),aOe=Do({"node_modules/debug/src/common.js"(t,e){function r(a){h.debug=h,h.default=h,h.coerce=M,h.disable=b,h.enable=d,h.enabled=g,h.humanize=nOe(),h.destroy=x,Object.keys(a).forEach(E=>{h[E]=a[E]}),h.names=[],h.skips=[],h.formatters={};function i(E){let A=0;for(let k=0;k<E.length;k++)A=(A<<5)-A+E.charCodeAt(k),A|=0;return h.colors[Math.abs(A)%h.colors.length]}h.selectColor=i;function h(E){let A,k=null,O,N;function L(...C){if(!L.enabled)return;let Y=L,G=Number(new Date),ie=G-(A||G);Y.diff=ie,Y.prev=A,Y.curr=G,A=G,C[0]=h.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let D=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(V,_)=>{if(V==="%%")return"%";D++;let n=h.formatters[_];if(typeof n=="function"){let s=C[D];V=n.call(Y,s),C.splice(D,1),D--}return V}),h.formatArgs.call(Y,C),(Y.log||h.log).apply(Y,C)}return L.namespace=E,L.useColors=h.useColors(),L.color=h.selectColor(E),L.extend=c,L.destroy=h.destroy,Object.defineProperty(L,"enabled",{enumerable:!0,configurable:!1,get:()=>k!==null?k:(O!==h.namespaces&&(O=h.namespaces,N=h.enabled(E)),N),set:C=>{k=C}}),typeof h.init=="function"&&h.init(L),L}function c(E,A){let k=h(this.namespace+(typeof A>"u"?":":A)+E);return k.log=this.log,k}function d(E){h.save(E),h.namespaces=E,h.names=[],h.skips=[];let A,k=(typeof E=="string"?E:"").split(/[\s,]+/),O=k.length;for(A=0;A<O;A++)k[A]&&(E=k[A].replace(/\*/g,".*?"),E[0]==="-"?h.skips.push(new RegExp("^"+E.slice(1)+"$")):h.names.push(new RegExp("^"+E+"$")))}function b(){let E=[...h.names.map(y),...h.skips.map(y).map(A=>"-"+A)].join(",");return h.enable(""),E}function g(E){if(E[E.length-1]==="*")return!0;let A,k;for(A=0,k=h.skips.length;A<k;A++)if(h.skips[A].test(E))return!1;for(A=0,k=h.names.length;A<k;A++)if(h.names[A].test(E))return!0;return!1}function y(E){return E.toString().substring(2,E.toString().length-2).replace(/\.\*\?$/,"*")}function M(E){return E instanceof Error?E.stack||E.message:E}function x(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return h.enable(h.load()),h}e.exports=r}}),oOe=Do({"node_modules/debug/src/browser.js"(t,e){t.formatArgs=a,t.save=i,t.load=h,t.useColors=r,t.storage=c(),t.destroy=(()=>{let b=!1;return()=>{b||(b=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function a(b){if(b[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+b[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let g="color: "+this.color;b.splice(1,0,g,"color: inherit");let y=0,M=0;b[0].replace(/%[a-zA-Z%]/g,x=>{x!=="%%"&&(y++,x==="%c"&&(M=y))}),b.splice(M,0,g)}t.log=console.debug||console.log||(()=>{});function i(b){try{b?t.storage.setItem("debug",b):t.storage.removeItem("debug")}catch{}}function h(){let b;try{b=t.storage.getItem("debug")}catch{}return!b&&typeof xe<"u"&&"env"in xe&&(b=xe.env.DEBUG),b}function c(){try{return localStorage}catch{}}e.exports=aOe()(t);var{formatters:d}=e.exports;d.j=function(b){try{return JSON.stringify(b)}catch(g){return"[UnexpectedJSONParseError]: "+g.message}}}}),sOe=Do({"node_modules/base64-js/index.js"(t){"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=E;var e=[],r=[],a=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(h=0,c=i.length;h<c;++h)e[h]=i[h],r[i.charCodeAt(h)]=h;var h,c;r[45]=62,r[95]=63;function d(A){var k=A.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var O=A.indexOf("=");O===-1&&(O=k);var N=O===k?0:4-O%4;return[O,N]}function b(A){var k=d(A),O=k[0],N=k[1];return(O+N)*3/4-N}function g(A,k,O){return(k+O)*3/4-O}function y(A){var k,O=d(A),N=O[0],L=O[1],C=new a(g(A,N,L)),Y=0,G=L>0?N-4:N,ie;for(ie=0;ie<G;ie+=4)k=r[A.charCodeAt(ie)]<<18|r[A.charCodeAt(ie+1)]<<12|r[A.charCodeAt(ie+2)]<<6|r[A.charCodeAt(ie+3)],C[Y++]=k>>16&255,C[Y++]=k>>8&255,C[Y++]=k&255;return L===2&&(k=r[A.charCodeAt(ie)]<<2|r[A.charCodeAt(ie+1)]>>4,C[Y++]=k&255),L===1&&(k=r[A.charCodeAt(ie)]<<10|r[A.charCodeAt(ie+1)]<<4|r[A.charCodeAt(ie+2)]>>2,C[Y++]=k>>8&255,C[Y++]=k&255),C}function M(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function x(A,k,O){for(var N,L=[],C=k;C<O;C+=3)N=(A[C]<<16&16711680)+(A[C+1]<<8&65280)+(A[C+2]&255),L.push(M(N));return L.join("")}function E(A){for(var k,O=A.length,N=O%3,L=[],C=16383,Y=0,G=O-N;Y<G;Y+=C)L.push(x(A,Y,Y+C>G?G:Y+C));return N===1?(k=A[O-1],L.push(e[k>>2]+e[k<<4&63]+"==")):N===2&&(k=(A[O-2]<<8)+A[O-1],L.push(e[k>>10]+e[k>>4&63]+e[k<<2&63]+"=")),L.join("")}}}),fOe=Do({"node_modules/ieee754/index.js"(t){t.read=function(e,r,a,i,h){var c,d,b=h*8-i-1,g=(1<<b)-1,y=g>>1,M=-7,x=a?h-1:0,E=a?-1:1,A=e[r+x];for(x+=E,c=A&(1<<-M)-1,A>>=-M,M+=b;M>0;c=c*256+e[r+x],x+=E,M-=8);for(d=c&(1<<-M)-1,c>>=-M,M+=i;M>0;d=d*256+e[r+x],x+=E,M-=8);if(c===0)c=1-y;else{if(c===g)return d?NaN:(A?-1:1)*(1/0);d=d+Math.pow(2,i),c=c-y}return(A?-1:1)*d*Math.pow(2,c-i)},t.write=function(e,r,a,i,h,c){var d,b,g,y=c*8-h-1,M=(1<<y)-1,x=M>>1,E=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=i?0:c-1,k=i?1:-1,O=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,d=M):(d=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-d))<1&&(d--,g*=2),d+x>=1?r+=E/g:r+=E*Math.pow(2,1-x),r*g>=2&&(d++,g/=2),d+x>=M?(b=0,d=M):d+x>=1?(b=(r*g-1)*Math.pow(2,h),d=d+x):(b=r*Math.pow(2,x-1)*Math.pow(2,h),d=0));h>=8;e[a+A]=b&255,A+=k,b/=256,h-=8);for(d=d<<h|b,y+=h;y>0;e[a+A]=d&255,A+=k,d/=256,y-=8);e[a+A-k]|=O*128}}}),uOe=Do({"node_modules/buffer/index.js"(t){"use strict";var e=sOe(),r=fOe(),a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=d,t.SlowBuffer=L,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,d.TYPED_ARRAY_SUPPORT=h(),!d.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 h(){try{let T=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(T,I),T.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function c(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');let I=new Uint8Array(T);return Object.setPrototypeOf(I,d.prototype),I}function d(T,I,P){if(typeof T=="number"){if(typeof I=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(T)}return b(T,I,P)}d.poolSize=8192;function b(T,I,P){if(typeof T=="string")return x(T,I);if(ArrayBuffer.isView(T))return A(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(ut(T,ArrayBuffer)||T&&ut(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ut(T,SharedArrayBuffer)||T&&ut(T.buffer,SharedArrayBuffer)))return k(T,I,P);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let U=T.valueOf&&T.valueOf();if(U!=null&&U!==T)return d.from(U,I,P);let Z=O(T);if(Z)return Z;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return d.from(T[Symbol.toPrimitive]("string"),I,P);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}d.from=function(T,I,P){return b(T,I,P)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array);function g(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function y(T,I,P){return g(T),T<=0?c(T):I!==void 0?typeof P=="string"?c(T).fill(I,P):c(T).fill(I):c(T)}d.alloc=function(T,I,P){return y(T,I,P)};function M(T){return g(T),c(T<0?0:N(T)|0)}d.allocUnsafe=function(T){return M(T)},d.allocUnsafeSlow=function(T){return M(T)};function x(T,I){if((typeof I!="string"||I==="")&&(I="utf8"),!d.isEncoding(I))throw new TypeError("Unknown encoding: "+I);let P=C(T,I)|0,U=c(P),Z=U.write(T,I);return Z!==P&&(U=U.slice(0,Z)),U}function E(T){let I=T.length<0?0:N(T.length)|0,P=c(I);for(let U=0;U<I;U+=1)P[U]=T[U]&255;return P}function A(T){if(ut(T,Uint8Array)){let I=new Uint8Array(T);return k(I.buffer,I.byteOffset,I.byteLength)}return E(T)}function k(T,I,P){if(I<0||T.byteLength<I)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<I+(P||0))throw new RangeError('"length" is outside of buffer bounds');let U;return I===void 0&&P===void 0?U=new Uint8Array(T):P===void 0?U=new Uint8Array(T,I):U=new Uint8Array(T,I,P),Object.setPrototypeOf(U,d.prototype),U}function O(T){if(d.isBuffer(T)){let I=N(T.length)|0,P=c(I);return P.length===0||T.copy(P,0,0,I),P}if(T.length!==void 0)return typeof T.length!="number"||Ze(T.length)?c(0):E(T);if(T.type==="Buffer"&&Array.isArray(T.data))return E(T.data)}function N(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function L(T){return+T!=T&&(T=0),d.alloc(+T)}d.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==d.prototype},d.compare=function(I,P){if(ut(I,Uint8Array)&&(I=d.from(I,I.offset,I.byteLength)),ut(P,Uint8Array)&&(P=d.from(P,P.offset,P.byteLength)),!d.isBuffer(I)||!d.isBuffer(P))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===P)return 0;let U=I.length,Z=P.length;for(let W=0,fe=Math.min(U,Z);W<fe;++W)if(I[W]!==P[W]){U=I[W],Z=P[W];break}return U<Z?-1:Z<U?1:0},d.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}},d.concat=function(I,P){if(!Array.isArray(I))throw new TypeError('"list" argument must be an Array of Buffers');if(I.length===0)return d.alloc(0);let U;if(P===void 0)for(P=0,U=0;U<I.length;++U)P+=I[U].length;let Z=d.allocUnsafe(P),W=0;for(U=0;U<I.length;++U){let fe=I[U];if(ut(fe,Uint8Array))W+fe.length>Z.length?(d.isBuffer(fe)||(fe=d.from(fe)),fe.copy(Z,W)):Uint8Array.prototype.set.call(Z,fe,W);else if(d.isBuffer(fe))fe.copy(Z,W);else throw new TypeError('"list" argument must be an Array of Buffers');W+=fe.length}return Z};function C(T,I){if(d.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||ut(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let P=T.length,U=arguments.length>2&&arguments[2]===!0;if(!U&&P===0)return 0;let Z=!1;for(;;)switch(I){case"ascii":case"latin1":case"binary":return P;case"utf8":case"utf-8":return oe(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P*2;case"hex":return P>>>1;case"base64":return be(T).length;default:if(Z)return U?-1:oe(T).length;I=(""+I).toLowerCase(),Z=!0}}d.byteLength=C;function Y(T,I,P){let U=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((P===void 0||P>this.length)&&(P=this.length),P<=0)||(P>>>=0,I>>>=0,P<=I))return"";for(T||(T="utf8");;)switch(T){case"hex":return o(this,I,P);case"utf8":case"utf-8":return u(this,I,P);case"ascii":return w(this,I,P);case"latin1":case"binary":return p(this,I,P);case"base64":return f(this,I,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,I,P);default:if(U)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),U=!0}}d.prototype._isBuffer=!0;function G(T,I,P){let U=T[I];T[I]=T[P],T[P]=U}d.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 P=0;P<I;P+=2)G(this,P,P+1);return this},d.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 P=0;P<I;P+=4)G(this,P,P+3),G(this,P+1,P+2);return this},d.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 P=0;P<I;P+=8)G(this,P,P+7),G(this,P+1,P+6),G(this,P+2,P+5),G(this,P+3,P+4);return this},d.prototype.toString=function(){let I=this.length;return I===0?"":arguments.length===0?u(this,0,I):Y.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(I){if(!d.isBuffer(I))throw new TypeError("Argument must be a Buffer");return this===I?!0:d.compare(this,I)===0},d.prototype.inspect=function(){let I="",P=t.INSPECT_MAX_BYTES;return I=this.toString("hex",0,P).replace(/(.{2})/g,"$1 ").trim(),this.length>P&&(I+=" ... "),"<Buffer "+I+">"},a&&(d.prototype[a]=d.prototype.inspect),d.prototype.compare=function(I,P,U,Z,W){if(ut(I,Uint8Array)&&(I=d.from(I,I.offset,I.byteLength)),!d.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(P===void 0&&(P=0),U===void 0&&(U=I?I.length:0),Z===void 0&&(Z=0),W===void 0&&(W=this.length),P<0||U>I.length||Z<0||W>this.length)throw new RangeError("out of range index");if(Z>=W&&P>=U)return 0;if(Z>=W)return-1;if(P>=U)return 1;if(P>>>=0,U>>>=0,Z>>>=0,W>>>=0,this===I)return 0;let fe=W-Z,st=U-P,ue=Math.min(fe,st),me=this.slice(Z,W),pe=I.slice(P,U);for(let ye=0;ye<ue;++ye)if(me[ye]!==pe[ye]){fe=me[ye],st=pe[ye];break}return fe<st?-1:st<fe?1:0};function ie(T,I,P,U,Z){if(T.length===0)return-1;if(typeof P=="string"?(U=P,P=0):P>2147483647?P=2147483647:P<-2147483648&&(P=-2147483648),P=+P,Ze(P)&&(P=Z?0:T.length-1),P<0&&(P=T.length+P),P>=T.length){if(Z)return-1;P=T.length-1}else if(P<0)if(Z)P=0;else return-1;if(typeof I=="string"&&(I=d.from(I,U)),d.isBuffer(I))return I.length===0?-1:D(T,I,P,U,Z);if(typeof I=="number")return I=I&255,typeof Uint8Array.prototype.indexOf=="function"?Z?Uint8Array.prototype.indexOf.call(T,I,P):Uint8Array.prototype.lastIndexOf.call(T,I,P):D(T,[I],P,U,Z);throw new TypeError("val must be string, number or Buffer")}function D(T,I,P,U,Z){let W=1,fe=T.length,st=I.length;if(U!==void 0&&(U=String(U).toLowerCase(),U==="ucs2"||U==="ucs-2"||U==="utf16le"||U==="utf-16le")){if(T.length<2||I.length<2)return-1;W=2,fe/=2,st/=2,P/=2}function ue(pe,ye){return W===1?pe[ye]:pe.readUInt16BE(ye*W)}let me;if(Z){let pe=-1;for(me=P;me<fe;me++)if(ue(T,me)===ue(I,pe===-1?0:me-pe)){if(pe===-1&&(pe=me),me-pe+1===st)return pe*W}else pe!==-1&&(me-=me-pe),pe=-1}else for(P+st>fe&&(P=fe-st),me=P;me>=0;me--){let pe=!0;for(let ye=0;ye<st;ye++)if(ue(T,me+ye)!==ue(I,ye)){pe=!1;break}if(pe)return me}return-1}d.prototype.includes=function(I,P,U){return this.indexOf(I,P,U)!==-1},d.prototype.indexOf=function(I,P,U){return ie(this,I,P,U,!0)},d.prototype.lastIndexOf=function(I,P,U){return ie(this,I,P,U,!1)};function q(T,I,P,U){P=Number(P)||0;let Z=T.length-P;U?(U=Number(U),U>Z&&(U=Z)):U=Z;let W=I.length;U>W/2&&(U=W/2);let fe;for(fe=0;fe<U;++fe){let st=parseInt(I.substr(fe*2,2),16);if(Ze(st))return fe;T[P+fe]=st}return fe}function V(T,I,P,U){return Ee(oe(I,T.length-P),T,P,U)}function _(T,I,P,U){return Ee(le(I),T,P,U)}function n(T,I,P,U){return Ee(be(I),T,P,U)}function s(T,I,P,U){return Ee(ot(I,T.length-P),T,P,U)}d.prototype.write=function(I,P,U,Z){if(P===void 0)Z="utf8",U=this.length,P=0;else if(U===void 0&&typeof P=="string")Z=P,U=this.length,P=0;else if(isFinite(P))P=P>>>0,isFinite(U)?(U=U>>>0,Z===void 0&&(Z="utf8")):(Z=U,U=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let W=this.length-P;if((U===void 0||U>W)&&(U=W),I.length>0&&(U<0||P<0)||P>this.length)throw new RangeError("Attempt to write outside buffer bounds");Z||(Z="utf8");let fe=!1;for(;;)switch(Z){case"hex":return q(this,I,P,U);case"utf8":case"utf-8":return V(this,I,P,U);case"ascii":case"latin1":case"binary":return _(this,I,P,U);case"base64":return n(this,I,P,U);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s(this,I,P,U);default:if(fe)throw new TypeError("Unknown encoding: "+Z);Z=(""+Z).toLowerCase(),fe=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f(T,I,P){return I===0&&P===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(I,P))}function u(T,I,P){P=Math.min(T.length,P);let U=[],Z=I;for(;Z<P;){let W=T[Z],fe=null,st=W>239?4:W>223?3:W>191?2:1;if(Z+st<=P){let ue,me,pe,ye;switch(st){case 1:W<128&&(fe=W);break;case 2:ue=T[Z+1],(ue&192)===128&&(ye=(W&31)<<6|ue&63,ye>127&&(fe=ye));break;case 3:ue=T[Z+1],me=T[Z+2],(ue&192)===128&&(me&192)===128&&(ye=(W&15)<<12|(ue&63)<<6|me&63,ye>2047&&(ye<55296||ye>57343)&&(fe=ye));break;case 4:ue=T[Z+1],me=T[Z+2],pe=T[Z+3],(ue&192)===128&&(me&192)===128&&(pe&192)===128&&(ye=(W&15)<<18|(ue&63)<<12|(me&63)<<6|pe&63,ye>65535&&ye<1114112&&(fe=ye))}}fe===null?(fe=65533,st=1):fe>65535&&(fe-=65536,U.push(fe>>>10&1023|55296),fe=56320|fe&1023),U.push(fe),Z+=st}return m(U)}var l=4096;function m(T){let I=T.length;if(I<=l)return String.fromCharCode.apply(String,T);let P="",U=0;for(;U<I;)P+=String.fromCharCode.apply(String,T.slice(U,U+=l));return P}function w(T,I,P){let U="";P=Math.min(T.length,P);for(let Z=I;Z<P;++Z)U+=String.fromCharCode(T[Z]&127);return U}function p(T,I,P){let U="";P=Math.min(T.length,P);for(let Z=I;Z<P;++Z)U+=String.fromCharCode(T[Z]);return U}function o(T,I,P){let U=T.length;(!I||I<0)&&(I=0),(!P||P<0||P>U)&&(P=U);let Z="";for(let W=I;W<P;++W)Z+=Ye[T[W]];return Z}function v(T,I,P){let U=T.slice(I,P),Z="";for(let W=0;W<U.length-1;W+=2)Z+=String.fromCharCode(U[W]+U[W+1]*256);return Z}d.prototype.slice=function(I,P){let U=this.length;I=~~I,P=P===void 0?U:~~P,I<0?(I+=U,I<0&&(I=0)):I>U&&(I=U),P<0?(P+=U,P<0&&(P=0)):P>U&&(P=U),P<I&&(P=I);let Z=this.subarray(I,P);return Object.setPrototypeOf(Z,d.prototype),Z};function R(T,I,P){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+I>P)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(I,P,U){I=I>>>0,P=P>>>0,U||R(I,P,this.length);let Z=this[I],W=1,fe=0;for(;++fe<P&&(W*=256);)Z+=this[I+fe]*W;return Z},d.prototype.readUintBE=d.prototype.readUIntBE=function(I,P,U){I=I>>>0,P=P>>>0,U||R(I,P,this.length);let Z=this[I+--P],W=1;for(;P>0&&(W*=256);)Z+=this[I+--P]*W;return Z},d.prototype.readUint8=d.prototype.readUInt8=function(I,P){return I=I>>>0,P||R(I,1,this.length),this[I]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(I,P){return I=I>>>0,P||R(I,2,this.length),this[I]|this[I+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(I,P){return I=I>>>0,P||R(I,2,this.length),this[I]<<8|this[I+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(I,P){return I=I>>>0,P||R(I,4,this.length),(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(I,P){return I=I>>>0,P||R(I,4,this.length),this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},d.prototype.readBigUInt64LE=ct(function(I){I=I>>>0,J(I,"offset");let P=this[I],U=this[I+7];(P===void 0||U===void 0)&&te(I,this.length-8);let Z=P+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24,W=this[++I]+this[++I]*2**8+this[++I]*2**16+U*2**24;return BigInt(Z)+(BigInt(W)<<BigInt(32))}),d.prototype.readBigUInt64BE=ct(function(I){I=I>>>0,J(I,"offset");let P=this[I],U=this[I+7];(P===void 0||U===void 0)&&te(I,this.length-8);let Z=P*2**24+this[++I]*2**16+this[++I]*2**8+this[++I],W=this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+U;return(BigInt(Z)<<BigInt(32))+BigInt(W)}),d.prototype.readIntLE=function(I,P,U){I=I>>>0,P=P>>>0,U||R(I,P,this.length);let Z=this[I],W=1,fe=0;for(;++fe<P&&(W*=256);)Z+=this[I+fe]*W;return W*=128,Z>=W&&(Z-=Math.pow(2,8*P)),Z},d.prototype.readIntBE=function(I,P,U){I=I>>>0,P=P>>>0,U||R(I,P,this.length);let Z=P,W=1,fe=this[I+--Z];for(;Z>0&&(W*=256);)fe+=this[I+--Z]*W;return W*=128,fe>=W&&(fe-=Math.pow(2,8*P)),fe},d.prototype.readInt8=function(I,P){return I=I>>>0,P||R(I,1,this.length),this[I]&128?(255-this[I]+1)*-1:this[I]},d.prototype.readInt16LE=function(I,P){I=I>>>0,P||R(I,2,this.length);let U=this[I]|this[I+1]<<8;return U&32768?U|4294901760:U},d.prototype.readInt16BE=function(I,P){I=I>>>0,P||R(I,2,this.length);let U=this[I+1]|this[I]<<8;return U&32768?U|4294901760:U},d.prototype.readInt32LE=function(I,P){return I=I>>>0,P||R(I,4,this.length),this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},d.prototype.readInt32BE=function(I,P){return I=I>>>0,P||R(I,4,this.length),this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},d.prototype.readBigInt64LE=ct(function(I){I=I>>>0,J(I,"offset");let P=this[I],U=this[I+7];(P===void 0||U===void 0)&&te(I,this.length-8);let Z=this[I+4]+this[I+5]*2**8+this[I+6]*2**16+(U<<24);return(BigInt(Z)<<BigInt(32))+BigInt(P+this[++I]*2**8+this[++I]*2**16+this[++I]*2**24)}),d.prototype.readBigInt64BE=ct(function(I){I=I>>>0,J(I,"offset");let P=this[I],U=this[I+7];(P===void 0||U===void 0)&&te(I,this.length-8);let Z=(P<<24)+this[++I]*2**16+this[++I]*2**8+this[++I];return(BigInt(Z)<<BigInt(32))+BigInt(this[++I]*2**24+this[++I]*2**16+this[++I]*2**8+U)}),d.prototype.readFloatLE=function(I,P){return I=I>>>0,P||R(I,4,this.length),r.read(this,I,!0,23,4)},d.prototype.readFloatBE=function(I,P){return I=I>>>0,P||R(I,4,this.length),r.read(this,I,!1,23,4)},d.prototype.readDoubleLE=function(I,P){return I=I>>>0,P||R(I,8,this.length),r.read(this,I,!0,52,8)},d.prototype.readDoubleBE=function(I,P){return I=I>>>0,P||R(I,8,this.length),r.read(this,I,!1,52,8)};function S(T,I,P,U,Z,W){if(!d.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>Z||I<W)throw new RangeError('"value" argument is out of bounds');if(P+U>T.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(I,P,U,Z){if(I=+I,P=P>>>0,U=U>>>0,!Z){let st=Math.pow(2,8*U)-1;S(this,I,P,U,st,0)}let W=1,fe=0;for(this[P]=I&255;++fe<U&&(W*=256);)this[P+fe]=I/W&255;return P+U},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(I,P,U,Z){if(I=+I,P=P>>>0,U=U>>>0,!Z){let st=Math.pow(2,8*U)-1;S(this,I,P,U,st,0)}let W=U-1,fe=1;for(this[P+W]=I&255;--W>=0&&(fe*=256);)this[P+W]=I/fe&255;return P+U},d.prototype.writeUint8=d.prototype.writeUInt8=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,1,255,0),this[P]=I&255,P+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,2,65535,0),this[P]=I&255,this[P+1]=I>>>8,P+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,2,65535,0),this[P]=I>>>8,this[P+1]=I&255,P+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,4,4294967295,0),this[P+3]=I>>>24,this[P+2]=I>>>16,this[P+1]=I>>>8,this[P]=I&255,P+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,4,4294967295,0),this[P]=I>>>24,this[P+1]=I>>>16,this[P+2]=I>>>8,this[P+3]=I&255,P+4};function B(T,I,P,U,Z){j(I,U,Z,T,P,7);let W=Number(I&BigInt(4294967295));T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[P++]=fe,fe=fe>>8,T[P++]=fe,fe=fe>>8,T[P++]=fe,fe=fe>>8,T[P++]=fe,P}function F(T,I,P,U,Z){j(I,U,Z,T,P,7);let W=Number(I&BigInt(4294967295));T[P+7]=W,W=W>>8,T[P+6]=W,W=W>>8,T[P+5]=W,W=W>>8,T[P+4]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[P+3]=fe,fe=fe>>8,T[P+2]=fe,fe=fe>>8,T[P+1]=fe,fe=fe>>8,T[P]=fe,P+8}d.prototype.writeBigUInt64LE=ct(function(I,P=0){return B(this,I,P,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeBigUInt64BE=ct(function(I,P=0){return F(this,I,P,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeIntLE=function(I,P,U,Z){if(I=+I,P=P>>>0,!Z){let ue=Math.pow(2,8*U-1);S(this,I,P,U,ue-1,-ue)}let W=0,fe=1,st=0;for(this[P]=I&255;++W<U&&(fe*=256);)I<0&&st===0&&this[P+W-1]!==0&&(st=1),this[P+W]=(I/fe>>0)-st&255;return P+U},d.prototype.writeIntBE=function(I,P,U,Z){if(I=+I,P=P>>>0,!Z){let ue=Math.pow(2,8*U-1);S(this,I,P,U,ue-1,-ue)}let W=U-1,fe=1,st=0;for(this[P+W]=I&255;--W>=0&&(fe*=256);)I<0&&st===0&&this[P+W+1]!==0&&(st=1),this[P+W]=(I/fe>>0)-st&255;return P+U},d.prototype.writeInt8=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,1,127,-128),I<0&&(I=255+I+1),this[P]=I&255,P+1},d.prototype.writeInt16LE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,2,32767,-32768),this[P]=I&255,this[P+1]=I>>>8,P+2},d.prototype.writeInt16BE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,2,32767,-32768),this[P]=I>>>8,this[P+1]=I&255,P+2},d.prototype.writeInt32LE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,4,2147483647,-2147483648),this[P]=I&255,this[P+1]=I>>>8,this[P+2]=I>>>16,this[P+3]=I>>>24,P+4},d.prototype.writeInt32BE=function(I,P,U){return I=+I,P=P>>>0,U||S(this,I,P,4,2147483647,-2147483648),I<0&&(I=4294967295+I+1),this[P]=I>>>24,this[P+1]=I>>>16,this[P+2]=I>>>8,this[P+3]=I&255,P+4},d.prototype.writeBigInt64LE=ct(function(I,P=0){return B(this,I,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),d.prototype.writeBigInt64BE=ct(function(I,P=0){return F(this,I,P,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $(T,I,P,U,Z,W){if(P+U>T.length)throw new RangeError("Index out of range");if(P<0)throw new RangeError("Index out of range")}function ae(T,I,P,U,Z){return I=+I,P=P>>>0,Z||$(T,I,P,4,34028234663852886e22,-34028234663852886e22),r.write(T,I,P,U,23,4),P+4}d.prototype.writeFloatLE=function(I,P,U){return ae(this,I,P,!0,U)},d.prototype.writeFloatBE=function(I,P,U){return ae(this,I,P,!1,U)};function re(T,I,P,U,Z){return I=+I,P=P>>>0,Z||$(T,I,P,8,17976931348623157e292,-17976931348623157e292),r.write(T,I,P,U,52,8),P+8}d.prototype.writeDoubleLE=function(I,P,U){return re(this,I,P,!0,U)},d.prototype.writeDoubleBE=function(I,P,U){return re(this,I,P,!1,U)},d.prototype.copy=function(I,P,U,Z){if(!d.isBuffer(I))throw new TypeError("argument should be a Buffer");if(U||(U=0),!Z&&Z!==0&&(Z=this.length),P>=I.length&&(P=I.length),P||(P=0),Z>0&&Z<U&&(Z=U),Z===U||I.length===0||this.length===0)return 0;if(P<0)throw new RangeError("targetStart out of bounds");if(U<0||U>=this.length)throw new RangeError("Index out of range");if(Z<0)throw new RangeError("sourceEnd out of bounds");Z>this.length&&(Z=this.length),I.length-P<Z-U&&(Z=I.length-P+U);let W=Z-U;return this===I&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(P,U,Z):Uint8Array.prototype.set.call(I,this.subarray(U,Z),P),W},d.prototype.fill=function(I,P,U,Z){if(typeof I=="string"){if(typeof P=="string"?(Z=P,P=0,U=this.length):typeof U=="string"&&(Z=U,U=this.length),Z!==void 0&&typeof Z!="string")throw new TypeError("encoding must be a string");if(typeof Z=="string"&&!d.isEncoding(Z))throw new TypeError("Unknown encoding: "+Z);if(I.length===1){let fe=I.charCodeAt(0);(Z==="utf8"&&fe<128||Z==="latin1")&&(I=fe)}}else typeof I=="number"?I=I&255:typeof I=="boolean"&&(I=Number(I));if(P<0||this.length<P||this.length<U)throw new RangeError("Out of range index");if(U<=P)return this;P=P>>>0,U=U===void 0?this.length:U>>>0,I||(I=0);let W;if(typeof I=="number")for(W=P;W<U;++W)this[W]=I;else{let fe=d.isBuffer(I)?I:d.from(I,Z),st=fe.length;if(st===0)throw new TypeError('The value "'+I+'" is invalid for argument "value"');for(W=0;W<U-P;++W)this[W+P]=fe[W%st]}return this};var H={};function K(T,I,P){H[T]=class extends P{constructor(){super(),Object.defineProperty(this,"message",{value:I.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(Z){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Z,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}K("ERR_BUFFER_OUT_OF_BOUNDS",function(T){return T?`${T} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),K("ERR_INVALID_ARG_TYPE",function(T,I){return`The "${T}" argument must be of type number. Received type ${typeof I}`},TypeError),K("ERR_OUT_OF_RANGE",function(T,I,P){let U=`The value of "${T}" is out of range.`,Z=P;return Number.isInteger(P)&&Math.abs(P)>2**32?Z=ce(String(P)):typeof P=="bigint"&&(Z=String(P),(P>BigInt(2)**BigInt(32)||P<-(BigInt(2)**BigInt(32)))&&(Z=ce(Z)),Z+="n"),U+=` It must be ${I}. Received ${Z}`,U},RangeError);function ce(T){let I="",P=T.length,U=T[0]==="-"?1:0;for(;P>=U+4;P-=3)I=`_${T.slice(P-3,P)}${I}`;return`${T.slice(0,P)}${I}`}function ne(T,I,P){J(I,"offset"),(T[I]===void 0||T[I+P]===void 0)&&te(I,T.length-(P+1))}function j(T,I,P,U,Z,W){if(T>P||T<I){let fe=typeof I=="bigint"?"n":"",st;throw W>3?I===0||I===BigInt(0)?st=`>= 0${fe} and < 2${fe} ** ${(W+1)*8}${fe}`:st=`>= -(2${fe} ** ${(W+1)*8-1}${fe}) and < 2 ** ${(W+1)*8-1}${fe}`:st=`>= ${I}${fe} and <= ${P}${fe}`,new H.ERR_OUT_OF_RANGE("value",st,T)}ne(U,Z,W)}function J(T,I){if(typeof T!="number")throw new H.ERR_INVALID_ARG_TYPE(I,"number",T)}function te(T,I,P){throw Math.floor(T)!==T?(J(T,P),new H.ERR_OUT_OF_RANGE(P||"offset","an integer",T)):I<0?new H.ERR_BUFFER_OUT_OF_BOUNDS:new H.ERR_OUT_OF_RANGE(P||"offset",`>= ${P?1:0} and <= ${I}`,T)}var he=/[^+/0-9A-Za-z-_]/g;function ke(T){if(T=T.split("=")[0],T=T.trim().replace(he,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function oe(T,I){I=I||1/0;let P,U=T.length,Z=null,W=[];for(let fe=0;fe<U;++fe){if(P=T.charCodeAt(fe),P>55295&&P<57344){if(!Z){if(P>56319){(I-=3)>-1&&W.push(239,191,189);continue}else if(fe+1===U){(I-=3)>-1&&W.push(239,191,189);continue}Z=P;continue}if(P<56320){(I-=3)>-1&&W.push(239,191,189),Z=P;continue}P=(Z-55296<<10|P-56320)+65536}else Z&&(I-=3)>-1&&W.push(239,191,189);if(Z=null,P<128){if((I-=1)<0)break;W.push(P)}else if(P<2048){if((I-=2)<0)break;W.push(P>>6|192,P&63|128)}else if(P<65536){if((I-=3)<0)break;W.push(P>>12|224,P>>6&63|128,P&63|128)}else if(P<1114112){if((I-=4)<0)break;W.push(P>>18|240,P>>12&63|128,P>>6&63|128,P&63|128)}else throw new Error("Invalid code point")}return W}function le(T){let I=[];for(let P=0;P<T.length;++P)I.push(T.charCodeAt(P)&255);return I}function ot(T,I){let P,U,Z,W=[];for(let fe=0;fe<T.length&&!((I-=2)<0);++fe)P=T.charCodeAt(fe),U=P>>8,Z=P%256,W.push(Z),W.push(U);return W}function be(T){return e.toByteArray(ke(T))}function Ee(T,I,P,U){let Z;for(Z=0;Z<U&&!(Z+P>=I.length||Z>=T.length);++Z)I[Z+P]=T[Z];return Z}function ut(T,I){return T instanceof I||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===I.name}function Ze(T){return T!==T}var Ye=function(){let T="0123456789abcdef",I=new Array(256);for(let P=0;P<16;++P){let U=P*16;for(let Z=0;Z<16;++Z)I[U+Z]=T[P]+T[Z]}return I}();function ct(T){return typeof BigInt>"u"?z:T}function z(){throw new Error("BigInt not supported")}}}),hOe={"@@functional/placeholder":!0};function Xi(t){return t===hOe}function Za(t){return function e(r){return arguments.length===0||Xi(r)?e:t.apply(this,arguments)}}function Hn(t){return function e(r,a){switch(arguments.length){case 0:return e;case 1:return Xi(r)?e:Za(function(i){return t(r,i)});default:return Xi(r)&&Xi(a)?e:Xi(r)?Za(function(i){return t(i,a)}):Xi(a)?Za(function(i){return t(r,i)}):t(r,a)}}}function jw(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(r){return e.apply(this,arguments)};case 2:return function(r,a){return e.apply(this,arguments)};case 3:return function(r,a,i){return e.apply(this,arguments)};case 4:return function(r,a,i,h){return e.apply(this,arguments)};case 5:return function(r,a,i,h,c){return e.apply(this,arguments)};case 6:return function(r,a,i,h,c,d){return e.apply(this,arguments)};case 7:return function(r,a,i,h,c,d,b){return e.apply(this,arguments)};case 8:return function(r,a,i,h,c,d,b,g){return e.apply(this,arguments)};case 9:return function(r,a,i,h,c,d,b,g,y){return e.apply(this,arguments)};case 10:return function(r,a,i,h,c,d,b,g,y,M){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function sse(t,e,r){return function(){for(var a=[],i=0,h=t,c=0,d=!1;c<e.length||i<arguments.length;){var b;c<e.length&&(!Xi(e[c])||i>=arguments.length)?b=e[c]:(b=arguments[i],i+=1),a[c]=b,Xi(b)?d=!0:h-=1,c+=1}return!d&&h<=0?r.apply(this,a):jw(Math.max(0,h),sse(t,a,r))}}var cOe=Hn(function(t,e){return t===1?Za(e):jw(t,sse(t,[],e))}),fse=cOe;function jB(t){return function e(r,a,i){switch(arguments.length){case 0:return e;case 1:return Xi(r)?e:Hn(function(h,c){return t(r,h,c)});case 2:return Xi(r)&&Xi(a)?e:Xi(r)?Hn(function(h,c){return t(h,a,c)}):Xi(a)?Hn(function(h,c){return t(r,h,c)}):Za(function(h){return t(r,a,h)});default:return Xi(r)&&Xi(a)&&Xi(i)?e:Xi(r)&&Xi(a)?Hn(function(h,c){return t(h,c,i)}):Xi(r)&&Xi(i)?Hn(function(h,c){return t(h,a,c)}):Xi(a)&&Xi(i)?Hn(function(h,c){return t(r,h,c)}):Xi(r)?Za(function(h){return t(h,a,i)}):Xi(a)?Za(function(h){return t(r,h,i)}):Xi(i)?Za(function(h){return t(r,a,h)}):t(r,a,i)}}}var zB=Array.isArray||function(t){return t!=null&&t.length>=0&&Object.prototype.toString.call(t)==="[object Array]"};function lOe(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function HB(t,e,r){return function(){if(arguments.length===0)return r();var a=arguments[arguments.length-1];if(!zB(a)){for(var i=0;i<t.length;){if(typeof a[t[i]]=="function")return a[t[i]].apply(a,Array.prototype.slice.call(arguments,0,-1));i+=1}if(lOe(a)){var h=e.apply(null,Array.prototype.slice.call(arguments,0,-1));return h(a)}}return r.apply(this,arguments)}}function dOe(t){return t&&t["@@transducer/reduced"]?t:{"@@transducer/value":t,"@@transducer/reduced":!0}}var F2={init:function(){return this.xf["@@transducer/init"]()},result:function(t){return this.xf["@@transducer/result"](t)}};function Poe(t){for(var e=[],r;!(r=t.next()).done;)e.push(r.value);return e}function Noe(t,e,r){for(var a=0,i=r.length;a<i;){if(t(e,r[a]))return!0;a+=1}return!1}function pOe(t){var e=String(t).match(/^function (\w*)/);return e==null?"":e[1]}function bw(t,e){return Object.prototype.hasOwnProperty.call(e,t)}function vOe(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var nB=typeof Object.is=="function"?Object.is:vOe,Coe=Object.prototype.toString,mOe=function(){return Coe.call(arguments)==="[object Arguments]"?function(t){return Coe.call(t)==="[object Arguments]"}:function(t){return bw("callee",t)}}(),gOe=mOe,bOe=!{toString:null}.propertyIsEnumerable("toString"),Loe=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Doe=function(){"use strict";return arguments.propertyIsEnumerable("length")}(),yOe=function(t,e){for(var r=0;r<t.length;){if(t[r]===e)return!0;r+=1}return!1},wOe=Za(typeof Object.keys=="function"&&!Doe?function(t){return Object(t)!==t?[]:Object.keys(t)}:function(t){if(Object(t)!==t)return[];var e,r,a=[],i=Doe&&gOe(t);for(e in t)bw(e,t)&&(!i||e!=="length")&&(a[a.length]=e);if(bOe)for(r=Loe.length-1;r>=0;)e=Loe[r],bw(e,t)&&!yOe(a,e)&&(a[a.length]=e),r-=1;return a}),rv=wOe,_Oe=Za(function(t){return t===null?"Null":t===void 0?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}),$oe=_Oe;function Uoe(t,e,r,a){var i=Poe(t),h=Poe(e);function c(d,b){return ZB(d,b,r.slice(),a.slice())}return!Noe(function(d,b){return!Noe(c,b,d)},h,i)}function ZB(t,e,r,a){if(nB(t,e))return!0;var i=$oe(t);if(i!==$oe(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(i){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&pOe(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&nB(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!nB(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var h=r.length-1;h>=0;){if(r[h]===t)return a[h]===e;h-=1}switch(i){case"Map":return t.size!==e.size?!1:Uoe(t.entries(),e.entries(),r.concat([t]),a.concat([e]));case"Set":return t.size!==e.size?!1:Uoe(t.values(),e.values(),r.concat([t]),a.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=rv(t);if(c.length!==rv(e).length)return!1;var d=r.concat([t]),b=a.concat([e]);for(h=c.length-1;h>=0;){var g=c[h];if(!(bw(g,e)&&ZB(e[g],t[g],d,b)))return!1;h-=1}return!0}var MOe=Hn(function(t,e){return ZB(t,e,[],[])}),use=MOe;function xOe(t,e,r){var a,i;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(a=1/e;r<t.length;){if(i=t[r],i===0&&1/i===a)return r;r+=1}return-1}else if(e!==e){for(;r<t.length;){if(i=t[r],typeof i=="number"&&i!==i)return r;r+=1}return-1}return t.indexOf(e,r);case"string":case"boolean":case"function":case"undefined":return t.indexOf(e,r);case"object":if(e===null)return t.indexOf(e,r)}for(;r<t.length;){if(use(t[r],e))return r;r+=1}return-1}function SOe(t,e){return xOe(e,t,0)>=0}function U2(t,e){for(var r=0,a=e.length,i=Array(a);r<a;)i[r]=t(e[r]),r+=1;return i}function aB(t){var e=t.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return'"'+e.replace(/"/g,'\\"')+'"'}var T2=function(t){return(t<10?"0":"")+t},EOe=typeof Date.prototype.toISOString=="function"?function(t){return t.toISOString()}:function(t){return t.getUTCFullYear()+"-"+T2(t.getUTCMonth()+1)+"-"+T2(t.getUTCDate())+"T"+T2(t.getUTCHours())+":"+T2(t.getUTCMinutes())+":"+T2(t.getUTCSeconds())+"."+(t.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"},AOe=EOe;function ROe(t){return function(){return!t.apply(this,arguments)}}function hse(t,e,r){for(var a=0,i=r.length;a<i;)e=t(e,r[a]),a+=1;return e}function TOe(t,e){for(var r=0,a=e.length,i=[];r<a;)t(e[r])&&(i[i.length]=e[r]),r+=1;return i}function kOe(t){return Object.prototype.toString.call(t)==="[object Object]"}var IOe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=F2.init,t.prototype["@@transducer/result"]=F2.result,t.prototype["@@transducer/step"]=function(e,r){return this.f(r)?this.xf["@@transducer/step"](e,r):e},t}();function BOe(t){return function(e){return new IOe(t,e)}}var OOe=Hn(HB(["fantasy-land/filter","filter"],BOe,function(t,e){return kOe(e)?hse(function(r,a){return t(e[a])&&(r[a]=e[a]),r},{},rv(e)):TOe(t,e)})),POe=OOe,NOe=Hn(function(t,e){return POe(ROe(t),e)}),COe=NOe;function cse(t,e){var r=function(h){var c=e.concat([t]);return SOe(h,c)?"<Circular>":cse(h,c)},a=function(h,c){return U2(function(d){return aB(d)+": "+r(h[d])},c.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+U2(r,t).join(", ")+"))";case"[object Array]":return"["+U2(r,t).concat(a(t,COe(function(h){return/^\d+$/.test(h)},rv(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):aB(AOe(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":aB(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var i=t.toString();if(i!=="[object Object]")return i}return"{"+a(t,rv(t)).join(", ")+"}"}}var LOe=Za(function(t){return cse(t,[])}),qoe=LOe,DOe=Hn(function(t,e){if(t===e)return e;function r(d,b){if(d>b!=b>d)return b>d?b:d}var a=r(t,e);if(a!==void 0)return a;var i=r(typeof t,typeof e);if(i!==void 0)return i===typeof t?t:e;var h=qoe(t),c=r(h,qoe(e));return c!==void 0&&c===h?t:e}),$Oe=DOe,UOe=function(){function t(e,r){this.xf=r,this.f=e}return t.prototype["@@transducer/init"]=F2.init,t.prototype["@@transducer/result"]=F2.result,t.prototype["@@transducer/step"]=function(e,r){return this.xf["@@transducer/step"](e,this.f(r))},t}(),qOe=function(t){return function(e){return new UOe(t,e)}},FOe=qOe,jOe=Hn(HB(["fantasy-land/map","map"],FOe,function(t,e){switch(Object.prototype.toString.call(e)){case"[object Function]":return fse(e.length,function(){return t.call(this,e.apply(this,arguments))});case"[object Object]":return hse(function(r,a){return r[a]=t(e[a]),r},{},rv(e));default:return U2(t,e)}})),zOe=jOe,lse=Number.isInteger||function(t){return t<<0===t};function dse(t){return Object.prototype.toString.call(t)==="[object String]"}function pse(t,e){var r=t<0?e.length+t:t;return dse(e)?e.charAt(r):e[r]}var HOe=Hn(function(t,e){if(e!=null)return lse(t)?pse(t,e):e[t]}),zw=HOe,ZOe=Hn(function(t,e){return zOe(zw(t),e)}),KOe=ZOe,WOe=Za(function(t){return zB(t)?!0:!t||typeof t!="object"||dse(t)?!1:t.length===0?!0:t.length>0?t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1):!1}),VOe=WOe,Foe=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function GOe(t,e,r){return function(a,i,h){if(VOe(h))return t(a,i,h);if(h==null)return i;if(typeof h["fantasy-land/reduce"]=="function")return e(a,i,h,"fantasy-land/reduce");if(h[Foe]!=null)return r(a,i,h[Foe]());if(typeof h.next=="function")return r(a,i,h);if(typeof h.reduce=="function")return e(a,i,h,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function YOe(t,e,r){for(var a=0,i=r.length;a<i;){if(e=t["@@transducer/step"](e,r[a]),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}a+=1}return t["@@transducer/result"](e)}var JOe=Hn(function(t,e){return jw(t.length,function(){return t.apply(e,arguments)})}),XOe=JOe;function QOe(t,e,r){for(var a=r.next();!a.done;){if(e=t["@@transducer/step"](e,a.value),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}a=r.next()}return t["@@transducer/result"](e)}function ePe(t,e,r,a){return t["@@transducer/result"](r[a](XOe(t["@@transducer/step"],t),e))}var tPe=GOe(YOe,ePe,QOe),rPe=tPe,iPe=function(){function t(e){this.f=e}return t.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(e){return e},t.prototype["@@transducer/step"]=function(e,r){return this.f(e,r)},t}();function nPe(t){return new iPe(t)}var aPe=jB(function(t,e,r){return rPe(typeof t=="function"?nPe(t):t,e,r)}),vse=aPe;function oPe(t,e){return function(){return e.call(this,t.apply(this,arguments))}}function mse(t,e){return function(){var r=arguments.length;if(r===0)return e();var a=arguments[r-1];return zB(a)||typeof a[t]!="function"?e.apply(this,arguments):a[t].apply(a,Array.prototype.slice.call(arguments,0,r-1))}}var sPe=jB(mse("slice",function(t,e,r){return Array.prototype.slice.call(r,t,e)})),fPe=sPe,uPe=Za(mse("tail",fPe(1,1/0))),hPe=uPe;function gse(){if(arguments.length===0)throw new Error("pipe requires at least one argument");return jw(arguments[0].length,vse(oPe,arguments[0],hPe(arguments)))}var cPe=Hn(function(t,e){return fse(vse($Oe,0,KOe("length",e)),function(){var r=arguments,a=this;return t.apply(a,U2(function(i){return i.apply(a,r)},e))})}),lPe=cPe,dPe=Hn(function(t,e){return e==null||e!==e?t:e}),dB=dPe,pPe=function(){function t(e,r){this.xf=r,this.f=e,this.found=!1}return t.prototype["@@transducer/init"]=F2.init,t.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,void 0)),this.xf["@@transducer/result"](e)},t.prototype["@@transducer/step"]=function(e,r){return this.f(r)&&(this.found=!0,e=dOe(this.xf["@@transducer/step"](e,r))),e},t}();function vPe(t){return function(e){return new pPe(t,e)}}var mPe=Hn(HB(["find"],vPe,function(t,e){for(var r=0,a=e.length;r<a;){if(t(e[r]))return e[r];r+=1}})),gPe=mPe,bPe=Za(function(t){return lPe(function(){return Array.prototype.slice.call(arguments,0)},t)}),yPe=bPe;function wPe(t,e){for(var r=e,a=0;a<t.length;a+=1){if(r==null)return;var i=t[a];lse(i)?r=pse(i,r):r=r[i]}return r}var _Pe=Hn(wPe),bse=_Pe,MPe=jB(function(t,e,r){return use(t,zw(e,r))}),xPe=MPe,yw=class extends Error{name="InvalidSchedulerLocation"},SPe=class extends Error{name="SchedulerTagNotFound"},EPe=class extends Error{name="TransactionNotFound"},APe="Url",RPe="Time-To-Live",TPe="Scheduler",pB=t=>gse(dB([]),gPe(xPe(t,"name")),dB({}),zw("value")),yse=t=>gse(e=>{if(!e)throw new EPe(t);return e},zw("tags"),dB([]));function wse({fetch:t,GRAPHQL_URL:e}){return async({query:r,variables:a})=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:r,variables:a})}).then(i=>i.json())}function kPe({fetch:t,GRAPHQL_URL:e}){let r=wse({fetch:t,GRAPHQL_URL:e}),a=_se({fetch:t,GRAPHQL_URL:e}),i=`
133
133
  query GetTransactions ($transactionIds: [ID!]!) {
134
134
  transactions(ids: $transactionIds) {
135
135
  edges {
@@ -184,12 +184,12 @@ nonce: bundlr`),ge.from(i))}};X();ee();Q();var sd=class{_publicKey;ownerLength=V
184
184
  }
185
185
  }
186
186
  }
187
- }`,i=_t.object({data:_t.object({transactions:_t.object({edges:_t.array(_t.object({node:_t.record(_t.any())}))})})});return h=>Hr(h).chain(Ui(c=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:a,variables:{transactionIds:[c]}})}).then(async d=>{if(d.ok)return d.json();throw r('Error Encountered when querying gateway for transaction "%s"',c),new Error(`${d.status}: ${await d.text()}`)}).then(i.parse).then(FLe(["data","transactions","edges","0","node"])))).toPromise()}var XDe=UB(oOe(),1),Rfe=(t="@permaweb/aoconnect")=>{let e=(0,XDe.default)(t);return e.child=r=>Rfe(`${e.namespace}:${r}`),e.tap=(r,...a)=>VLe((...i)=>e(r,...a,...i)),e},Tfe=({url:t,path:e})=>e?e.startsWith("/")?Tfe({url:t,path:e.slice(1)}):(t=new URL(t),t.pathname+=e,t.toString()):t;function QDe(t){return cv(Gw([]),hv((e,r)=>cv(HLe([],r.name),tO(r.value),js(r.name,Qh,e))(e),{}),Ww(e=>e.length>1?e:e[0]))(t)}function Us(t,e){return r=>Jse(QCe([Qoe(t,"name"),iO(eO(e),Qoe(e,"value"),JB)]),r)}function rse(t){return sfe([[q2(String),ev(t)],[q2(Array),OLe(t)],[JB,uCe]])}function Cd(t){let e;return q2(qs,t)?(e=new Error(e$e(t)),e.stack+=t.stack):q2(Error,t)?e=t:kLe("message",t)?e=new Error(t.message):q2(String,t)?e=new Error(t):e=new Error("An error occurred"),e}function e$e(t){return cv(e=>function r(a,i,h){return hv((c,d)=>cv(sfe([[ev(Tt.invalid_arguments),()=>r(d.argumentsError,422,"Invalid Arguments")],[ev(Tt.invalid_return_type),()=>r(d.returnTypeError,500,"Invalid Return")],[ev(Tt.invalid_union),()=>vLe(b=>r(b,400,"Invalid Union"),d.unionErrors)],[JB,()=>[{...d,status:i,contextCode:h}]]]),rO(c))(d.code),[],a.issues)}(e,400,""),e=>hv((r,a)=>{let{message:i,path:h,contextCode:c}=a,d=h[1]||h[0],b=c?`${c} `:"";return r.push(`${b}'${d}': ${i}.`),r},[],e),$Le(" | "))(t)}var t$e=_t.object({id:_t.string().min(1,{message:"message is required to be a message id"}),processId:_t.string().min(1,{message:"process is required to be a process id"})});function r$e(){return t=>Hr(t).map(t$e.parse).map(()=>t)}var xb=_t.object({name:_t.string(),value:_t.string()}),i$e=_t.function().args(_t.object({Id:_t.string(),Target:_t.string(),Owner:_t.string(),Anchor:_t.string().optional(),Data:_t.any().default("1234"),Tags:_t.array(_t.object({name:_t.string(),value:_t.string()}))})).returns(_t.promise(_t.any())),n$e=_t.function().args(_t.object({id:_t.string().min(1,{message:"message id is required"}),processId:_t.string().min(1,{message:"process id is required"})})).returns(_t.promise(_t.any())),a$e=_t.function().args(_t.object({process:_t.string().min(1,{message:"process id is required"}),from:_t.string().optional(),to:_t.string().optional(),sort:_t.enum(["ASC","DESC"]).default("ASC"),limit:_t.number().optional()})).returns(_t.promise(_t.object({edges:_t.array(_t.object({cursor:_t.string(),node:_t.object({Output:_t.any().optional(),Messages:_t.array(_t.any()).optional(),Spawns:_t.array(_t.any()).optional(),Error:_t.any().optional()})}))}))),kfe=_t.function().args(_t.object({processId:_t.string(),data:_t.any(),tags:_t.array(xb),anchor:_t.string().optional(),signer:_t.any()})).returns(_t.promise(_t.object({messageId:_t.string()}).passthrough())),o$e=_t.function().args(_t.object({data:_t.any(),tags:_t.array(xb),signer:_t.any()})).returns(_t.promise(_t.object({processId:_t.string()}).passthrough())),s$e=_t.function().args(_t.object({process:_t.string(),message:_t.string(),baseLayer:_t.boolean().optional(),exclude:_t.array(_t.string()).optional()})).returns(_t.promise(_t.object({assignmentId:_t.string()}).passthrough())),Ife=kfe,Bbt=_t.function().args(_t.object({suUrl:_t.string().url(),processId:_t.string()})).returns(_t.promise(_t.object({tags:_t.array(xb)}).passthrough())),Obt=_t.function().args(_t.string()).returns(_t.promise(_t.object({url:_t.string()}))),f$e=_t.function().args(_t.string()).returns(_t.promise(_t.boolean())),u$e=_t.function().args(_t.string()).returns(_t.promise(_t.object({tags:_t.array(xb)}).passthrough())),Yw=_t.function().args(_t.object({data:_t.any(),tags:_t.array(xb),target:_t.string().optional(),anchor:_t.string().optional()})).returns(_t.promise(_t.object({id:_t.string(),raw:_t.any()})));function h$e({loadResult:t}){return t=Ui(n$e.implement(t)),e=>Hr({id:e.id,processId:e.processId}).chain(t)}function c$e(t){let e=r$e(t),r=h$e(t);return({message:a,process:i})=>Hr({id:a,processId:i}).chain(e).chain(r).map(t.logger.tap('readResult result for message "%s": %O',a)).map(h=>h).bimap(Cd,Nd).toPromise()}var l$e=_t.array(_t.object({name:_t.string(),value:_t.string()}));function d$e(){return t=>Hr(t.tags).map(Gw([])).map(Us("Data-Protocol","ao")).map(Us("Variant")).map(Us("Type")).map(Us("SDK")).map(rO(Qh,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(l$e.parse).map(js("tags",Qh,t))}function p$e({logger:t}){return e=>Hr(e).chain(iO(eO(e.data),()=>Id(e),()=>Id(Math.random().toString().slice(-4)).map(js("data",Qh,e)).map(r=>cv(Pd("tags"),Us("Content-Type"),tO({name:"Content-Type",value:"text/plain"}),js("tags",Qh,r))(r)).map(t.tap('added pseudo-random string as message "data"'))))}function v$e(t){let e=d$e(t),r=p$e(t),a=kfe.implement(t.deployMessage);return i=>Hr(i).chain(e).chain(r).chain(Ui(({id:h,data:c,tags:d,anchor:b,signer:g})=>a({processId:h,data:c,tags:d,anchor:b,signer:Yw.implement(g)}))).map(h=>js("messageId",h.messageId,i))}function m$e(t){let e=v$e(t);return({process:r,data:a,tags:i,anchor:h,signer:c})=>Hr({id:r,data:a,tags:i,anchor:h,signer:c}).chain(e).map(d=>d.messageId).bimap(Cd,Nd).toPromise()}var I2=(t,e,r)=>a=>e(a[t])?Id(a):Bl(`Tag '${t}': ${r}`);function g$e({loadTransactionMeta:t,logger:e}){return t=Ui(u$e.implement(t)),r=>Hr(r).chain(t).map(Pd("tags")).map(QDe).chain(I2("Data-Protocol",rse("ao"),"value 'ao' was not found on module")).chain(I2("Type",rse("Module"),"value 'Module' was not found on module")).chain(I2("Module-Format",hB,"was not found on module")).chain(I2("Input-Encoding",hB,"was not found on module")).chain(I2("Output-Encoding",hB,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function b$e({logger:t,validateScheduler:e}){return e=Ui(f$e.implement(e)),r=>Hr(r).chain(a=>e(a).chain(i=>i?Id(a):Bl(`Valid Scheduler-Location owned by ${a} not found`))).bimap(t.tap("Verifying scheduler failed: %s"),t.tap("Verified scheduler"))}function y$e({logger:t}){return e=>Hr(e).map(t.tap("Checking for signer")).chain(r=>r?Id(r):Bl("signer not found"))}function w$e(t){let e=t.logger.child("verifyInput");t={...t,logger:e};let r=g$e(t),a=b$e(t),i=y$e(t);return h=>Hr(h).chain(c=>r(c.module).map(()=>c)).chain(c=>a(c.scheduler)).map(()=>h).chain(c=>i(c.signer).map(()=>c)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var _$e=_t.array(_t.object({name:_t.string(),value:_t.string()}));function M$e(){return t=>Hr(t).map(Pd("tags")).map(Gw([])).map(Us("Data-Protocol","ao")).map(Us("Variant")).map(Us("Type")).map(Us("Module")).map(Us("Scheduler")).map(Us("SDK")).map(rO(Qh,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:t.module},{name:"Scheduler",value:t.scheduler},{name:"SDK",value:"aoconnect"}])).map(_$e.parse).map(js("tags",Qh,t))}function x$e({logger:t}){return e=>Hr(e).chain(iO(eO(e.data),()=>Id(e),()=>Id(Math.random().toString().slice(-4)).map(js("data",Qh,e)).map(r=>cv(Pd("tags"),Us("Content-Type"),tO({name:"Content-Type",value:"text/plain"}),js("tags",Qh,r))(r)).map(t.tap('added pseudo-random string as process "data"'))))}function S$e(t){let e=t.logger.child("uploadProcess");t={...t,logger:e};let r=M$e(t),a=x$e(t),i=o$e.implement(t.deployProcess);return h=>Hr(h).chain(r).chain(a).chain(Ui(({data:c,tags:d,signer:b})=>i({data:c,tags:d,signer:Yw.implement(b)}))).map(c=>js("processId",c.processId,h))}function E$e(t){let e=w$e(t),r=S$e(t);return({module:a,scheduler:i,signer:h,tags:c,data:d})=>Hr({module:a,scheduler:i,signer:h,tags:c,data:d}).chain(e).chain(r).map(b=>b.processId).bimap(Cd,Nd).toPromise()}function A$e(t){let e=Ife.implement(t.deployMonitor);return r=>Hr(r).chain(Ui(({id:a,signer:i})=>e({processId:a,signer:Yw.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(a=>js("monitorId",a.messageId,r))}function R$e(t){let e=A$e(t);return({process:r,signer:a})=>Hr({id:r,signer:a}).chain(e).map(i=>i.monitorId).bimap(Cd,Nd).toPromise()}function T$e(t){let e=Ife.implement(t.deployUnmonitor);return r=>Hr(r).chain(Ui(({id:a,signer:i})=>e({processId:a,signer:Yw.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(a=>js("monitorId",a.messageId,r))}function k$e(t){let e=T$e(t);return({process:r,signer:a})=>Hr({id:r,signer:a}).chain(e).map(i=>i.monitorId).bimap(Cd,Nd).toPromise()}var I$e=_t.object({process:_t.string().min(1,{message:"process identifier is required"}),from:_t.string().optional(),to:_t.string().optional(),sort:_t.enum(["ASC","DESC"]).default("ASC"),limit:_t.number().optional()});function B$e(){return t=>Hr(t).map(I$e.parse).map(()=>t)}function O$e({queryResults:t}){return t=Ui(a$e.implement(t)),e=>Hr({process:e.process,from:e.from,to:e.to,sort:e.sort,limit:e.limit}).chain(t)}function P$e(t){let e=B$e(t),r=O$e(t);return({process:a,from:i,to:h,sort:c,limit:d})=>Hr({process:a,from:i,to:h,sort:c,limit:d}).chain(e).chain(r).map(t.logger.tap('readResults result for message "%s": %O',a)).map(b=>b).bimap(Cd,Nd).toPromise()}var N$e=_t.object({Id:_t.string(),Target:_t.string(),Owner:_t.string(),Anchor:_t.string().optional(),Data:_t.any().default("1234"),Tags:_t.array(_t.object({name:_t.string(),value:_t.string()}))});function C$e(){return t=>Hr(t).map(N$e.parse).map(e=>(e.Tags=e.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),e))}function L$e({dryrunFetch:t}){return Ui(i$e.implement(t))}function D$e(t){let e=C$e(t),r=L$e(t);return a=>Hr(a).map($$e).chain(e).chain(r).toPromise()}function $$e({process:t,data:e,tags:r,anchor:a,...i}){return{Id:"1234",Owner:"1234",...i,Target:t,Data:e||"1234",Tags:r||[],Anchor:a||"0"}}function U$e(t){let e=s$e.implement(t.deployAssign);return r=>Hr(r).chain(Ui(({process:a,message:i,baseLayer:h,exclude:c})=>e({process:a,message:i,baseLayer:h,exclude:c}))).map(a=>js("assignmentId",a.assignmentId,r))}function q$e(t){let e=U$e(t);return({process:r,message:a,baseLayer:i,exclude:h})=>Hr({process:r,message:a,baseLayer:i,exclude:h}).chain(e).map(c=>c.assignmentId).bimap(Cd,Nd).toPromise()}var F$e="https://arweave.net",j$e="https://mu.ao-testnet.xyz",z$e="https://cu.ao-testnet.xyz";function gv({GRAPHQL_URL:t,GATEWAY_URL:e=F$e,MU_URL:r=j$e,CU_URL:a=z$e}={}){let i=Rfe();t||(t=Tfe({url:e,path:"/graphql"}));let{validate:h}=Wse({cacheSize:100,GRAPHQL_URL:t}),c=sCe({MAX_SIZE:25}),d=i.child("result"),b=c$e({loadResult:nCe({fetch,CU_URL:a,logger:d}),logger:d}),g=i.child("message"),y=m$e({loadProcessMeta:sB({fetch,cache:c,logger:g}),deployMessage:XNe({fetch,MU_URL:r,logger:g}),logger:g}),M=i.child("spawn"),x=E$e({loadTransactionMeta:JDe({fetch,GRAPHQL_URL:t,logger:M}),validateScheduler:h,deployProcess:QNe({fetch,MU_URL:r,logger:M}),logger:M}),E=i.child("monitor"),A=R$e({loadProcessMeta:sB({fetch,cache:c,logger:E}),deployMonitor:eCe({fetch,MU_URL:r,logger:E}),logger:E}),k=i.child("unmonitor"),O=k$e({loadProcessMeta:sB({fetch,cache:c,logger:k}),deployUnmonitor:tCe({fetch,MU_URL:r,logger:k}),logger:E}),N=i.child("results"),L=P$e({queryResults:aCe({fetch,CU_URL:a,logger:N}),logger:N}),C=i.child("dryrun"),Y=D$e({dryrunFetch:iCe({fetch,CU_URL:a,logger:C}),logger:C}),G=i.child("assign"),ie=q$e({deployAssign:rCe({fetch,MU_URL:r,logger:G}),logger:g});return{result:b,results:L,message:y,spawn:x,monitor:A,unmonitor:O,dryrun:Y,assign:ie}}var Bfe={};ase(Bfe,{createDataItemSigner:()=>pUe});var Ofe=UB(uOe(),1),Pfe={};ase(Pfe,{AVSCTap:()=>Sb,ArweaveSigner:()=>fO,DataItem:()=>yb,MAX_TAG_BYTES:()=>Jw,MIN_BINARY_SIZE:()=>cO,SIG_CONFIG:()=>mv,SignatureConfig:()=>$s,Signer:()=>Dfe,createData:()=>Ffe,default:()=>cUe,deserializeTags:()=>Fw,indexToType:()=>uO,serializeTags:()=>hO,tagsExceedLimit:()=>qfe,warparbundles:()=>lUe});var H$e=Object.create,oO=Object.defineProperty,Z$e=Object.getOwnPropertyDescriptor,K$e=Object.getOwnPropertyNames,W$e=Object.getPrototypeOf,V$e=Object.prototype.hasOwnProperty,tc=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),G$e=(t,e)=>{for(var r in e)oO(t,r,{get:e[r],enumerable:!0})},Y$e=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of K$e(e))!V$e.call(t,i)&&i!==r&&oO(t,i,{get:()=>e[i],enumerable:!(a=Z$e(e,i))||a.enumerable});return t},Ld=(t,e,r)=>(r=t!=null?H$e(W$e(t)):{},Y$e(e||!t||!t.__esModule?oO(r,"default",{value:t,enumerable:!0}):r,t)),J$e=tc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});function e(r){var a=4,i=r.length,h=i%a;if(!h)return r;var c=i,d=a-h,b=i+d,g=ge.alloc(b);for(g.write(r);d--;)g.write("=",c++);return g.toString()}t.default=e}),X$e=tc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=J$e();function r(b,g){return g===void 0&&(g="utf8"),ge.isBuffer(b)?h(b.toString("base64")):h(ge.from(b,g).toString("base64"))}function a(b,g){return g===void 0&&(g="utf8"),ge.from(i(b),"base64").toString(g)}function i(b){return b=b.toString(),e.default(b).replace(/\-/g,"+").replace(/_/g,"/")}function h(b){return b.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(b){return ge.from(i(b),"base64")}var d=r;d.encode=r,d.decode=a,d.toBase64=i,d.fromBase64=h,d.toBuffer=c,t.default=d}),sO=tc((t,e)=>{e.exports=X$e().default,e.exports.default=e.exports}),Nfe=tc(t=>{"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=E;var e=[],r=[],a=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(h=0,c=i.length;h<c;++h)e[h]=i[h],r[i.charCodeAt(h)]=h;var h,c;r[45]=62,r[95]=63;function d(A){var k=A.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var O=A.indexOf("=");O===-1&&(O=k);var N=O===k?0:4-O%4;return[O,N]}function b(A){var k=d(A),O=k[0],N=k[1];return(O+N)*3/4-N}function g(A,k,O){return(k+O)*3/4-O}function y(A){var k,O=d(A),N=O[0],L=O[1],C=new a(g(A,N,L)),Y=0,G=L>0?N-4:N,ie;for(ie=0;ie<G;ie+=4)k=r[A.charCodeAt(ie)]<<18|r[A.charCodeAt(ie+1)]<<12|r[A.charCodeAt(ie+2)]<<6|r[A.charCodeAt(ie+3)],C[Y++]=k>>16&255,C[Y++]=k>>8&255,C[Y++]=k&255;return L===2&&(k=r[A.charCodeAt(ie)]<<2|r[A.charCodeAt(ie+1)]>>4,C[Y++]=k&255),L===1&&(k=r[A.charCodeAt(ie)]<<10|r[A.charCodeAt(ie+1)]<<4|r[A.charCodeAt(ie+2)]>>2,C[Y++]=k>>8&255,C[Y++]=k&255),C}function M(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function x(A,k,O){for(var N,L=[],C=k;C<O;C+=3)N=(A[C]<<16&16711680)+(A[C+1]<<8&65280)+(A[C+2]&255),L.push(M(N));return L.join("")}function E(A){for(var k,O=A.length,N=O%3,L=[],C=16383,Y=0,G=O-N;Y<G;Y+=C)L.push(x(A,Y,Y+C>G?G:Y+C));return N===1?(k=A[O-1],L.push(e[k>>2]+e[k<<4&63]+"==")):N===2&&(k=(A[O-2]<<8)+A[O-1],L.push(e[k>>10]+e[k>>4&63]+e[k<<2&63]+"=")),L.join("")}}),Cfe=tc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=Nfe();function r(x){let E=0;for(let O=0;O<x.length;O++)E+=x[O].byteLength;let A=new Uint8Array(E),k=0;A.set(new Uint8Array(x[0]),k),k+=x[0].byteLength;for(let O=1;O<x.length;O++)A.set(new Uint8Array(x[O]),k),k+=x[O].byteLength;return A}t.concatBuffers=r;function a(x){let E=d(x);return i(E)}t.b64UrlToString=a;function i(x){return new TextDecoder("utf-8",{fatal:!0}).decode(x)}t.bufferToString=i;function h(x){return new TextEncoder().encode(x)}t.stringToBuffer=h;function c(x){return g(h(x))}t.stringToB64Url=c;function d(x){return new Uint8Array(e.toByteArray(M(x)))}t.b64UrlToBuffer=d;function b(x){return e.fromByteArray(new Uint8Array(x))}t.bufferTob64=b;function g(x){return y(b(x))}t.bufferTob64Url=g;function y(x){return x.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}t.b64UrlEncode=y;function M(x){x=x.replace(/\-/g,"+").replace(/\_/g,"/");let E;return x.length%4==0?E=0:E=4-x.length%4,x.concat("=".repeat(E))}t.b64UrlDecode=M}),Q$e=tc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=Cfe(),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 a=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),i=await this.driver.exportKey("jwk",a.privateKey);return{kty:i.kty,e:i.e,n:i.n,d:i.d,p:i.p,q:i.q,dp:i.dp,dq:i.dq,qi:i.qi}}async sign(a,i,{saltLength:h}={}){let c=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(a),i);return new Uint8Array(c)}async hash(a,i="SHA-256"){let h=await this.driver.digest(i,a);return new Uint8Array(h)}async verify(a,i,h){let c={kty:"RSA",e:"AQAB",n:a},d=await this.jwkToPublicCryptoKey(c),b=await this.driver.digest("SHA-256",i),g=await this.driver.verify({name:"RSA-PSS",saltLength:0},d,h,i),y=await this.driver.verify({name:"RSA-PSS",saltLength:32},d,h,i),M=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((d.algorithm.modulusLength-1)/8)-b.byteLength-2},d,h,i);return g||y||M}async jwkToCryptoKey(a){return this.driver.importKey("jwk",a,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(a){return this.driver.importKey("jwk",a,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let a=crypto?.subtle;return a===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(i=>typeof a[i]=="function")}async encrypt(a,i,h){let c=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),d=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=new Uint8Array(16);crypto.getRandomValues(b);let g=await this.driver.encrypt({name:"AES-CBC",iv:b},d,a);return e.concatBuffers([b,g])}async decrypt(a,i,h){let c=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),d=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=a.slice(0,16),g=await this.driver.decrypt({name:"AES-CBC",iv:b},d,a.slice(16));return e.concatBuffers([g])}};t.default=r}),eUe=tc(t=>{t.read=function(e,r,a,i,h){var c,d,b=h*8-i-1,g=(1<<b)-1,y=g>>1,M=-7,x=a?h-1:0,E=a?-1:1,A=e[r+x];for(x+=E,c=A&(1<<-M)-1,A>>=-M,M+=b;M>0;c=c*256+e[r+x],x+=E,M-=8);for(d=c&(1<<-M)-1,c>>=-M,M+=i;M>0;d=d*256+e[r+x],x+=E,M-=8);if(c===0)c=1-y;else{if(c===g)return d?NaN:(A?-1:1)*(1/0);d=d+Math.pow(2,i),c=c-y}return(A?-1:1)*d*Math.pow(2,c-i)},t.write=function(e,r,a,i,h,c){var d,b,g,y=c*8-h-1,M=(1<<y)-1,x=M>>1,E=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=i?0:c-1,k=i?1:-1,O=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,d=M):(d=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-d))<1&&(d--,g*=2),d+x>=1?r+=E/g:r+=E*Math.pow(2,1-x),r*g>=2&&(d++,g/=2),d+x>=M?(b=0,d=M):d+x>=1?(b=(r*g-1)*Math.pow(2,h),d=d+x):(b=r*Math.pow(2,x-1)*Math.pow(2,h),d=0));h>=8;e[a+A]=b&255,A+=k,b/=256,h-=8);for(d=d<<h|b,y+=h;y>0;e[a+A]=d&255,A+=k,d/=256,y-=8);e[a+A-k]|=O*128}}),LB=tc(t=>{"use strict";var e=Nfe(),r=eUe(),a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=d,t.SlowBuffer=L,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,d.TYPED_ARRAY_SUPPORT=h(),!d.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 h(){try{let T=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(T,I),T.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function c(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');let I=new Uint8Array(T);return Object.setPrototypeOf(I,d.prototype),I}function d(T,I,P){if(typeof T=="number"){if(typeof I=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(T)}return b(T,I,P)}d.poolSize=8192;function b(T,I,P){if(typeof T=="string")return x(T,I);if(ArrayBuffer.isView(T))return A(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(ut(T,ArrayBuffer)||T&&ut(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ut(T,SharedArrayBuffer)||T&&ut(T.buffer,SharedArrayBuffer)))return k(T,I,P);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let U=T.valueOf&&T.valueOf();if(U!=null&&U!==T)return d.from(U,I,P);let Z=O(T);if(Z)return Z;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return d.from(T[Symbol.toPrimitive]("string"),I,P);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}d.from=function(T,I,P){return b(T,I,P)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array);function g(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function y(T,I,P){return g(T),T<=0?c(T):I!==void 0?typeof P=="string"?c(T).fill(I,P):c(T).fill(I):c(T)}d.alloc=function(T,I,P){return y(T,I,P)};function M(T){return g(T),c(T<0?0:N(T)|0)}d.allocUnsafe=function(T){return M(T)},d.allocUnsafeSlow=function(T){return M(T)};function x(T,I){if((typeof I!="string"||I==="")&&(I="utf8"),!d.isEncoding(I))throw new TypeError("Unknown encoding: "+I);let P=C(T,I)|0,U=c(P),Z=U.write(T,I);return Z!==P&&(U=U.slice(0,Z)),U}function E(T){let I=T.length<0?0:N(T.length)|0,P=c(I);for(let U=0;U<I;U+=1)P[U]=T[U]&255;return P}function A(T){if(ut(T,Uint8Array)){let I=new Uint8Array(T);return k(I.buffer,I.byteOffset,I.byteLength)}return E(T)}function k(T,I,P){if(I<0||T.byteLength<I)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<I+(P||0))throw new RangeError('"length" is outside of buffer bounds');let U;return I===void 0&&P===void 0?U=new Uint8Array(T):P===void 0?U=new Uint8Array(T,I):U=new Uint8Array(T,I,P),Object.setPrototypeOf(U,d.prototype),U}function O(T){if(d.isBuffer(T)){let I=N(T.length)|0,P=c(I);return P.length===0||T.copy(P,0,0,I),P}if(T.length!==void 0)return typeof T.length!="number"||Ze(T.length)?c(0):E(T);if(T.type==="Buffer"&&Array.isArray(T.data))return E(T.data)}function N(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function L(T){return+T!=T&&(T=0),d.alloc(+T)}d.isBuffer=function(T){return T!=null&&T._isBuffer===!0&&T!==d.prototype},d.compare=function(T,I){if(ut(T,Uint8Array)&&(T=d.from(T,T.offset,T.byteLength)),ut(I,Uint8Array)&&(I=d.from(I,I.offset,I.byteLength)),!d.isBuffer(T)||!d.isBuffer(I))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(T===I)return 0;let P=T.length,U=I.length;for(let Z=0,W=Math.min(P,U);Z<W;++Z)if(T[Z]!==I[Z]){P=T[Z],U=I[Z];break}return P<U?-1:U<P?1:0},d.isEncoding=function(T){switch(String(T).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}},d.concat=function(T,I){if(!Array.isArray(T))throw new TypeError('"list" argument must be an Array of Buffers');if(T.length===0)return d.alloc(0);let P;if(I===void 0)for(I=0,P=0;P<T.length;++P)I+=T[P].length;let U=d.allocUnsafe(I),Z=0;for(P=0;P<T.length;++P){let W=T[P];if(ut(W,Uint8Array))Z+W.length>U.length?(d.isBuffer(W)||(W=d.from(W)),W.copy(U,Z)):Uint8Array.prototype.set.call(U,W,Z);else if(d.isBuffer(W))W.copy(U,Z);else throw new TypeError('"list" argument must be an Array of Buffers');Z+=W.length}return U};function C(T,I){if(d.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||ut(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let P=T.length,U=arguments.length>2&&arguments[2]===!0;if(!U&&P===0)return 0;let Z=!1;for(;;)switch(I){case"ascii":case"latin1":case"binary":return P;case"utf8":case"utf-8":return oe(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P*2;case"hex":return P>>>1;case"base64":return be(T).length;default:if(Z)return U?-1:oe(T).length;I=(""+I).toLowerCase(),Z=!0}}d.byteLength=C;function Y(T,I,P){let U=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((P===void 0||P>this.length)&&(P=this.length),P<=0)||(P>>>=0,I>>>=0,P<=I))return"";for(T||(T="utf8");;)switch(T){case"hex":return o(this,I,P);case"utf8":case"utf-8":return u(this,I,P);case"ascii":return w(this,I,P);case"latin1":case"binary":return p(this,I,P);case"base64":return f(this,I,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,I,P);default:if(U)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),U=!0}}d.prototype._isBuffer=!0;function G(T,I,P){let U=T[I];T[I]=T[P],T[P]=U}d.prototype.swap16=function(){let T=this.length;if(T%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let I=0;I<T;I+=2)G(this,I,I+1);return this},d.prototype.swap32=function(){let T=this.length;if(T%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let I=0;I<T;I+=4)G(this,I,I+3),G(this,I+1,I+2);return this},d.prototype.swap64=function(){let T=this.length;if(T%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let I=0;I<T;I+=8)G(this,I,I+7),G(this,I+1,I+6),G(this,I+2,I+5),G(this,I+3,I+4);return this},d.prototype.toString=function(){let T=this.length;return T===0?"":arguments.length===0?u(this,0,T):Y.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(T){if(!d.isBuffer(T))throw new TypeError("Argument must be a Buffer");return this===T?!0:d.compare(this,T)===0},d.prototype.inspect=function(){let T="",I=t.INSPECT_MAX_BYTES;return T=this.toString("hex",0,I).replace(/(.{2})/g,"$1 ").trim(),this.length>I&&(T+=" ... "),"<Buffer "+T+">"},a&&(d.prototype[a]=d.prototype.inspect),d.prototype.compare=function(T,I,P,U,Z){if(ut(T,Uint8Array)&&(T=d.from(T,T.offset,T.byteLength)),!d.isBuffer(T))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof T);if(I===void 0&&(I=0),P===void 0&&(P=T?T.length:0),U===void 0&&(U=0),Z===void 0&&(Z=this.length),I<0||P>T.length||U<0||Z>this.length)throw new RangeError("out of range index");if(U>=Z&&I>=P)return 0;if(U>=Z)return-1;if(I>=P)return 1;if(I>>>=0,P>>>=0,U>>>=0,Z>>>=0,this===T)return 0;let W=Z-U,fe=P-I,st=Math.min(W,fe),ue=this.slice(U,Z),me=T.slice(I,P);for(let pe=0;pe<st;++pe)if(ue[pe]!==me[pe]){W=ue[pe],fe=me[pe];break}return W<fe?-1:fe<W?1:0};function ie(T,I,P,U,Z){if(T.length===0)return-1;if(typeof P=="string"?(U=P,P=0):P>2147483647?P=2147483647:P<-2147483648&&(P=-2147483648),P=+P,Ze(P)&&(P=Z?0:T.length-1),P<0&&(P=T.length+P),P>=T.length){if(Z)return-1;P=T.length-1}else if(P<0)if(Z)P=0;else return-1;if(typeof I=="string"&&(I=d.from(I,U)),d.isBuffer(I))return I.length===0?-1:D(T,I,P,U,Z);if(typeof I=="number")return I=I&255,typeof Uint8Array.prototype.indexOf=="function"?Z?Uint8Array.prototype.indexOf.call(T,I,P):Uint8Array.prototype.lastIndexOf.call(T,I,P):D(T,[I],P,U,Z);throw new TypeError("val must be string, number or Buffer")}function D(T,I,P,U,Z){let W=1,fe=T.length,st=I.length;if(U!==void 0&&(U=String(U).toLowerCase(),U==="ucs2"||U==="ucs-2"||U==="utf16le"||U==="utf-16le")){if(T.length<2||I.length<2)return-1;W=2,fe/=2,st/=2,P/=2}function ue(pe,ye){return W===1?pe[ye]:pe.readUInt16BE(ye*W)}let me;if(Z){let pe=-1;for(me=P;me<fe;me++)if(ue(T,me)===ue(I,pe===-1?0:me-pe)){if(pe===-1&&(pe=me),me-pe+1===st)return pe*W}else pe!==-1&&(me-=me-pe),pe=-1}else for(P+st>fe&&(P=fe-st),me=P;me>=0;me--){let pe=!0;for(let ye=0;ye<st;ye++)if(ue(T,me+ye)!==ue(I,ye)){pe=!1;break}if(pe)return me}return-1}d.prototype.includes=function(T,I,P){return this.indexOf(T,I,P)!==-1},d.prototype.indexOf=function(T,I,P){return ie(this,T,I,P,!0)},d.prototype.lastIndexOf=function(T,I,P){return ie(this,T,I,P,!1)};function q(T,I,P,U){P=Number(P)||0;let Z=T.length-P;U?(U=Number(U),U>Z&&(U=Z)):U=Z;let W=I.length;U>W/2&&(U=W/2);let fe;for(fe=0;fe<U;++fe){let st=parseInt(I.substr(fe*2,2),16);if(Ze(st))return fe;T[P+fe]=st}return fe}function V(T,I,P,U){return Ee(oe(I,T.length-P),T,P,U)}function _(T,I,P,U){return Ee(le(I),T,P,U)}function n(T,I,P,U){return Ee(be(I),T,P,U)}function s(T,I,P,U){return Ee(ot(I,T.length-P),T,P,U)}d.prototype.write=function(T,I,P,U){if(I===void 0)U="utf8",P=this.length,I=0;else if(P===void 0&&typeof I=="string")U=I,P=this.length,I=0;else if(isFinite(I))I=I>>>0,isFinite(P)?(P=P>>>0,U===void 0&&(U="utf8")):(U=P,P=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Z=this.length-I;if((P===void 0||P>Z)&&(P=Z),T.length>0&&(P<0||I<0)||I>this.length)throw new RangeError("Attempt to write outside buffer bounds");U||(U="utf8");let W=!1;for(;;)switch(U){case"hex":return q(this,T,I,P);case"utf8":case"utf-8":return V(this,T,I,P);case"ascii":case"latin1":case"binary":return _(this,T,I,P);case"base64":return n(this,T,I,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s(this,T,I,P);default:if(W)throw new TypeError("Unknown encoding: "+U);U=(""+U).toLowerCase(),W=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f(T,I,P){return I===0&&P===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(I,P))}function u(T,I,P){P=Math.min(T.length,P);let U=[],Z=I;for(;Z<P;){let W=T[Z],fe=null,st=W>239?4:W>223?3:W>191?2:1;if(Z+st<=P){let ue,me,pe,ye;switch(st){case 1:W<128&&(fe=W);break;case 2:ue=T[Z+1],(ue&192)===128&&(ye=(W&31)<<6|ue&63,ye>127&&(fe=ye));break;case 3:ue=T[Z+1],me=T[Z+2],(ue&192)===128&&(me&192)===128&&(ye=(W&15)<<12|(ue&63)<<6|me&63,ye>2047&&(ye<55296||ye>57343)&&(fe=ye));break;case 4:ue=T[Z+1],me=T[Z+2],pe=T[Z+3],(ue&192)===128&&(me&192)===128&&(pe&192)===128&&(ye=(W&15)<<18|(ue&63)<<12|(me&63)<<6|pe&63,ye>65535&&ye<1114112&&(fe=ye))}}fe===null?(fe=65533,st=1):fe>65535&&(fe-=65536,U.push(fe>>>10&1023|55296),fe=56320|fe&1023),U.push(fe),Z+=st}return m(U)}var l=4096;function m(T){let I=T.length;if(I<=l)return String.fromCharCode.apply(String,T);let P="",U=0;for(;U<I;)P+=String.fromCharCode.apply(String,T.slice(U,U+=l));return P}function w(T,I,P){let U="";P=Math.min(T.length,P);for(let Z=I;Z<P;++Z)U+=String.fromCharCode(T[Z]&127);return U}function p(T,I,P){let U="";P=Math.min(T.length,P);for(let Z=I;Z<P;++Z)U+=String.fromCharCode(T[Z]);return U}function o(T,I,P){let U=T.length;(!I||I<0)&&(I=0),(!P||P<0||P>U)&&(P=U);let Z="";for(let W=I;W<P;++W)Z+=Ye[T[W]];return Z}function v(T,I,P){let U=T.slice(I,P),Z="";for(let W=0;W<U.length-1;W+=2)Z+=String.fromCharCode(U[W]+U[W+1]*256);return Z}d.prototype.slice=function(T,I){let P=this.length;T=~~T,I=I===void 0?P:~~I,T<0?(T+=P,T<0&&(T=0)):T>P&&(T=P),I<0?(I+=P,I<0&&(I=0)):I>P&&(I=P),I<T&&(I=T);let U=this.subarray(T,I);return Object.setPrototypeOf(U,d.prototype),U};function R(T,I,P){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+I>P)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(T,I,P){T=T>>>0,I=I>>>0,P||R(T,I,this.length);let U=this[T],Z=1,W=0;for(;++W<I&&(Z*=256);)U+=this[T+W]*Z;return U},d.prototype.readUintBE=d.prototype.readUIntBE=function(T,I,P){T=T>>>0,I=I>>>0,P||R(T,I,this.length);let U=this[T+--I],Z=1;for(;I>0&&(Z*=256);)U+=this[T+--I]*Z;return U},d.prototype.readUint8=d.prototype.readUInt8=function(T,I){return T=T>>>0,I||R(T,1,this.length),this[T]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(T,I){return T=T>>>0,I||R(T,2,this.length),this[T]|this[T+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(T,I){return T=T>>>0,I||R(T,2,this.length),this[T]<<8|this[T+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(T,I){return T=T>>>0,I||R(T,4,this.length),(this[T]|this[T+1]<<8|this[T+2]<<16)+this[T+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]*16777216+(this[T+1]<<16|this[T+2]<<8|this[T+3])},d.prototype.readBigUInt64LE=ct(function(T){T=T>>>0,J(T,"offset");let I=this[T],P=this[T+7];(I===void 0||P===void 0)&&te(T,this.length-8);let U=I+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24,Z=this[++T]+this[++T]*2**8+this[++T]*2**16+P*2**24;return BigInt(U)+(BigInt(Z)<<BigInt(32))}),d.prototype.readBigUInt64BE=ct(function(T){T=T>>>0,J(T,"offset");let I=this[T],P=this[T+7];(I===void 0||P===void 0)&&te(T,this.length-8);let U=I*2**24+this[++T]*2**16+this[++T]*2**8+this[++T],Z=this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+P;return(BigInt(U)<<BigInt(32))+BigInt(Z)}),d.prototype.readIntLE=function(T,I,P){T=T>>>0,I=I>>>0,P||R(T,I,this.length);let U=this[T],Z=1,W=0;for(;++W<I&&(Z*=256);)U+=this[T+W]*Z;return Z*=128,U>=Z&&(U-=Math.pow(2,8*I)),U},d.prototype.readIntBE=function(T,I,P){T=T>>>0,I=I>>>0,P||R(T,I,this.length);let U=I,Z=1,W=this[T+--U];for(;U>0&&(Z*=256);)W+=this[T+--U]*Z;return Z*=128,W>=Z&&(W-=Math.pow(2,8*I)),W},d.prototype.readInt8=function(T,I){return T=T>>>0,I||R(T,1,this.length),this[T]&128?(255-this[T]+1)*-1:this[T]},d.prototype.readInt16LE=function(T,I){T=T>>>0,I||R(T,2,this.length);let P=this[T]|this[T+1]<<8;return P&32768?P|4294901760:P},d.prototype.readInt16BE=function(T,I){T=T>>>0,I||R(T,2,this.length);let P=this[T+1]|this[T]<<8;return P&32768?P|4294901760:P},d.prototype.readInt32LE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]|this[T+1]<<8|this[T+2]<<16|this[T+3]<<24},d.prototype.readInt32BE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]<<24|this[T+1]<<16|this[T+2]<<8|this[T+3]},d.prototype.readBigInt64LE=ct(function(T){T=T>>>0,J(T,"offset");let I=this[T],P=this[T+7];(I===void 0||P===void 0)&&te(T,this.length-8);let U=this[T+4]+this[T+5]*2**8+this[T+6]*2**16+(P<<24);return(BigInt(U)<<BigInt(32))+BigInt(I+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24)}),d.prototype.readBigInt64BE=ct(function(T){T=T>>>0,J(T,"offset");let I=this[T],P=this[T+7];(I===void 0||P===void 0)&&te(T,this.length-8);let U=(I<<24)+this[++T]*2**16+this[++T]*2**8+this[++T];return(BigInt(U)<<BigInt(32))+BigInt(this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+P)}),d.prototype.readFloatLE=function(T,I){return T=T>>>0,I||R(T,4,this.length),r.read(this,T,!0,23,4)},d.prototype.readFloatBE=function(T,I){return T=T>>>0,I||R(T,4,this.length),r.read(this,T,!1,23,4)},d.prototype.readDoubleLE=function(T,I){return T=T>>>0,I||R(T,8,this.length),r.read(this,T,!0,52,8)},d.prototype.readDoubleBE=function(T,I){return T=T>>>0,I||R(T,8,this.length),r.read(this,T,!1,52,8)};function S(T,I,P,U,Z,W){if(!d.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>Z||I<W)throw new RangeError('"value" argument is out of bounds');if(P+U>T.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(T,I,P,U){if(T=+T,I=I>>>0,P=P>>>0,!U){let fe=Math.pow(2,8*P)-1;S(this,T,I,P,fe,0)}let Z=1,W=0;for(this[I]=T&255;++W<P&&(Z*=256);)this[I+W]=T/Z&255;return I+P},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(T,I,P,U){if(T=+T,I=I>>>0,P=P>>>0,!U){let fe=Math.pow(2,8*P)-1;S(this,T,I,P,fe,0)}let Z=P-1,W=1;for(this[I+Z]=T&255;--Z>=0&&(W*=256);)this[I+Z]=T/W&255;return I+P},d.prototype.writeUint8=d.prototype.writeUInt8=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,1,255,0),this[I]=T&255,I+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,2,65535,0),this[I]=T&255,this[I+1]=T>>>8,I+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,2,65535,0),this[I]=T>>>8,this[I+1]=T&255,I+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,4,4294967295,0),this[I+3]=T>>>24,this[I+2]=T>>>16,this[I+1]=T>>>8,this[I]=T&255,I+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,4,4294967295,0),this[I]=T>>>24,this[I+1]=T>>>16,this[I+2]=T>>>8,this[I+3]=T&255,I+4};function B(T,I,P,U,Z){j(I,U,Z,T,P,7);let W=Number(I&BigInt(4294967295));T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[P++]=fe,fe=fe>>8,T[P++]=fe,fe=fe>>8,T[P++]=fe,fe=fe>>8,T[P++]=fe,P}function F(T,I,P,U,Z){j(I,U,Z,T,P,7);let W=Number(I&BigInt(4294967295));T[P+7]=W,W=W>>8,T[P+6]=W,W=W>>8,T[P+5]=W,W=W>>8,T[P+4]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[P+3]=fe,fe=fe>>8,T[P+2]=fe,fe=fe>>8,T[P+1]=fe,fe=fe>>8,T[P]=fe,P+8}d.prototype.writeBigUInt64LE=ct(function(T,I=0){return B(this,T,I,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeBigUInt64BE=ct(function(T,I=0){return F(this,T,I,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeIntLE=function(T,I,P,U){if(T=+T,I=I>>>0,!U){let st=Math.pow(2,8*P-1);S(this,T,I,P,st-1,-st)}let Z=0,W=1,fe=0;for(this[I]=T&255;++Z<P&&(W*=256);)T<0&&fe===0&&this[I+Z-1]!==0&&(fe=1),this[I+Z]=(T/W>>0)-fe&255;return I+P},d.prototype.writeIntBE=function(T,I,P,U){if(T=+T,I=I>>>0,!U){let st=Math.pow(2,8*P-1);S(this,T,I,P,st-1,-st)}let Z=P-1,W=1,fe=0;for(this[I+Z]=T&255;--Z>=0&&(W*=256);)T<0&&fe===0&&this[I+Z+1]!==0&&(fe=1),this[I+Z]=(T/W>>0)-fe&255;return I+P},d.prototype.writeInt8=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,1,127,-128),T<0&&(T=255+T+1),this[I]=T&255,I+1},d.prototype.writeInt16LE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,2,32767,-32768),this[I]=T&255,this[I+1]=T>>>8,I+2},d.prototype.writeInt16BE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,2,32767,-32768),this[I]=T>>>8,this[I+1]=T&255,I+2},d.prototype.writeInt32LE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,4,2147483647,-2147483648),this[I]=T&255,this[I+1]=T>>>8,this[I+2]=T>>>16,this[I+3]=T>>>24,I+4},d.prototype.writeInt32BE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,4,2147483647,-2147483648),T<0&&(T=4294967295+T+1),this[I]=T>>>24,this[I+1]=T>>>16,this[I+2]=T>>>8,this[I+3]=T&255,I+4},d.prototype.writeBigInt64LE=ct(function(T,I=0){return B(this,T,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),d.prototype.writeBigInt64BE=ct(function(T,I=0){return F(this,T,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $(T,I,P,U,Z,W){if(P+U>T.length)throw new RangeError("Index out of range");if(P<0)throw new RangeError("Index out of range")}function ae(T,I,P,U,Z){return I=+I,P=P>>>0,Z||$(T,I,P,4,34028234663852886e22,-34028234663852886e22),r.write(T,I,P,U,23,4),P+4}d.prototype.writeFloatLE=function(T,I,P){return ae(this,T,I,!0,P)},d.prototype.writeFloatBE=function(T,I,P){return ae(this,T,I,!1,P)};function re(T,I,P,U,Z){return I=+I,P=P>>>0,Z||$(T,I,P,8,17976931348623157e292,-17976931348623157e292),r.write(T,I,P,U,52,8),P+8}d.prototype.writeDoubleLE=function(T,I,P){return re(this,T,I,!0,P)},d.prototype.writeDoubleBE=function(T,I,P){return re(this,T,I,!1,P)},d.prototype.copy=function(T,I,P,U){if(!d.isBuffer(T))throw new TypeError("argument should be a Buffer");if(P||(P=0),!U&&U!==0&&(U=this.length),I>=T.length&&(I=T.length),I||(I=0),U>0&&U<P&&(U=P),U===P||T.length===0||this.length===0)return 0;if(I<0)throw new RangeError("targetStart out of bounds");if(P<0||P>=this.length)throw new RangeError("Index out of range");if(U<0)throw new RangeError("sourceEnd out of bounds");U>this.length&&(U=this.length),T.length-I<U-P&&(U=T.length-I+P);let Z=U-P;return this===T&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(I,P,U):Uint8Array.prototype.set.call(T,this.subarray(P,U),I),Z},d.prototype.fill=function(T,I,P,U){if(typeof T=="string"){if(typeof I=="string"?(U=I,I=0,P=this.length):typeof P=="string"&&(U=P,P=this.length),U!==void 0&&typeof U!="string")throw new TypeError("encoding must be a string");if(typeof U=="string"&&!d.isEncoding(U))throw new TypeError("Unknown encoding: "+U);if(T.length===1){let W=T.charCodeAt(0);(U==="utf8"&&W<128||U==="latin1")&&(T=W)}}else typeof T=="number"?T=T&255:typeof T=="boolean"&&(T=Number(T));if(I<0||this.length<I||this.length<P)throw new RangeError("Out of range index");if(P<=I)return this;I=I>>>0,P=P===void 0?this.length:P>>>0,T||(T=0);let Z;if(typeof T=="number")for(Z=I;Z<P;++Z)this[Z]=T;else{let W=d.isBuffer(T)?T:d.from(T,U),fe=W.length;if(fe===0)throw new TypeError('The value "'+T+'" is invalid for argument "value"');for(Z=0;Z<P-I;++Z)this[Z+I]=W[Z%fe]}return this};var H={};function K(T,I,P){H[T]=class extends P{constructor(){super(),Object.defineProperty(this,"message",{value:I.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(U){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:U,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}K("ERR_BUFFER_OUT_OF_BOUNDS",function(T){return T?`${T} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),K("ERR_INVALID_ARG_TYPE",function(T,I){return`The "${T}" argument must be of type number. Received type ${typeof I}`},TypeError),K("ERR_OUT_OF_RANGE",function(T,I,P){let U=`The value of "${T}" is out of range.`,Z=P;return Number.isInteger(P)&&Math.abs(P)>2**32?Z=ce(String(P)):typeof P=="bigint"&&(Z=String(P),(P>BigInt(2)**BigInt(32)||P<-(BigInt(2)**BigInt(32)))&&(Z=ce(Z)),Z+="n"),U+=` It must be ${I}. Received ${Z}`,U},RangeError);function ce(T){let I="",P=T.length,U=T[0]==="-"?1:0;for(;P>=U+4;P-=3)I=`_${T.slice(P-3,P)}${I}`;return`${T.slice(0,P)}${I}`}function ne(T,I,P){J(I,"offset"),(T[I]===void 0||T[I+P]===void 0)&&te(I,T.length-(P+1))}function j(T,I,P,U,Z,W){if(T>P||T<I){let fe=typeof I=="bigint"?"n":"",st;throw W>3?I===0||I===BigInt(0)?st=`>= 0${fe} and < 2${fe} ** ${(W+1)*8}${fe}`:st=`>= -(2${fe} ** ${(W+1)*8-1}${fe}) and < 2 ** ${(W+1)*8-1}${fe}`:st=`>= ${I}${fe} and <= ${P}${fe}`,new H.ERR_OUT_OF_RANGE("value",st,T)}ne(U,Z,W)}function J(T,I){if(typeof T!="number")throw new H.ERR_INVALID_ARG_TYPE(I,"number",T)}function te(T,I,P){throw Math.floor(T)!==T?(J(T,P),new H.ERR_OUT_OF_RANGE(P||"offset","an integer",T)):I<0?new H.ERR_BUFFER_OUT_OF_BOUNDS:new H.ERR_OUT_OF_RANGE(P||"offset",`>= ${P?1:0} and <= ${I}`,T)}var he=/[^+/0-9A-Za-z-_]/g;function ke(T){if(T=T.split("=")[0],T=T.trim().replace(he,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function oe(T,I){I=I||1/0;let P,U=T.length,Z=null,W=[];for(let fe=0;fe<U;++fe){if(P=T.charCodeAt(fe),P>55295&&P<57344){if(!Z){if(P>56319){(I-=3)>-1&&W.push(239,191,189);continue}else if(fe+1===U){(I-=3)>-1&&W.push(239,191,189);continue}Z=P;continue}if(P<56320){(I-=3)>-1&&W.push(239,191,189),Z=P;continue}P=(Z-55296<<10|P-56320)+65536}else Z&&(I-=3)>-1&&W.push(239,191,189);if(Z=null,P<128){if((I-=1)<0)break;W.push(P)}else if(P<2048){if((I-=2)<0)break;W.push(P>>6|192,P&63|128)}else if(P<65536){if((I-=3)<0)break;W.push(P>>12|224,P>>6&63|128,P&63|128)}else if(P<1114112){if((I-=4)<0)break;W.push(P>>18|240,P>>12&63|128,P>>6&63|128,P&63|128)}else throw new Error("Invalid code point")}return W}function le(T){let I=[];for(let P=0;P<T.length;++P)I.push(T.charCodeAt(P)&255);return I}function ot(T,I){let P,U,Z,W=[];for(let fe=0;fe<T.length&&!((I-=2)<0);++fe)P=T.charCodeAt(fe),U=P>>8,Z=P%256,W.push(Z),W.push(U);return W}function be(T){return e.toByteArray(ke(T))}function Ee(T,I,P,U){let Z;for(Z=0;Z<U&&!(Z+P>=I.length||Z>=T.length);++Z)I[Z+P]=T[Z];return Z}function ut(T,I){return T instanceof I||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===I.name}function Ze(T){return T!==T}var Ye=function(){let T="0123456789abcdef",I=new Array(256);for(let P=0;P<16;++P){let U=P*16;for(let Z=0;Z<16;++Z)I[U+Z]=T[P]+T[Z]}return I}();function ct(T){return typeof BigInt>"u"?z:T}function z(){throw new Error("BigInt not supported")}}),tUe=tc((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:LB().Buffer,Crypto:window.crypto}):e.exports={Buffer:LB().Buffer,Crypto:crypto}}),Lfe={};G$e(Lfe,{AVSCTap:()=>Sb,ArweaveSigner:()=>fO,DataItem:()=>yb,MAX_TAG_BYTES:()=>Jw,MIN_BINARY_SIZE:()=>cO,SIG_CONFIG:()=>mv,SignatureConfig:()=>$s,Signer:()=>Dfe,createData:()=>Ffe,deserializeTags:()=>Fw,indexToType:()=>uO,serializeTags:()=>hO,tagsExceedLimit:()=>qfe});var Dfe=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,r,a){throw new Error("You must implement verify method on child")}},rUe=Ld(sO(),1),Hf=Ld(Cfe(),1);async function $fe(t){if(Array.isArray(t)){let i=(0,Hf.concatBuffers)([(0,Hf.stringToBuffer)("list"),(0,Hf.stringToBuffer)(t.length.toString())]);return await Ufe(t,await Jh().hash(i,"SHA-384"))}let e=t,r=(0,Hf.concatBuffers)([(0,Hf.stringToBuffer)("blob"),(0,Hf.stringToBuffer)(e.byteLength.toString())]),a=(0,Hf.concatBuffers)([await Jh().hash(r,"SHA-384"),await Jh().hash(e,"SHA-384")]);return await Jh().hash(a,"SHA-384")}async function Ufe(t,e){if(t.length<1)return e;let r=(0,Hf.concatBuffers)([e,await $fe(t[0])]),a=await Jh().hash(r,"SHA-384");return await Ufe(t.slice(1),a)}var lB=Ld(Q$e(),1),iUe=lB.default.default?lB.default.default:lB.default,nUe=class extends iUe{getPublicKey(t){throw new Error("Unimplemented")}},aUe;function Jh(){return aUe??=new nUe}var $s;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})($s||($s={}));var mv={[$s.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[$s.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[$s.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[$s.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[$s.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[$s.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[$s.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},fO=class{signatureType=1;ownerLength=mv[1].pubLength;signatureLength=mv[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return rUe.default.toBuffer(this.pk)}sign(t){return Jh().sign(this.jwk,t)}static async verify(t,e,r){return await Jh().verify(t,e,r)}},uO={1:fO},Hu=Ld(sO(),1);async function DB(t){return $fe([(0,Hf.stringToBuffer)("dataitem"),(0,Hf.stringToBuffer)("1"),(0,Hf.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function oUe(t,e){let r=await DB(t),a=await e.sign(r),i=await Jh().hash(a);return{signature:ge.from(a),id:ge.from(i)}}async function sUe(t,e){let{signature:r,id:a}=await oUe(t,e);return t.getRaw().set(r,2),a}var Sb=class{buf;pos;constructor(t=ge.alloc(Jw),e=0){this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e=t.length,r;if(e)for(this.writeLong(e),r=0;r<e;r++){let a=t[r];if(a?.name===void 0||a?.value===void 0)throw new Error(`Invalid tag format for ${a}, expected {name:string, value: string}`);this.writeString(a.name),this.writeString(a.value)}this.writeLong(0)}toBuffer(){let t=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(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e=this.buf,r,a;if(t>=-1073741824&&t<1073741824){a=t>=0?t<<1:~t<<1|1;do e[this.pos]=a&127,a>>=7;while(a&&(e[this.pos++]|=128))}else{r=t>=0?t*2:-t*2-1;do e[this.pos]=r&127,r/=128;while(r>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(t){let e=ge.byteLength(t),r=this.buf;this.writeLong(e);let a=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let i,h,c,d;for(i=0,h=e;i<h;i++)c=t.charCodeAt(i),c<128?r[a++]=c:c<2048?(r[a++]=c>>6|192,r[a++]=c&63|128):(c&64512)===55296&&((d=t.charCodeAt(i+1))&64512)===56320?(c=65536+((c&1023)<<10)+(d&1023),i++,r[a++]=c>>18|240,r[a++]=c>>12&63|128,r[a++]=c>>6&63|128,r[a++]=c&63|128):(r[a++]=c>>12|224,r[a++]=c>>6&63|128,r[a++]=c&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,a,i,h,c;do a=r[this.pos++],i=a&128,t|=(a&127)<<e,e+=7;while(i&&e<28);if(i){h=t,c=268435456;do a=r[this.pos++],h+=(a&127)*c,c*=128;while(a&128);return(h%2?-(h+1):h)/2}return t>>1^-(t&1)}skipLong(){let t=this.buf;for(;t[this.pos++]&128;);}readTags(){let t=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let r=this.readString(),a=this.readString();t.push({name:r,value:a})}return t}readString(){let t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.slice(e,e+t).toString()}};function hO(t){let e=new Sb;return e.writeTags(t),e.toBuffer()}function qfe(t){let e=new Sb;return e.writeTags(t),e.tagsExceedLimit()}function Fw(t){return new Sb(t).readTags()}function Ml(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function fUe(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;r<e.length;r++){let a=t&255;e[r]=a,t=(t-a)/256}return Uint8Array.from(e)}function ise(t){let e=[0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++){let a=t&255;e[r]=a,t=(t-a)/256}return Uint8Array.from(e)}var uUe=Ld(tUe(),1),Y1=Ld(LB(),1),Jw=4096,cO=80,yb=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return t.binary!==void 0}get signatureType(){let t=Ml(this.binary.subarray(0,2));if($s?.[t]!==void 0)return t;throw new Error("Unknown signature type: "+t)}async isValid(){return yb.verify(this.binary)}get id(){return(async()=>Hu.default.encode(await this.rawId))()}set id(t){this._id=Hu.default.toBuffer(t)}get rawId(){return(async()=>Y1.Buffer.from(await uUe.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Hu.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return mv[this.signatureType].sigLength}get owner(){return Hu.default.encode(this.rawOwner)}get ownerLength(){return mv[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):Y1.Buffer.alloc(0)}get target(){return Hu.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):Y1.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Ml(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(Ml(this.binary.subarray(t,t+8))==0)return[];let e=Ml(this.binary.subarray(t+8,t+16));return Fw(Y1.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:Hu.default.encode(t.name),value:Hu.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=Ml(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=Ml(e),a=t+16+r;return this.binary.subarray(a,this.binary.length)}get data(){return Hu.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await sUe(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=Y1.Buffer.from(await Jh().hash(t))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(t=>({name:Hu.default.encode(t.name),value:Hu.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLength<cO)return!1;let e=new yb(t),r=e.signatureType,a=e.getTagsStart(),i=Ml(t.subarray(a,a+8)),h=t.subarray(a+8,a+16),c=Ml(h);if(c>Jw)return!1;if(i>0)try{if(Fw(Y1.Buffer.from(t.subarray(a+16,a+16+c))).length!==i)return!1}catch{return!1}let d=uO[r],b=await DB(e);return await d.verify(e.rawOwner,b,e.rawSignature)}async getSignatureData(){return DB(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),a=this.binary[r]==1;return r+=a?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return t+=e?32:0,t}},hUe=Ld(sO(),1);function Ffe(t,e,r){let a=e.publicKey,i=r?.target?hUe.default.toBuffer(r.target):null,h=1+(i?.byteLength??0),c=r?.anchor?ge.from(r.anchor):null,d=1+(c?.byteLength??0),b=(r?.tags?.length??0)>0?hO(r.tags):null,g=16+(b?b.byteLength:0),y=ge.from(t),M=y.byteLength,x=2+e.signatureLength+e.ownerLength+h+d+g+M,E=ge.alloc(x);if(E.set(fUe(e.signatureType),0),E.set(new Uint8Array(e.signatureLength).fill(0),2),a.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${a.byteLength}`);E.set(a,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(E[A]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);E.set(i,A+1)}let k=A+h,O=k+1;if(E[k]=c?1:0,c){if(O+=c.byteLength,c.byteLength!==32)throw new Error("Anchor must be 32 bytes");E.set(c,k+1)}E.set(ise(r?.tags?.length??0),O);let N=ise(b?.byteLength??0);E.set(N,O+8),b&&E.set(b,O+16);let L=O+g;return E.set(y,L),new yb(E)}var lO={...Lfe};globalThis.arbundles??=lO;var cUe=lO,lUe=lO;globalThis.Buffer||(globalThis.Buffer=Ofe.Buffer);var{DataItem:dUe}=Pfe;function pUe(t){return async({data:r,tags:a,target:i,anchor:h,createDataItem:c=d=>new dUe(d)})=>{let d=await t.signDataItem({data:r,tags:a,target:i,anchor:h}),b=c(Ofe.Buffer.from(d));return{id:await b.id,raw:await b.getRaw()}}}var vUe=globalThis.GATEWAY_URL||void 0,mUe=globalThis.MU_URL||void 0,gUe=globalThis.CU_URL||void 0,bUe=globalThis.GRAPHQL_URL||void 0,{result:Pbt,results:Nbt,message:Cbt,spawn:Lbt,monitor:Dbt,unmonitor:$bt,dryrun:Ubt,assign:qbt}=gv({GATEWAY_URL:vUe,MU_URL:mUe,CU_URL:gUe,GRAPHQL_URL:bUe}),jfe=Bfe.createDataItemSigner;X();ee();Q();var li;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let h={};for(let c of i)h[c]=c;return h},t.getValidEnumValues=i=>{let h=t.objectKeys(i).filter(d=>typeof i[i[d]]!="number"),c={};for(let d of h)c[d]=i[d];return t.objectValues(c)},t.objectValues=i=>t.objectKeys(i).map(function(h){return i[h]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let h=[];for(let c in i)Object.prototype.hasOwnProperty.call(i,c)&&h.push(c);return h},t.find=(i,h)=>{for(let c of i)if(h(c))return c},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function a(i,h=" | "){return i.map(c=>typeof c=="string"?`'${c}'`:c).join(h)}t.joinValues=a,t.jsonStringifyReplacer=(i,h)=>typeof h=="bigint"?h.toString():h})(li||(li={}));var pO;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(pO||(pO={}));var Qt=li.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ol=t=>{switch(typeof t){case"undefined":return Qt.undefined;case"string":return Qt.string;case"number":return isNaN(t)?Qt.nan:Qt.number;case"boolean":return Qt.boolean;case"function":return Qt.function;case"bigint":return Qt.bigint;case"symbol":return Qt.symbol;case"object":return Array.isArray(t)?Qt.array:t===null?Qt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Qt.promise:typeof Map<"u"&&t instanceof Map?Qt.map:typeof Set<"u"&&t instanceof Set?Qt.set:typeof Date<"u"&&t instanceof Date?Qt.date:Qt.object;default:return Qt.unknown}},Nt=li.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),yUe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),$o=class t extends Error{constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(h){return h.message},a={_errors:[]},i=h=>{for(let c of h.issues)if(c.code==="invalid_union")c.unionErrors.map(i);else if(c.code==="invalid_return_type")i(c.returnTypeError);else if(c.code==="invalid_arguments")i(c.argumentsError);else if(c.path.length===0)a._errors.push(r(c));else{let d=a,b=0;for(;b<c.path.length;){let g=c.path[b];b===c.path.length-1?(d[g]=d[g]||{_errors:[]},d[g]._errors.push(r(c))):d[g]=d[g]||{_errors:[]},d=d[g],b++}}};return i(this),a}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,li.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},a=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):a.push(e(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};$o.create=t=>new $o(t);var wv=(t,e)=>{let r;switch(t.code){case Nt.invalid_type:t.received===Qt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Nt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,li.jsonStringifyReplacer)}`;break;case Nt.unrecognized_keys:r=`Unrecognized key(s) in object: ${li.joinValues(t.keys,", ")}`;break;case Nt.invalid_union:r="Invalid input";break;case Nt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${li.joinValues(t.options)}`;break;case Nt.invalid_enum_value:r=`Invalid enum value. Expected ${li.joinValues(t.options)}, received '${t.received}'`;break;case Nt.invalid_arguments:r="Invalid function arguments";break;case Nt.invalid_return_type:r="Invalid function return type";break;case Nt.invalid_date:r="Invalid date";break;case Nt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:li.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Nt.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Nt.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Nt.custom:r="Invalid input";break;case Nt.invalid_intersection_types:r="Intersection results could not be merged";break;case Nt.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Nt.not_finite:r="Number must be finite";break;default:r=e.defaultError,li.assertNever(t)}return{message:r}},Zfe=wv;function wUe(t){Zfe=t}function Xw(){return Zfe}var Qw=t=>{let{data:e,path:r,errorMaps:a,issueData:i}=t,h=[...r,...i.path||[]],c={...i,path:h};if(i.message!==void 0)return{...i,path:h,message:i.message};let d="",b=a.filter(g=>!!g).slice().reverse();for(let g of b)d=g(c,{data:e,defaultError:d}).message;return{...i,path:h,message:d}},_Ue=[];function Yt(t,e){let r=Xw(),a=Qw({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===wv?void 0:wv].filter(i=>!!i)});t.common.issues.push(a)}var Ca=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let a=[];for(let i of r){if(i.status==="aborted")return mr;i.status==="dirty"&&e.dirty(),a.push(i.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,r){let a=[];for(let i of r){let h=await i.key,c=await i.value;a.push({key:h,value:c})}return t.mergeObjectSync(e,a)}static mergeObjectSync(e,r){let a={};for(let i of r){let{key:h,value:c}=i;if(h.status==="aborted"||c.status==="aborted")return mr;h.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),h.value!=="__proto__"&&(typeof c.value<"u"||i.alwaysSet)&&(a[h.value]=c.value)}return{status:e.value,value:a}}},mr=Object.freeze({status:"aborted"}),yv=t=>({status:"dirty",value:t}),Va=t=>({status:"valid",value:t}),vO=t=>t.status==="aborted",mO=t=>t.status==="dirty",Rb=t=>t.status==="valid",Tb=t=>typeof Promise<"u"&&t instanceof Promise;function e5(t,e,r,a){if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?a:r==="a"?a.call(t):a?a.value:e.get(t)}function Kfe(t,e,r,a,i){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}var ar;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ar||(ar={}));var Eb,Ab,Zs=class{constructor(e,r,a,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=a,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},zfe=(t,e)=>{if(Rb(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new $o(t.common.issues);return this._error=r,this._error}}};function Nr(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:i}=t;if(e&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(c,d)=>{var b,g;let{message:y}=t;return c.code==="invalid_enum_value"?{message:y??d.defaultError}:typeof d.data>"u"?{message:(b=y??a)!==null&&b!==void 0?b:d.defaultError}:c.code!=="invalid_type"?{message:d.defaultError}:{message:(g=y??r)!==null&&g!==void 0?g:d.defaultError}},description:i}}var Cr=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Ol(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ol(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ca,ctx:{common:e.parent.common,data:e.data,parsedType:Ol(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Tb(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let a=this.safeParse(e,r);if(a.success)return a.data;throw a.error}safeParse(e,r){var a;let i={common:{issues:[],async:(a=r?.async)!==null&&a!==void 0?a:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ol(e)},h=this._parseSync({data:e,path:i.path,parent:i});return zfe(i,h)}async parseAsync(e,r){let a=await this.safeParseAsync(e,r);if(a.success)return a.data;throw a.error}async safeParseAsync(e,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ol(e)},i=this._parse({data:e,path:a.path,parent:a}),h=await(Tb(i)?i:Promise.resolve(i));return zfe(a,h)}refine(e,r){let a=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,h)=>{let c=e(i),d=()=>h.addIssue({code:Nt.custom,...a(i)});return typeof Promise<"u"&&c instanceof Promise?c.then(b=>b?!0:(d(),!1)):c?!0:(d(),!1)})}refinement(e,r){return this._refinement((a,i)=>e(a)?!0:(i.addIssue(typeof r=="function"?r(a,i):r),!1))}_refinement(e){return new Uo({schema:this,typeName:pr.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Hs.create(this,this._def)}nullable(){return Ju.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nc.create(this,this._def)}promise(){return Cl.create(this,this._def)}or(e){return zd.create([this,e],this._def)}and(e){return Hd.create(this,e,this._def)}transform(e){return new Uo({...Nr(this._def),schema:this,typeName:pr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Gd({...Nr(this._def),innerType:this,defaultValue:r,typeName:pr.ZodDefault})}brand(){return new kb({typeName:pr.ZodBranded,type:this,...Nr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Yd({...Nr(this._def),innerType:this,catchValue:r,typeName:pr.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ib.create(this,e)}readonly(){return Jd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},MUe=/^c[^\s-]{8,}$/i,xUe=/^[0-9a-z]+$/,SUe=/^[0-9A-HJKMNP-TV-Z]{26}$/,EUe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,AUe=/^[a-z0-9_-]{21}$/i,RUe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,TUe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kUe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dO,IUe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,BUe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,OUe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wfe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",PUe=new RegExp(`^${Wfe}$`);function Vfe(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function NUe(t){return new RegExp(`^${Vfe(t)}$`)}function Gfe(t){let e=`${Wfe}T${Vfe(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function CUe(t,e){return!!((e==="v4"||!e)&&IUe.test(t)||(e==="v6"||!e)&&BUe.test(t))}var Pl=class t extends Cr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Qt.string){let h=this._getOrReturnCtx(e);return Yt(h,{code:Nt.invalid_type,expected:Qt.string,received:h.parsedType}),mr}let a=new Ca,i;for(let h of this._def.checks)if(h.kind==="min")e.data.length<h.value&&(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.too_small,minimum:h.value,type:"string",inclusive:!0,exact:!1,message:h.message}),a.dirty());else if(h.kind==="max")e.data.length>h.value&&(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.too_big,maximum:h.value,type:"string",inclusive:!0,exact:!1,message:h.message}),a.dirty());else if(h.kind==="length"){let c=e.data.length>h.value,d=e.data.length<h.value;(c||d)&&(i=this._getOrReturnCtx(e,i),c?Yt(i,{code:Nt.too_big,maximum:h.value,type:"string",inclusive:!0,exact:!0,message:h.message}):d&&Yt(i,{code:Nt.too_small,minimum:h.value,type:"string",inclusive:!0,exact:!0,message:h.message}),a.dirty())}else if(h.kind==="email")TUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"email",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="emoji")dO||(dO=new RegExp(kUe,"u")),dO.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"emoji",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="uuid")EUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"uuid",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="nanoid")AUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"nanoid",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="cuid")MUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"cuid",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="cuid2")xUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"cuid2",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="ulid")SUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"ulid",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Yt(i,{validation:"url",code:Nt.invalid_string,message:h.message}),a.dirty()}else h.kind==="regex"?(h.regex.lastIndex=0,h.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"regex",code:Nt.invalid_string,message:h.message}),a.dirty())):h.kind==="trim"?e.data=e.data.trim():h.kind==="includes"?e.data.includes(h.value,h.position)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:{includes:h.value,position:h.position},message:h.message}),a.dirty()):h.kind==="toLowerCase"?e.data=e.data.toLowerCase():h.kind==="toUpperCase"?e.data=e.data.toUpperCase():h.kind==="startsWith"?e.data.startsWith(h.value)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:{startsWith:h.value},message:h.message}),a.dirty()):h.kind==="endsWith"?e.data.endsWith(h.value)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:{endsWith:h.value},message:h.message}),a.dirty()):h.kind==="datetime"?Gfe(h).test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:"datetime",message:h.message}),a.dirty()):h.kind==="date"?PUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:"date",message:h.message}),a.dirty()):h.kind==="time"?NUe(h).test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:"time",message:h.message}),a.dirty()):h.kind==="duration"?RUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"duration",code:Nt.invalid_string,message:h.message}),a.dirty()):h.kind==="ip"?CUe(e.data,h.version)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"ip",code:Nt.invalid_string,message:h.message}),a.dirty()):h.kind==="base64"?OUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"base64",code:Nt.invalid_string,message:h.message}),a.dirty()):li.assertNever(h);return{status:a.value,value:e.data}}_regex(e,r,a){return this.refinement(i=>e.test(i),{validation:r,code:Nt.invalid_string,...ar.errToObj(a)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ar.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ar.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ar.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ar.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ar.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ar.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ar.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ar.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ar.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ar.errToObj(e)})}datetime(e){var r,a;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(a=e?.local)!==null&&a!==void 0?a:!1,...ar.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ar.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ar.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ar.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ar.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ar.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ar.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ar.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ar.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ar.errToObj(r)})}nonempty(e){return this.min(1,ar.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Pl.create=t=>{var e;return new Pl({checks:[],typeName:pr.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Nr(t)})};function LUe(t,e){let r=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,i=r>a?r:a,h=parseInt(t.toFixed(i).replace(".","")),c=parseInt(e.toFixed(i).replace(".",""));return h%c/Math.pow(10,i)}var Dd=class t extends Cr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Qt.number){let h=this._getOrReturnCtx(e);return Yt(h,{code:Nt.invalid_type,expected:Qt.number,received:h.parsedType}),mr}let a,i=new Ca;for(let h of this._def.checks)h.kind==="int"?li.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.invalid_type,expected:"integer",received:"float",message:h.message}),i.dirty()):h.kind==="min"?(h.inclusive?e.data<h.value:e.data<=h.value)&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.too_small,minimum:h.value,type:"number",inclusive:h.inclusive,exact:!1,message:h.message}),i.dirty()):h.kind==="max"?(h.inclusive?e.data>h.value:e.data>=h.value)&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.too_big,maximum:h.value,type:"number",inclusive:h.inclusive,exact:!1,message:h.message}),i.dirty()):h.kind==="multipleOf"?LUe(e.data,h.value)!==0&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.not_multiple_of,multipleOf:h.value,message:h.message}),i.dirty()):h.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.not_finite,message:h.message}),i.dirty()):li.assertNever(h);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ar.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ar.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ar.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ar.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:ar.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ar.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ar.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ar.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ar.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ar.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ar.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ar.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ar.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ar.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&li.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Dd.create=t=>new Dd({checks:[],typeName:pr.ZodNumber,coerce:t?.coerce||!1,...Nr(t)});var $d=class t extends Cr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Qt.bigint){let h=this._getOrReturnCtx(e);return Yt(h,{code:Nt.invalid_type,expected:Qt.bigint,received:h.parsedType}),mr}let a,i=new Ca;for(let h of this._def.checks)h.kind==="min"?(h.inclusive?e.data<h.value:e.data<=h.value)&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.too_small,type:"bigint",minimum:h.value,inclusive:h.inclusive,message:h.message}),i.dirty()):h.kind==="max"?(h.inclusive?e.data>h.value:e.data>=h.value)&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.too_big,type:"bigint",maximum:h.value,inclusive:h.inclusive,message:h.message}),i.dirty()):h.kind==="multipleOf"?e.data%h.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.not_multiple_of,multipleOf:h.value,message:h.message}),i.dirty()):li.assertNever(h);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ar.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ar.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ar.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ar.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:ar.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ar.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ar.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ar.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ar.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ar.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};$d.create=t=>{var e;return new $d({checks:[],typeName:pr.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Nr(t)})};var Ud=class extends Cr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Qt.boolean){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.boolean,received:a.parsedType}),mr}return Va(e.data)}};Ud.create=t=>new Ud({typeName:pr.ZodBoolean,coerce:t?.coerce||!1,...Nr(t)});var qd=class t extends Cr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Qt.date){let h=this._getOrReturnCtx(e);return Yt(h,{code:Nt.invalid_type,expected:Qt.date,received:h.parsedType}),mr}if(isNaN(e.data.getTime())){let h=this._getOrReturnCtx(e);return Yt(h,{code:Nt.invalid_date}),mr}let a=new Ca,i;for(let h of this._def.checks)h.kind==="min"?e.data.getTime()<h.value&&(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.too_small,message:h.message,inclusive:!0,exact:!1,minimum:h.value,type:"date"}),a.dirty()):h.kind==="max"?e.data.getTime()>h.value&&(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.too_big,message:h.message,inclusive:!0,exact:!1,maximum:h.value,type:"date"}),a.dirty()):li.assertNever(h);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ar.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ar.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};qd.create=t=>new qd({checks:[],coerce:t?.coerce||!1,typeName:pr.ZodDate,...Nr(t)});var _v=class extends Cr{_parse(e){if(this._getType(e)!==Qt.symbol){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.symbol,received:a.parsedType}),mr}return Va(e.data)}};_v.create=t=>new _v({typeName:pr.ZodSymbol,...Nr(t)});var Fd=class extends Cr{_parse(e){if(this._getType(e)!==Qt.undefined){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.undefined,received:a.parsedType}),mr}return Va(e.data)}};Fd.create=t=>new Fd({typeName:pr.ZodUndefined,...Nr(t)});var jd=class extends Cr{_parse(e){if(this._getType(e)!==Qt.null){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.null,received:a.parsedType}),mr}return Va(e.data)}};jd.create=t=>new jd({typeName:pr.ZodNull,...Nr(t)});var Nl=class extends Cr{constructor(){super(...arguments),this._any=!0}_parse(e){return Va(e.data)}};Nl.create=t=>new Nl({typeName:pr.ZodAny,...Nr(t)});var ic=class extends Cr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Va(e.data)}};ic.create=t=>new ic({typeName:pr.ZodUnknown,...Nr(t)});var Vf=class extends Cr{_parse(e){let r=this._getOrReturnCtx(e);return Yt(r,{code:Nt.invalid_type,expected:Qt.never,received:r.parsedType}),mr}};Vf.create=t=>new Vf({typeName:pr.ZodNever,...Nr(t)});var Mv=class extends Cr{_parse(e){if(this._getType(e)!==Qt.undefined){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.void,received:a.parsedType}),mr}return Va(e.data)}};Mv.create=t=>new Mv({typeName:pr.ZodVoid,...Nr(t)});var nc=class t extends Cr{_parse(e){let{ctx:r,status:a}=this._processInputParams(e),i=this._def;if(r.parsedType!==Qt.array)return Yt(r,{code:Nt.invalid_type,expected:Qt.array,received:r.parsedType}),mr;if(i.exactLength!==null){let c=r.data.length>i.exactLength.value,d=r.data.length<i.exactLength.value;(c||d)&&(Yt(r,{code:c?Nt.too_big:Nt.too_small,minimum:d?i.exactLength.value:void 0,maximum:c?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Yt(r,{code:Nt.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Yt(r,{code:Nt.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((c,d)=>i.type._parseAsync(new Zs(r,c,r.path,d)))).then(c=>Ca.mergeArray(a,c));let h=[...r.data].map((c,d)=>i.type._parseSync(new Zs(r,c,r.path,d)));return Ca.mergeArray(a,h)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:ar.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:ar.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:ar.toString(r)}})}nonempty(e){return this.min(1,e)}};nc.create=(t,e)=>new nc({type:t,minLength:null,maxLength:null,exactLength:null,typeName:pr.ZodArray,...Nr(e)});function bv(t){if(t instanceof vo){let e={};for(let r in t.shape){let a=t.shape[r];e[r]=Hs.create(bv(a))}return new vo({...t._def,shape:()=>e})}else return t instanceof nc?new nc({...t._def,type:bv(t.element)}):t instanceof Hs?Hs.create(bv(t.unwrap())):t instanceof Ju?Ju.create(bv(t.unwrap())):t instanceof Yu?Yu.create(t.items.map(e=>bv(e))):t}var vo=class t extends Cr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=li.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Qt.object){let g=this._getOrReturnCtx(e);return Yt(g,{code:Nt.invalid_type,expected:Qt.object,received:g.parsedType}),mr}let{status:a,ctx:i}=this._processInputParams(e),{shape:h,keys:c}=this._getCached(),d=[];if(!(this._def.catchall instanceof Vf&&this._def.unknownKeys==="strip"))for(let g in i.data)c.includes(g)||d.push(g);let b=[];for(let g of c){let y=h[g],M=i.data[g];b.push({key:{status:"valid",value:g},value:y._parse(new Zs(i,M,i.path,g)),alwaysSet:g in i.data})}if(this._def.catchall instanceof Vf){let g=this._def.unknownKeys;if(g==="passthrough")for(let y of d)b.push({key:{status:"valid",value:y},value:{status:"valid",value:i.data[y]}});else if(g==="strict")d.length>0&&(Yt(i,{code:Nt.unrecognized_keys,keys:d}),a.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let g=this._def.catchall;for(let y of d){let M=i.data[y];b.push({key:{status:"valid",value:y},value:g._parse(new Zs(i,M,i.path,y)),alwaysSet:y in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let g=[];for(let y of b){let M=await y.key,x=await y.value;g.push({key:M,value:x,alwaysSet:y.alwaysSet})}return g}).then(g=>Ca.mergeObjectSync(a,g)):Ca.mergeObjectSync(a,b)}get shape(){return this._def.shape()}strict(e){return ar.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,a)=>{var i,h,c,d;let b=(c=(h=(i=this._def).errorMap)===null||h===void 0?void 0:h.call(i,r,a).message)!==null&&c!==void 0?c:a.defaultError;return r.code==="unrecognized_keys"?{message:(d=ar.errToObj(e).message)!==null&&d!==void 0?d:b}:{message:b}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:pr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return li.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(r[a]=this.shape[a])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return li.objectKeys(this.shape).forEach(a=>{e[a]||(r[a]=this.shape[a])}),new t({...this._def,shape:()=>r})}deepPartial(){return bv(this)}partial(e){let r={};return li.objectKeys(this.shape).forEach(a=>{let i=this.shape[a];e&&!e[a]?r[a]=i:r[a]=i.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return li.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])r[a]=this.shape[a];else{let h=this.shape[a];for(;h instanceof Hs;)h=h._def.innerType;r[a]=h}}),new t({...this._def,shape:()=>r})}keyof(){return Yfe(li.objectKeys(this.shape))}};vo.create=(t,e)=>new vo({shape:()=>t,unknownKeys:"strip",catchall:Vf.create(),typeName:pr.ZodObject,...Nr(e)});vo.strictCreate=(t,e)=>new vo({shape:()=>t,unknownKeys:"strict",catchall:Vf.create(),typeName:pr.ZodObject,...Nr(e)});vo.lazycreate=(t,e)=>new vo({shape:t,unknownKeys:"strip",catchall:Vf.create(),typeName:pr.ZodObject,...Nr(e)});var zd=class extends Cr{_parse(e){let{ctx:r}=this._processInputParams(e),a=this._def.options;function i(h){for(let d of h)if(d.result.status==="valid")return d.result;for(let d of h)if(d.result.status==="dirty")return r.common.issues.push(...d.ctx.common.issues),d.result;let c=h.map(d=>new $o(d.ctx.common.issues));return Yt(r,{code:Nt.invalid_union,unionErrors:c}),mr}if(r.common.async)return Promise.all(a.map(async h=>{let c={...r,common:{...r.common,issues:[]},parent:null};return{result:await h._parseAsync({data:r.data,path:r.path,parent:c}),ctx:c}})).then(i);{let h,c=[];for(let b of a){let g={...r,common:{...r.common,issues:[]},parent:null},y=b._parseSync({data:r.data,path:r.path,parent:g});if(y.status==="valid")return y;y.status==="dirty"&&!h&&(h={result:y,ctx:g}),g.common.issues.length&&c.push(g.common.issues)}if(h)return r.common.issues.push(...h.ctx.common.issues),h.result;let d=c.map(b=>new $o(b));return Yt(r,{code:Nt.invalid_union,unionErrors:d}),mr}}get options(){return this._def.options}};zd.create=(t,e)=>new zd({options:t,typeName:pr.ZodUnion,...Nr(e)});var rc=t=>t instanceof Zd?rc(t.schema):t instanceof Uo?rc(t.innerType()):t instanceof Kd?[t.value]:t instanceof Wd?t.options:t instanceof Vd?li.objectValues(t.enum):t instanceof Gd?rc(t._def.innerType):t instanceof Fd?[void 0]:t instanceof jd?[null]:t instanceof Hs?[void 0,...rc(t.unwrap())]:t instanceof Ju?[null,...rc(t.unwrap())]:t instanceof kb||t instanceof Jd?rc(t.unwrap()):t instanceof Yd?rc(t._def.innerType):[],t5=class t extends Cr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Qt.object)return Yt(r,{code:Nt.invalid_type,expected:Qt.object,received:r.parsedType}),mr;let a=this.discriminator,i=r.data[a],h=this.optionsMap.get(i);return h?r.common.async?h._parseAsync({data:r.data,path:r.path,parent:r}):h._parseSync({data:r.data,path:r.path,parent:r}):(Yt(r,{code:Nt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),mr)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,a){let i=new Map;for(let h of r){let c=rc(h.shape[e]);if(!c.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let d of c){if(i.has(d))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);i.set(d,h)}}return new t({typeName:pr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Nr(a)})}};function gO(t,e){let r=Ol(t),a=Ol(e);if(t===e)return{valid:!0,data:t};if(r===Qt.object&&a===Qt.object){let i=li.objectKeys(e),h=li.objectKeys(t).filter(d=>i.indexOf(d)!==-1),c={...t,...e};for(let d of h){let b=gO(t[d],e[d]);if(!b.valid)return{valid:!1};c[d]=b.data}return{valid:!0,data:c}}else if(r===Qt.array&&a===Qt.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let h=0;h<t.length;h++){let c=t[h],d=e[h],b=gO(c,d);if(!b.valid)return{valid:!1};i.push(b.data)}return{valid:!0,data:i}}else return r===Qt.date&&a===Qt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Hd=class extends Cr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e),i=(h,c)=>{if(vO(h)||vO(c))return mr;let d=gO(h.value,c.value);return d.valid?((mO(h)||mO(c))&&r.dirty(),{status:r.value,value:d.data}):(Yt(a,{code:Nt.invalid_intersection_types}),mr)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([h,c])=>i(h,c)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Hd.create=(t,e,r)=>new Hd({left:t,right:e,typeName:pr.ZodIntersection,...Nr(r)});var Yu=class t extends Cr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Qt.array)return Yt(a,{code:Nt.invalid_type,expected:Qt.array,received:a.parsedType}),mr;if(a.data.length<this._def.items.length)return Yt(a,{code:Nt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),mr;!this._def.rest&&a.data.length>this._def.items.length&&(Yt(a,{code:Nt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let h=[...a.data].map((c,d)=>{let b=this._def.items[d]||this._def.rest;return b?b._parse(new Zs(a,c,a.path,d)):null}).filter(c=>!!c);return a.common.async?Promise.all(h).then(c=>Ca.mergeArray(r,c)):Ca.mergeArray(r,h)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Yu.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Yu({items:t,typeName:pr.ZodTuple,rest:null,...Nr(e)})};var r5=class t extends Cr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Qt.object)return Yt(a,{code:Nt.invalid_type,expected:Qt.object,received:a.parsedType}),mr;let i=[],h=this._def.keyType,c=this._def.valueType;for(let d in a.data)i.push({key:h._parse(new Zs(a,d,a.path,d)),value:c._parse(new Zs(a,a.data[d],a.path,d)),alwaysSet:d in a.data});return a.common.async?Ca.mergeObjectAsync(r,i):Ca.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,a){return r instanceof Cr?new t({keyType:e,valueType:r,typeName:pr.ZodRecord,...Nr(a)}):new t({keyType:Pl.create(),valueType:e,typeName:pr.ZodRecord,...Nr(r)})}},xv=class extends Cr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Qt.map)return Yt(a,{code:Nt.invalid_type,expected:Qt.map,received:a.parsedType}),mr;let i=this._def.keyType,h=this._def.valueType,c=[...a.data.entries()].map(([d,b],g)=>({key:i._parse(new Zs(a,d,a.path,[g,"key"])),value:h._parse(new Zs(a,b,a.path,[g,"value"]))}));if(a.common.async){let d=new Map;return Promise.resolve().then(async()=>{for(let b of c){let g=await b.key,y=await b.value;if(g.status==="aborted"||y.status==="aborted")return mr;(g.status==="dirty"||y.status==="dirty")&&r.dirty(),d.set(g.value,y.value)}return{status:r.value,value:d}})}else{let d=new Map;for(let b of c){let g=b.key,y=b.value;if(g.status==="aborted"||y.status==="aborted")return mr;(g.status==="dirty"||y.status==="dirty")&&r.dirty(),d.set(g.value,y.value)}return{status:r.value,value:d}}}};xv.create=(t,e,r)=>new xv({valueType:e,keyType:t,typeName:pr.ZodMap,...Nr(r)});var Sv=class t extends Cr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Qt.set)return Yt(a,{code:Nt.invalid_type,expected:Qt.set,received:a.parsedType}),mr;let i=this._def;i.minSize!==null&&a.data.size<i.minSize.value&&(Yt(a,{code:Nt.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&a.data.size>i.maxSize.value&&(Yt(a,{code:Nt.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let h=this._def.valueType;function c(b){let g=new Set;for(let y of b){if(y.status==="aborted")return mr;y.status==="dirty"&&r.dirty(),g.add(y.value)}return{status:r.value,value:g}}let d=[...a.data.values()].map((b,g)=>h._parse(new Zs(a,b,a.path,g)));return a.common.async?Promise.all(d).then(b=>c(b)):c(d)}min(e,r){return new t({...this._def,minSize:{value:e,message:ar.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:ar.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Sv.create=(t,e)=>new Sv({valueType:t,minSize:null,maxSize:null,typeName:pr.ZodSet,...Nr(e)});var i5=class t extends Cr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Qt.function)return Yt(r,{code:Nt.invalid_type,expected:Qt.function,received:r.parsedType}),mr;function a(d,b){return Qw({data:d,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Xw(),wv].filter(g=>!!g),issueData:{code:Nt.invalid_arguments,argumentsError:b}})}function i(d,b){return Qw({data:d,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Xw(),wv].filter(g=>!!g),issueData:{code:Nt.invalid_return_type,returnTypeError:b}})}let h={errorMap:r.common.contextualErrorMap},c=r.data;if(this._def.returns instanceof Cl){let d=this;return Va(async function(...b){let g=new $o([]),y=await d._def.args.parseAsync(b,h).catch(E=>{throw g.addIssue(a(b,E)),g}),M=await Reflect.apply(c,this,y);return await d._def.returns._def.type.parseAsync(M,h).catch(E=>{throw g.addIssue(i(M,E)),g})})}else{let d=this;return Va(function(...b){let g=d._def.args.safeParse(b,h);if(!g.success)throw new $o([a(b,g.error)]);let y=Reflect.apply(c,this,g.data),M=d._def.returns.safeParse(y,h);if(!M.success)throw new $o([i(y,M.error)]);return M.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Yu.create(e).rest(ic.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,a){return new t({args:e||Yu.create([]).rest(ic.create()),returns:r||ic.create(),typeName:pr.ZodFunction,...Nr(a)})}},Zd=class extends Cr{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Zd.create=(t,e)=>new Zd({getter:t,typeName:pr.ZodLazy,...Nr(e)});var Kd=class extends Cr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Yt(r,{received:r.data,code:Nt.invalid_literal,expected:this._def.value}),mr}return{status:"valid",value:e.data}}get value(){return this._def.value}};Kd.create=(t,e)=>new Kd({value:t,typeName:pr.ZodLiteral,...Nr(e)});function Yfe(t,e){return new Wd({values:t,typeName:pr.ZodEnum,...Nr(e)})}var Wd=class t extends Cr{constructor(){super(...arguments),Eb.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),a=this._def.values;return Yt(r,{expected:li.joinValues(a),received:r.parsedType,code:Nt.invalid_type}),mr}if(e5(this,Eb,"f")||Kfe(this,Eb,new Set(this._def.values),"f"),!e5(this,Eb,"f").has(e.data)){let r=this._getOrReturnCtx(e),a=this._def.values;return Yt(r,{received:r.data,code:Nt.invalid_enum_value,options:a}),mr}return Va(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(a=>!e.includes(a)),{...this._def,...r})}};Eb=new WeakMap;Wd.create=Yfe;var Vd=class extends Cr{constructor(){super(...arguments),Ab.set(this,void 0)}_parse(e){let r=li.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==Qt.string&&a.parsedType!==Qt.number){let i=li.objectValues(r);return Yt(a,{expected:li.joinValues(i),received:a.parsedType,code:Nt.invalid_type}),mr}if(e5(this,Ab,"f")||Kfe(this,Ab,new Set(li.getValidEnumValues(this._def.values)),"f"),!e5(this,Ab,"f").has(e.data)){let i=li.objectValues(r);return Yt(a,{received:a.data,code:Nt.invalid_enum_value,options:i}),mr}return Va(e.data)}get enum(){return this._def.values}};Ab=new WeakMap;Vd.create=(t,e)=>new Vd({values:t,typeName:pr.ZodNativeEnum,...Nr(e)});var Cl=class extends Cr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Qt.promise&&r.common.async===!1)return Yt(r,{code:Nt.invalid_type,expected:Qt.promise,received:r.parsedType}),mr;let a=r.parsedType===Qt.promise?r.data:Promise.resolve(r.data);return Va(a.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Cl.create=(t,e)=>new Cl({type:t,typeName:pr.ZodPromise,...Nr(e)});var Uo=class extends Cr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===pr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:a}=this._processInputParams(e),i=this._def.effect||null,h={addIssue:c=>{Yt(a,c),c.fatal?r.abort():r.dirty()},get path(){return a.path}};if(h.addIssue=h.addIssue.bind(h),i.type==="preprocess"){let c=i.transform(a.data,h);if(a.common.async)return Promise.resolve(c).then(async d=>{if(r.value==="aborted")return mr;let b=await this._def.schema._parseAsync({data:d,path:a.path,parent:a});return b.status==="aborted"?mr:b.status==="dirty"||r.value==="dirty"?yv(b.value):b});{if(r.value==="aborted")return mr;let d=this._def.schema._parseSync({data:c,path:a.path,parent:a});return d.status==="aborted"?mr:d.status==="dirty"||r.value==="dirty"?yv(d.value):d}}if(i.type==="refinement"){let c=d=>{let b=i.refinement(d,h);if(a.common.async)return Promise.resolve(b);if(b instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(a.common.async===!1){let d=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return d.status==="aborted"?mr:(d.status==="dirty"&&r.dirty(),c(d.value),{status:r.value,value:d.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(d=>d.status==="aborted"?mr:(d.status==="dirty"&&r.dirty(),c(d.value).then(()=>({status:r.value,value:d.value}))))}if(i.type==="transform")if(a.common.async===!1){let c=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Rb(c))return c;let d=i.transform(c.value,h);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:d}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(c=>Rb(c)?Promise.resolve(i.transform(c.value,h)).then(d=>({status:r.value,value:d})):c);li.assertNever(i)}};Uo.create=(t,e,r)=>new Uo({schema:t,typeName:pr.ZodEffects,effect:e,...Nr(r)});Uo.createWithPreprocess=(t,e,r)=>new Uo({schema:e,effect:{type:"preprocess",transform:t},typeName:pr.ZodEffects,...Nr(r)});var Hs=class extends Cr{_parse(e){return this._getType(e)===Qt.undefined?Va(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Hs.create=(t,e)=>new Hs({innerType:t,typeName:pr.ZodOptional,...Nr(e)});var Ju=class extends Cr{_parse(e){return this._getType(e)===Qt.null?Va(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ju.create=(t,e)=>new Ju({innerType:t,typeName:pr.ZodNullable,...Nr(e)});var Gd=class extends Cr{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return r.parsedType===Qt.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Gd.create=(t,e)=>new Gd({innerType:t,typeName:pr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Nr(e)});var Yd=class extends Cr{_parse(e){let{ctx:r}=this._processInputParams(e),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Tb(i)?i.then(h=>({status:"valid",value:h.status==="valid"?h.value:this._def.catchValue({get error(){return new $o(a.common.issues)},input:a.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new $o(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Yd.create=(t,e)=>new Yd({innerType:t,typeName:pr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Nr(e)});var Ev=class extends Cr{_parse(e){if(this._getType(e)!==Qt.nan){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.nan,received:a.parsedType}),mr}return{status:"valid",value:e.data}}};Ev.create=t=>new Ev({typeName:pr.ZodNaN,...Nr(t)});var DUe=Symbol("zod_brand"),kb=class extends Cr{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},Ib=class t extends Cr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let h=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return h.status==="aborted"?mr:h.status==="dirty"?(r.dirty(),yv(h.value)):this._def.out._parseAsync({data:h.value,path:a.path,parent:a})})();{let i=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?mr:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:a.path,parent:a})}}static create(e,r){return new t({in:e,out:r,typeName:pr.ZodPipeline})}},Jd=class extends Cr{_parse(e){let r=this._def.innerType._parse(e),a=i=>(Rb(i)&&(i.value=Object.freeze(i.value)),i);return Tb(r)?r.then(i=>a(i)):a(r)}unwrap(){return this._def.innerType}};Jd.create=(t,e)=>new Jd({innerType:t,typeName:pr.ZodReadonly,...Nr(e)});function Jfe(t,e={},r){return t?Nl.create().superRefine((a,i)=>{var h,c;if(!t(a)){let d=typeof e=="function"?e(a):typeof e=="string"?{message:e}:e,b=(c=(h=d.fatal)!==null&&h!==void 0?h:r)!==null&&c!==void 0?c:!0,g=typeof d=="string"?{message:d}:d;i.addIssue({code:"custom",...g,fatal:b})}}):Nl.create()}var $Ue={object:vo.lazycreate},pr;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(pr||(pr={}));var UUe=(t,e={message:`Input not instance of ${t.name}`})=>Jfe(r=>r instanceof t,e),Xfe=Pl.create,Qfe=Dd.create,qUe=Ev.create,FUe=$d.create,eue=Ud.create,jUe=qd.create,zUe=_v.create,HUe=Fd.create,ZUe=jd.create,KUe=Nl.create,WUe=ic.create,VUe=Vf.create,GUe=Mv.create,YUe=nc.create,JUe=vo.create,XUe=vo.strictCreate,QUe=zd.create,eqe=t5.create,tqe=Hd.create,rqe=Yu.create,iqe=r5.create,nqe=xv.create,aqe=Sv.create,oqe=i5.create,sqe=Zd.create,fqe=Kd.create,uqe=Wd.create,hqe=Vd.create,cqe=Cl.create,Hfe=Uo.create,lqe=Hs.create,dqe=Ju.create,pqe=Uo.createWithPreprocess,vqe=Ib.create,mqe=()=>Xfe().optional(),gqe=()=>Qfe().optional(),bqe=()=>eue().optional(),yqe={string:t=>Pl.create({...t,coerce:!0}),number:t=>Dd.create({...t,coerce:!0}),boolean:t=>Ud.create({...t,coerce:!0}),bigint:t=>$d.create({...t,coerce:!0}),date:t=>qd.create({...t,coerce:!0})},wqe=mr,yi=Object.freeze({__proto__:null,defaultErrorMap:wv,setErrorMap:wUe,getErrorMap:Xw,makeIssue:Qw,EMPTY_PATH:_Ue,addIssueToContext:Yt,ParseStatus:Ca,INVALID:mr,DIRTY:yv,OK:Va,isAborted:vO,isDirty:mO,isValid:Rb,isAsync:Tb,get util(){return li},get objectUtil(){return pO},ZodParsedType:Qt,getParsedType:Ol,ZodType:Cr,datetimeRegex:Gfe,ZodString:Pl,ZodNumber:Dd,ZodBigInt:$d,ZodBoolean:Ud,ZodDate:qd,ZodSymbol:_v,ZodUndefined:Fd,ZodNull:jd,ZodAny:Nl,ZodUnknown:ic,ZodNever:Vf,ZodVoid:Mv,ZodArray:nc,ZodObject:vo,ZodUnion:zd,ZodDiscriminatedUnion:t5,ZodIntersection:Hd,ZodTuple:Yu,ZodRecord:r5,ZodMap:xv,ZodSet:Sv,ZodFunction:i5,ZodLazy:Zd,ZodLiteral:Kd,ZodEnum:Wd,ZodNativeEnum:Vd,ZodPromise:Cl,ZodEffects:Uo,ZodTransformer:Uo,ZodOptional:Hs,ZodNullable:Ju,ZodDefault:Gd,ZodCatch:Yd,ZodNaN:Ev,BRAND:DUe,ZodBranded:kb,ZodPipeline:Ib,ZodReadonly:Jd,custom:Jfe,Schema:Cr,ZodSchema:Cr,late:$Ue,get ZodFirstPartyTypeKind(){return pr},coerce:yqe,any:KUe,array:YUe,bigint:FUe,boolean:eue,date:jUe,discriminatedUnion:eqe,effect:Hfe,enum:uqe,function:oqe,instanceof:UUe,intersection:tqe,lazy:sqe,literal:fqe,map:nqe,nan:qUe,nativeEnum:hqe,never:VUe,null:ZUe,nullable:dqe,number:Qfe,object:JUe,oboolean:bqe,onumber:gqe,optional:lqe,ostring:mqe,pipeline:vqe,preprocess:pqe,promise:cqe,record:iqe,set:aqe,strictObject:XUe,string:Xfe,symbol:zUe,transformer:Hfe,tuple:rqe,undefined:HUe,union:QUe,unknown:WUe,void:GUe,NEVER:wqe,ZodIssueCode:Nt,quotelessJson:yUe,ZodError:$o});X();ee();Q();var Wue=vi(Kue(),1),Fb=Wue.default.init({host:"arweave.net",port:443,protocol:"https"});async function C3t({signer:t,module:e=iee,luaCodeTxId:r=QT,ao:a=gv(),scheduler:i=nee,state:h,stateContractTxId:c,antRegistryId:d=n4}){let b=Xd.init({process:new La({processId:d,ao:a}),signer:t}),g=await Fb.transactions.getData(r,{decode:!0,string:!0}),y=await a.spawn({module:e,scheduler:i,signer:t,tags:[{name:"ANT-Registry-Id",value:d}]}),M=new La({processId:y,ao:a});return await M.send({tags:[{name:"Action",value:"Eval"},{name:"App-Name",value:"ArNS-ANT"},{name:"Source-Code-TX-ID",value:r}],data:g,signer:t}),h&&await M.send({tags:[{name:"Action",value:"Initialize-State"},...c!==void 0?[{name:"State-Contract-TX-ID",value:c}]:[]],data:JSON.stringify(h),signer:t}),await b.register({processId:y}),y}async function L3t({signer:t,processId:e,luaCodeTxId:r=QT,ao:a=gv()}){let i=new La({processId:e,ao:a}),h=await Fb.transactions.getData(r,{decode:!0,string:!0}),{id:c}=await i.send({tags:[{name:"Action",value:"Eval"},{name:"App-Name",value:"ArNS-ANT"},{name:"Source-Code-TX-ID",value:r}],data:h,signer:t});return c}function qFe(t){let e=yi.object({name:yi.string(),value:yi.union([yi.string(),yi.number()])}),r=yi.function().args(yi.object({data:yi.union([yi.string(),yi.instanceof(ge)]),tags:yi.array(e).optional(),target:yi.string().optional(),anchor:yi.string().optional()})).returns(yi.promise(yi.object({id:yi.string(),raw:yi.instanceof(ArrayBuffer)})));try{return r.parse(t),!0}catch{return!1}}function $l(t){return qFe(t)?t:"publicKey"in t?async({data:r,tags:a,target:i,anchor:h})=>{t.publicKey===void 0&&"setPublicKey"in t&&typeof t.setPublicKey=="function"&&await t.setPublicKey();let c=jg(r,t,{tags:a,target:i,anchor:h});return c.sign(t).then(async()=>({id:await c.id,raw:await c.getRaw()}))}:jfe(t)}var FFe=yi.object({Name:yi.string(),Ticker:yi.string(),Owner:yi.string(),Controllers:yi.array(yi.string()),Records:yi.record(yi.string(),yi.object({transactionId:yi.string(),ttlSeconds:yi.number()}).passthrough()),Balances:yi.record(yi.string(),yi.number())}).passthrough();function D3t(t,e=Ff.default){try{return FFe.parse(t),!0}catch(r){return e.error(r.issues),!1}}var c5=class{static init({signer:e,...r}){if(Fh(r)||jh(r))return e?new WO({signer:e,...r}):new l5(r);throw new Du}},l5=class{process;constructor(e){if(Fh(e))this.process=e.process;else if(jh(e))this.process=new La({processId:e.processId});else throw new Du}async getState(){let e=[{name:"Action",value:"State"}];return await this.process.read({tags:e})}async getInfo(){let e=[{name:"Action",value:"Info"}];return await this.process.read({tags:e})}async getRecord({undername:e}){let r=[{name:"Sub-Domain",value:e},{name:"Action",value:"Record"}];return await this.process.read({tags:r})}async getRecords(){let e=[{name:"Action",value:"Records"}];return await this.process.read({tags:e})}async getOwner(){return(await this.getInfo()).Owner}async getControllers(){let e=[{name:"Action",value:"Controllers"}];return await this.process.read({tags:e})}async getName(){return(await this.getInfo()).Name}async getTicker(){return(await this.getInfo()).Ticker}async getBalances(){let e=[{name:"Action",value:"Balances"}];return await this.process.read({tags:e})}async getBalance({address:e}){let r=[{name:"Action",value:"Balance"},{name:"Recipient",value:e}];return await this.process.read({tags:r})}},WO=class extends l5{signer;constructor({signer:e,...r}){super(r),this.signer=$l(e)}async transfer({target:e}){let r=[{name:"Action",value:"Transfer"},{name:"Recipient",value:e}];return this.process.send({tags:r,signer:this.signer})}async addController({controller:e}){let r=[{name:"Action",value:"Add-Controller"},{name:"Controller",value:e}];return this.process.send({tags:r,signer:this.signer})}async removeController({controller:e}){let r=[{name:"Action",value:"Remove-Controller"},{name:"Controller",value:e}];return this.process.send({tags:r,signer:this.signer})}async setRecord({undername:e,transactionId:r,ttlSeconds:a}){return this.process.send({tags:[{name:"Action",value:"Set-Record"},{name:"Sub-Domain",value:e},{name:"Transaction-Id",value:r},{name:"TTL-Seconds",value:a.toString()}],signer:this.signer})}async removeRecord({undername:e}){return this.process.send({tags:[{name:"Action",value:"Remove-Record"},{name:"Sub-Domain",value:e}],signer:this.signer})}async setTicker({ticker:e}){return this.process.send({tags:[{name:"Action",value:"Set-Ticker"},{name:"Ticker",value:e}],signer:this.signer})}async setName({name:e}){return this.process.send({tags:[{name:"Action",value:"Set-Name"},{name:"Name",value:e}],signer:this.signer})}};X();ee();Q();var Xd=class{static init(e){if(e&&e.signer){let{signer:r,...a}=e;return new VO({...a,signer:r})}return new d5(e)}},d5=class{process;constructor(e){if(e&&(jh(e)||Fh(e)))if(Fh(e))this.process=e.process;else if(jh(e))this.process=new La({processId:e.processId});else throw new Du;else this.process=new La({processId:n4})}async accessControlList({address:e}){return this.process.read({tags:[{name:"Action",value:"Access-Control-List"},{name:"Address",value:e}]})}},VO=class extends d5{signer;constructor({signer:e,...r}){super(r),this.signer=$l(e)}async register({processId:e}){return this.process.send({tags:[{name:"Action",value:"Register"},{name:"Process-Id",value:e}],signer:this.signer})}};X();ee();Q();X();ee();Q();X();ee();Q();function GO(t){try{return JSON.parse(t)}catch{return t}}var La=class{logger;processId;ao;constructor({processId:e,ao:r=gv(),logger:a=Ff.default}){this.processId=e,this.logger=a,this.ao=r}async read({tags:e,retries:r=3}){let a=0,i;for(;a<r;)try{this.logger.debug("Evaluating read interaction on contract",{tags:e});let h=await this.ao.dryrun({process:this.processId,tags:e});if(h.Messages.length===0)throw new Error(`Process ${this.processId} does not support provided action.`);let d=h.Messages[0].Tags.find(g=>g.name==="Error");if(d)throw new Error(`${d.Value}: ${h.Messages[0].Data}`);return this.logger.debug("Read interaction result",{result:h.Messages[0].Data}),h.Messages[0].Data===void 0?{}:GO(h.Messages[0].Data)}catch(h){a++,this.logger.debug(`Read attempt ${a} failed`,{error:h,tags:e}),i=h,await new Promise(c=>setTimeout(c,2**a*1e3))}throw i}async send({tags:e,data:r,signer:a,retries:i=3}){let h=0,c;for(;h<i;)try{this.logger.debug("Evaluating send interaction on contract",{tags:e,data:r,processId:this.processId});let d=await this.ao.message({process:this.processId,tags:[...e,{name:"AR-IO-SDK",value:V1}],data:r,signer:a});this.logger.debug("Sent message to process",{messageId:d,processId:this.processId});let b=await this.ao.result({message:d,process:this.processId});if(this.logger.debug("Message result",{output:b,messageId:d,processId:this.processId}),b.Messages?.length===0||b.Messages===void 0)return{id:d};let y=b.Messages[0].Tags.find(x=>x.name==="Error");if(y){let x=b.Messages[0].Data;throw new a4(`${y.Value}: ${x}`)}if(b.Messages.length===0)throw new Error(`Process ${this.processId} does not support provided action.`);if(b.Messages[0].Data===void 0)return{id:d};let M=GO(b.Messages[0].Data);return this.logger.debug("Message result data",{resultData:M,messageId:d,processId:this.processId}),{id:d,result:M}}catch(d){if(this.logger.error("Error sending message to process",{error:d.message,processId:this.processId,tags:e}),d.message.includes("500"))this.logger.debug("Retrying send interaction",{attempts:h,retries:i,error:d.message,processId:this.processId}),await new Promise(b=>setTimeout(b,2**h*2e3)),h++,c=d;else throw d}throw c}};var jb=class{static init(e){if(e&&e.signer){let{signer:r,...a}=e;return new YO({...a,signer:r})}return new p5(e)}},p5=class{process;arweave;constructor(e,r=Fb){if(!e)this.process=new La({processId:R1});else if(Fh(e))this.process=e.process;else if(jh(e))this.process=new La({processId:e.processId});else throw new Du;this.arweave=r}async getInfo(){return this.process.read({tags:[{name:"Action",value:"Info"}]})}async getTokenSupply(){return this.process.read({tags:[{name:"Action",value:"Total-Token-Supply"}]})}async getEpochSettings(e){let a=[{name:"Action",value:"Epoch-Settings"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getEpoch(e){let a=[{name:"Action",value:"Epoch"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getArNSRecord({name:e}){return this.process.read({tags:[{name:"Action",value:"Record"},{name:"Name",value:e}]})}async getArNSRecords(e){let a=[{name:"Action",value:"Paginated-Records"},{name:"Cursor",value:e?.cursor?.toString()},{name:"Limit",value:e?.limit?.toString()},{name:"Sort-By",value:e?.sortBy},{name:"Sort-Order",value:e?.sortOrder}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getArNSReservedNames(){return this.process.read({tags:[{name:"Action",value:"Reserved-Names"}]})}async getArNSReservedName({name:e}){return this.process.read({tags:[{name:"Action",value:"Reserved-Name"},{name:"Name",value:e}]})}async getBalance({address:e}){return this.process.read({tags:[{name:"Action",value:"Balance"},{name:"Address",value:e}]})}async getBalances(e){let a=[{name:"Action",value:"Paginated-Balances"},{name:"Cursor",value:e?.cursor?.toString()},{name:"Limit",value:e?.limit?.toString()},{name:"Sort-By",value:e?.sortBy},{name:"Sort-Order",value:e?.sortOrder}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getGateway({address:e}){return this.process.read({tags:[{name:"Action",value:"Gateway"},{name:"Address",value:e}]})}async getGateways(e){let a=[{name:"Action",value:"Paginated-Gateways"},{name:"Cursor",value:e?.cursor?.toString()},{name:"Limit",value:e?.limit?.toString()},{name:"Sort-By",value:e?.sortBy},{name:"Sort-Order",value:e?.sortOrder}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getCurrentEpoch(){return this.process.read({tags:[{name:"Action",value:"Epoch"},{name:"Timestamp",value:(await this.arweave.blocks.getCurrent().then(e=>({timestamp:e.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()}]})}async getPrescribedObservers(e){let a=[{name:"Action",value:"Epoch-Prescribed-Observers"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getPrescribedNames(e){let a=[{name:"Action",value:"Epoch-Prescribed-Names"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getObservations(e){let a=[{name:"Action",value:"Epoch-Observations"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:`${Date.now()}`}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getDistributions(e){let a=[{name:"Action",value:"Epoch-Distributions"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getTokenCost({intent:e,purchaseType:r,years:a,name:i,quantity:h}){let d=[{name:"Action",value:"Token-Cost"},{name:"Intent",value:e},{name:"Name",value:i},{name:"Years",value:a?.toString()},{name:"Quantity",value:h?.toString()},{name:"Purchase-Type",value:r},{name:"Timestamp",value:(await this.arweave.blocks.getCurrent().then(b=>({timestamp:b.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()}].filter(b=>b.value!==void 0);return this.process.read({tags:d})}},YO=class extends p5{signer;constructor({signer:e,...r}){if(Object.keys(r).length===0)super({process:new La({processId:R1})}),this.signer=$l(e);else if(Fh(r))super({process:r.process}),this.signer=$l(e);else if(jh(r))super({process:new La({processId:r.processId})}),this.signer=$l(e);else throw new Du}async transfer({target:e,qty:r},a){let{tags:i=[]}=a||{};return this.process.send({tags:[...i,{name:"Action",value:"Transfer"},{name:"Recipient",value:e},{name:"Quantity",value:r.valueOf().toString()}],signer:this.signer})}async joinNetwork({operatorStake:e,allowDelegatedStaking:r,delegateRewardShareRatio:a,fqdn:i,label:h,minDelegatedStake:c,note:d,port:b,properties:g,protocol:y,autoStake:M,observerAddress:x},E){let{tags:A=[]}=E||{},O=[...A,{name:"Action",value:"Join-Network"},{name:"Operator-Stake",value:e.valueOf().toString()},{name:"Allow-Delegated-Staking",value:r?.toString()},{name:"Delegate-Reward-Share-Ratio",value:a?.toString()},{name:"FQDN",value:i},{name:"Label",value:h},{name:"Min-Delegated-Stake",value:c?.valueOf().toString()},{name:"Note",value:d},{name:"Port",value:b?.toString()},{name:"Properties",value:g},{name:"Protocol",value:y},{name:"Auto-Stake",value:M?.toString()},{name:"Observer-Address",value:x}].filter(N=>N.value!==void 0);return this.process.send({signer:this.signer,tags:O})}async leaveNetwork(e){let{tags:r=[]}=e||{};return this.process.send({signer:this.signer,tags:[...r,{name:"Action",value:"Leave-Network"}]})}async updateGatewaySettings({allowDelegatedStaking:e,delegateRewardShareRatio:r,fqdn:a,label:i,minDelegatedStake:h,note:c,port:d,properties:b,protocol:g,autoStake:y,observerAddress:M},x){let{tags:E=[]}=x||{},k=[...E,{name:"Action",value:"Update-Gateway-Settings"},{name:"Label",value:i},{name:"Note",value:c},{name:"FQDN",value:a},{name:"Port",value:d?.toString()},{name:"Properties",value:b},{name:"Protocol",value:g},{name:"Observer-Address",value:M},{name:"Allow-Delegated-Staking",value:e?.toString()},{name:"Delegate-Reward-Share-Ratio",value:r?.toString()},{name:"Min-Delegated-Stake",value:h?.valueOf().toString()},{name:"Auto-Stake",value:y?.toString()}].filter(O=>O.value!==void 0);return this.process.send({signer:this.signer,tags:k})}async delegateStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.stakeQty.valueOf().toString()}]})}async decreaseDelegateStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Decrease-Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.decreaseQty.valueOf().toString()}]})}async increaseOperatorStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Increase-Operator-Stake"},{name:"Quantity",value:e.increaseQty.valueOf().toString()}]})}async decreaseOperatorStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Decrease-Operator-Stake"},{name:"Quantity",value:e.decreaseQty.valueOf().toString()}]})}async saveObservations(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Save-Observations"},{name:"Report-Tx-Id",value:e.reportTxId},{name:"Failed-Gateways",value:e.failedGateways.join(",")}]})}async buyRecord(e,r){let{tags:a=[]}=r||{},h=[...a,{name:"Action",value:"Buy-Record"},{name:"Name",value:e.name},{name:"Years",value:e.years?.toString()??"1"},{name:"Process-Id",value:e.processId},{name:"Purchase-Type",value:e.type||"lease"}].filter(c=>c.value!==void 0);return this.process.send({signer:this.signer,tags:h})}async extendLease(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Extend-Lease"},{name:"Name",value:e.name},{name:"Years",value:e.years.toString()}]})}async increaseUndernameLimit(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Increase-Undername-Limit"},{name:"Name",value:e.name},{name:"Quantity",value:e.increaseCount.toString()}]})}};X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();function zb(t,e){return function(){return t.apply(e,arguments)}}var{toString:jFe}=Object.prototype,{getPrototypeOf:QO}=Object,m5=(t=>e=>{let r=jFe.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Xf=t=>(t=t.toLowerCase(),e=>m5(e)===t),g5=t=>e=>typeof e===t,{isArray:Rv}=Array,Hb=g5("undefined");function zFe(t){return t!==null&&!Hb(t)&&t.constructor!==null&&!Hb(t.constructor)&&jo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var Yue=Xf("ArrayBuffer");function HFe(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Yue(t.buffer),e}var ZFe=g5("string"),jo=g5("function"),Jue=g5("number"),b5=t=>t!==null&&typeof t=="object",KFe=t=>t===!0||t===!1,v5=t=>{if(m5(t)!=="object")return!1;let e=QO(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},WFe=Xf("Date"),VFe=Xf("File"),GFe=Xf("Blob"),YFe=Xf("FileList"),JFe=t=>b5(t)&&jo(t.pipe),XFe=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||jo(t.append)&&((e=m5(t))==="formdata"||e==="object"&&jo(t.toString)&&t.toString()==="[object FormData]"))},QFe=Xf("URLSearchParams"),[eje,tje,rje,ije]=["ReadableStream","Request","Response","Headers"].map(Xf),nje=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Zb(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let a,i;if(typeof t!="object"&&(t=[t]),Rv(t))for(a=0,i=t.length;a<i;a++)e.call(null,t[a],a,t);else{let h=r?Object.getOwnPropertyNames(t):Object.keys(t),c=h.length,d;for(a=0;a<c;a++)d=h[a],e.call(null,t[d],d,t)}}function Xue(t,e){e=e.toLowerCase();let r=Object.keys(t),a=r.length,i;for(;a-- >0;)if(i=r[a],e===i.toLowerCase())return i;return null}var Qd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Que=t=>!Hb(t)&&t!==Qd;function XO(){let{caseless:t}=Que(this)&&this||{},e={},r=(a,i)=>{let h=t&&Xue(e,i)||i;v5(e[h])&&v5(a)?e[h]=XO(e[h],a):v5(a)?e[h]=XO({},a):Rv(a)?e[h]=a.slice():e[h]=a};for(let a=0,i=arguments.length;a<i;a++)arguments[a]&&Zb(arguments[a],r);return e}var aje=(t,e,r,{allOwnKeys:a}={})=>(Zb(e,(i,h)=>{r&&jo(i)?t[h]=zb(i,r):t[h]=i},{allOwnKeys:a}),t),oje=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),sje=(t,e,r,a)=>{t.prototype=Object.create(e.prototype,a),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},fje=(t,e,r,a)=>{let i,h,c,d={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),h=i.length;h-- >0;)c=i[h],(!a||a(c,t,e))&&!d[c]&&(e[c]=t[c],d[c]=!0);t=r!==!1&&QO(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},uje=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let a=t.indexOf(e,r);return a!==-1&&a===r},hje=t=>{if(!t)return null;if(Rv(t))return t;let e=t.length;if(!Jue(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},cje=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&QO(Uint8Array)),lje=(t,e)=>{let a=(t&&t[Symbol.iterator]).call(t),i;for(;(i=a.next())&&!i.done;){let h=i.value;e.call(t,h[0],h[1])}},dje=(t,e)=>{let r,a=[];for(;(r=t.exec(e))!==null;)a.push(r);return a},pje=Xf("HTMLFormElement"),vje=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,a,i){return a.toUpperCase()+i}),Vue=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),mje=Xf("RegExp"),ehe=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),a={};Zb(r,(i,h)=>{let c;(c=e(i,h,t))!==!1&&(a[h]=c||i)}),Object.defineProperties(t,a)},gje=t=>{ehe(t,(e,r)=>{if(jo(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let a=t[r];if(jo(a)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},bje=(t,e)=>{let r={},a=i=>{i.forEach(h=>{r[h]=!0})};return Rv(t)?a(t):a(String(t).split(e)),r},yje=()=>{},wje=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,JO="abcdefghijklmnopqrstuvwxyz",Gue="0123456789",the={DIGIT:Gue,ALPHA:JO,ALPHA_DIGIT:JO+JO.toUpperCase()+Gue},_je=(t=16,e=the.ALPHA_DIGIT)=>{let r="",{length:a}=e;for(;t--;)r+=e[Math.random()*a|0];return r};function Mje(t){return!!(t&&jo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var xje=t=>{let e=new Array(10),r=(a,i)=>{if(b5(a)){if(e.indexOf(a)>=0)return;if(!("toJSON"in a)){e[i]=a;let h=Rv(a)?[]:{};return Zb(a,(c,d)=>{let b=r(c,i+1);!Hb(b)&&(h[d]=b)}),e[i]=void 0,h}}return a};return r(t,0)},Sje=Xf("AsyncFunction"),Eje=t=>t&&(b5(t)||jo(t))&&jo(t.then)&&jo(t.catch),rhe=((t,e)=>t?setImmediate:e?((r,a)=>(Qd.addEventListener("message",({source:i,data:h})=>{i===Qd&&h===r&&a.length&&a.shift()()},!1),i=>{a.push(i),Qd.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",jo(Qd.postMessage)),Aje=typeof queueMicrotask<"u"?queueMicrotask.bind(Qd):typeof xe<"u"&&xe.nextTick||rhe,vt={isArray:Rv,isArrayBuffer:Yue,isBuffer:zFe,isFormData:XFe,isArrayBufferView:HFe,isString:ZFe,isNumber:Jue,isBoolean:KFe,isObject:b5,isPlainObject:v5,isReadableStream:eje,isRequest:tje,isResponse:rje,isHeaders:ije,isUndefined:Hb,isDate:WFe,isFile:VFe,isBlob:GFe,isRegExp:mje,isFunction:jo,isStream:JFe,isURLSearchParams:QFe,isTypedArray:cje,isFileList:YFe,forEach:Zb,merge:XO,extend:aje,trim:nje,stripBOM:oje,inherits:sje,toFlatObject:fje,kindOf:m5,kindOfTest:Xf,endsWith:uje,toArray:hje,forEachEntry:lje,matchAll:dje,isHTMLForm:pje,hasOwnProperty:Vue,hasOwnProp:Vue,reduceDescriptors:ehe,freezeMethods:gje,toObjectSet:bje,toCamelCase:vje,noop:yje,toFiniteNumber:wje,findKey:Xue,global:Qd,isContextDefined:Que,ALPHABET:the,generateString:_je,isSpecCompliantForm:Mje,toJSONObject:xje,isAsyncFn:Sje,isThenable:Eje,setImmediate:rhe,asap:Aje};X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();function Tv(t,e,r,a,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),a&&(this.request=a),i&&(this.response=i,this.status=i.status?i.status:null)}vt.inherits(Tv,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:vt.toJSONObject(this.config),code:this.code,status:this.status}}});var ihe=Tv.prototype,nhe={};["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(t=>{nhe[t]={value:t}});Object.defineProperties(Tv,nhe);Object.defineProperty(ihe,"isAxiosError",{value:!0});Tv.from=(t,e,r,a,i,h)=>{let c=Object.create(ihe);return vt.toFlatObject(t,c,function(b){return b!==Error.prototype},d=>d!=="isAxiosError"),Tv.call(c,t.message,e,r,a,i),c.cause=t,c.name=t.name,h&&Object.assign(c,h),c};var yr=Tv;X();ee();Q();var y5=null;function eP(t){return vt.isPlainObject(t)||vt.isArray(t)}function ohe(t){return vt.endsWith(t,"[]")?t.slice(0,-2):t}function ahe(t,e,r){return t?t.concat(e).map(function(i,h){return i=ohe(i),!r&&h?"["+i+"]":i}).join(r?".":""):e}function Rje(t){return vt.isArray(t)&&!t.some(eP)}var Tje=vt.toFlatObject(vt,{},null,function(e){return/^is[A-Z]/.test(e)});function kje(t,e,r){if(!vt.isObject(t))throw new TypeError("target must be an object");e=e||new(y5||FormData),r=vt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,O){return!vt.isUndefined(O[k])});let a=r.metaTokens,i=r.visitor||y,h=r.dots,c=r.indexes,b=(r.Blob||typeof Blob<"u"&&Blob)&&vt.isSpecCompliantForm(e);if(!vt.isFunction(i))throw new TypeError("visitor must be a function");function g(A){if(A===null)return"";if(vt.isDate(A))return A.toISOString();if(!b&&vt.isBlob(A))throw new yr("Blob is not supported. Use a Buffer instead.");return vt.isArrayBuffer(A)||vt.isTypedArray(A)?b&&typeof Blob=="function"?new Blob([A]):ge.from(A):A}function y(A,k,O){let N=A;if(A&&!O&&typeof A=="object"){if(vt.endsWith(k,"{}"))k=a?k:k.slice(0,-2),A=JSON.stringify(A);else if(vt.isArray(A)&&Rje(A)||(vt.isFileList(A)||vt.endsWith(k,"[]"))&&(N=vt.toArray(A)))return k=ohe(k),N.forEach(function(C,Y){!(vt.isUndefined(C)||C===null)&&e.append(c===!0?ahe([k],Y,h):c===null?k:k+"[]",g(C))}),!1}return eP(A)?!0:(e.append(ahe(O,k,h),g(A)),!1)}let M=[],x=Object.assign(Tje,{defaultVisitor:y,convertValue:g,isVisitable:eP});function E(A,k){if(!vt.isUndefined(A)){if(M.indexOf(A)!==-1)throw Error("Circular reference detected in "+k.join("."));M.push(A),vt.forEach(A,function(N,L){(!(vt.isUndefined(N)||N===null)&&i.call(e,N,vt.isString(L)?L.trim():L,k,x))===!0&&E(N,k?k.concat(L):[L])}),M.pop()}}if(!vt.isObject(t))throw new TypeError("data must be an object");return E(t),e}var Ul=kje;function she(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(a){return e[a]})}function fhe(t,e){this._pairs=[],t&&Ul(t,this,e)}var uhe=fhe.prototype;uhe.append=function(e,r){this._pairs.push([e,r])};uhe.toString=function(e){let r=e?function(a){return e.call(this,a,she)}:she;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var w5=fhe;function Ije(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Kb(t,e,r){if(!e)return t;let a=r&&r.encode||Ije,i=r&&r.serialize,h;if(i?h=i(e,r):h=vt.isURLSearchParams(e)?e.toString():new w5(e,r).toString(a),h){let c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+h}return t}X();ee();Q();var tP=class{constructor(){this.handlers=[]}use(e,r,a){return this.handlers.push({fulfilled:e,rejected:r,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){vt.forEach(this.handlers,function(a){a!==null&&e(a)})}},rP=tP;X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var _5={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var hhe=typeof URLSearchParams<"u"?URLSearchParams:w5;X();ee();Q();var che=typeof FormData<"u"?FormData:null;X();ee();Q();var lhe=typeof Blob<"u"?Blob:null;var dhe={isBrowser:!0,classes:{URLSearchParams:hhe,FormData:che,Blob:lhe},protocols:["http","https","file","blob","url","data"]};var aP={};$a(aP,{hasBrowserEnv:()=>nP,hasStandardBrowserEnv:()=>Bje,hasStandardBrowserWebWorkerEnv:()=>Oje,navigator:()=>iP,origin:()=>Pje});X();ee();Q();var nP=typeof window<"u"&&typeof document<"u",iP=typeof navigator=="object"&&navigator||void 0,Bje=nP&&(!iP||["ReactNative","NativeScript","NS"].indexOf(iP.product)<0),Oje=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Pje=nP&&window.location.href||"http://localhost";var Rn={...aP,...dhe};function oP(t,e){return Ul(t,new Rn.classes.URLSearchParams,Object.assign({visitor:function(r,a,i,h){return Rn.isNode&&vt.isBuffer(r)?(this.append(a,r.toString("base64")),!1):h.defaultVisitor.apply(this,arguments)}},e))}X();ee();Q();function Nje(t){return vt.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Cje(t){let e={},r=Object.keys(t),a,i=r.length,h;for(a=0;a<i;a++)h=r[a],e[h]=t[h];return e}function Lje(t){function e(r,a,i,h){let c=r[h++];if(c==="__proto__")return!0;let d=Number.isFinite(+c),b=h>=r.length;return c=!c&&vt.isArray(i)?i.length:c,b?(vt.hasOwnProp(i,c)?i[c]=[i[c],a]:i[c]=a,!d):((!i[c]||!vt.isObject(i[c]))&&(i[c]=[]),e(r,a,i[c],h)&&vt.isArray(i[c])&&(i[c]=Cje(i[c])),!d)}if(vt.isFormData(t)&&vt.isFunction(t.entries)){let r={};return vt.forEachEntry(t,(a,i)=>{e(Nje(a),i,r,0)}),r}return null}var M5=Lje;function Dje(t,e,r){if(vt.isString(t))try{return(e||JSON.parse)(t),vt.trim(t)}catch(a){if(a.name!=="SyntaxError")throw a}return(r||JSON.stringify)(t)}var sP={transitional:_5,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let a=r.getContentType()||"",i=a.indexOf("application/json")>-1,h=vt.isObject(e);if(h&&vt.isHTMLForm(e)&&(e=new FormData(e)),vt.isFormData(e))return i?JSON.stringify(M5(e)):e;if(vt.isArrayBuffer(e)||vt.isBuffer(e)||vt.isStream(e)||vt.isFile(e)||vt.isBlob(e)||vt.isReadableStream(e))return e;if(vt.isArrayBufferView(e))return e.buffer;if(vt.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(h){if(a.indexOf("application/x-www-form-urlencoded")>-1)return oP(e,this.formSerializer).toString();if((d=vt.isFileList(e))||a.indexOf("multipart/form-data")>-1){let b=this.env&&this.env.FormData;return Ul(d?{"files[]":e}:e,b&&new b,this.formSerializer)}}return h||i?(r.setContentType("application/json",!1),Dje(e)):e}],transformResponse:[function(e){let r=this.transitional||sP.transitional,a=r&&r.forcedJSONParsing,i=this.responseType==="json";if(vt.isResponse(e)||vt.isReadableStream(e))return e;if(e&&vt.isString(e)&&(a&&!this.responseType||i)){let c=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(d){if(c)throw d.name==="SyntaxError"?yr.from(d,yr.ERR_BAD_RESPONSE,this,null,this.response):d}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Rn.classes.FormData,Blob:Rn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};vt.forEach(["delete","get","head","post","put","patch"],t=>{sP.headers[t]={}});var kv=sP;X();ee();Q();X();ee();Q();var $je=vt.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"]),phe=t=>{let e={},r,a,i;return t&&t.split(`
187
+ }`,i=_t.object({data:_t.object({transactions:_t.object({edges:_t.array(_t.object({node:_t.record(_t.any())}))})})});return h=>Hr(h).chain(Ui(c=>t(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:a,variables:{transactionIds:[c]}})}).then(async d=>{if(d.ok)return d.json();throw r('Error Encountered when querying gateway for transaction "%s"',c),new Error(`${d.status}: ${await d.text()}`)}).then(i.parse).then(FLe(["data","transactions","edges","0","node"])))).toPromise()}var XDe=UB(oOe(),1),Rfe=(t="@permaweb/aoconnect")=>{let e=(0,XDe.default)(t);return e.child=r=>Rfe(`${e.namespace}:${r}`),e.tap=(r,...a)=>VLe((...i)=>e(r,...a,...i)),e},Tfe=({url:t,path:e})=>e?e.startsWith("/")?Tfe({url:t,path:e.slice(1)}):(t=new URL(t),t.pathname+=e,t.toString()):t;function QDe(t){return cv(Gw([]),hv((e,r)=>cv(HLe([],r.name),tO(r.value),js(r.name,Qh,e))(e),{}),Ww(e=>e.length>1?e:e[0]))(t)}function Us(t,e){return r=>Jse(QCe([Qoe(t,"name"),iO(eO(e),Qoe(e,"value"),JB)]),r)}function rse(t){return sfe([[q2(String),ev(t)],[q2(Array),OLe(t)],[JB,uCe]])}function Cd(t){let e;return q2(qs,t)?(e=new Error(e$e(t)),e.stack+=t.stack):q2(Error,t)?e=t:kLe("message",t)?e=new Error(t.message):q2(String,t)?e=new Error(t):e=new Error("An error occurred"),e}function e$e(t){return cv(e=>function r(a,i,h){return hv((c,d)=>cv(sfe([[ev(Tt.invalid_arguments),()=>r(d.argumentsError,422,"Invalid Arguments")],[ev(Tt.invalid_return_type),()=>r(d.returnTypeError,500,"Invalid Return")],[ev(Tt.invalid_union),()=>vLe(b=>r(b,400,"Invalid Union"),d.unionErrors)],[JB,()=>[{...d,status:i,contextCode:h}]]]),rO(c))(d.code),[],a.issues)}(e,400,""),e=>hv((r,a)=>{let{message:i,path:h,contextCode:c}=a,d=h[1]||h[0],b=c?`${c} `:"";return r.push(`${b}'${d}': ${i}.`),r},[],e),$Le(" | "))(t)}var t$e=_t.object({id:_t.string().min(1,{message:"message is required to be a message id"}),processId:_t.string().min(1,{message:"process is required to be a process id"})});function r$e(){return t=>Hr(t).map(t$e.parse).map(()=>t)}var xb=_t.object({name:_t.string(),value:_t.string()}),i$e=_t.function().args(_t.object({Id:_t.string(),Target:_t.string(),Owner:_t.string(),Anchor:_t.string().optional(),Data:_t.any().default("1234"),Tags:_t.array(_t.object({name:_t.string(),value:_t.string()}))})).returns(_t.promise(_t.any())),n$e=_t.function().args(_t.object({id:_t.string().min(1,{message:"message id is required"}),processId:_t.string().min(1,{message:"process id is required"})})).returns(_t.promise(_t.any())),a$e=_t.function().args(_t.object({process:_t.string().min(1,{message:"process id is required"}),from:_t.string().optional(),to:_t.string().optional(),sort:_t.enum(["ASC","DESC"]).default("ASC"),limit:_t.number().optional()})).returns(_t.promise(_t.object({edges:_t.array(_t.object({cursor:_t.string(),node:_t.object({Output:_t.any().optional(),Messages:_t.array(_t.any()).optional(),Spawns:_t.array(_t.any()).optional(),Error:_t.any().optional()})}))}))),kfe=_t.function().args(_t.object({processId:_t.string(),data:_t.any(),tags:_t.array(xb),anchor:_t.string().optional(),signer:_t.any()})).returns(_t.promise(_t.object({messageId:_t.string()}).passthrough())),o$e=_t.function().args(_t.object({data:_t.any(),tags:_t.array(xb),signer:_t.any()})).returns(_t.promise(_t.object({processId:_t.string()}).passthrough())),s$e=_t.function().args(_t.object({process:_t.string(),message:_t.string(),baseLayer:_t.boolean().optional(),exclude:_t.array(_t.string()).optional()})).returns(_t.promise(_t.object({assignmentId:_t.string()}).passthrough())),Ife=kfe,Bbt=_t.function().args(_t.object({suUrl:_t.string().url(),processId:_t.string()})).returns(_t.promise(_t.object({tags:_t.array(xb)}).passthrough())),Obt=_t.function().args(_t.string()).returns(_t.promise(_t.object({url:_t.string()}))),f$e=_t.function().args(_t.string()).returns(_t.promise(_t.boolean())),u$e=_t.function().args(_t.string()).returns(_t.promise(_t.object({tags:_t.array(xb)}).passthrough())),Yw=_t.function().args(_t.object({data:_t.any(),tags:_t.array(xb),target:_t.string().optional(),anchor:_t.string().optional()})).returns(_t.promise(_t.object({id:_t.string(),raw:_t.any()})));function h$e({loadResult:t}){return t=Ui(n$e.implement(t)),e=>Hr({id:e.id,processId:e.processId}).chain(t)}function c$e(t){let e=r$e(t),r=h$e(t);return({message:a,process:i})=>Hr({id:a,processId:i}).chain(e).chain(r).map(t.logger.tap('readResult result for message "%s": %O',a)).map(h=>h).bimap(Cd,Nd).toPromise()}var l$e=_t.array(_t.object({name:_t.string(),value:_t.string()}));function d$e(){return t=>Hr(t.tags).map(Gw([])).map(Us("Data-Protocol","ao")).map(Us("Variant")).map(Us("Type")).map(Us("SDK")).map(rO(Qh,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Message"},{name:"SDK",value:"aoconnect"}])).map(l$e.parse).map(js("tags",Qh,t))}function p$e({logger:t}){return e=>Hr(e).chain(iO(eO(e.data),()=>Id(e),()=>Id(Math.random().toString().slice(-4)).map(js("data",Qh,e)).map(r=>cv(Pd("tags"),Us("Content-Type"),tO({name:"Content-Type",value:"text/plain"}),js("tags",Qh,r))(r)).map(t.tap('added pseudo-random string as message "data"'))))}function v$e(t){let e=d$e(t),r=p$e(t),a=kfe.implement(t.deployMessage);return i=>Hr(i).chain(e).chain(r).chain(Ui(({id:h,data:c,tags:d,anchor:b,signer:g})=>a({processId:h,data:c,tags:d,anchor:b,signer:Yw.implement(g)}))).map(h=>js("messageId",h.messageId,i))}function m$e(t){let e=v$e(t);return({process:r,data:a,tags:i,anchor:h,signer:c})=>Hr({id:r,data:a,tags:i,anchor:h,signer:c}).chain(e).map(d=>d.messageId).bimap(Cd,Nd).toPromise()}var I2=(t,e,r)=>a=>e(a[t])?Id(a):Bl(`Tag '${t}': ${r}`);function g$e({loadTransactionMeta:t,logger:e}){return t=Ui(u$e.implement(t)),r=>Hr(r).chain(t).map(Pd("tags")).map(QDe).chain(I2("Data-Protocol",rse("ao"),"value 'ao' was not found on module")).chain(I2("Type",rse("Module"),"value 'Module' was not found on module")).chain(I2("Module-Format",hB,"was not found on module")).chain(I2("Input-Encoding",hB,"was not found on module")).chain(I2("Output-Encoding",hB,"was not found on module")).bimap(e.tap("Verifying module source failed: %s"),e.tap("Verified module source"))}function b$e({logger:t,validateScheduler:e}){return e=Ui(f$e.implement(e)),r=>Hr(r).chain(a=>e(a).chain(i=>i?Id(a):Bl(`Valid Scheduler-Location owned by ${a} not found`))).bimap(t.tap("Verifying scheduler failed: %s"),t.tap("Verified scheduler"))}function y$e({logger:t}){return e=>Hr(e).map(t.tap("Checking for signer")).chain(r=>r?Id(r):Bl("signer not found"))}function w$e(t){let e=t.logger.child("verifyInput");t={...t,logger:e};let r=g$e(t),a=b$e(t),i=y$e(t);return h=>Hr(h).chain(c=>r(c.module).map(()=>c)).chain(c=>a(c.scheduler)).map(()=>h).chain(c=>i(c.signer).map(()=>c)).bimap(e.tap("Error when verify input: %s"),e.tap("Successfully verified inputs"))}var _$e=_t.array(_t.object({name:_t.string(),value:_t.string()}));function M$e(){return t=>Hr(t).map(Pd("tags")).map(Gw([])).map(Us("Data-Protocol","ao")).map(Us("Variant")).map(Us("Type")).map(Us("Module")).map(Us("Scheduler")).map(Us("SDK")).map(rO(Qh,[{name:"Data-Protocol",value:"ao"},{name:"Variant",value:"ao.TN.1"},{name:"Type",value:"Process"},{name:"Module",value:t.module},{name:"Scheduler",value:t.scheduler},{name:"SDK",value:"aoconnect"}])).map(_$e.parse).map(js("tags",Qh,t))}function x$e({logger:t}){return e=>Hr(e).chain(iO(eO(e.data),()=>Id(e),()=>Id(Math.random().toString().slice(-4)).map(js("data",Qh,e)).map(r=>cv(Pd("tags"),Us("Content-Type"),tO({name:"Content-Type",value:"text/plain"}),js("tags",Qh,r))(r)).map(t.tap('added pseudo-random string as process "data"'))))}function S$e(t){let e=t.logger.child("uploadProcess");t={...t,logger:e};let r=M$e(t),a=x$e(t),i=o$e.implement(t.deployProcess);return h=>Hr(h).chain(r).chain(a).chain(Ui(({data:c,tags:d,signer:b})=>i({data:c,tags:d,signer:Yw.implement(b)}))).map(c=>js("processId",c.processId,h))}function E$e(t){let e=w$e(t),r=S$e(t);return({module:a,scheduler:i,signer:h,tags:c,data:d})=>Hr({module:a,scheduler:i,signer:h,tags:c,data:d}).chain(e).chain(r).map(b=>b.processId).bimap(Cd,Nd).toPromise()}function A$e(t){let e=Ife.implement(t.deployMonitor);return r=>Hr(r).chain(Ui(({id:a,signer:i})=>e({processId:a,signer:Yw.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(a=>js("monitorId",a.messageId,r))}function R$e(t){let e=A$e(t);return({process:r,signer:a})=>Hr({id:r,signer:a}).chain(e).map(i=>i.monitorId).bimap(Cd,Nd).toPromise()}function T$e(t){let e=Ife.implement(t.deployUnmonitor);return r=>Hr(r).chain(Ui(({id:a,signer:i})=>e({processId:a,signer:Yw.implement(i),data:Math.random().toString().slice(-4),tags:[]}))).map(a=>js("monitorId",a.messageId,r))}function k$e(t){let e=T$e(t);return({process:r,signer:a})=>Hr({id:r,signer:a}).chain(e).map(i=>i.monitorId).bimap(Cd,Nd).toPromise()}var I$e=_t.object({process:_t.string().min(1,{message:"process identifier is required"}),from:_t.string().optional(),to:_t.string().optional(),sort:_t.enum(["ASC","DESC"]).default("ASC"),limit:_t.number().optional()});function B$e(){return t=>Hr(t).map(I$e.parse).map(()=>t)}function O$e({queryResults:t}){return t=Ui(a$e.implement(t)),e=>Hr({process:e.process,from:e.from,to:e.to,sort:e.sort,limit:e.limit}).chain(t)}function P$e(t){let e=B$e(t),r=O$e(t);return({process:a,from:i,to:h,sort:c,limit:d})=>Hr({process:a,from:i,to:h,sort:c,limit:d}).chain(e).chain(r).map(t.logger.tap('readResults result for message "%s": %O',a)).map(b=>b).bimap(Cd,Nd).toPromise()}var N$e=_t.object({Id:_t.string(),Target:_t.string(),Owner:_t.string(),Anchor:_t.string().optional(),Data:_t.any().default("1234"),Tags:_t.array(_t.object({name:_t.string(),value:_t.string()}))});function C$e(){return t=>Hr(t).map(N$e.parse).map(e=>(e.Tags=e.Tags.concat([{name:"Data-Protocol",value:"ao"},{name:"Type",value:"Message"},{name:"Variant",value:"ao.TN.1"}]),e))}function L$e({dryrunFetch:t}){return Ui(i$e.implement(t))}function D$e(t){let e=C$e(t),r=L$e(t);return a=>Hr(a).map($$e).chain(e).chain(r).toPromise()}function $$e({process:t,data:e,tags:r,anchor:a,...i}){return{Id:"1234",Owner:"1234",...i,Target:t,Data:e||"1234",Tags:r||[],Anchor:a||"0"}}function U$e(t){let e=s$e.implement(t.deployAssign);return r=>Hr(r).chain(Ui(({process:a,message:i,baseLayer:h,exclude:c})=>e({process:a,message:i,baseLayer:h,exclude:c}))).map(a=>js("assignmentId",a.assignmentId,r))}function q$e(t){let e=U$e(t);return({process:r,message:a,baseLayer:i,exclude:h})=>Hr({process:r,message:a,baseLayer:i,exclude:h}).chain(e).map(c=>c.assignmentId).bimap(Cd,Nd).toPromise()}var F$e="https://arweave.net",j$e="https://mu.ao-testnet.xyz",z$e="https://cu.ao-testnet.xyz";function gv({GRAPHQL_URL:t,GATEWAY_URL:e=F$e,MU_URL:r=j$e,CU_URL:a=z$e}={}){let i=Rfe();t||(t=Tfe({url:e,path:"/graphql"}));let{validate:h}=Wse({cacheSize:100,GRAPHQL_URL:t}),c=sCe({MAX_SIZE:25}),d=i.child("result"),b=c$e({loadResult:nCe({fetch,CU_URL:a,logger:d}),logger:d}),g=i.child("message"),y=m$e({loadProcessMeta:sB({fetch,cache:c,logger:g}),deployMessage:XNe({fetch,MU_URL:r,logger:g}),logger:g}),M=i.child("spawn"),x=E$e({loadTransactionMeta:JDe({fetch,GRAPHQL_URL:t,logger:M}),validateScheduler:h,deployProcess:QNe({fetch,MU_URL:r,logger:M}),logger:M}),E=i.child("monitor"),A=R$e({loadProcessMeta:sB({fetch,cache:c,logger:E}),deployMonitor:eCe({fetch,MU_URL:r,logger:E}),logger:E}),k=i.child("unmonitor"),O=k$e({loadProcessMeta:sB({fetch,cache:c,logger:k}),deployUnmonitor:tCe({fetch,MU_URL:r,logger:k}),logger:E}),N=i.child("results"),L=P$e({queryResults:aCe({fetch,CU_URL:a,logger:N}),logger:N}),C=i.child("dryrun"),Y=D$e({dryrunFetch:iCe({fetch,CU_URL:a,logger:C}),logger:C}),G=i.child("assign"),ie=q$e({deployAssign:rCe({fetch,MU_URL:r,logger:G}),logger:g});return{result:b,results:L,message:y,spawn:x,monitor:A,unmonitor:O,dryrun:Y,assign:ie}}var Bfe={};ase(Bfe,{createDataItemSigner:()=>pUe});var Ofe=UB(uOe(),1),Pfe={};ase(Pfe,{AVSCTap:()=>Sb,ArweaveSigner:()=>fO,DataItem:()=>yb,MAX_TAG_BYTES:()=>Jw,MIN_BINARY_SIZE:()=>cO,SIG_CONFIG:()=>mv,SignatureConfig:()=>$s,Signer:()=>Dfe,createData:()=>Ffe,default:()=>cUe,deserializeTags:()=>Fw,indexToType:()=>uO,serializeTags:()=>hO,tagsExceedLimit:()=>qfe,warparbundles:()=>lUe});var H$e=Object.create,oO=Object.defineProperty,Z$e=Object.getOwnPropertyDescriptor,K$e=Object.getOwnPropertyNames,W$e=Object.getPrototypeOf,V$e=Object.prototype.hasOwnProperty,tc=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),G$e=(t,e)=>{for(var r in e)oO(t,r,{get:e[r],enumerable:!0})},Y$e=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of K$e(e))!V$e.call(t,i)&&i!==r&&oO(t,i,{get:()=>e[i],enumerable:!(a=Z$e(e,i))||a.enumerable});return t},Ld=(t,e,r)=>(r=t!=null?H$e(W$e(t)):{},Y$e(e||!t||!t.__esModule?oO(r,"default",{value:t,enumerable:!0}):r,t)),J$e=tc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});function e(r){var a=4,i=r.length,h=i%a;if(!h)return r;var c=i,d=a-h,b=i+d,g=ge.alloc(b);for(g.write(r);d--;)g.write("=",c++);return g.toString()}t.default=e}),X$e=tc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=J$e();function r(b,g){return g===void 0&&(g="utf8"),ge.isBuffer(b)?h(b.toString("base64")):h(ge.from(b,g).toString("base64"))}function a(b,g){return g===void 0&&(g="utf8"),ge.from(i(b),"base64").toString(g)}function i(b){return b=b.toString(),e.default(b).replace(/\-/g,"+").replace(/_/g,"/")}function h(b){return b.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function c(b){return ge.from(i(b),"base64")}var d=r;d.encode=r,d.decode=a,d.toBase64=i,d.fromBase64=h,d.toBuffer=c,t.default=d}),sO=tc((t,e)=>{e.exports=X$e().default,e.exports.default=e.exports}),Nfe=tc(t=>{"use strict";t.byteLength=b,t.toByteArray=y,t.fromByteArray=E;var e=[],r=[],a=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(h=0,c=i.length;h<c;++h)e[h]=i[h],r[i.charCodeAt(h)]=h;var h,c;r[45]=62,r[95]=63;function d(A){var k=A.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var O=A.indexOf("=");O===-1&&(O=k);var N=O===k?0:4-O%4;return[O,N]}function b(A){var k=d(A),O=k[0],N=k[1];return(O+N)*3/4-N}function g(A,k,O){return(k+O)*3/4-O}function y(A){var k,O=d(A),N=O[0],L=O[1],C=new a(g(A,N,L)),Y=0,G=L>0?N-4:N,ie;for(ie=0;ie<G;ie+=4)k=r[A.charCodeAt(ie)]<<18|r[A.charCodeAt(ie+1)]<<12|r[A.charCodeAt(ie+2)]<<6|r[A.charCodeAt(ie+3)],C[Y++]=k>>16&255,C[Y++]=k>>8&255,C[Y++]=k&255;return L===2&&(k=r[A.charCodeAt(ie)]<<2|r[A.charCodeAt(ie+1)]>>4,C[Y++]=k&255),L===1&&(k=r[A.charCodeAt(ie)]<<10|r[A.charCodeAt(ie+1)]<<4|r[A.charCodeAt(ie+2)]>>2,C[Y++]=k>>8&255,C[Y++]=k&255),C}function M(A){return e[A>>18&63]+e[A>>12&63]+e[A>>6&63]+e[A&63]}function x(A,k,O){for(var N,L=[],C=k;C<O;C+=3)N=(A[C]<<16&16711680)+(A[C+1]<<8&65280)+(A[C+2]&255),L.push(M(N));return L.join("")}function E(A){for(var k,O=A.length,N=O%3,L=[],C=16383,Y=0,G=O-N;Y<G;Y+=C)L.push(x(A,Y,Y+C>G?G:Y+C));return N===1?(k=A[O-1],L.push(e[k>>2]+e[k<<4&63]+"==")):N===2&&(k=(A[O-2]<<8)+A[O-1],L.push(e[k>>10]+e[k>>4&63]+e[k<<2&63]+"=")),L.join("")}}),Cfe=tc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.b64UrlDecode=t.b64UrlEncode=t.bufferTob64Url=t.bufferTob64=t.b64UrlToBuffer=t.stringToB64Url=t.stringToBuffer=t.bufferToString=t.b64UrlToString=t.concatBuffers=void 0;var e=Nfe();function r(x){let E=0;for(let O=0;O<x.length;O++)E+=x[O].byteLength;let A=new Uint8Array(E),k=0;A.set(new Uint8Array(x[0]),k),k+=x[0].byteLength;for(let O=1;O<x.length;O++)A.set(new Uint8Array(x[O]),k),k+=x[O].byteLength;return A}t.concatBuffers=r;function a(x){let E=d(x);return i(E)}t.b64UrlToString=a;function i(x){return new TextDecoder("utf-8",{fatal:!0}).decode(x)}t.bufferToString=i;function h(x){return new TextEncoder().encode(x)}t.stringToBuffer=h;function c(x){return g(h(x))}t.stringToB64Url=c;function d(x){return new Uint8Array(e.toByteArray(M(x)))}t.b64UrlToBuffer=d;function b(x){return e.fromByteArray(new Uint8Array(x))}t.bufferTob64=b;function g(x){return y(b(x))}t.bufferTob64Url=g;function y(x){return x.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}t.b64UrlEncode=y;function M(x){x=x.replace(/\-/g,"+").replace(/\_/g,"/");let E;return x.length%4==0?E=0:E=4-x.length%4,x.concat("=".repeat(E))}t.b64UrlDecode=M}),Q$e=tc(t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=Cfe(),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 a=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),i=await this.driver.exportKey("jwk",a.privateKey);return{kty:i.kty,e:i.e,n:i.n,d:i.d,p:i.p,q:i.q,dp:i.dp,dq:i.dq,qi:i.qi}}async sign(a,i,{saltLength:h}={}){let c=await this.driver.sign({name:"RSA-PSS",saltLength:32},await this.jwkToCryptoKey(a),i);return new Uint8Array(c)}async hash(a,i="SHA-256"){let h=await this.driver.digest(i,a);return new Uint8Array(h)}async verify(a,i,h){let c={kty:"RSA",e:"AQAB",n:a},d=await this.jwkToPublicCryptoKey(c),b=await this.driver.digest("SHA-256",i),g=await this.driver.verify({name:"RSA-PSS",saltLength:0},d,h,i),y=await this.driver.verify({name:"RSA-PSS",saltLength:32},d,h,i),M=await this.driver.verify({name:"RSA-PSS",saltLength:Math.ceil((d.algorithm.modulusLength-1)/8)-b.byteLength-2},d,h,i);return g||y||M}async jwkToCryptoKey(a){return this.driver.importKey("jwk",a,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(a){return this.driver.importKey("jwk",a,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let a=crypto?.subtle;return a===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(i=>typeof a[i]=="function")}async encrypt(a,i,h){let c=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),d=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=new Uint8Array(16);crypto.getRandomValues(b);let g=await this.driver.encrypt({name:"AES-CBC",iv:b},d,a);return e.concatBuffers([b,g])}async decrypt(a,i,h){let c=await this.driver.importKey("raw",typeof i=="string"?e.stringToBuffer(i):i,{name:"PBKDF2",length:32},!1,["deriveKey"]),d=await this.driver.deriveKey({name:"PBKDF2",salt:h?e.stringToBuffer(h):e.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},c,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=a.slice(0,16),g=await this.driver.decrypt({name:"AES-CBC",iv:b},d,a.slice(16));return e.concatBuffers([g])}};t.default=r}),eUe=tc(t=>{t.read=function(e,r,a,i,h){var c,d,b=h*8-i-1,g=(1<<b)-1,y=g>>1,M=-7,x=a?h-1:0,E=a?-1:1,A=e[r+x];for(x+=E,c=A&(1<<-M)-1,A>>=-M,M+=b;M>0;c=c*256+e[r+x],x+=E,M-=8);for(d=c&(1<<-M)-1,c>>=-M,M+=i;M>0;d=d*256+e[r+x],x+=E,M-=8);if(c===0)c=1-y;else{if(c===g)return d?NaN:(A?-1:1)*(1/0);d=d+Math.pow(2,i),c=c-y}return(A?-1:1)*d*Math.pow(2,c-i)},t.write=function(e,r,a,i,h,c){var d,b,g,y=c*8-h-1,M=(1<<y)-1,x=M>>1,E=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=i?0:c-1,k=i?1:-1,O=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(b=isNaN(r)?1:0,d=M):(d=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-d))<1&&(d--,g*=2),d+x>=1?r+=E/g:r+=E*Math.pow(2,1-x),r*g>=2&&(d++,g/=2),d+x>=M?(b=0,d=M):d+x>=1?(b=(r*g-1)*Math.pow(2,h),d=d+x):(b=r*Math.pow(2,x-1)*Math.pow(2,h),d=0));h>=8;e[a+A]=b&255,A+=k,b/=256,h-=8);for(d=d<<h|b,y+=h;y>0;e[a+A]=d&255,A+=k,d/=256,y-=8);e[a+A-k]|=O*128}}),LB=tc(t=>{"use strict";var e=Nfe(),r=eUe(),a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=d,t.SlowBuffer=L,t.INSPECT_MAX_BYTES=50;var i=2147483647;t.kMaxLength=i,d.TYPED_ARRAY_SUPPORT=h(),!d.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 h(){try{let T=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(T,I),T.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function c(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');let I=new Uint8Array(T);return Object.setPrototypeOf(I,d.prototype),I}function d(T,I,P){if(typeof T=="number"){if(typeof I=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(T)}return b(T,I,P)}d.poolSize=8192;function b(T,I,P){if(typeof T=="string")return x(T,I);if(ArrayBuffer.isView(T))return A(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(ut(T,ArrayBuffer)||T&&ut(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ut(T,SharedArrayBuffer)||T&&ut(T.buffer,SharedArrayBuffer)))return k(T,I,P);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let U=T.valueOf&&T.valueOf();if(U!=null&&U!==T)return d.from(U,I,P);let Z=O(T);if(Z)return Z;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return d.from(T[Symbol.toPrimitive]("string"),I,P);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}d.from=function(T,I,P){return b(T,I,P)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array);function g(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function y(T,I,P){return g(T),T<=0?c(T):I!==void 0?typeof P=="string"?c(T).fill(I,P):c(T).fill(I):c(T)}d.alloc=function(T,I,P){return y(T,I,P)};function M(T){return g(T),c(T<0?0:N(T)|0)}d.allocUnsafe=function(T){return M(T)},d.allocUnsafeSlow=function(T){return M(T)};function x(T,I){if((typeof I!="string"||I==="")&&(I="utf8"),!d.isEncoding(I))throw new TypeError("Unknown encoding: "+I);let P=C(T,I)|0,U=c(P),Z=U.write(T,I);return Z!==P&&(U=U.slice(0,Z)),U}function E(T){let I=T.length<0?0:N(T.length)|0,P=c(I);for(let U=0;U<I;U+=1)P[U]=T[U]&255;return P}function A(T){if(ut(T,Uint8Array)){let I=new Uint8Array(T);return k(I.buffer,I.byteOffset,I.byteLength)}return E(T)}function k(T,I,P){if(I<0||T.byteLength<I)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<I+(P||0))throw new RangeError('"length" is outside of buffer bounds');let U;return I===void 0&&P===void 0?U=new Uint8Array(T):P===void 0?U=new Uint8Array(T,I):U=new Uint8Array(T,I,P),Object.setPrototypeOf(U,d.prototype),U}function O(T){if(d.isBuffer(T)){let I=N(T.length)|0,P=c(I);return P.length===0||T.copy(P,0,0,I),P}if(T.length!==void 0)return typeof T.length!="number"||Ze(T.length)?c(0):E(T);if(T.type==="Buffer"&&Array.isArray(T.data))return E(T.data)}function N(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function L(T){return+T!=T&&(T=0),d.alloc(+T)}d.isBuffer=function(T){return T!=null&&T._isBuffer===!0&&T!==d.prototype},d.compare=function(T,I){if(ut(T,Uint8Array)&&(T=d.from(T,T.offset,T.byteLength)),ut(I,Uint8Array)&&(I=d.from(I,I.offset,I.byteLength)),!d.isBuffer(T)||!d.isBuffer(I))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(T===I)return 0;let P=T.length,U=I.length;for(let Z=0,W=Math.min(P,U);Z<W;++Z)if(T[Z]!==I[Z]){P=T[Z],U=I[Z];break}return P<U?-1:U<P?1:0},d.isEncoding=function(T){switch(String(T).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}},d.concat=function(T,I){if(!Array.isArray(T))throw new TypeError('"list" argument must be an Array of Buffers');if(T.length===0)return d.alloc(0);let P;if(I===void 0)for(I=0,P=0;P<T.length;++P)I+=T[P].length;let U=d.allocUnsafe(I),Z=0;for(P=0;P<T.length;++P){let W=T[P];if(ut(W,Uint8Array))Z+W.length>U.length?(d.isBuffer(W)||(W=d.from(W)),W.copy(U,Z)):Uint8Array.prototype.set.call(U,W,Z);else if(d.isBuffer(W))W.copy(U,Z);else throw new TypeError('"list" argument must be an Array of Buffers');Z+=W.length}return U};function C(T,I){if(d.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||ut(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);let P=T.length,U=arguments.length>2&&arguments[2]===!0;if(!U&&P===0)return 0;let Z=!1;for(;;)switch(I){case"ascii":case"latin1":case"binary":return P;case"utf8":case"utf-8":return oe(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P*2;case"hex":return P>>>1;case"base64":return be(T).length;default:if(Z)return U?-1:oe(T).length;I=(""+I).toLowerCase(),Z=!0}}d.byteLength=C;function Y(T,I,P){let U=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((P===void 0||P>this.length)&&(P=this.length),P<=0)||(P>>>=0,I>>>=0,P<=I))return"";for(T||(T="utf8");;)switch(T){case"hex":return o(this,I,P);case"utf8":case"utf-8":return u(this,I,P);case"ascii":return w(this,I,P);case"latin1":case"binary":return p(this,I,P);case"base64":return f(this,I,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,I,P);default:if(U)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),U=!0}}d.prototype._isBuffer=!0;function G(T,I,P){let U=T[I];T[I]=T[P],T[P]=U}d.prototype.swap16=function(){let T=this.length;if(T%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let I=0;I<T;I+=2)G(this,I,I+1);return this},d.prototype.swap32=function(){let T=this.length;if(T%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let I=0;I<T;I+=4)G(this,I,I+3),G(this,I+1,I+2);return this},d.prototype.swap64=function(){let T=this.length;if(T%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let I=0;I<T;I+=8)G(this,I,I+7),G(this,I+1,I+6),G(this,I+2,I+5),G(this,I+3,I+4);return this},d.prototype.toString=function(){let T=this.length;return T===0?"":arguments.length===0?u(this,0,T):Y.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(T){if(!d.isBuffer(T))throw new TypeError("Argument must be a Buffer");return this===T?!0:d.compare(this,T)===0},d.prototype.inspect=function(){let T="",I=t.INSPECT_MAX_BYTES;return T=this.toString("hex",0,I).replace(/(.{2})/g,"$1 ").trim(),this.length>I&&(T+=" ... "),"<Buffer "+T+">"},a&&(d.prototype[a]=d.prototype.inspect),d.prototype.compare=function(T,I,P,U,Z){if(ut(T,Uint8Array)&&(T=d.from(T,T.offset,T.byteLength)),!d.isBuffer(T))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof T);if(I===void 0&&(I=0),P===void 0&&(P=T?T.length:0),U===void 0&&(U=0),Z===void 0&&(Z=this.length),I<0||P>T.length||U<0||Z>this.length)throw new RangeError("out of range index");if(U>=Z&&I>=P)return 0;if(U>=Z)return-1;if(I>=P)return 1;if(I>>>=0,P>>>=0,U>>>=0,Z>>>=0,this===T)return 0;let W=Z-U,fe=P-I,st=Math.min(W,fe),ue=this.slice(U,Z),me=T.slice(I,P);for(let pe=0;pe<st;++pe)if(ue[pe]!==me[pe]){W=ue[pe],fe=me[pe];break}return W<fe?-1:fe<W?1:0};function ie(T,I,P,U,Z){if(T.length===0)return-1;if(typeof P=="string"?(U=P,P=0):P>2147483647?P=2147483647:P<-2147483648&&(P=-2147483648),P=+P,Ze(P)&&(P=Z?0:T.length-1),P<0&&(P=T.length+P),P>=T.length){if(Z)return-1;P=T.length-1}else if(P<0)if(Z)P=0;else return-1;if(typeof I=="string"&&(I=d.from(I,U)),d.isBuffer(I))return I.length===0?-1:D(T,I,P,U,Z);if(typeof I=="number")return I=I&255,typeof Uint8Array.prototype.indexOf=="function"?Z?Uint8Array.prototype.indexOf.call(T,I,P):Uint8Array.prototype.lastIndexOf.call(T,I,P):D(T,[I],P,U,Z);throw new TypeError("val must be string, number or Buffer")}function D(T,I,P,U,Z){let W=1,fe=T.length,st=I.length;if(U!==void 0&&(U=String(U).toLowerCase(),U==="ucs2"||U==="ucs-2"||U==="utf16le"||U==="utf-16le")){if(T.length<2||I.length<2)return-1;W=2,fe/=2,st/=2,P/=2}function ue(pe,ye){return W===1?pe[ye]:pe.readUInt16BE(ye*W)}let me;if(Z){let pe=-1;for(me=P;me<fe;me++)if(ue(T,me)===ue(I,pe===-1?0:me-pe)){if(pe===-1&&(pe=me),me-pe+1===st)return pe*W}else pe!==-1&&(me-=me-pe),pe=-1}else for(P+st>fe&&(P=fe-st),me=P;me>=0;me--){let pe=!0;for(let ye=0;ye<st;ye++)if(ue(T,me+ye)!==ue(I,ye)){pe=!1;break}if(pe)return me}return-1}d.prototype.includes=function(T,I,P){return this.indexOf(T,I,P)!==-1},d.prototype.indexOf=function(T,I,P){return ie(this,T,I,P,!0)},d.prototype.lastIndexOf=function(T,I,P){return ie(this,T,I,P,!1)};function q(T,I,P,U){P=Number(P)||0;let Z=T.length-P;U?(U=Number(U),U>Z&&(U=Z)):U=Z;let W=I.length;U>W/2&&(U=W/2);let fe;for(fe=0;fe<U;++fe){let st=parseInt(I.substr(fe*2,2),16);if(Ze(st))return fe;T[P+fe]=st}return fe}function V(T,I,P,U){return Ee(oe(I,T.length-P),T,P,U)}function _(T,I,P,U){return Ee(le(I),T,P,U)}function n(T,I,P,U){return Ee(be(I),T,P,U)}function s(T,I,P,U){return Ee(ot(I,T.length-P),T,P,U)}d.prototype.write=function(T,I,P,U){if(I===void 0)U="utf8",P=this.length,I=0;else if(P===void 0&&typeof I=="string")U=I,P=this.length,I=0;else if(isFinite(I))I=I>>>0,isFinite(P)?(P=P>>>0,U===void 0&&(U="utf8")):(U=P,P=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let Z=this.length-I;if((P===void 0||P>Z)&&(P=Z),T.length>0&&(P<0||I<0)||I>this.length)throw new RangeError("Attempt to write outside buffer bounds");U||(U="utf8");let W=!1;for(;;)switch(U){case"hex":return q(this,T,I,P);case"utf8":case"utf-8":return V(this,T,I,P);case"ascii":case"latin1":case"binary":return _(this,T,I,P);case"base64":return n(this,T,I,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s(this,T,I,P);default:if(W)throw new TypeError("Unknown encoding: "+U);U=(""+U).toLowerCase(),W=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function f(T,I,P){return I===0&&P===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(I,P))}function u(T,I,P){P=Math.min(T.length,P);let U=[],Z=I;for(;Z<P;){let W=T[Z],fe=null,st=W>239?4:W>223?3:W>191?2:1;if(Z+st<=P){let ue,me,pe,ye;switch(st){case 1:W<128&&(fe=W);break;case 2:ue=T[Z+1],(ue&192)===128&&(ye=(W&31)<<6|ue&63,ye>127&&(fe=ye));break;case 3:ue=T[Z+1],me=T[Z+2],(ue&192)===128&&(me&192)===128&&(ye=(W&15)<<12|(ue&63)<<6|me&63,ye>2047&&(ye<55296||ye>57343)&&(fe=ye));break;case 4:ue=T[Z+1],me=T[Z+2],pe=T[Z+3],(ue&192)===128&&(me&192)===128&&(pe&192)===128&&(ye=(W&15)<<18|(ue&63)<<12|(me&63)<<6|pe&63,ye>65535&&ye<1114112&&(fe=ye))}}fe===null?(fe=65533,st=1):fe>65535&&(fe-=65536,U.push(fe>>>10&1023|55296),fe=56320|fe&1023),U.push(fe),Z+=st}return m(U)}var l=4096;function m(T){let I=T.length;if(I<=l)return String.fromCharCode.apply(String,T);let P="",U=0;for(;U<I;)P+=String.fromCharCode.apply(String,T.slice(U,U+=l));return P}function w(T,I,P){let U="";P=Math.min(T.length,P);for(let Z=I;Z<P;++Z)U+=String.fromCharCode(T[Z]&127);return U}function p(T,I,P){let U="";P=Math.min(T.length,P);for(let Z=I;Z<P;++Z)U+=String.fromCharCode(T[Z]);return U}function o(T,I,P){let U=T.length;(!I||I<0)&&(I=0),(!P||P<0||P>U)&&(P=U);let Z="";for(let W=I;W<P;++W)Z+=Ye[T[W]];return Z}function v(T,I,P){let U=T.slice(I,P),Z="";for(let W=0;W<U.length-1;W+=2)Z+=String.fromCharCode(U[W]+U[W+1]*256);return Z}d.prototype.slice=function(T,I){let P=this.length;T=~~T,I=I===void 0?P:~~I,T<0?(T+=P,T<0&&(T=0)):T>P&&(T=P),I<0?(I+=P,I<0&&(I=0)):I>P&&(I=P),I<T&&(I=T);let U=this.subarray(T,I);return Object.setPrototypeOf(U,d.prototype),U};function R(T,I,P){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+I>P)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(T,I,P){T=T>>>0,I=I>>>0,P||R(T,I,this.length);let U=this[T],Z=1,W=0;for(;++W<I&&(Z*=256);)U+=this[T+W]*Z;return U},d.prototype.readUintBE=d.prototype.readUIntBE=function(T,I,P){T=T>>>0,I=I>>>0,P||R(T,I,this.length);let U=this[T+--I],Z=1;for(;I>0&&(Z*=256);)U+=this[T+--I]*Z;return U},d.prototype.readUint8=d.prototype.readUInt8=function(T,I){return T=T>>>0,I||R(T,1,this.length),this[T]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(T,I){return T=T>>>0,I||R(T,2,this.length),this[T]|this[T+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(T,I){return T=T>>>0,I||R(T,2,this.length),this[T]<<8|this[T+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(T,I){return T=T>>>0,I||R(T,4,this.length),(this[T]|this[T+1]<<8|this[T+2]<<16)+this[T+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]*16777216+(this[T+1]<<16|this[T+2]<<8|this[T+3])},d.prototype.readBigUInt64LE=ct(function(T){T=T>>>0,J(T,"offset");let I=this[T],P=this[T+7];(I===void 0||P===void 0)&&te(T,this.length-8);let U=I+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24,Z=this[++T]+this[++T]*2**8+this[++T]*2**16+P*2**24;return BigInt(U)+(BigInt(Z)<<BigInt(32))}),d.prototype.readBigUInt64BE=ct(function(T){T=T>>>0,J(T,"offset");let I=this[T],P=this[T+7];(I===void 0||P===void 0)&&te(T,this.length-8);let U=I*2**24+this[++T]*2**16+this[++T]*2**8+this[++T],Z=this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+P;return(BigInt(U)<<BigInt(32))+BigInt(Z)}),d.prototype.readIntLE=function(T,I,P){T=T>>>0,I=I>>>0,P||R(T,I,this.length);let U=this[T],Z=1,W=0;for(;++W<I&&(Z*=256);)U+=this[T+W]*Z;return Z*=128,U>=Z&&(U-=Math.pow(2,8*I)),U},d.prototype.readIntBE=function(T,I,P){T=T>>>0,I=I>>>0,P||R(T,I,this.length);let U=I,Z=1,W=this[T+--U];for(;U>0&&(Z*=256);)W+=this[T+--U]*Z;return Z*=128,W>=Z&&(W-=Math.pow(2,8*I)),W},d.prototype.readInt8=function(T,I){return T=T>>>0,I||R(T,1,this.length),this[T]&128?(255-this[T]+1)*-1:this[T]},d.prototype.readInt16LE=function(T,I){T=T>>>0,I||R(T,2,this.length);let P=this[T]|this[T+1]<<8;return P&32768?P|4294901760:P},d.prototype.readInt16BE=function(T,I){T=T>>>0,I||R(T,2,this.length);let P=this[T+1]|this[T]<<8;return P&32768?P|4294901760:P},d.prototype.readInt32LE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]|this[T+1]<<8|this[T+2]<<16|this[T+3]<<24},d.prototype.readInt32BE=function(T,I){return T=T>>>0,I||R(T,4,this.length),this[T]<<24|this[T+1]<<16|this[T+2]<<8|this[T+3]},d.prototype.readBigInt64LE=ct(function(T){T=T>>>0,J(T,"offset");let I=this[T],P=this[T+7];(I===void 0||P===void 0)&&te(T,this.length-8);let U=this[T+4]+this[T+5]*2**8+this[T+6]*2**16+(P<<24);return(BigInt(U)<<BigInt(32))+BigInt(I+this[++T]*2**8+this[++T]*2**16+this[++T]*2**24)}),d.prototype.readBigInt64BE=ct(function(T){T=T>>>0,J(T,"offset");let I=this[T],P=this[T+7];(I===void 0||P===void 0)&&te(T,this.length-8);let U=(I<<24)+this[++T]*2**16+this[++T]*2**8+this[++T];return(BigInt(U)<<BigInt(32))+BigInt(this[++T]*2**24+this[++T]*2**16+this[++T]*2**8+P)}),d.prototype.readFloatLE=function(T,I){return T=T>>>0,I||R(T,4,this.length),r.read(this,T,!0,23,4)},d.prototype.readFloatBE=function(T,I){return T=T>>>0,I||R(T,4,this.length),r.read(this,T,!1,23,4)},d.prototype.readDoubleLE=function(T,I){return T=T>>>0,I||R(T,8,this.length),r.read(this,T,!0,52,8)},d.prototype.readDoubleBE=function(T,I){return T=T>>>0,I||R(T,8,this.length),r.read(this,T,!1,52,8)};function S(T,I,P,U,Z,W){if(!d.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>Z||I<W)throw new RangeError('"value" argument is out of bounds');if(P+U>T.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(T,I,P,U){if(T=+T,I=I>>>0,P=P>>>0,!U){let fe=Math.pow(2,8*P)-1;S(this,T,I,P,fe,0)}let Z=1,W=0;for(this[I]=T&255;++W<P&&(Z*=256);)this[I+W]=T/Z&255;return I+P},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(T,I,P,U){if(T=+T,I=I>>>0,P=P>>>0,!U){let fe=Math.pow(2,8*P)-1;S(this,T,I,P,fe,0)}let Z=P-1,W=1;for(this[I+Z]=T&255;--Z>=0&&(W*=256);)this[I+Z]=T/W&255;return I+P},d.prototype.writeUint8=d.prototype.writeUInt8=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,1,255,0),this[I]=T&255,I+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,2,65535,0),this[I]=T&255,this[I+1]=T>>>8,I+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,2,65535,0),this[I]=T>>>8,this[I+1]=T&255,I+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,4,4294967295,0),this[I+3]=T>>>24,this[I+2]=T>>>16,this[I+1]=T>>>8,this[I]=T&255,I+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,4,4294967295,0),this[I]=T>>>24,this[I+1]=T>>>16,this[I+2]=T>>>8,this[I+3]=T&255,I+4};function B(T,I,P,U,Z){j(I,U,Z,T,P,7);let W=Number(I&BigInt(4294967295));T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W,W=W>>8,T[P++]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[P++]=fe,fe=fe>>8,T[P++]=fe,fe=fe>>8,T[P++]=fe,fe=fe>>8,T[P++]=fe,P}function F(T,I,P,U,Z){j(I,U,Z,T,P,7);let W=Number(I&BigInt(4294967295));T[P+7]=W,W=W>>8,T[P+6]=W,W=W>>8,T[P+5]=W,W=W>>8,T[P+4]=W;let fe=Number(I>>BigInt(32)&BigInt(4294967295));return T[P+3]=fe,fe=fe>>8,T[P+2]=fe,fe=fe>>8,T[P+1]=fe,fe=fe>>8,T[P]=fe,P+8}d.prototype.writeBigUInt64LE=ct(function(T,I=0){return B(this,T,I,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeBigUInt64BE=ct(function(T,I=0){return F(this,T,I,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeIntLE=function(T,I,P,U){if(T=+T,I=I>>>0,!U){let st=Math.pow(2,8*P-1);S(this,T,I,P,st-1,-st)}let Z=0,W=1,fe=0;for(this[I]=T&255;++Z<P&&(W*=256);)T<0&&fe===0&&this[I+Z-1]!==0&&(fe=1),this[I+Z]=(T/W>>0)-fe&255;return I+P},d.prototype.writeIntBE=function(T,I,P,U){if(T=+T,I=I>>>0,!U){let st=Math.pow(2,8*P-1);S(this,T,I,P,st-1,-st)}let Z=P-1,W=1,fe=0;for(this[I+Z]=T&255;--Z>=0&&(W*=256);)T<0&&fe===0&&this[I+Z+1]!==0&&(fe=1),this[I+Z]=(T/W>>0)-fe&255;return I+P},d.prototype.writeInt8=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,1,127,-128),T<0&&(T=255+T+1),this[I]=T&255,I+1},d.prototype.writeInt16LE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,2,32767,-32768),this[I]=T&255,this[I+1]=T>>>8,I+2},d.prototype.writeInt16BE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,2,32767,-32768),this[I]=T>>>8,this[I+1]=T&255,I+2},d.prototype.writeInt32LE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,4,2147483647,-2147483648),this[I]=T&255,this[I+1]=T>>>8,this[I+2]=T>>>16,this[I+3]=T>>>24,I+4},d.prototype.writeInt32BE=function(T,I,P){return T=+T,I=I>>>0,P||S(this,T,I,4,2147483647,-2147483648),T<0&&(T=4294967295+T+1),this[I]=T>>>24,this[I+1]=T>>>16,this[I+2]=T>>>8,this[I+3]=T&255,I+4},d.prototype.writeBigInt64LE=ct(function(T,I=0){return B(this,T,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),d.prototype.writeBigInt64BE=ct(function(T,I=0){return F(this,T,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $(T,I,P,U,Z,W){if(P+U>T.length)throw new RangeError("Index out of range");if(P<0)throw new RangeError("Index out of range")}function ae(T,I,P,U,Z){return I=+I,P=P>>>0,Z||$(T,I,P,4,34028234663852886e22,-34028234663852886e22),r.write(T,I,P,U,23,4),P+4}d.prototype.writeFloatLE=function(T,I,P){return ae(this,T,I,!0,P)},d.prototype.writeFloatBE=function(T,I,P){return ae(this,T,I,!1,P)};function re(T,I,P,U,Z){return I=+I,P=P>>>0,Z||$(T,I,P,8,17976931348623157e292,-17976931348623157e292),r.write(T,I,P,U,52,8),P+8}d.prototype.writeDoubleLE=function(T,I,P){return re(this,T,I,!0,P)},d.prototype.writeDoubleBE=function(T,I,P){return re(this,T,I,!1,P)},d.prototype.copy=function(T,I,P,U){if(!d.isBuffer(T))throw new TypeError("argument should be a Buffer");if(P||(P=0),!U&&U!==0&&(U=this.length),I>=T.length&&(I=T.length),I||(I=0),U>0&&U<P&&(U=P),U===P||T.length===0||this.length===0)return 0;if(I<0)throw new RangeError("targetStart out of bounds");if(P<0||P>=this.length)throw new RangeError("Index out of range");if(U<0)throw new RangeError("sourceEnd out of bounds");U>this.length&&(U=this.length),T.length-I<U-P&&(U=T.length-I+P);let Z=U-P;return this===T&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(I,P,U):Uint8Array.prototype.set.call(T,this.subarray(P,U),I),Z},d.prototype.fill=function(T,I,P,U){if(typeof T=="string"){if(typeof I=="string"?(U=I,I=0,P=this.length):typeof P=="string"&&(U=P,P=this.length),U!==void 0&&typeof U!="string")throw new TypeError("encoding must be a string");if(typeof U=="string"&&!d.isEncoding(U))throw new TypeError("Unknown encoding: "+U);if(T.length===1){let W=T.charCodeAt(0);(U==="utf8"&&W<128||U==="latin1")&&(T=W)}}else typeof T=="number"?T=T&255:typeof T=="boolean"&&(T=Number(T));if(I<0||this.length<I||this.length<P)throw new RangeError("Out of range index");if(P<=I)return this;I=I>>>0,P=P===void 0?this.length:P>>>0,T||(T=0);let Z;if(typeof T=="number")for(Z=I;Z<P;++Z)this[Z]=T;else{let W=d.isBuffer(T)?T:d.from(T,U),fe=W.length;if(fe===0)throw new TypeError('The value "'+T+'" is invalid for argument "value"');for(Z=0;Z<P-I;++Z)this[Z+I]=W[Z%fe]}return this};var H={};function K(T,I,P){H[T]=class extends P{constructor(){super(),Object.defineProperty(this,"message",{value:I.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${T}]`,this.stack,delete this.name}get code(){return T}set code(U){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:U,writable:!0})}toString(){return`${this.name} [${T}]: ${this.message}`}}}K("ERR_BUFFER_OUT_OF_BOUNDS",function(T){return T?`${T} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),K("ERR_INVALID_ARG_TYPE",function(T,I){return`The "${T}" argument must be of type number. Received type ${typeof I}`},TypeError),K("ERR_OUT_OF_RANGE",function(T,I,P){let U=`The value of "${T}" is out of range.`,Z=P;return Number.isInteger(P)&&Math.abs(P)>2**32?Z=ce(String(P)):typeof P=="bigint"&&(Z=String(P),(P>BigInt(2)**BigInt(32)||P<-(BigInt(2)**BigInt(32)))&&(Z=ce(Z)),Z+="n"),U+=` It must be ${I}. Received ${Z}`,U},RangeError);function ce(T){let I="",P=T.length,U=T[0]==="-"?1:0;for(;P>=U+4;P-=3)I=`_${T.slice(P-3,P)}${I}`;return`${T.slice(0,P)}${I}`}function ne(T,I,P){J(I,"offset"),(T[I]===void 0||T[I+P]===void 0)&&te(I,T.length-(P+1))}function j(T,I,P,U,Z,W){if(T>P||T<I){let fe=typeof I=="bigint"?"n":"",st;throw W>3?I===0||I===BigInt(0)?st=`>= 0${fe} and < 2${fe} ** ${(W+1)*8}${fe}`:st=`>= -(2${fe} ** ${(W+1)*8-1}${fe}) and < 2 ** ${(W+1)*8-1}${fe}`:st=`>= ${I}${fe} and <= ${P}${fe}`,new H.ERR_OUT_OF_RANGE("value",st,T)}ne(U,Z,W)}function J(T,I){if(typeof T!="number")throw new H.ERR_INVALID_ARG_TYPE(I,"number",T)}function te(T,I,P){throw Math.floor(T)!==T?(J(T,P),new H.ERR_OUT_OF_RANGE(P||"offset","an integer",T)):I<0?new H.ERR_BUFFER_OUT_OF_BOUNDS:new H.ERR_OUT_OF_RANGE(P||"offset",`>= ${P?1:0} and <= ${I}`,T)}var he=/[^+/0-9A-Za-z-_]/g;function ke(T){if(T=T.split("=")[0],T=T.trim().replace(he,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function oe(T,I){I=I||1/0;let P,U=T.length,Z=null,W=[];for(let fe=0;fe<U;++fe){if(P=T.charCodeAt(fe),P>55295&&P<57344){if(!Z){if(P>56319){(I-=3)>-1&&W.push(239,191,189);continue}else if(fe+1===U){(I-=3)>-1&&W.push(239,191,189);continue}Z=P;continue}if(P<56320){(I-=3)>-1&&W.push(239,191,189),Z=P;continue}P=(Z-55296<<10|P-56320)+65536}else Z&&(I-=3)>-1&&W.push(239,191,189);if(Z=null,P<128){if((I-=1)<0)break;W.push(P)}else if(P<2048){if((I-=2)<0)break;W.push(P>>6|192,P&63|128)}else if(P<65536){if((I-=3)<0)break;W.push(P>>12|224,P>>6&63|128,P&63|128)}else if(P<1114112){if((I-=4)<0)break;W.push(P>>18|240,P>>12&63|128,P>>6&63|128,P&63|128)}else throw new Error("Invalid code point")}return W}function le(T){let I=[];for(let P=0;P<T.length;++P)I.push(T.charCodeAt(P)&255);return I}function ot(T,I){let P,U,Z,W=[];for(let fe=0;fe<T.length&&!((I-=2)<0);++fe)P=T.charCodeAt(fe),U=P>>8,Z=P%256,W.push(Z),W.push(U);return W}function be(T){return e.toByteArray(ke(T))}function Ee(T,I,P,U){let Z;for(Z=0;Z<U&&!(Z+P>=I.length||Z>=T.length);++Z)I[Z+P]=T[Z];return Z}function ut(T,I){return T instanceof I||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===I.name}function Ze(T){return T!==T}var Ye=function(){let T="0123456789abcdef",I=new Array(256);for(let P=0;P<16;++P){let U=P*16;for(let Z=0;Z<16;++Z)I[U+Z]=T[P]+T[Z]}return I}();function ct(T){return typeof BigInt>"u"?z:T}function z(){throw new Error("BigInt not supported")}}),tUe=tc((t,e)=>{typeof window<"u"?(window.global=window,global.fetch=window.fetch,e.exports={Buffer:LB().Buffer,Crypto:window.crypto}):e.exports={Buffer:LB().Buffer,Crypto:crypto}}),Lfe={};G$e(Lfe,{AVSCTap:()=>Sb,ArweaveSigner:()=>fO,DataItem:()=>yb,MAX_TAG_BYTES:()=>Jw,MIN_BINARY_SIZE:()=>cO,SIG_CONFIG:()=>mv,SignatureConfig:()=>$s,Signer:()=>Dfe,createData:()=>Ffe,deserializeTags:()=>Fw,indexToType:()=>uO,serializeTags:()=>hO,tagsExceedLimit:()=>qfe});var Dfe=class{signer;publicKey;signatureType;signatureLength;ownerLength;pem;static verify(t,e,r,a){throw new Error("You must implement verify method on child")}},rUe=Ld(sO(),1),Hf=Ld(Cfe(),1);async function $fe(t){if(Array.isArray(t)){let i=(0,Hf.concatBuffers)([(0,Hf.stringToBuffer)("list"),(0,Hf.stringToBuffer)(t.length.toString())]);return await Ufe(t,await Jh().hash(i,"SHA-384"))}let e=t,r=(0,Hf.concatBuffers)([(0,Hf.stringToBuffer)("blob"),(0,Hf.stringToBuffer)(e.byteLength.toString())]),a=(0,Hf.concatBuffers)([await Jh().hash(r,"SHA-384"),await Jh().hash(e,"SHA-384")]);return await Jh().hash(a,"SHA-384")}async function Ufe(t,e){if(t.length<1)return e;let r=(0,Hf.concatBuffers)([e,await $fe(t[0])]),a=await Jh().hash(r,"SHA-384");return await Ufe(t.slice(1),a)}var lB=Ld(Q$e(),1),iUe=lB.default.default?lB.default.default:lB.default,nUe=class extends iUe{getPublicKey(t){throw new Error("Unimplemented")}},aUe;function Jh(){return aUe??=new nUe}var $s;(function(t){t[t.ARWEAVE=1]="ARWEAVE",t[t.ED25519=2]="ED25519",t[t.ETHEREUM=3]="ETHEREUM",t[t.SOLANA=4]="SOLANA",t[t.INJECTEDAPTOS=5]="INJECTEDAPTOS",t[t.MULTIAPTOS=6]="MULTIAPTOS",t[t.TYPEDETHEREUM=7]="TYPEDETHEREUM"})($s||($s={}));var mv={[$s.ARWEAVE]:{sigLength:512,pubLength:512,sigName:"arweave"},[$s.ED25519]:{sigLength:64,pubLength:32,sigName:"ed25519"},[$s.ETHEREUM]:{sigLength:65,pubLength:65,sigName:"ethereum"},[$s.SOLANA]:{sigLength:64,pubLength:32,sigName:"solana"},[$s.INJECTEDAPTOS]:{sigLength:64,pubLength:32,sigName:"injectedAptos"},[$s.MULTIAPTOS]:{sigLength:64*32+4,pubLength:32*32+1,sigName:"multiAptos"},[$s.TYPEDETHEREUM]:{sigLength:65,pubLength:42,sigName:"typedEthereum"}},fO=class{signatureType=1;ownerLength=mv[1].pubLength;signatureLength=mv[1].sigLength;jwk;pk;constructor(t){this.pk=t.n,this.jwk=t}get publicKey(){return rUe.default.toBuffer(this.pk)}sign(t){return Jh().sign(this.jwk,t)}static async verify(t,e,r){return await Jh().verify(t,e,r)}},uO={1:fO},Hu=Ld(sO(),1);async function DB(t){return $fe([(0,Hf.stringToBuffer)("dataitem"),(0,Hf.stringToBuffer)("1"),(0,Hf.stringToBuffer)(t.signatureType.toString()),t.rawOwner,t.rawTarget,t.rawAnchor,t.rawTags,t.rawData])}async function oUe(t,e){let r=await DB(t),a=await e.sign(r),i=await Jh().hash(a);return{signature:ge.from(a),id:ge.from(i)}}async function sUe(t,e){let{signature:r,id:a}=await oUe(t,e);return t.getRaw().set(r,2),a}var Sb=class{buf;pos;constructor(t=ge.alloc(Jw),e=0){this.buf=t,this.pos=e}writeTags(t){if(!Array.isArray(t))throw new Error("input must be array");let e=t.length,r;if(e)for(this.writeLong(e),r=0;r<e;r++){let a=t[r];if(a?.name===void 0||a?.value===void 0)throw new Error(`Invalid tag format for ${a}, expected {name:string, value: string}`);this.writeString(a.name),this.writeString(a.value)}this.writeLong(0)}toBuffer(){let t=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(t,0,0,this.pos),t}tagsExceedLimit(){return this.pos>this.buf.length}writeLong(t){let e=this.buf,r,a;if(t>=-1073741824&&t<1073741824){a=t>=0?t<<1:~t<<1|1;do e[this.pos]=a&127,a>>=7;while(a&&(e[this.pos++]|=128))}else{r=t>=0?t*2:-t*2-1;do e[this.pos]=r&127,r/=128;while(r>=1&&(e[this.pos++]|=128))}this.pos++,this.buf=e}writeString(t){let e=ge.byteLength(t),r=this.buf;this.writeLong(e);let a=this.pos;if(this.pos+=e,!(this.pos>r.length)){if(e>64)this.buf.write(t,this.pos-e,e,"utf8");else{let i,h,c,d;for(i=0,h=e;i<h;i++)c=t.charCodeAt(i),c<128?r[a++]=c:c<2048?(r[a++]=c>>6|192,r[a++]=c&63|128):(c&64512)===55296&&((d=t.charCodeAt(i+1))&64512)===56320?(c=65536+((c&1023)<<10)+(d&1023),i++,r[a++]=c>>18|240,r[a++]=c>>12&63|128,r[a++]=c>>6&63|128,r[a++]=c&63|128):(r[a++]=c>>12|224,r[a++]=c>>6&63|128,r[a++]=c&63|128)}this.buf=r}}readLong(){let t=0,e=0,r=this.buf,a,i,h,c;do a=r[this.pos++],i=a&128,t|=(a&127)<<e,e+=7;while(i&&e<28);if(i){h=t,c=268435456;do a=r[this.pos++],h+=(a&127)*c,c*=128;while(a&128);return(h%2?-(h+1):h)/2}return t>>1^-(t&1)}skipLong(){let t=this.buf;for(;t[this.pos++]&128;);}readTags(){let t=[],e;for(;e=this.readLong();)for(e<0&&(e=-e,this.skipLong());e--;){let r=this.readString(),a=this.readString();t.push({name:r,value:a})}return t}readString(){let t=this.readLong(),e=this.pos,r=this.buf;if(this.pos+=t,!(this.pos>r.length))return this.buf.slice(e,e+t).toString()}};function hO(t){let e=new Sb;return e.writeTags(t),e.toBuffer()}function qfe(t){let e=new Sb;return e.writeTags(t),e.tagsExceedLimit()}function Fw(t){return new Sb(t).readTags()}function Ml(t){let e=0;for(let r=t.length-1;r>=0;r--)e=e*256+t[r];return e}function fUe(t){if(t>29)throw new Error("Short too long");let e=[0,0];for(let r=0;r<e.length;r++){let a=t&255;e[r]=a,t=(t-a)/256}return Uint8Array.from(e)}function ise(t){let e=[0,0,0,0,0,0,0,0];for(let r=0;r<e.length;r++){let a=t&255;e[r]=a,t=(t-a)/256}return Uint8Array.from(e)}var uUe=Ld(tUe(),1),Y1=Ld(LB(),1),Jw=4096,cO=80,yb=class{binary;_id;constructor(t){this.binary=t}static isDataItem(t){return t.binary!==void 0}get signatureType(){let t=Ml(this.binary.subarray(0,2));if($s?.[t]!==void 0)return t;throw new Error("Unknown signature type: "+t)}async isValid(){return yb.verify(this.binary)}get id(){return(async()=>Hu.default.encode(await this.rawId))()}set id(t){this._id=Hu.default.toBuffer(t)}get rawId(){return(async()=>Y1.Buffer.from(await uUe.Crypto.subtle.digest("SHA-256",this.rawSignature)))()}set rawId(t){this._id=t}get rawSignature(){return this.binary.subarray(2,2+this.signatureLength)}get signature(){return Hu.default.encode(this.rawSignature)}set rawOwner(t){if(t.byteLength!=this.ownerLength)throw new Error(`Expected raw owner (pubkey) to be ${this.ownerLength} bytes, got ${t.byteLength} bytes.`);this.binary.set(t,2+this.signatureLength)}get rawOwner(){return this.binary.subarray(2+this.signatureLength,2+this.signatureLength+this.ownerLength)}get signatureLength(){return mv[this.signatureType].sigLength}get owner(){return Hu.default.encode(this.rawOwner)}get ownerLength(){return mv[this.signatureType].pubLength}get rawTarget(){let t=this.getTargetStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):Y1.Buffer.alloc(0)}get target(){return Hu.default.encode(this.rawTarget)}get rawAnchor(){let t=this.getAnchorStart();return this.binary[t]==1?this.binary.subarray(t+1,t+33):Y1.Buffer.alloc(0)}get anchor(){return this.rawAnchor.toString()}get rawTags(){let t=this.getTagsStart(),e=Ml(this.binary.subarray(t+8,t+16));return this.binary.subarray(t+16,t+16+e)}get tags(){let t=this.getTagsStart();if(Ml(this.binary.subarray(t,t+8))==0)return[];let e=Ml(this.binary.subarray(t+8,t+16));return Fw(Y1.Buffer.from(this.binary.subarray(t+16,t+16+e)))}get tagsB64Url(){return this.tags.map(t=>({name:Hu.default.encode(t.name),value:Hu.default.encode(t.value)}))}getStartOfData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=Ml(e);return t+16+r}get rawData(){let t=this.getTagsStart(),e=this.binary.subarray(t+8,t+16),r=Ml(e),a=t+16+r;return this.binary.subarray(a,this.binary.length)}get data(){return Hu.default.encode(this.rawData)}getRaw(){return this.binary}async sign(t){return this._id=await sUe(this,t),this.rawId}async setSignature(t){this.binary.set(t,2),this._id=Y1.Buffer.from(await Jh().hash(t))}isSigned(){return(this._id?.length??0)>0}toJSON(){return{signature:this.signature,owner:this.owner,target:this.target,tags:this.tags.map(t=>({name:Hu.default.encode(t.name),value:Hu.default.encode(t.value)})),data:this.data}}static async verify(t){if(t.byteLength<cO)return!1;let e=new yb(t),r=e.signatureType,a=e.getTagsStart(),i=Ml(t.subarray(a,a+8)),h=t.subarray(a+8,a+16),c=Ml(h);if(c>Jw)return!1;if(i>0)try{if(Fw(Y1.Buffer.from(t.subarray(a+16,a+16+c))).length!==i)return!1}catch{return!1}let d=uO[r],b=await DB(e);return await d.verify(e.rawOwner,b,e.rawSignature)}async getSignatureData(){return DB(this)}getTagsStart(){let t=this.getTargetStart(),e=this.binary[t]==1,r=t+(e?33:1),a=this.binary[r]==1;return r+=a?33:1,r}getTargetStart(){return 2+this.signatureLength+this.ownerLength}getAnchorStart(){let t=this.getTargetStart()+1,e=this.binary[this.getTargetStart()]==1;return t+=e?32:0,t}},hUe=Ld(sO(),1);function Ffe(t,e,r){let a=e.publicKey,i=r?.target?hUe.default.toBuffer(r.target):null,h=1+(i?.byteLength??0),c=r?.anchor?ge.from(r.anchor):null,d=1+(c?.byteLength??0),b=(r?.tags?.length??0)>0?hO(r.tags):null,g=16+(b?b.byteLength:0),y=ge.from(t),M=y.byteLength,x=2+e.signatureLength+e.ownerLength+h+d+g+M,E=ge.alloc(x);if(E.set(fUe(e.signatureType),0),E.set(new Uint8Array(e.signatureLength).fill(0),2),a.byteLength!==e.ownerLength)throw new Error(`Owner must be ${e.ownerLength} bytes, but was incorrectly ${a.byteLength}`);E.set(a,2+e.signatureLength);let A=2+e.signatureLength+e.ownerLength;if(E[A]=i?1:0,i){if(i.byteLength!==32)throw new Error(`Target must be 32 bytes but was incorrectly ${i.byteLength}`);E.set(i,A+1)}let k=A+h,O=k+1;if(E[k]=c?1:0,c){if(O+=c.byteLength,c.byteLength!==32)throw new Error("Anchor must be 32 bytes");E.set(c,k+1)}E.set(ise(r?.tags?.length??0),O);let N=ise(b?.byteLength??0);E.set(N,O+8),b&&E.set(b,O+16);let L=O+g;return E.set(y,L),new yb(E)}var lO={...Lfe};globalThis.arbundles??=lO;var cUe=lO,lUe=lO;globalThis.Buffer||(globalThis.Buffer=Ofe.Buffer);var{DataItem:dUe}=Pfe;function pUe(t){return async({data:r,tags:a,target:i,anchor:h,createDataItem:c=d=>new dUe(d)})=>{let d=await t.signDataItem({data:r,tags:a,target:i,anchor:h}),b=c(Ofe.Buffer.from(d));return{id:await b.id,raw:await b.getRaw()}}}var vUe=globalThis.GATEWAY_URL||void 0,mUe=globalThis.MU_URL||void 0,gUe=globalThis.CU_URL||void 0,bUe=globalThis.GRAPHQL_URL||void 0,{result:Pbt,results:Nbt,message:Cbt,spawn:Lbt,monitor:Dbt,unmonitor:$bt,dryrun:Ubt,assign:qbt}=gv({GATEWAY_URL:vUe,MU_URL:mUe,CU_URL:gUe,GRAPHQL_URL:bUe}),jfe=Bfe.createDataItemSigner;X();ee();Q();var li;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let h={};for(let c of i)h[c]=c;return h},t.getValidEnumValues=i=>{let h=t.objectKeys(i).filter(d=>typeof i[i[d]]!="number"),c={};for(let d of h)c[d]=i[d];return t.objectValues(c)},t.objectValues=i=>t.objectKeys(i).map(function(h){return i[h]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let h=[];for(let c in i)Object.prototype.hasOwnProperty.call(i,c)&&h.push(c);return h},t.find=(i,h)=>{for(let c of i)if(h(c))return c},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function a(i,h=" | "){return i.map(c=>typeof c=="string"?`'${c}'`:c).join(h)}t.joinValues=a,t.jsonStringifyReplacer=(i,h)=>typeof h=="bigint"?h.toString():h})(li||(li={}));var pO;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(pO||(pO={}));var Qt=li.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ol=t=>{switch(typeof t){case"undefined":return Qt.undefined;case"string":return Qt.string;case"number":return isNaN(t)?Qt.nan:Qt.number;case"boolean":return Qt.boolean;case"function":return Qt.function;case"bigint":return Qt.bigint;case"symbol":return Qt.symbol;case"object":return Array.isArray(t)?Qt.array:t===null?Qt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Qt.promise:typeof Map<"u"&&t instanceof Map?Qt.map:typeof Set<"u"&&t instanceof Set?Qt.set:typeof Date<"u"&&t instanceof Date?Qt.date:Qt.object;default:return Qt.unknown}},Nt=li.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),yUe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),$o=class t extends Error{constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(h){return h.message},a={_errors:[]},i=h=>{for(let c of h.issues)if(c.code==="invalid_union")c.unionErrors.map(i);else if(c.code==="invalid_return_type")i(c.returnTypeError);else if(c.code==="invalid_arguments")i(c.argumentsError);else if(c.path.length===0)a._errors.push(r(c));else{let d=a,b=0;for(;b<c.path.length;){let g=c.path[b];b===c.path.length-1?(d[g]=d[g]||{_errors:[]},d[g]._errors.push(r(c))):d[g]=d[g]||{_errors:[]},d=d[g],b++}}};return i(this),a}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,li.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},a=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):a.push(e(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};$o.create=t=>new $o(t);var wv=(t,e)=>{let r;switch(t.code){case Nt.invalid_type:t.received===Qt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Nt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,li.jsonStringifyReplacer)}`;break;case Nt.unrecognized_keys:r=`Unrecognized key(s) in object: ${li.joinValues(t.keys,", ")}`;break;case Nt.invalid_union:r="Invalid input";break;case Nt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${li.joinValues(t.options)}`;break;case Nt.invalid_enum_value:r=`Invalid enum value. Expected ${li.joinValues(t.options)}, received '${t.received}'`;break;case Nt.invalid_arguments:r="Invalid function arguments";break;case Nt.invalid_return_type:r="Invalid function return type";break;case Nt.invalid_date:r="Invalid date";break;case Nt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:li.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Nt.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Nt.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Nt.custom:r="Invalid input";break;case Nt.invalid_intersection_types:r="Intersection results could not be merged";break;case Nt.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Nt.not_finite:r="Number must be finite";break;default:r=e.defaultError,li.assertNever(t)}return{message:r}},Zfe=wv;function wUe(t){Zfe=t}function Xw(){return Zfe}var Qw=t=>{let{data:e,path:r,errorMaps:a,issueData:i}=t,h=[...r,...i.path||[]],c={...i,path:h};if(i.message!==void 0)return{...i,path:h,message:i.message};let d="",b=a.filter(g=>!!g).slice().reverse();for(let g of b)d=g(c,{data:e,defaultError:d}).message;return{...i,path:h,message:d}},_Ue=[];function Yt(t,e){let r=Xw(),a=Qw({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===wv?void 0:wv].filter(i=>!!i)});t.common.issues.push(a)}var Ca=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let a=[];for(let i of r){if(i.status==="aborted")return mr;i.status==="dirty"&&e.dirty(),a.push(i.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,r){let a=[];for(let i of r){let h=await i.key,c=await i.value;a.push({key:h,value:c})}return t.mergeObjectSync(e,a)}static mergeObjectSync(e,r){let a={};for(let i of r){let{key:h,value:c}=i;if(h.status==="aborted"||c.status==="aborted")return mr;h.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),h.value!=="__proto__"&&(typeof c.value<"u"||i.alwaysSet)&&(a[h.value]=c.value)}return{status:e.value,value:a}}},mr=Object.freeze({status:"aborted"}),yv=t=>({status:"dirty",value:t}),Va=t=>({status:"valid",value:t}),vO=t=>t.status==="aborted",mO=t=>t.status==="dirty",Rb=t=>t.status==="valid",Tb=t=>typeof Promise<"u"&&t instanceof Promise;function e5(t,e,r,a){if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?a:r==="a"?a.call(t):a?a.value:e.get(t)}function Kfe(t,e,r,a,i){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}var ar;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ar||(ar={}));var Eb,Ab,Zs=class{constructor(e,r,a,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=a,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},zfe=(t,e)=>{if(Rb(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new $o(t.common.issues);return this._error=r,this._error}}};function Nr(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:i}=t;if(e&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(c,d)=>{var b,g;let{message:y}=t;return c.code==="invalid_enum_value"?{message:y??d.defaultError}:typeof d.data>"u"?{message:(b=y??a)!==null&&b!==void 0?b:d.defaultError}:c.code!=="invalid_type"?{message:d.defaultError}:{message:(g=y??r)!==null&&g!==void 0?g:d.defaultError}},description:i}}var Cr=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Ol(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ol(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ca,ctx:{common:e.parent.common,data:e.data,parsedType:Ol(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Tb(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let a=this.safeParse(e,r);if(a.success)return a.data;throw a.error}safeParse(e,r){var a;let i={common:{issues:[],async:(a=r?.async)!==null&&a!==void 0?a:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ol(e)},h=this._parseSync({data:e,path:i.path,parent:i});return zfe(i,h)}async parseAsync(e,r){let a=await this.safeParseAsync(e,r);if(a.success)return a.data;throw a.error}async safeParseAsync(e,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ol(e)},i=this._parse({data:e,path:a.path,parent:a}),h=await(Tb(i)?i:Promise.resolve(i));return zfe(a,h)}refine(e,r){let a=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,h)=>{let c=e(i),d=()=>h.addIssue({code:Nt.custom,...a(i)});return typeof Promise<"u"&&c instanceof Promise?c.then(b=>b?!0:(d(),!1)):c?!0:(d(),!1)})}refinement(e,r){return this._refinement((a,i)=>e(a)?!0:(i.addIssue(typeof r=="function"?r(a,i):r),!1))}_refinement(e){return new Uo({schema:this,typeName:pr.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Hs.create(this,this._def)}nullable(){return Ju.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nc.create(this,this._def)}promise(){return Cl.create(this,this._def)}or(e){return zd.create([this,e],this._def)}and(e){return Hd.create(this,e,this._def)}transform(e){return new Uo({...Nr(this._def),schema:this,typeName:pr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Gd({...Nr(this._def),innerType:this,defaultValue:r,typeName:pr.ZodDefault})}brand(){return new kb({typeName:pr.ZodBranded,type:this,...Nr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Yd({...Nr(this._def),innerType:this,catchValue:r,typeName:pr.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ib.create(this,e)}readonly(){return Jd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},MUe=/^c[^\s-]{8,}$/i,xUe=/^[0-9a-z]+$/,SUe=/^[0-9A-HJKMNP-TV-Z]{26}$/,EUe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,AUe=/^[a-z0-9_-]{21}$/i,RUe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,TUe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kUe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dO,IUe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,BUe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,OUe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wfe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",PUe=new RegExp(`^${Wfe}$`);function Vfe(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function NUe(t){return new RegExp(`^${Vfe(t)}$`)}function Gfe(t){let e=`${Wfe}T${Vfe(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function CUe(t,e){return!!((e==="v4"||!e)&&IUe.test(t)||(e==="v6"||!e)&&BUe.test(t))}var Pl=class t extends Cr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Qt.string){let h=this._getOrReturnCtx(e);return Yt(h,{code:Nt.invalid_type,expected:Qt.string,received:h.parsedType}),mr}let a=new Ca,i;for(let h of this._def.checks)if(h.kind==="min")e.data.length<h.value&&(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.too_small,minimum:h.value,type:"string",inclusive:!0,exact:!1,message:h.message}),a.dirty());else if(h.kind==="max")e.data.length>h.value&&(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.too_big,maximum:h.value,type:"string",inclusive:!0,exact:!1,message:h.message}),a.dirty());else if(h.kind==="length"){let c=e.data.length>h.value,d=e.data.length<h.value;(c||d)&&(i=this._getOrReturnCtx(e,i),c?Yt(i,{code:Nt.too_big,maximum:h.value,type:"string",inclusive:!0,exact:!0,message:h.message}):d&&Yt(i,{code:Nt.too_small,minimum:h.value,type:"string",inclusive:!0,exact:!0,message:h.message}),a.dirty())}else if(h.kind==="email")TUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"email",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="emoji")dO||(dO=new RegExp(kUe,"u")),dO.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"emoji",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="uuid")EUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"uuid",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="nanoid")AUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"nanoid",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="cuid")MUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"cuid",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="cuid2")xUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"cuid2",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="ulid")SUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"ulid",code:Nt.invalid_string,message:h.message}),a.dirty());else if(h.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Yt(i,{validation:"url",code:Nt.invalid_string,message:h.message}),a.dirty()}else h.kind==="regex"?(h.regex.lastIndex=0,h.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"regex",code:Nt.invalid_string,message:h.message}),a.dirty())):h.kind==="trim"?e.data=e.data.trim():h.kind==="includes"?e.data.includes(h.value,h.position)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:{includes:h.value,position:h.position},message:h.message}),a.dirty()):h.kind==="toLowerCase"?e.data=e.data.toLowerCase():h.kind==="toUpperCase"?e.data=e.data.toUpperCase():h.kind==="startsWith"?e.data.startsWith(h.value)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:{startsWith:h.value},message:h.message}),a.dirty()):h.kind==="endsWith"?e.data.endsWith(h.value)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:{endsWith:h.value},message:h.message}),a.dirty()):h.kind==="datetime"?Gfe(h).test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:"datetime",message:h.message}),a.dirty()):h.kind==="date"?PUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:"date",message:h.message}),a.dirty()):h.kind==="time"?NUe(h).test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.invalid_string,validation:"time",message:h.message}),a.dirty()):h.kind==="duration"?RUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"duration",code:Nt.invalid_string,message:h.message}),a.dirty()):h.kind==="ip"?CUe(e.data,h.version)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"ip",code:Nt.invalid_string,message:h.message}),a.dirty()):h.kind==="base64"?OUe.test(e.data)||(i=this._getOrReturnCtx(e,i),Yt(i,{validation:"base64",code:Nt.invalid_string,message:h.message}),a.dirty()):li.assertNever(h);return{status:a.value,value:e.data}}_regex(e,r,a){return this.refinement(i=>e.test(i),{validation:r,code:Nt.invalid_string,...ar.errToObj(a)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ar.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ar.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ar.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ar.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ar.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ar.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ar.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ar.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ar.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ar.errToObj(e)})}datetime(e){var r,a;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(a=e?.local)!==null&&a!==void 0?a:!1,...ar.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ar.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ar.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ar.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ar.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ar.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ar.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ar.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ar.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ar.errToObj(r)})}nonempty(e){return this.min(1,ar.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Pl.create=t=>{var e;return new Pl({checks:[],typeName:pr.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Nr(t)})};function LUe(t,e){let r=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,i=r>a?r:a,h=parseInt(t.toFixed(i).replace(".","")),c=parseInt(e.toFixed(i).replace(".",""));return h%c/Math.pow(10,i)}var Dd=class t extends Cr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Qt.number){let h=this._getOrReturnCtx(e);return Yt(h,{code:Nt.invalid_type,expected:Qt.number,received:h.parsedType}),mr}let a,i=new Ca;for(let h of this._def.checks)h.kind==="int"?li.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.invalid_type,expected:"integer",received:"float",message:h.message}),i.dirty()):h.kind==="min"?(h.inclusive?e.data<h.value:e.data<=h.value)&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.too_small,minimum:h.value,type:"number",inclusive:h.inclusive,exact:!1,message:h.message}),i.dirty()):h.kind==="max"?(h.inclusive?e.data>h.value:e.data>=h.value)&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.too_big,maximum:h.value,type:"number",inclusive:h.inclusive,exact:!1,message:h.message}),i.dirty()):h.kind==="multipleOf"?LUe(e.data,h.value)!==0&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.not_multiple_of,multipleOf:h.value,message:h.message}),i.dirty()):h.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.not_finite,message:h.message}),i.dirty()):li.assertNever(h);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ar.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ar.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ar.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ar.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:ar.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ar.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ar.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ar.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ar.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ar.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ar.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ar.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ar.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ar.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&li.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Dd.create=t=>new Dd({checks:[],typeName:pr.ZodNumber,coerce:t?.coerce||!1,...Nr(t)});var $d=class t extends Cr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Qt.bigint){let h=this._getOrReturnCtx(e);return Yt(h,{code:Nt.invalid_type,expected:Qt.bigint,received:h.parsedType}),mr}let a,i=new Ca;for(let h of this._def.checks)h.kind==="min"?(h.inclusive?e.data<h.value:e.data<=h.value)&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.too_small,type:"bigint",minimum:h.value,inclusive:h.inclusive,message:h.message}),i.dirty()):h.kind==="max"?(h.inclusive?e.data>h.value:e.data>=h.value)&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.too_big,type:"bigint",maximum:h.value,inclusive:h.inclusive,message:h.message}),i.dirty()):h.kind==="multipleOf"?e.data%h.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),Yt(a,{code:Nt.not_multiple_of,multipleOf:h.value,message:h.message}),i.dirty()):li.assertNever(h);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ar.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ar.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ar.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ar.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:ar.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ar.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ar.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ar.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ar.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ar.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};$d.create=t=>{var e;return new $d({checks:[],typeName:pr.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Nr(t)})};var Ud=class extends Cr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Qt.boolean){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.boolean,received:a.parsedType}),mr}return Va(e.data)}};Ud.create=t=>new Ud({typeName:pr.ZodBoolean,coerce:t?.coerce||!1,...Nr(t)});var qd=class t extends Cr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Qt.date){let h=this._getOrReturnCtx(e);return Yt(h,{code:Nt.invalid_type,expected:Qt.date,received:h.parsedType}),mr}if(isNaN(e.data.getTime())){let h=this._getOrReturnCtx(e);return Yt(h,{code:Nt.invalid_date}),mr}let a=new Ca,i;for(let h of this._def.checks)h.kind==="min"?e.data.getTime()<h.value&&(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.too_small,message:h.message,inclusive:!0,exact:!1,minimum:h.value,type:"date"}),a.dirty()):h.kind==="max"?e.data.getTime()>h.value&&(i=this._getOrReturnCtx(e,i),Yt(i,{code:Nt.too_big,message:h.message,inclusive:!0,exact:!1,maximum:h.value,type:"date"}),a.dirty()):li.assertNever(h);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ar.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ar.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};qd.create=t=>new qd({checks:[],coerce:t?.coerce||!1,typeName:pr.ZodDate,...Nr(t)});var _v=class extends Cr{_parse(e){if(this._getType(e)!==Qt.symbol){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.symbol,received:a.parsedType}),mr}return Va(e.data)}};_v.create=t=>new _v({typeName:pr.ZodSymbol,...Nr(t)});var Fd=class extends Cr{_parse(e){if(this._getType(e)!==Qt.undefined){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.undefined,received:a.parsedType}),mr}return Va(e.data)}};Fd.create=t=>new Fd({typeName:pr.ZodUndefined,...Nr(t)});var jd=class extends Cr{_parse(e){if(this._getType(e)!==Qt.null){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.null,received:a.parsedType}),mr}return Va(e.data)}};jd.create=t=>new jd({typeName:pr.ZodNull,...Nr(t)});var Nl=class extends Cr{constructor(){super(...arguments),this._any=!0}_parse(e){return Va(e.data)}};Nl.create=t=>new Nl({typeName:pr.ZodAny,...Nr(t)});var ic=class extends Cr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Va(e.data)}};ic.create=t=>new ic({typeName:pr.ZodUnknown,...Nr(t)});var Vf=class extends Cr{_parse(e){let r=this._getOrReturnCtx(e);return Yt(r,{code:Nt.invalid_type,expected:Qt.never,received:r.parsedType}),mr}};Vf.create=t=>new Vf({typeName:pr.ZodNever,...Nr(t)});var Mv=class extends Cr{_parse(e){if(this._getType(e)!==Qt.undefined){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.void,received:a.parsedType}),mr}return Va(e.data)}};Mv.create=t=>new Mv({typeName:pr.ZodVoid,...Nr(t)});var nc=class t extends Cr{_parse(e){let{ctx:r,status:a}=this._processInputParams(e),i=this._def;if(r.parsedType!==Qt.array)return Yt(r,{code:Nt.invalid_type,expected:Qt.array,received:r.parsedType}),mr;if(i.exactLength!==null){let c=r.data.length>i.exactLength.value,d=r.data.length<i.exactLength.value;(c||d)&&(Yt(r,{code:c?Nt.too_big:Nt.too_small,minimum:d?i.exactLength.value:void 0,maximum:c?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Yt(r,{code:Nt.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Yt(r,{code:Nt.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((c,d)=>i.type._parseAsync(new Zs(r,c,r.path,d)))).then(c=>Ca.mergeArray(a,c));let h=[...r.data].map((c,d)=>i.type._parseSync(new Zs(r,c,r.path,d)));return Ca.mergeArray(a,h)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:ar.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:ar.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:ar.toString(r)}})}nonempty(e){return this.min(1,e)}};nc.create=(t,e)=>new nc({type:t,minLength:null,maxLength:null,exactLength:null,typeName:pr.ZodArray,...Nr(e)});function bv(t){if(t instanceof vo){let e={};for(let r in t.shape){let a=t.shape[r];e[r]=Hs.create(bv(a))}return new vo({...t._def,shape:()=>e})}else return t instanceof nc?new nc({...t._def,type:bv(t.element)}):t instanceof Hs?Hs.create(bv(t.unwrap())):t instanceof Ju?Ju.create(bv(t.unwrap())):t instanceof Yu?Yu.create(t.items.map(e=>bv(e))):t}var vo=class t extends Cr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=li.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Qt.object){let g=this._getOrReturnCtx(e);return Yt(g,{code:Nt.invalid_type,expected:Qt.object,received:g.parsedType}),mr}let{status:a,ctx:i}=this._processInputParams(e),{shape:h,keys:c}=this._getCached(),d=[];if(!(this._def.catchall instanceof Vf&&this._def.unknownKeys==="strip"))for(let g in i.data)c.includes(g)||d.push(g);let b=[];for(let g of c){let y=h[g],M=i.data[g];b.push({key:{status:"valid",value:g},value:y._parse(new Zs(i,M,i.path,g)),alwaysSet:g in i.data})}if(this._def.catchall instanceof Vf){let g=this._def.unknownKeys;if(g==="passthrough")for(let y of d)b.push({key:{status:"valid",value:y},value:{status:"valid",value:i.data[y]}});else if(g==="strict")d.length>0&&(Yt(i,{code:Nt.unrecognized_keys,keys:d}),a.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let g=this._def.catchall;for(let y of d){let M=i.data[y];b.push({key:{status:"valid",value:y},value:g._parse(new Zs(i,M,i.path,y)),alwaysSet:y in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let g=[];for(let y of b){let M=await y.key,x=await y.value;g.push({key:M,value:x,alwaysSet:y.alwaysSet})}return g}).then(g=>Ca.mergeObjectSync(a,g)):Ca.mergeObjectSync(a,b)}get shape(){return this._def.shape()}strict(e){return ar.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,a)=>{var i,h,c,d;let b=(c=(h=(i=this._def).errorMap)===null||h===void 0?void 0:h.call(i,r,a).message)!==null&&c!==void 0?c:a.defaultError;return r.code==="unrecognized_keys"?{message:(d=ar.errToObj(e).message)!==null&&d!==void 0?d:b}:{message:b}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:pr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return li.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(r[a]=this.shape[a])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return li.objectKeys(this.shape).forEach(a=>{e[a]||(r[a]=this.shape[a])}),new t({...this._def,shape:()=>r})}deepPartial(){return bv(this)}partial(e){let r={};return li.objectKeys(this.shape).forEach(a=>{let i=this.shape[a];e&&!e[a]?r[a]=i:r[a]=i.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return li.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])r[a]=this.shape[a];else{let h=this.shape[a];for(;h instanceof Hs;)h=h._def.innerType;r[a]=h}}),new t({...this._def,shape:()=>r})}keyof(){return Yfe(li.objectKeys(this.shape))}};vo.create=(t,e)=>new vo({shape:()=>t,unknownKeys:"strip",catchall:Vf.create(),typeName:pr.ZodObject,...Nr(e)});vo.strictCreate=(t,e)=>new vo({shape:()=>t,unknownKeys:"strict",catchall:Vf.create(),typeName:pr.ZodObject,...Nr(e)});vo.lazycreate=(t,e)=>new vo({shape:t,unknownKeys:"strip",catchall:Vf.create(),typeName:pr.ZodObject,...Nr(e)});var zd=class extends Cr{_parse(e){let{ctx:r}=this._processInputParams(e),a=this._def.options;function i(h){for(let d of h)if(d.result.status==="valid")return d.result;for(let d of h)if(d.result.status==="dirty")return r.common.issues.push(...d.ctx.common.issues),d.result;let c=h.map(d=>new $o(d.ctx.common.issues));return Yt(r,{code:Nt.invalid_union,unionErrors:c}),mr}if(r.common.async)return Promise.all(a.map(async h=>{let c={...r,common:{...r.common,issues:[]},parent:null};return{result:await h._parseAsync({data:r.data,path:r.path,parent:c}),ctx:c}})).then(i);{let h,c=[];for(let b of a){let g={...r,common:{...r.common,issues:[]},parent:null},y=b._parseSync({data:r.data,path:r.path,parent:g});if(y.status==="valid")return y;y.status==="dirty"&&!h&&(h={result:y,ctx:g}),g.common.issues.length&&c.push(g.common.issues)}if(h)return r.common.issues.push(...h.ctx.common.issues),h.result;let d=c.map(b=>new $o(b));return Yt(r,{code:Nt.invalid_union,unionErrors:d}),mr}}get options(){return this._def.options}};zd.create=(t,e)=>new zd({options:t,typeName:pr.ZodUnion,...Nr(e)});var rc=t=>t instanceof Zd?rc(t.schema):t instanceof Uo?rc(t.innerType()):t instanceof Kd?[t.value]:t instanceof Wd?t.options:t instanceof Vd?li.objectValues(t.enum):t instanceof Gd?rc(t._def.innerType):t instanceof Fd?[void 0]:t instanceof jd?[null]:t instanceof Hs?[void 0,...rc(t.unwrap())]:t instanceof Ju?[null,...rc(t.unwrap())]:t instanceof kb||t instanceof Jd?rc(t.unwrap()):t instanceof Yd?rc(t._def.innerType):[],t5=class t extends Cr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Qt.object)return Yt(r,{code:Nt.invalid_type,expected:Qt.object,received:r.parsedType}),mr;let a=this.discriminator,i=r.data[a],h=this.optionsMap.get(i);return h?r.common.async?h._parseAsync({data:r.data,path:r.path,parent:r}):h._parseSync({data:r.data,path:r.path,parent:r}):(Yt(r,{code:Nt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),mr)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,a){let i=new Map;for(let h of r){let c=rc(h.shape[e]);if(!c.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let d of c){if(i.has(d))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);i.set(d,h)}}return new t({typeName:pr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Nr(a)})}};function gO(t,e){let r=Ol(t),a=Ol(e);if(t===e)return{valid:!0,data:t};if(r===Qt.object&&a===Qt.object){let i=li.objectKeys(e),h=li.objectKeys(t).filter(d=>i.indexOf(d)!==-1),c={...t,...e};for(let d of h){let b=gO(t[d],e[d]);if(!b.valid)return{valid:!1};c[d]=b.data}return{valid:!0,data:c}}else if(r===Qt.array&&a===Qt.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let h=0;h<t.length;h++){let c=t[h],d=e[h],b=gO(c,d);if(!b.valid)return{valid:!1};i.push(b.data)}return{valid:!0,data:i}}else return r===Qt.date&&a===Qt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Hd=class extends Cr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e),i=(h,c)=>{if(vO(h)||vO(c))return mr;let d=gO(h.value,c.value);return d.valid?((mO(h)||mO(c))&&r.dirty(),{status:r.value,value:d.data}):(Yt(a,{code:Nt.invalid_intersection_types}),mr)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([h,c])=>i(h,c)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Hd.create=(t,e,r)=>new Hd({left:t,right:e,typeName:pr.ZodIntersection,...Nr(r)});var Yu=class t extends Cr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Qt.array)return Yt(a,{code:Nt.invalid_type,expected:Qt.array,received:a.parsedType}),mr;if(a.data.length<this._def.items.length)return Yt(a,{code:Nt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),mr;!this._def.rest&&a.data.length>this._def.items.length&&(Yt(a,{code:Nt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let h=[...a.data].map((c,d)=>{let b=this._def.items[d]||this._def.rest;return b?b._parse(new Zs(a,c,a.path,d)):null}).filter(c=>!!c);return a.common.async?Promise.all(h).then(c=>Ca.mergeArray(r,c)):Ca.mergeArray(r,h)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Yu.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Yu({items:t,typeName:pr.ZodTuple,rest:null,...Nr(e)})};var r5=class t extends Cr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Qt.object)return Yt(a,{code:Nt.invalid_type,expected:Qt.object,received:a.parsedType}),mr;let i=[],h=this._def.keyType,c=this._def.valueType;for(let d in a.data)i.push({key:h._parse(new Zs(a,d,a.path,d)),value:c._parse(new Zs(a,a.data[d],a.path,d)),alwaysSet:d in a.data});return a.common.async?Ca.mergeObjectAsync(r,i):Ca.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,a){return r instanceof Cr?new t({keyType:e,valueType:r,typeName:pr.ZodRecord,...Nr(a)}):new t({keyType:Pl.create(),valueType:e,typeName:pr.ZodRecord,...Nr(r)})}},xv=class extends Cr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Qt.map)return Yt(a,{code:Nt.invalid_type,expected:Qt.map,received:a.parsedType}),mr;let i=this._def.keyType,h=this._def.valueType,c=[...a.data.entries()].map(([d,b],g)=>({key:i._parse(new Zs(a,d,a.path,[g,"key"])),value:h._parse(new Zs(a,b,a.path,[g,"value"]))}));if(a.common.async){let d=new Map;return Promise.resolve().then(async()=>{for(let b of c){let g=await b.key,y=await b.value;if(g.status==="aborted"||y.status==="aborted")return mr;(g.status==="dirty"||y.status==="dirty")&&r.dirty(),d.set(g.value,y.value)}return{status:r.value,value:d}})}else{let d=new Map;for(let b of c){let g=b.key,y=b.value;if(g.status==="aborted"||y.status==="aborted")return mr;(g.status==="dirty"||y.status==="dirty")&&r.dirty(),d.set(g.value,y.value)}return{status:r.value,value:d}}}};xv.create=(t,e,r)=>new xv({valueType:e,keyType:t,typeName:pr.ZodMap,...Nr(r)});var Sv=class t extends Cr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==Qt.set)return Yt(a,{code:Nt.invalid_type,expected:Qt.set,received:a.parsedType}),mr;let i=this._def;i.minSize!==null&&a.data.size<i.minSize.value&&(Yt(a,{code:Nt.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&a.data.size>i.maxSize.value&&(Yt(a,{code:Nt.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let h=this._def.valueType;function c(b){let g=new Set;for(let y of b){if(y.status==="aborted")return mr;y.status==="dirty"&&r.dirty(),g.add(y.value)}return{status:r.value,value:g}}let d=[...a.data.values()].map((b,g)=>h._parse(new Zs(a,b,a.path,g)));return a.common.async?Promise.all(d).then(b=>c(b)):c(d)}min(e,r){return new t({...this._def,minSize:{value:e,message:ar.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:ar.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Sv.create=(t,e)=>new Sv({valueType:t,minSize:null,maxSize:null,typeName:pr.ZodSet,...Nr(e)});var i5=class t extends Cr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Qt.function)return Yt(r,{code:Nt.invalid_type,expected:Qt.function,received:r.parsedType}),mr;function a(d,b){return Qw({data:d,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Xw(),wv].filter(g=>!!g),issueData:{code:Nt.invalid_arguments,argumentsError:b}})}function i(d,b){return Qw({data:d,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Xw(),wv].filter(g=>!!g),issueData:{code:Nt.invalid_return_type,returnTypeError:b}})}let h={errorMap:r.common.contextualErrorMap},c=r.data;if(this._def.returns instanceof Cl){let d=this;return Va(async function(...b){let g=new $o([]),y=await d._def.args.parseAsync(b,h).catch(E=>{throw g.addIssue(a(b,E)),g}),M=await Reflect.apply(c,this,y);return await d._def.returns._def.type.parseAsync(M,h).catch(E=>{throw g.addIssue(i(M,E)),g})})}else{let d=this;return Va(function(...b){let g=d._def.args.safeParse(b,h);if(!g.success)throw new $o([a(b,g.error)]);let y=Reflect.apply(c,this,g.data),M=d._def.returns.safeParse(y,h);if(!M.success)throw new $o([i(y,M.error)]);return M.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Yu.create(e).rest(ic.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,a){return new t({args:e||Yu.create([]).rest(ic.create()),returns:r||ic.create(),typeName:pr.ZodFunction,...Nr(a)})}},Zd=class extends Cr{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Zd.create=(t,e)=>new Zd({getter:t,typeName:pr.ZodLazy,...Nr(e)});var Kd=class extends Cr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Yt(r,{received:r.data,code:Nt.invalid_literal,expected:this._def.value}),mr}return{status:"valid",value:e.data}}get value(){return this._def.value}};Kd.create=(t,e)=>new Kd({value:t,typeName:pr.ZodLiteral,...Nr(e)});function Yfe(t,e){return new Wd({values:t,typeName:pr.ZodEnum,...Nr(e)})}var Wd=class t extends Cr{constructor(){super(...arguments),Eb.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),a=this._def.values;return Yt(r,{expected:li.joinValues(a),received:r.parsedType,code:Nt.invalid_type}),mr}if(e5(this,Eb,"f")||Kfe(this,Eb,new Set(this._def.values),"f"),!e5(this,Eb,"f").has(e.data)){let r=this._getOrReturnCtx(e),a=this._def.values;return Yt(r,{received:r.data,code:Nt.invalid_enum_value,options:a}),mr}return Va(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(a=>!e.includes(a)),{...this._def,...r})}};Eb=new WeakMap;Wd.create=Yfe;var Vd=class extends Cr{constructor(){super(...arguments),Ab.set(this,void 0)}_parse(e){let r=li.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==Qt.string&&a.parsedType!==Qt.number){let i=li.objectValues(r);return Yt(a,{expected:li.joinValues(i),received:a.parsedType,code:Nt.invalid_type}),mr}if(e5(this,Ab,"f")||Kfe(this,Ab,new Set(li.getValidEnumValues(this._def.values)),"f"),!e5(this,Ab,"f").has(e.data)){let i=li.objectValues(r);return Yt(a,{received:a.data,code:Nt.invalid_enum_value,options:i}),mr}return Va(e.data)}get enum(){return this._def.values}};Ab=new WeakMap;Vd.create=(t,e)=>new Vd({values:t,typeName:pr.ZodNativeEnum,...Nr(e)});var Cl=class extends Cr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Qt.promise&&r.common.async===!1)return Yt(r,{code:Nt.invalid_type,expected:Qt.promise,received:r.parsedType}),mr;let a=r.parsedType===Qt.promise?r.data:Promise.resolve(r.data);return Va(a.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Cl.create=(t,e)=>new Cl({type:t,typeName:pr.ZodPromise,...Nr(e)});var Uo=class extends Cr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===pr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:a}=this._processInputParams(e),i=this._def.effect||null,h={addIssue:c=>{Yt(a,c),c.fatal?r.abort():r.dirty()},get path(){return a.path}};if(h.addIssue=h.addIssue.bind(h),i.type==="preprocess"){let c=i.transform(a.data,h);if(a.common.async)return Promise.resolve(c).then(async d=>{if(r.value==="aborted")return mr;let b=await this._def.schema._parseAsync({data:d,path:a.path,parent:a});return b.status==="aborted"?mr:b.status==="dirty"||r.value==="dirty"?yv(b.value):b});{if(r.value==="aborted")return mr;let d=this._def.schema._parseSync({data:c,path:a.path,parent:a});return d.status==="aborted"?mr:d.status==="dirty"||r.value==="dirty"?yv(d.value):d}}if(i.type==="refinement"){let c=d=>{let b=i.refinement(d,h);if(a.common.async)return Promise.resolve(b);if(b instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(a.common.async===!1){let d=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return d.status==="aborted"?mr:(d.status==="dirty"&&r.dirty(),c(d.value),{status:r.value,value:d.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(d=>d.status==="aborted"?mr:(d.status==="dirty"&&r.dirty(),c(d.value).then(()=>({status:r.value,value:d.value}))))}if(i.type==="transform")if(a.common.async===!1){let c=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Rb(c))return c;let d=i.transform(c.value,h);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:d}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(c=>Rb(c)?Promise.resolve(i.transform(c.value,h)).then(d=>({status:r.value,value:d})):c);li.assertNever(i)}};Uo.create=(t,e,r)=>new Uo({schema:t,typeName:pr.ZodEffects,effect:e,...Nr(r)});Uo.createWithPreprocess=(t,e,r)=>new Uo({schema:e,effect:{type:"preprocess",transform:t},typeName:pr.ZodEffects,...Nr(r)});var Hs=class extends Cr{_parse(e){return this._getType(e)===Qt.undefined?Va(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Hs.create=(t,e)=>new Hs({innerType:t,typeName:pr.ZodOptional,...Nr(e)});var Ju=class extends Cr{_parse(e){return this._getType(e)===Qt.null?Va(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ju.create=(t,e)=>new Ju({innerType:t,typeName:pr.ZodNullable,...Nr(e)});var Gd=class extends Cr{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return r.parsedType===Qt.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Gd.create=(t,e)=>new Gd({innerType:t,typeName:pr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Nr(e)});var Yd=class extends Cr{_parse(e){let{ctx:r}=this._processInputParams(e),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Tb(i)?i.then(h=>({status:"valid",value:h.status==="valid"?h.value:this._def.catchValue({get error(){return new $o(a.common.issues)},input:a.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new $o(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Yd.create=(t,e)=>new Yd({innerType:t,typeName:pr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Nr(e)});var Ev=class extends Cr{_parse(e){if(this._getType(e)!==Qt.nan){let a=this._getOrReturnCtx(e);return Yt(a,{code:Nt.invalid_type,expected:Qt.nan,received:a.parsedType}),mr}return{status:"valid",value:e.data}}};Ev.create=t=>new Ev({typeName:pr.ZodNaN,...Nr(t)});var DUe=Symbol("zod_brand"),kb=class extends Cr{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},Ib=class t extends Cr{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let h=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return h.status==="aborted"?mr:h.status==="dirty"?(r.dirty(),yv(h.value)):this._def.out._parseAsync({data:h.value,path:a.path,parent:a})})();{let i=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?mr:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:a.path,parent:a})}}static create(e,r){return new t({in:e,out:r,typeName:pr.ZodPipeline})}},Jd=class extends Cr{_parse(e){let r=this._def.innerType._parse(e),a=i=>(Rb(i)&&(i.value=Object.freeze(i.value)),i);return Tb(r)?r.then(i=>a(i)):a(r)}unwrap(){return this._def.innerType}};Jd.create=(t,e)=>new Jd({innerType:t,typeName:pr.ZodReadonly,...Nr(e)});function Jfe(t,e={},r){return t?Nl.create().superRefine((a,i)=>{var h,c;if(!t(a)){let d=typeof e=="function"?e(a):typeof e=="string"?{message:e}:e,b=(c=(h=d.fatal)!==null&&h!==void 0?h:r)!==null&&c!==void 0?c:!0,g=typeof d=="string"?{message:d}:d;i.addIssue({code:"custom",...g,fatal:b})}}):Nl.create()}var $Ue={object:vo.lazycreate},pr;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(pr||(pr={}));var UUe=(t,e={message:`Input not instance of ${t.name}`})=>Jfe(r=>r instanceof t,e),Xfe=Pl.create,Qfe=Dd.create,qUe=Ev.create,FUe=$d.create,eue=Ud.create,jUe=qd.create,zUe=_v.create,HUe=Fd.create,ZUe=jd.create,KUe=Nl.create,WUe=ic.create,VUe=Vf.create,GUe=Mv.create,YUe=nc.create,JUe=vo.create,XUe=vo.strictCreate,QUe=zd.create,eqe=t5.create,tqe=Hd.create,rqe=Yu.create,iqe=r5.create,nqe=xv.create,aqe=Sv.create,oqe=i5.create,sqe=Zd.create,fqe=Kd.create,uqe=Wd.create,hqe=Vd.create,cqe=Cl.create,Hfe=Uo.create,lqe=Hs.create,dqe=Ju.create,pqe=Uo.createWithPreprocess,vqe=Ib.create,mqe=()=>Xfe().optional(),gqe=()=>Qfe().optional(),bqe=()=>eue().optional(),yqe={string:t=>Pl.create({...t,coerce:!0}),number:t=>Dd.create({...t,coerce:!0}),boolean:t=>Ud.create({...t,coerce:!0}),bigint:t=>$d.create({...t,coerce:!0}),date:t=>qd.create({...t,coerce:!0})},wqe=mr,yi=Object.freeze({__proto__:null,defaultErrorMap:wv,setErrorMap:wUe,getErrorMap:Xw,makeIssue:Qw,EMPTY_PATH:_Ue,addIssueToContext:Yt,ParseStatus:Ca,INVALID:mr,DIRTY:yv,OK:Va,isAborted:vO,isDirty:mO,isValid:Rb,isAsync:Tb,get util(){return li},get objectUtil(){return pO},ZodParsedType:Qt,getParsedType:Ol,ZodType:Cr,datetimeRegex:Gfe,ZodString:Pl,ZodNumber:Dd,ZodBigInt:$d,ZodBoolean:Ud,ZodDate:qd,ZodSymbol:_v,ZodUndefined:Fd,ZodNull:jd,ZodAny:Nl,ZodUnknown:ic,ZodNever:Vf,ZodVoid:Mv,ZodArray:nc,ZodObject:vo,ZodUnion:zd,ZodDiscriminatedUnion:t5,ZodIntersection:Hd,ZodTuple:Yu,ZodRecord:r5,ZodMap:xv,ZodSet:Sv,ZodFunction:i5,ZodLazy:Zd,ZodLiteral:Kd,ZodEnum:Wd,ZodNativeEnum:Vd,ZodPromise:Cl,ZodEffects:Uo,ZodTransformer:Uo,ZodOptional:Hs,ZodNullable:Ju,ZodDefault:Gd,ZodCatch:Yd,ZodNaN:Ev,BRAND:DUe,ZodBranded:kb,ZodPipeline:Ib,ZodReadonly:Jd,custom:Jfe,Schema:Cr,ZodSchema:Cr,late:$Ue,get ZodFirstPartyTypeKind(){return pr},coerce:yqe,any:KUe,array:YUe,bigint:FUe,boolean:eue,date:jUe,discriminatedUnion:eqe,effect:Hfe,enum:uqe,function:oqe,instanceof:UUe,intersection:tqe,lazy:sqe,literal:fqe,map:nqe,nan:qUe,nativeEnum:hqe,never:VUe,null:ZUe,nullable:dqe,number:Qfe,object:JUe,oboolean:bqe,onumber:gqe,optional:lqe,ostring:mqe,pipeline:vqe,preprocess:pqe,promise:cqe,record:iqe,set:aqe,strictObject:XUe,string:Xfe,symbol:zUe,transformer:Hfe,tuple:rqe,undefined:HUe,union:QUe,unknown:WUe,void:GUe,NEVER:wqe,ZodIssueCode:Nt,quotelessJson:yUe,ZodError:$o});X();ee();Q();var Wue=vi(Kue(),1),Fb=Wue.default.init({host:"arweave.net",port:443,protocol:"https"});async function C3t({signer:t,module:e=iee,luaCodeTxId:r=QT,ao:a=gv(),scheduler:i=nee,state:h,stateContractTxId:c,antRegistryId:d=n4}){let b=Xd.init({process:new La({processId:d,ao:a}),signer:t}),g=await Fb.transactions.getData(r,{decode:!0,string:!0}),y=await a.spawn({module:e,scheduler:i,signer:t,tags:[{name:"ANT-Registry-Id",value:d}]}),M=new La({processId:y,ao:a});return await M.send({tags:[{name:"Action",value:"Eval"},{name:"App-Name",value:"ArNS-ANT"},{name:"Source-Code-TX-ID",value:r}],data:g,signer:t}),h&&await M.send({tags:[{name:"Action",value:"Initialize-State"},...c!==void 0?[{name:"State-Contract-TX-ID",value:c}]:[]],data:JSON.stringify(h),signer:t}),await b.register({processId:y}),y}async function L3t({signer:t,processId:e,luaCodeTxId:r=QT,ao:a=gv()}){let i=new La({processId:e,ao:a}),h=await Fb.transactions.getData(r,{decode:!0,string:!0}),{id:c}=await i.send({tags:[{name:"Action",value:"Eval"},{name:"App-Name",value:"ArNS-ANT"},{name:"Source-Code-TX-ID",value:r}],data:h,signer:t});return c}function qFe(t){let e=yi.object({name:yi.string(),value:yi.union([yi.string(),yi.number()])}),r=yi.function().args(yi.object({data:yi.union([yi.string(),yi.instanceof(ge)]),tags:yi.array(e).optional(),target:yi.string().optional(),anchor:yi.string().optional()})).returns(yi.promise(yi.object({id:yi.string(),raw:yi.instanceof(ArrayBuffer)})));try{return r.parse(t),!0}catch{return!1}}function $l(t){return qFe(t)?t:"publicKey"in t?async({data:r,tags:a,target:i,anchor:h})=>{t.publicKey===void 0&&"setPublicKey"in t&&typeof t.setPublicKey=="function"&&await t.setPublicKey();let c=jg(r,t,{tags:a,target:i,anchor:h});return c.sign(t).then(async()=>({id:await c.id,raw:await c.getRaw()}))}:jfe(t)}var FFe=yi.object({Name:yi.string(),Ticker:yi.string(),Owner:yi.string(),Controllers:yi.array(yi.string()),Records:yi.record(yi.string(),yi.object({transactionId:yi.string(),ttlSeconds:yi.number()}).passthrough()),Balances:yi.record(yi.string(),yi.number())}).passthrough();function D3t(t,e=Ff.default){try{return FFe.parse(t),!0}catch(r){return e.error(r.issues),!1}}var c5=class{static init({signer:e,...r}){if(Fh(r)||jh(r))return e?new WO({signer:e,...r}):new l5(r);throw new Du}},l5=class{process;constructor(e){if(Fh(e))this.process=e.process;else if(jh(e))this.process=new La({processId:e.processId});else throw new Du}async getState(){let e=[{name:"Action",value:"State"}];return await this.process.read({tags:e})}async getInfo(){let e=[{name:"Action",value:"Info"}];return await this.process.read({tags:e})}async getRecord({undername:e}){let r=[{name:"Sub-Domain",value:e},{name:"Action",value:"Record"}];return await this.process.read({tags:r})}async getRecords(){let e=[{name:"Action",value:"Records"}];return await this.process.read({tags:e})}async getOwner(){return(await this.getInfo()).Owner}async getControllers(){let e=[{name:"Action",value:"Controllers"}];return await this.process.read({tags:e})}async getName(){return(await this.getInfo()).Name}async getTicker(){return(await this.getInfo()).Ticker}async getBalances(){let e=[{name:"Action",value:"Balances"}];return await this.process.read({tags:e})}async getBalance({address:e}){let r=[{name:"Action",value:"Balance"},{name:"Recipient",value:e}];return await this.process.read({tags:r})}},WO=class extends l5{signer;constructor({signer:e,...r}){super(r),this.signer=$l(e)}async transfer({target:e}){let r=[{name:"Action",value:"Transfer"},{name:"Recipient",value:e}];return this.process.send({tags:r,signer:this.signer})}async addController({controller:e}){let r=[{name:"Action",value:"Add-Controller"},{name:"Controller",value:e}];return this.process.send({tags:r,signer:this.signer})}async removeController({controller:e}){let r=[{name:"Action",value:"Remove-Controller"},{name:"Controller",value:e}];return this.process.send({tags:r,signer:this.signer})}async setRecord({undername:e,transactionId:r,ttlSeconds:a}){return this.process.send({tags:[{name:"Action",value:"Set-Record"},{name:"Sub-Domain",value:e},{name:"Transaction-Id",value:r},{name:"TTL-Seconds",value:a.toString()}],signer:this.signer})}async removeRecord({undername:e}){return this.process.send({tags:[{name:"Action",value:"Remove-Record"},{name:"Sub-Domain",value:e}],signer:this.signer})}async setTicker({ticker:e}){return this.process.send({tags:[{name:"Action",value:"Set-Ticker"},{name:"Ticker",value:e}],signer:this.signer})}async setName({name:e}){return this.process.send({tags:[{name:"Action",value:"Set-Name"},{name:"Name",value:e}],signer:this.signer})}};X();ee();Q();var Xd=class{static init(e){if(e&&e.signer){let{signer:r,...a}=e;return new VO({...a,signer:r})}return new d5(e)}},d5=class{process;constructor(e){if(e&&(jh(e)||Fh(e)))if(Fh(e))this.process=e.process;else if(jh(e))this.process=new La({processId:e.processId});else throw new Du;else this.process=new La({processId:n4})}async accessControlList({address:e}){return this.process.read({tags:[{name:"Action",value:"Access-Control-List"},{name:"Address",value:e}]})}},VO=class extends d5{signer;constructor({signer:e,...r}){super(r),this.signer=$l(e)}async register({processId:e}){return this.process.send({tags:[{name:"Action",value:"Register"},{name:"Process-Id",value:e}],signer:this.signer})}};X();ee();Q();X();ee();Q();X();ee();Q();function GO(t){try{return JSON.parse(t)}catch{return t}}var La=class{logger;processId;ao;constructor({processId:e,ao:r=gv(),logger:a=Ff.default}){this.processId=e,this.logger=a,this.ao=r}async read({tags:e,retries:r=3}){let a=0,i;for(;a<r;)try{this.logger.debug("Evaluating read interaction on contract",{tags:e});let h=await this.ao.dryrun({process:this.processId,tags:e});if(h.Messages.length===0)throw new Error(`Process ${this.processId} does not support provided action.`);let d=h.Messages[0].Tags.find(g=>g.name==="Error");if(d)throw new Error(`${d.Value}: ${h.Messages[0].Data}`);return this.logger.debug("Read interaction result",{result:h.Messages[0].Data}),h.Messages[0].Data===void 0?{}:GO(h.Messages[0].Data)}catch(h){a++,this.logger.debug(`Read attempt ${a} failed`,{error:h,tags:e}),i=h,await new Promise(c=>setTimeout(c,2**a*1e3))}throw i}async send({tags:e,data:r,signer:a,retries:i=3}){let h=0,c;for(;h<i;)try{this.logger.debug("Evaluating send interaction on contract",{tags:e,data:r,processId:this.processId});let d=await this.ao.message({process:this.processId,tags:[...e,{name:"AR-IO-SDK",value:V1}],data:r,signer:a});this.logger.debug("Sent message to process",{messageId:d,processId:this.processId});let b=await this.ao.result({message:d,process:this.processId});if(this.logger.debug("Message result",{output:b,messageId:d,processId:this.processId}),b.Messages?.length===0||b.Messages===void 0)return{id:d};let y=b.Messages[0].Tags.find(x=>x.name==="Error");if(y){let x=b.Messages[0].Data;throw new a4(`${y.Value}: ${x}`)}if(b.Messages.length===0)throw new Error(`Process ${this.processId} does not support provided action.`);if(b.Messages[0].Data===void 0)return{id:d};let M=GO(b.Messages[0].Data);return this.logger.debug("Message result data",{resultData:M,messageId:d,processId:this.processId}),{id:d,result:M}}catch(d){if(this.logger.error("Error sending message to process",{error:d.message,processId:this.processId,tags:e}),d.message.includes("500"))this.logger.debug("Retrying send interaction",{attempts:h,retries:i,error:d.message,processId:this.processId}),await new Promise(b=>setTimeout(b,2**h*2e3)),h++,c=d;else throw d}throw c}};var jb=class{static init(e){if(e&&e.signer){let{signer:r,...a}=e;return new YO({...a,signer:r})}return new p5(e)}},p5=class{process;arweave;constructor(e,r=Fb){if(!e)this.process=new La({processId:R1});else if(Fh(e))this.process=e.process;else if(jh(e))this.process=new La({processId:e.processId});else throw new Du;this.arweave=r}async getInfo(){return this.process.read({tags:[{name:"Action",value:"Info"}]})}async getTokenSupply(){return this.process.read({tags:[{name:"Action",value:"Total-Token-Supply"}]})}async getEpochSettings(e){let a=[{name:"Action",value:"Epoch-Settings"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getEpoch(e){let a=[{name:"Action",value:"Epoch"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getArNSRecord({name:e}){return this.process.read({tags:[{name:"Action",value:"Record"},{name:"Name",value:e}]})}async getArNSRecords(e){let a=[{name:"Action",value:"Paginated-Records"},{name:"Cursor",value:e?.cursor?.toString()},{name:"Limit",value:e?.limit?.toString()},{name:"Sort-By",value:e?.sortBy},{name:"Sort-Order",value:e?.sortOrder}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getArNSReservedNames(){return this.process.read({tags:[{name:"Action",value:"Reserved-Names"}]})}async getArNSReservedName({name:e}){return this.process.read({tags:[{name:"Action",value:"Reserved-Name"},{name:"Name",value:e}]})}async getBalance({address:e}){return this.process.read({tags:[{name:"Action",value:"Balance"},{name:"Address",value:e}]})}async getBalances(e){let a=[{name:"Action",value:"Paginated-Balances"},{name:"Cursor",value:e?.cursor?.toString()},{name:"Limit",value:e?.limit?.toString()},{name:"Sort-By",value:e?.sortBy},{name:"Sort-Order",value:e?.sortOrder}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getGateway({address:e}){return this.process.read({tags:[{name:"Action",value:"Gateway"},{name:"Address",value:e}]})}async getGateways(e){let a=[{name:"Action",value:"Paginated-Gateways"},{name:"Cursor",value:e?.cursor?.toString()},{name:"Limit",value:e?.limit?.toString()},{name:"Sort-By",value:e?.sortBy},{name:"Sort-Order",value:e?.sortOrder}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getCurrentEpoch(){return this.process.read({tags:[{name:"Action",value:"Epoch"},{name:"Timestamp",value:(await this.arweave.blocks.getCurrent().then(e=>({timestamp:e.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()}]})}async getPrescribedObservers(e){let a=[{name:"Action",value:"Epoch-Prescribed-Observers"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getPrescribedNames(e){let a=[{name:"Action",value:"Epoch-Prescribed-Names"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getObservations(e){let a=[{name:"Action",value:"Epoch-Observations"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:`${Date.now()}`}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getDistributions(e){let a=[{name:"Action",value:"Epoch-Distributions"},{name:"Timestamp",value:e?.timestamp?.toString()??(await this.arweave.blocks.getCurrent().then(i=>({timestamp:i.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()},{name:"Epoch-Index",value:e?.epochIndex?.toString()}].filter(i=>i.value!==void 0);return this.process.read({tags:a})}async getTokenCost({intent:e,purchaseType:r,years:a,name:i,quantity:h}){let d=[{name:"Action",value:"Token-Cost"},{name:"Intent",value:e},{name:"Name",value:i},{name:"Years",value:a?.toString()},{name:"Quantity",value:h?.toString()},{name:"Purchase-Type",value:r},{name:"Timestamp",value:(await this.arweave.blocks.getCurrent().then(b=>({timestamp:b.timestamp*1e3})).catch(()=>({timestamp:Date.now()}))).timestamp.toString()}].filter(b=>b.value!==void 0);return this.process.read({tags:d})}async getRegistrationFees(){return this.process.read({tags:[{name:"Action",value:"Get-Registration-Fees"}]})}},YO=class extends p5{signer;constructor({signer:e,...r}){if(Object.keys(r).length===0)super({process:new La({processId:R1})}),this.signer=$l(e);else if(Fh(r))super({process:r.process}),this.signer=$l(e);else if(jh(r))super({process:new La({processId:r.processId})}),this.signer=$l(e);else throw new Du}async transfer({target:e,qty:r},a){let{tags:i=[]}=a||{};return this.process.send({tags:[...i,{name:"Action",value:"Transfer"},{name:"Recipient",value:e},{name:"Quantity",value:r.valueOf().toString()}],signer:this.signer})}async joinNetwork({operatorStake:e,allowDelegatedStaking:r,delegateRewardShareRatio:a,fqdn:i,label:h,minDelegatedStake:c,note:d,port:b,properties:g,protocol:y,autoStake:M,observerAddress:x},E){let{tags:A=[]}=E||{},O=[...A,{name:"Action",value:"Join-Network"},{name:"Operator-Stake",value:e.valueOf().toString()},{name:"Allow-Delegated-Staking",value:r?.toString()},{name:"Delegate-Reward-Share-Ratio",value:a?.toString()},{name:"FQDN",value:i},{name:"Label",value:h},{name:"Min-Delegated-Stake",value:c?.valueOf().toString()},{name:"Note",value:d},{name:"Port",value:b?.toString()},{name:"Properties",value:g},{name:"Protocol",value:y},{name:"Auto-Stake",value:M?.toString()},{name:"Observer-Address",value:x}].filter(N=>N.value!==void 0);return this.process.send({signer:this.signer,tags:O})}async leaveNetwork(e){let{tags:r=[]}=e||{};return this.process.send({signer:this.signer,tags:[...r,{name:"Action",value:"Leave-Network"}]})}async updateGatewaySettings({allowDelegatedStaking:e,delegateRewardShareRatio:r,fqdn:a,label:i,minDelegatedStake:h,note:c,port:d,properties:b,protocol:g,autoStake:y,observerAddress:M},x){let{tags:E=[]}=x||{},k=[...E,{name:"Action",value:"Update-Gateway-Settings"},{name:"Label",value:i},{name:"Note",value:c},{name:"FQDN",value:a},{name:"Port",value:d?.toString()},{name:"Properties",value:b},{name:"Protocol",value:g},{name:"Observer-Address",value:M},{name:"Allow-Delegated-Staking",value:e?.toString()},{name:"Delegate-Reward-Share-Ratio",value:r?.toString()},{name:"Min-Delegated-Stake",value:h?.valueOf().toString()},{name:"Auto-Stake",value:y?.toString()}].filter(O=>O.value!==void 0);return this.process.send({signer:this.signer,tags:k})}async delegateStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.stakeQty.valueOf().toString()}]})}async decreaseDelegateStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Decrease-Delegate-Stake"},{name:"Target",value:e.target},{name:"Quantity",value:e.decreaseQty.valueOf().toString()}]})}async increaseOperatorStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Increase-Operator-Stake"},{name:"Quantity",value:e.increaseQty.valueOf().toString()}]})}async decreaseOperatorStake(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Decrease-Operator-Stake"},{name:"Quantity",value:e.decreaseQty.valueOf().toString()}]})}async saveObservations(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Save-Observations"},{name:"Report-Tx-Id",value:e.reportTxId},{name:"Failed-Gateways",value:e.failedGateways.join(",")}]})}async buyRecord(e,r){let{tags:a=[]}=r||{},h=[...a,{name:"Action",value:"Buy-Record"},{name:"Name",value:e.name},{name:"Years",value:e.years?.toString()??"1"},{name:"Process-Id",value:e.processId},{name:"Purchase-Type",value:e.type||"lease"}].filter(c=>c.value!==void 0);return this.process.send({signer:this.signer,tags:h})}async extendLease(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Extend-Lease"},{name:"Name",value:e.name},{name:"Years",value:e.years.toString()}]})}async increaseUndernameLimit(e,r){let{tags:a=[]}=r||{};return this.process.send({signer:this.signer,tags:[...a,{name:"Action",value:"Increase-Undername-Limit"},{name:"Name",value:e.name},{name:"Quantity",value:e.increaseCount.toString()}]})}};X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();function zb(t,e){return function(){return t.apply(e,arguments)}}var{toString:jFe}=Object.prototype,{getPrototypeOf:QO}=Object,m5=(t=>e=>{let r=jFe.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Xf=t=>(t=t.toLowerCase(),e=>m5(e)===t),g5=t=>e=>typeof e===t,{isArray:Rv}=Array,Hb=g5("undefined");function zFe(t){return t!==null&&!Hb(t)&&t.constructor!==null&&!Hb(t.constructor)&&jo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var Yue=Xf("ArrayBuffer");function HFe(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Yue(t.buffer),e}var ZFe=g5("string"),jo=g5("function"),Jue=g5("number"),b5=t=>t!==null&&typeof t=="object",KFe=t=>t===!0||t===!1,v5=t=>{if(m5(t)!=="object")return!1;let e=QO(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},WFe=Xf("Date"),VFe=Xf("File"),GFe=Xf("Blob"),YFe=Xf("FileList"),JFe=t=>b5(t)&&jo(t.pipe),XFe=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||jo(t.append)&&((e=m5(t))==="formdata"||e==="object"&&jo(t.toString)&&t.toString()==="[object FormData]"))},QFe=Xf("URLSearchParams"),[eje,tje,rje,ije]=["ReadableStream","Request","Response","Headers"].map(Xf),nje=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Zb(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let a,i;if(typeof t!="object"&&(t=[t]),Rv(t))for(a=0,i=t.length;a<i;a++)e.call(null,t[a],a,t);else{let h=r?Object.getOwnPropertyNames(t):Object.keys(t),c=h.length,d;for(a=0;a<c;a++)d=h[a],e.call(null,t[d],d,t)}}function Xue(t,e){e=e.toLowerCase();let r=Object.keys(t),a=r.length,i;for(;a-- >0;)if(i=r[a],e===i.toLowerCase())return i;return null}var Qd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Que=t=>!Hb(t)&&t!==Qd;function XO(){let{caseless:t}=Que(this)&&this||{},e={},r=(a,i)=>{let h=t&&Xue(e,i)||i;v5(e[h])&&v5(a)?e[h]=XO(e[h],a):v5(a)?e[h]=XO({},a):Rv(a)?e[h]=a.slice():e[h]=a};for(let a=0,i=arguments.length;a<i;a++)arguments[a]&&Zb(arguments[a],r);return e}var aje=(t,e,r,{allOwnKeys:a}={})=>(Zb(e,(i,h)=>{r&&jo(i)?t[h]=zb(i,r):t[h]=i},{allOwnKeys:a}),t),oje=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),sje=(t,e,r,a)=>{t.prototype=Object.create(e.prototype,a),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},fje=(t,e,r,a)=>{let i,h,c,d={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),h=i.length;h-- >0;)c=i[h],(!a||a(c,t,e))&&!d[c]&&(e[c]=t[c],d[c]=!0);t=r!==!1&&QO(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},uje=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let a=t.indexOf(e,r);return a!==-1&&a===r},hje=t=>{if(!t)return null;if(Rv(t))return t;let e=t.length;if(!Jue(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},cje=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&QO(Uint8Array)),lje=(t,e)=>{let a=(t&&t[Symbol.iterator]).call(t),i;for(;(i=a.next())&&!i.done;){let h=i.value;e.call(t,h[0],h[1])}},dje=(t,e)=>{let r,a=[];for(;(r=t.exec(e))!==null;)a.push(r);return a},pje=Xf("HTMLFormElement"),vje=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,a,i){return a.toUpperCase()+i}),Vue=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),mje=Xf("RegExp"),ehe=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),a={};Zb(r,(i,h)=>{let c;(c=e(i,h,t))!==!1&&(a[h]=c||i)}),Object.defineProperties(t,a)},gje=t=>{ehe(t,(e,r)=>{if(jo(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let a=t[r];if(jo(a)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},bje=(t,e)=>{let r={},a=i=>{i.forEach(h=>{r[h]=!0})};return Rv(t)?a(t):a(String(t).split(e)),r},yje=()=>{},wje=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,JO="abcdefghijklmnopqrstuvwxyz",Gue="0123456789",the={DIGIT:Gue,ALPHA:JO,ALPHA_DIGIT:JO+JO.toUpperCase()+Gue},_je=(t=16,e=the.ALPHA_DIGIT)=>{let r="",{length:a}=e;for(;t--;)r+=e[Math.random()*a|0];return r};function Mje(t){return!!(t&&jo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var xje=t=>{let e=new Array(10),r=(a,i)=>{if(b5(a)){if(e.indexOf(a)>=0)return;if(!("toJSON"in a)){e[i]=a;let h=Rv(a)?[]:{};return Zb(a,(c,d)=>{let b=r(c,i+1);!Hb(b)&&(h[d]=b)}),e[i]=void 0,h}}return a};return r(t,0)},Sje=Xf("AsyncFunction"),Eje=t=>t&&(b5(t)||jo(t))&&jo(t.then)&&jo(t.catch),rhe=((t,e)=>t?setImmediate:e?((r,a)=>(Qd.addEventListener("message",({source:i,data:h})=>{i===Qd&&h===r&&a.length&&a.shift()()},!1),i=>{a.push(i),Qd.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",jo(Qd.postMessage)),Aje=typeof queueMicrotask<"u"?queueMicrotask.bind(Qd):typeof xe<"u"&&xe.nextTick||rhe,vt={isArray:Rv,isArrayBuffer:Yue,isBuffer:zFe,isFormData:XFe,isArrayBufferView:HFe,isString:ZFe,isNumber:Jue,isBoolean:KFe,isObject:b5,isPlainObject:v5,isReadableStream:eje,isRequest:tje,isResponse:rje,isHeaders:ije,isUndefined:Hb,isDate:WFe,isFile:VFe,isBlob:GFe,isRegExp:mje,isFunction:jo,isStream:JFe,isURLSearchParams:QFe,isTypedArray:cje,isFileList:YFe,forEach:Zb,merge:XO,extend:aje,trim:nje,stripBOM:oje,inherits:sje,toFlatObject:fje,kindOf:m5,kindOfTest:Xf,endsWith:uje,toArray:hje,forEachEntry:lje,matchAll:dje,isHTMLForm:pje,hasOwnProperty:Vue,hasOwnProp:Vue,reduceDescriptors:ehe,freezeMethods:gje,toObjectSet:bje,toCamelCase:vje,noop:yje,toFiniteNumber:wje,findKey:Xue,global:Qd,isContextDefined:Que,ALPHABET:the,generateString:_je,isSpecCompliantForm:Mje,toJSONObject:xje,isAsyncFn:Sje,isThenable:Eje,setImmediate:rhe,asap:Aje};X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();function Tv(t,e,r,a,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),a&&(this.request=a),i&&(this.response=i,this.status=i.status?i.status:null)}vt.inherits(Tv,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:vt.toJSONObject(this.config),code:this.code,status:this.status}}});var ihe=Tv.prototype,nhe={};["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(t=>{nhe[t]={value:t}});Object.defineProperties(Tv,nhe);Object.defineProperty(ihe,"isAxiosError",{value:!0});Tv.from=(t,e,r,a,i,h)=>{let c=Object.create(ihe);return vt.toFlatObject(t,c,function(b){return b!==Error.prototype},d=>d!=="isAxiosError"),Tv.call(c,t.message,e,r,a,i),c.cause=t,c.name=t.name,h&&Object.assign(c,h),c};var yr=Tv;X();ee();Q();var y5=null;function eP(t){return vt.isPlainObject(t)||vt.isArray(t)}function ohe(t){return vt.endsWith(t,"[]")?t.slice(0,-2):t}function ahe(t,e,r){return t?t.concat(e).map(function(i,h){return i=ohe(i),!r&&h?"["+i+"]":i}).join(r?".":""):e}function Rje(t){return vt.isArray(t)&&!t.some(eP)}var Tje=vt.toFlatObject(vt,{},null,function(e){return/^is[A-Z]/.test(e)});function kje(t,e,r){if(!vt.isObject(t))throw new TypeError("target must be an object");e=e||new(y5||FormData),r=vt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(k,O){return!vt.isUndefined(O[k])});let a=r.metaTokens,i=r.visitor||y,h=r.dots,c=r.indexes,b=(r.Blob||typeof Blob<"u"&&Blob)&&vt.isSpecCompliantForm(e);if(!vt.isFunction(i))throw new TypeError("visitor must be a function");function g(A){if(A===null)return"";if(vt.isDate(A))return A.toISOString();if(!b&&vt.isBlob(A))throw new yr("Blob is not supported. Use a Buffer instead.");return vt.isArrayBuffer(A)||vt.isTypedArray(A)?b&&typeof Blob=="function"?new Blob([A]):ge.from(A):A}function y(A,k,O){let N=A;if(A&&!O&&typeof A=="object"){if(vt.endsWith(k,"{}"))k=a?k:k.slice(0,-2),A=JSON.stringify(A);else if(vt.isArray(A)&&Rje(A)||(vt.isFileList(A)||vt.endsWith(k,"[]"))&&(N=vt.toArray(A)))return k=ohe(k),N.forEach(function(C,Y){!(vt.isUndefined(C)||C===null)&&e.append(c===!0?ahe([k],Y,h):c===null?k:k+"[]",g(C))}),!1}return eP(A)?!0:(e.append(ahe(O,k,h),g(A)),!1)}let M=[],x=Object.assign(Tje,{defaultVisitor:y,convertValue:g,isVisitable:eP});function E(A,k){if(!vt.isUndefined(A)){if(M.indexOf(A)!==-1)throw Error("Circular reference detected in "+k.join("."));M.push(A),vt.forEach(A,function(N,L){(!(vt.isUndefined(N)||N===null)&&i.call(e,N,vt.isString(L)?L.trim():L,k,x))===!0&&E(N,k?k.concat(L):[L])}),M.pop()}}if(!vt.isObject(t))throw new TypeError("data must be an object");return E(t),e}var Ul=kje;function she(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(a){return e[a]})}function fhe(t,e){this._pairs=[],t&&Ul(t,this,e)}var uhe=fhe.prototype;uhe.append=function(e,r){this._pairs.push([e,r])};uhe.toString=function(e){let r=e?function(a){return e.call(this,a,she)}:she;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var w5=fhe;function Ije(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Kb(t,e,r){if(!e)return t;let a=r&&r.encode||Ije,i=r&&r.serialize,h;if(i?h=i(e,r):h=vt.isURLSearchParams(e)?e.toString():new w5(e,r).toString(a),h){let c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+h}return t}X();ee();Q();var tP=class{constructor(){this.handlers=[]}use(e,r,a){return this.handlers.push({fulfilled:e,rejected:r,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){vt.forEach(this.handlers,function(a){a!==null&&e(a)})}},rP=tP;X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var _5={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};X();ee();Q();X();ee();Q();X();ee();Q();X();ee();Q();var hhe=typeof URLSearchParams<"u"?URLSearchParams:w5;X();ee();Q();var che=typeof FormData<"u"?FormData:null;X();ee();Q();var lhe=typeof Blob<"u"?Blob:null;var dhe={isBrowser:!0,classes:{URLSearchParams:hhe,FormData:che,Blob:lhe},protocols:["http","https","file","blob","url","data"]};var aP={};$a(aP,{hasBrowserEnv:()=>nP,hasStandardBrowserEnv:()=>Bje,hasStandardBrowserWebWorkerEnv:()=>Oje,navigator:()=>iP,origin:()=>Pje});X();ee();Q();var nP=typeof window<"u"&&typeof document<"u",iP=typeof navigator=="object"&&navigator||void 0,Bje=nP&&(!iP||["ReactNative","NativeScript","NS"].indexOf(iP.product)<0),Oje=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Pje=nP&&window.location.href||"http://localhost";var Rn={...aP,...dhe};function oP(t,e){return Ul(t,new Rn.classes.URLSearchParams,Object.assign({visitor:function(r,a,i,h){return Rn.isNode&&vt.isBuffer(r)?(this.append(a,r.toString("base64")),!1):h.defaultVisitor.apply(this,arguments)}},e))}X();ee();Q();function Nje(t){return vt.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Cje(t){let e={},r=Object.keys(t),a,i=r.length,h;for(a=0;a<i;a++)h=r[a],e[h]=t[h];return e}function Lje(t){function e(r,a,i,h){let c=r[h++];if(c==="__proto__")return!0;let d=Number.isFinite(+c),b=h>=r.length;return c=!c&&vt.isArray(i)?i.length:c,b?(vt.hasOwnProp(i,c)?i[c]=[i[c],a]:i[c]=a,!d):((!i[c]||!vt.isObject(i[c]))&&(i[c]=[]),e(r,a,i[c],h)&&vt.isArray(i[c])&&(i[c]=Cje(i[c])),!d)}if(vt.isFormData(t)&&vt.isFunction(t.entries)){let r={};return vt.forEachEntry(t,(a,i)=>{e(Nje(a),i,r,0)}),r}return null}var M5=Lje;function Dje(t,e,r){if(vt.isString(t))try{return(e||JSON.parse)(t),vt.trim(t)}catch(a){if(a.name!=="SyntaxError")throw a}return(r||JSON.stringify)(t)}var sP={transitional:_5,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let a=r.getContentType()||"",i=a.indexOf("application/json")>-1,h=vt.isObject(e);if(h&&vt.isHTMLForm(e)&&(e=new FormData(e)),vt.isFormData(e))return i?JSON.stringify(M5(e)):e;if(vt.isArrayBuffer(e)||vt.isBuffer(e)||vt.isStream(e)||vt.isFile(e)||vt.isBlob(e)||vt.isReadableStream(e))return e;if(vt.isArrayBufferView(e))return e.buffer;if(vt.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(h){if(a.indexOf("application/x-www-form-urlencoded")>-1)return oP(e,this.formSerializer).toString();if((d=vt.isFileList(e))||a.indexOf("multipart/form-data")>-1){let b=this.env&&this.env.FormData;return Ul(d?{"files[]":e}:e,b&&new b,this.formSerializer)}}return h||i?(r.setContentType("application/json",!1),Dje(e)):e}],transformResponse:[function(e){let r=this.transitional||sP.transitional,a=r&&r.forcedJSONParsing,i=this.responseType==="json";if(vt.isResponse(e)||vt.isReadableStream(e))return e;if(e&&vt.isString(e)&&(a&&!this.responseType||i)){let c=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(d){if(c)throw d.name==="SyntaxError"?yr.from(d,yr.ERR_BAD_RESPONSE,this,null,this.response):d}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Rn.classes.FormData,Blob:Rn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};vt.forEach(["delete","get","head","post","put","patch"],t=>{sP.headers[t]={}});var kv=sP;X();ee();Q();X();ee();Q();var $je=vt.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"]),phe=t=>{let e={},r,a,i;return t&&t.split(`
188
188
  `).forEach(function(c){i=c.indexOf(":"),r=c.substring(0,i).trim().toLowerCase(),a=c.substring(i+1).trim(),!(!r||e[r]&&$je[r])&&(r==="set-cookie"?e[r]?e[r].push(a):e[r]=[a]:e[r]=e[r]?e[r]+", "+a:a)}),e};var vhe=Symbol("internals");function Wb(t){return t&&String(t).trim().toLowerCase()}function x5(t){return t===!1||t==null?t:vt.isArray(t)?t.map(x5):String(t)}function Uje(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,a;for(;a=r.exec(t);)e[a[1]]=a[2];return e}var qje=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function fP(t,e,r,a,i){if(vt.isFunction(a))return a.call(this,e,r);if(i&&(e=r),!!vt.isString(e)){if(vt.isString(a))return e.indexOf(a)!==-1;if(vt.isRegExp(a))return a.test(e)}}function Fje(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,a)=>r.toUpperCase()+a)}function jje(t,e){let r=vt.toCamelCase(" "+e);["get","set","has"].forEach(a=>{Object.defineProperty(t,a+r,{value:function(i,h,c){return this[a].call(this,e,i,h,c)},configurable:!0})})}var Iv=class{constructor(e){e&&this.set(e)}set(e,r,a){let i=this;function h(d,b,g){let y=Wb(b);if(!y)throw new Error("header name must be a non-empty string");let M=vt.findKey(i,y);(!M||i[M]===void 0||g===!0||g===void 0&&i[M]!==!1)&&(i[M||b]=x5(d))}let c=(d,b)=>vt.forEach(d,(g,y)=>h(g,y,b));if(vt.isPlainObject(e)||e instanceof this.constructor)c(e,r);else if(vt.isString(e)&&(e=e.trim())&&!qje(e))c(phe(e),r);else if(vt.isHeaders(e))for(let[d,b]of e.entries())h(b,d,a);else e!=null&&h(r,e,a);return this}get(e,r){if(e=Wb(e),e){let a=vt.findKey(this,e);if(a){let i=this[a];if(!r)return i;if(r===!0)return Uje(i);if(vt.isFunction(r))return r.call(this,i,a);if(vt.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Wb(e),e){let a=vt.findKey(this,e);return!!(a&&this[a]!==void 0&&(!r||fP(this,this[a],a,r)))}return!1}delete(e,r){let a=this,i=!1;function h(c){if(c=Wb(c),c){let d=vt.findKey(a,c);d&&(!r||fP(a,a[d],d,r))&&(delete a[d],i=!0)}}return vt.isArray(e)?e.forEach(h):h(e),i}clear(e){let r=Object.keys(this),a=r.length,i=!1;for(;a--;){let h=r[a];(!e||fP(this,this[h],h,e,!0))&&(delete this[h],i=!0)}return i}normalize(e){let r=this,a={};return vt.forEach(this,(i,h)=>{let c=vt.findKey(a,h);if(c){r[c]=x5(i),delete r[h];return}let d=e?Fje(h):String(h).trim();d!==h&&delete r[h],r[d]=x5(i),a[d]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return vt.forEach(this,(a,i)=>{a!=null&&a!==!1&&(r[i]=e&&vt.isArray(a)?a.join(", "):a)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
189
189
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let a=new this(e);return r.forEach(i=>a.set(i)),a}static accessor(e){let a=(this[vhe]=this[vhe]={accessors:{}}).accessors,i=this.prototype;function h(c){let d=Wb(c);a[d]||(jje(i,c),a[d]=!0)}return vt.isArray(e)?e.forEach(h):h(e),this}};Iv.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);vt.reduceDescriptors(Iv.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(a){this[r]=a}}});vt.freezeMethods(Iv);var Kn=Iv;function Vb(t,e){let r=this||kv,a=e||r,i=Kn.from(a.headers),h=a.data;return vt.forEach(t,function(d){h=d.call(r,h,i.normalize(),e?e.status:void 0)}),i.normalize(),h}X();ee();Q();function Gb(t){return!!(t&&t.__CANCEL__)}X();ee();Q();function mhe(t,e,r){yr.call(this,t??"canceled",yr.ERR_CANCELED,e,r),this.name="CanceledError"}vt.inherits(mhe,yr,{__CANCEL__:!0});var Qu=mhe;X();ee();Q();X();ee();Q();X();ee();Q();function Yb(t,e,r){let a=r.config.validateStatus;!r.status||!a||a(r.status)?t(r):e(new yr("Request failed with status code "+r.status,[yr.ERR_BAD_REQUEST,yr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}X();ee();Q();function uP(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}X();ee();Q();X();ee();Q();function zje(t,e){t=t||10;let r=new Array(t),a=new Array(t),i=0,h=0,c;return e=e!==void 0?e:1e3,function(b){let g=Date.now(),y=a[h];c||(c=g),r[i]=b,a[i]=g;let M=h,x=0;for(;M!==i;)x+=r[M++],M=M%t;if(i=(i+1)%t,i===h&&(h=(h+1)%t),g-c<e)return;let E=y&&g-y;return E?Math.round(x*1e3/E):void 0}}var ghe=zje;X();ee();Q();function Hje(t,e){let r=0,a=1e3/e,i,h,c=(g,y=Date.now())=>{r=y,i=null,h&&(clearTimeout(h),h=null),t.apply(null,g)};return[(...g)=>{let y=Date.now(),M=y-r;M>=a?c(g,y):(i=g,h||(h=setTimeout(()=>{h=null,c(i)},a-M)))},()=>i&&c(i)]}var bhe=Hje;var Bv=(t,e,r=3)=>{let a=0,i=ghe(50,250);return bhe(h=>{let c=h.loaded,d=h.lengthComputable?h.total:void 0,b=c-a,g=i(b),y=c<=d;a=c;let M={loaded:c,total:d,progress:d?c/d:void 0,bytes:b,rate:g||void 0,estimated:g&&d&&y?(d-c)/g:void 0,event:h,lengthComputable:d!=null,[e?"download":"upload"]:!0};t(M)},r)},hP=(t,e)=>{let r=t!=null;return[a=>e[0]({lengthComputable:r,total:t,loaded:a}),e[1]]},cP=t=>(...e)=>vt.asap(()=>t(...e));X();ee();Q();X();ee();Q();var yhe=Rn.hasStandardBrowserEnv?function(){let e=Rn.navigator&&/(msie|trident)/i.test(Rn.navigator.userAgent),r=document.createElement("a"),a;function i(h){let c=h;return e&&(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 a=i(window.location.href),function(c){let d=vt.isString(c)?i(c):c;return d.protocol===a.protocol&&d.host===a.host}}():function(){return function(){return!0}}();X();ee();Q();var whe=Rn.hasStandardBrowserEnv?{write(t,e,r,a,i,h){let c=[t+"="+encodeURIComponent(e)];vt.isNumber(r)&&c.push("expires="+new Date(r).toGMTString()),vt.isString(a)&&c.push("path="+a),vt.isString(i)&&c.push("domain="+i),h===!0&&c.push("secure"),document.cookie=c.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};X();ee();Q();X();ee();Q();function lP(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}X();ee();Q();function dP(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Jb(t,e){return t&&!lP(e)?dP(t,e):e}X();ee();Q();var _he=t=>t instanceof Kn?{...t}:t;function Qf(t,e){e=e||{};let r={};function a(g,y,M){return vt.isPlainObject(g)&&vt.isPlainObject(y)?vt.merge.call({caseless:M},g,y):vt.isPlainObject(y)?vt.merge({},y):vt.isArray(y)?y.slice():y}function i(g,y,M){if(vt.isUndefined(y)){if(!vt.isUndefined(g))return a(void 0,g,M)}else return a(g,y,M)}function h(g,y){if(!vt.isUndefined(y))return a(void 0,y)}function c(g,y){if(vt.isUndefined(y)){if(!vt.isUndefined(g))return a(void 0,g)}else return a(void 0,y)}function d(g,y,M){if(M in e)return a(g,y);if(M in t)return a(void 0,g)}let b={url:h,method:h,data:h,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:d,headers:(g,y)=>i(_he(g),_he(y),!0)};return vt.forEach(Object.keys(Object.assign({},t,e)),function(y){let M=b[y]||i,x=M(t[y],e[y],y);vt.isUndefined(x)&&M!==d||(r[y]=x)}),r}var S5=t=>{let e=Qf({},t),{data:r,withXSRFToken:a,xsrfHeaderName:i,xsrfCookieName:h,headers:c,auth:d}=e;e.headers=c=Kn.from(c),e.url=Kb(Jb(e.baseURL,e.url),t.params,t.paramsSerializer),d&&c.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):"")));let b;if(vt.isFormData(r)){if(Rn.hasStandardBrowserEnv||Rn.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if((b=c.getContentType())!==!1){let[g,...y]=b?b.split(";").map(M=>M.trim()).filter(Boolean):[];c.setContentType([g||"multipart/form-data",...y].join("; "))}}if(Rn.hasStandardBrowserEnv&&(a&&vt.isFunction(a)&&(a=a(e)),a||a!==!1&&yhe(e.url))){let g=i&&h&&whe.read(h);g&&c.set(i,g)}return e};var Zje=typeof XMLHttpRequest<"u",Mhe=Zje&&function(t){return new Promise(function(r,a){let i=S5(t),h=i.data,c=Kn.from(i.headers).normalize(),{responseType:d,onUploadProgress:b,onDownloadProgress:g}=i,y,M,x,E,A;function k(){E&&E(),A&&A(),i.cancelToken&&i.cancelToken.unsubscribe(y),i.signal&&i.signal.removeEventListener("abort",y)}let O=new XMLHttpRequest;O.open(i.method.toUpperCase(),i.url,!0),O.timeout=i.timeout;function N(){if(!O)return;let C=Kn.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),G={data:!d||d==="text"||d==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:C,config:t,request:O};Yb(function(D){r(D),k()},function(D){a(D),k()},G),O=null}"onloadend"in O?O.onloadend=N:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout(N)},O.onabort=function(){O&&(a(new yr("Request aborted",yr.ECONNABORTED,t,O)),O=null)},O.onerror=function(){a(new yr("Network Error",yr.ERR_NETWORK,t,O)),O=null},O.ontimeout=function(){let Y=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",G=i.transitional||_5;i.timeoutErrorMessage&&(Y=i.timeoutErrorMessage),a(new yr(Y,G.clarifyTimeoutError?yr.ETIMEDOUT:yr.ECONNABORTED,t,O)),O=null},h===void 0&&c.setContentType(null),"setRequestHeader"in O&&vt.forEach(c.toJSON(),function(Y,G){O.setRequestHeader(G,Y)}),vt.isUndefined(i.withCredentials)||(O.withCredentials=!!i.withCredentials),d&&d!=="json"&&(O.responseType=i.responseType),g&&([x,A]=Bv(g,!0),O.addEventListener("progress",x)),b&&O.upload&&([M,E]=Bv(b),O.upload.addEventListener("progress",M),O.upload.addEventListener("loadend",E)),(i.cancelToken||i.signal)&&(y=C=>{O&&(a(!C||C.type?new Qu(null,t,O):C),O.abort(),O=null)},i.cancelToken&&i.cancelToken.subscribe(y),i.signal&&(i.signal.aborted?y():i.signal.addEventListener("abort",y)));let L=uP(i.url);if(L&&Rn.protocols.indexOf(L)===-1){a(new yr("Unsupported protocol "+L+":",yr.ERR_BAD_REQUEST,t));return}O.send(h||null)})};X();ee();Q();X();ee();Q();var Kje=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let a=new AbortController,i,h=function(g){if(!i){i=!0,d();let y=g instanceof Error?g:this.reason;a.abort(y instanceof yr?y:new Qu(y instanceof Error?y.message:y))}},c=e&&setTimeout(()=>{c=null,h(new yr(`timeout ${e} of ms exceeded`,yr.ETIMEDOUT))},e),d=()=>{t&&(c&&clearTimeout(c),c=null,t.forEach(g=>{g.unsubscribe?g.unsubscribe(h):g.removeEventListener("abort",h)}),t=null)};t.forEach(g=>g.addEventListener("abort",h));let{signal:b}=a;return b.unsubscribe=()=>vt.asap(d),b}},xhe=Kje;X();ee();Q();var Wje=function*(t,e){let r=t.byteLength;if(!e||r<e){yield t;return}let a=0,i;for(;a<r;)i=a+e,yield t.slice(a,i),a=i},Vje=async function*(t,e){for await(let r of Gje(t))yield*Wje(r,e)},Gje=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:r,value:a}=await e.read();if(r)break;yield a}}finally{await e.cancel()}},pP=(t,e,r,a)=>{let i=Vje(t,e),h=0,c,d=b=>{c||(c=!0,a&&a(b))};return new ReadableStream({async pull(b){try{let{done:g,value:y}=await i.next();if(g){d(),b.close();return}let M=y.byteLength;if(r){let x=h+=M;r(x)}b.enqueue(new Uint8Array(y))}catch(g){throw d(g),g}},cancel(b){return d(b),i.return()}},{highWaterMark:2})};var A5=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Ehe=A5&&typeof ReadableStream=="function",Yje=A5&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),Ahe=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Jje=Ehe&&Ahe(()=>{let t=!1,e=new Request(Rn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),She=64*1024,vP=Ehe&&Ahe(()=>vt.isReadableStream(new Response("").body)),E5={stream:vP&&(t=>t.body)};A5&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!E5[e]&&(E5[e]=vt.isFunction(t[e])?r=>r[e]():(r,a)=>{throw new yr(`Response type '${e}' is not supported`,yr.ERR_NOT_SUPPORT,a)})})})(new Response);var Xje=async t=>{if(t==null)return 0;if(vt.isBlob(t))return t.size;if(vt.isSpecCompliantForm(t))return(await new Request(Rn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(vt.isArrayBufferView(t)||vt.isArrayBuffer(t))return t.byteLength;if(vt.isURLSearchParams(t)&&(t=t+""),vt.isString(t))return(await Yje(t)).byteLength},Qje=async(t,e)=>{let r=vt.toFiniteNumber(t.getContentLength());return r??Xje(e)},Rhe=A5&&(async t=>{let{url:e,method:r,data:a,signal:i,cancelToken:h,timeout:c,onDownloadProgress:d,onUploadProgress:b,responseType:g,headers:y,withCredentials:M="same-origin",fetchOptions:x}=S5(t);g=g?(g+"").toLowerCase():"text";let E=xhe([i,h&&h.toAbortSignal()],c),A,k=E&&E.unsubscribe&&(()=>{E.unsubscribe()}),O;try{if(b&&Jje&&r!=="get"&&r!=="head"&&(O=await Qje(y,a))!==0){let G=new Request(e,{method:"POST",body:a,duplex:"half"}),ie;if(vt.isFormData(a)&&(ie=G.headers.get("content-type"))&&y.setContentType(ie),G.body){let[D,q]=hP(O,Bv(cP(b)));a=pP(G.body,She,D,q)}}vt.isString(M)||(M=M?"include":"omit");let N="credentials"in Request.prototype;A=new Request(e,{...x,signal:E,method:r.toUpperCase(),headers:y.normalize().toJSON(),body:a,duplex:"half",credentials:N?M:void 0});let L=await fetch(A),C=vP&&(g==="stream"||g==="response");if(vP&&(d||C&&k)){let G={};["status","statusText","headers"].forEach(V=>{G[V]=L[V]});let ie=vt.toFiniteNumber(L.headers.get("content-length")),[D,q]=d&&hP(ie,Bv(cP(d),!0))||[];L=new Response(pP(L.body,She,D,()=>{q&&q(),k&&k()}),G)}g=g||"text";let Y=await E5[vt.findKey(E5,g)||"text"](L,t);return!C&&k&&k(),await new Promise((G,ie)=>{Yb(G,ie,{data:Y,headers:Kn.from(L.headers),status:L.status,statusText:L.statusText,config:t,request:A})})}catch(N){throw k&&k(),N&&N.name==="TypeError"&&/fetch/i.test(N.message)?Object.assign(new yr("Network Error",yr.ERR_NETWORK,t,A),{cause:N.cause||N}):yr.from(N,N&&N.code,t,A)}});var mP={http:y5,xhr:Mhe,fetch:Rhe};vt.forEach(mP,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var The=t=>`- ${t}`,eze=t=>vt.isFunction(t)||t===null||t===!1,R5={getAdapter:t=>{t=vt.isArray(t)?t:[t];let{length:e}=t,r,a,i={};for(let h=0;h<e;h++){r=t[h];let c;if(a=r,!eze(r)&&(a=mP[(c=String(r)).toLowerCase()],a===void 0))throw new yr(`Unknown adapter '${c}'`);if(a)break;i[c||"#"+h]=a}if(!a){let h=Object.entries(i).map(([d,b])=>`adapter ${d} `+(b===!1?"is not supported by the environment":"is not available in the build")),c=e?h.length>1?`since :
190
190
  `+h.map(The).join(`
191
191
  `):" "+The(h[0]):"as no adapter specified";throw new yr("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return a},adapters:mP};function gP(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Qu(null,t)}function T5(t){return gP(t),t.headers=Kn.from(t.headers),t.data=Vb.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),R5.getAdapter(t.adapter||kv.adapter)(t).then(function(a){return gP(t),a.data=Vb.call(t,t.transformResponse,a),a.headers=Kn.from(a.headers),a},function(a){return Gb(a)||(gP(t),a&&a.response&&(a.response.data=Vb.call(t,t.transformResponse,a.response),a.response.headers=Kn.from(a.response.headers))),Promise.reject(a)})}X();ee();Q();X();ee();Q();var k5="1.7.7";var bP={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{bP[t]=function(a){return typeof a===t||"a"+(e<1?"n ":" ")+t}});var khe={};bP.transitional=function(e,r,a){function i(h,c){return"[Axios v"+k5+"] Transitional option '"+h+"'"+c+(a?". "+a:"")}return(h,c,d)=>{if(e===!1)throw new yr(i(c," has been removed"+(r?" in "+r:"")),yr.ERR_DEPRECATED);return r&&!khe[c]&&(khe[c]=!0,console.warn(i(c," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(h,c,d):!0}};function tze(t,e,r){if(typeof t!="object")throw new yr("options must be an object",yr.ERR_BAD_OPTION_VALUE);let a=Object.keys(t),i=a.length;for(;i-- >0;){let h=a[i],c=e[h];if(c){let d=t[h],b=d===void 0||c(d,h,t);if(b!==!0)throw new yr("option "+h+" must be "+b,yr.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new yr("Unknown option "+h,yr.ERR_BAD_OPTION)}}var I5={assertOptions:tze,validators:bP};var ql=I5.validators,Ov=class{constructor(e){this.defaults=e,this.interceptors={request:new rP,response:new rP}}async request(e,r){try{return await this._request(e,r)}catch(a){if(a instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;let h=i.stack?i.stack.replace(/^.+\n/,""):"";try{a.stack?h&&!String(a.stack).endsWith(h.replace(/^.+\n.+\n/,""))&&(a.stack+=`
192
- `+h):a.stack=h}catch{}}throw a}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Qf(this.defaults,r);let{transitional:a,paramsSerializer:i,headers:h}=r;a!==void 0&&I5.assertOptions(a,{silentJSONParsing:ql.transitional(ql.boolean),forcedJSONParsing:ql.transitional(ql.boolean),clarifyTimeoutError:ql.transitional(ql.boolean)},!1),i!=null&&(vt.isFunction(i)?r.paramsSerializer={serialize:i}:I5.assertOptions(i,{encode:ql.function,serialize:ql.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let c=h&&vt.merge(h.common,h[r.method]);h&&vt.forEach(["delete","get","head","post","put","patch","common"],A=>{delete h[A]}),r.headers=Kn.concat(c,h);let d=[],b=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(r)===!1||(b=b&&k.synchronous,d.unshift(k.fulfilled,k.rejected))});let g=[];this.interceptors.response.forEach(function(k){g.push(k.fulfilled,k.rejected)});let y,M=0,x;if(!b){let A=[T5.bind(this),void 0];for(A.unshift.apply(A,d),A.push.apply(A,g),x=A.length,y=Promise.resolve(r);M<x;)y=y.then(A[M++],A[M++]);return y}x=d.length;let E=r;for(M=0;M<x;){let A=d[M++],k=d[M++];try{E=A(E)}catch(O){k.call(this,O);break}}try{y=T5.call(this,E)}catch(A){return Promise.reject(A)}for(M=0,x=g.length;M<x;)y=y.then(g[M++],g[M++]);return y}getUri(e){e=Qf(this.defaults,e);let r=Jb(e.baseURL,e.url);return Kb(r,e.params,e.paramsSerializer)}};vt.forEach(["delete","get","head","options"],function(e){Ov.prototype[e]=function(r,a){return this.request(Qf(a||{},{method:e,url:r,data:(a||{}).data}))}});vt.forEach(["post","put","patch"],function(e){function r(a){return function(h,c,d){return this.request(Qf(d||{},{method:e,headers:a?{"Content-Type":"multipart/form-data"}:{},url:h,data:c}))}}Ov.prototype[e]=r(),Ov.prototype[e+"Form"]=r(!0)});var Xb=Ov;X();ee();Q();var yP=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(h){r=h});let a=this;this.promise.then(i=>{if(!a._listeners)return;let h=a._listeners.length;for(;h-- >0;)a._listeners[h](i);a._listeners=null}),this.promise.then=i=>{let h,c=new Promise(d=>{a.subscribe(d),h=d}).then(i);return c.cancel=function(){a.unsubscribe(h)},c},e(function(h,c,d){a.reason||(a.reason=new Qu(h,c,d),r(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=a=>{e.abort(a)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},Ihe=yP;X();ee();Q();function wP(t){return function(r){return t.apply(null,r)}}X();ee();Q();function _P(t){return vt.isObject(t)&&t.isAxiosError===!0}X();ee();Q();var MP={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(MP).forEach(([t,e])=>{MP[e]=t});var Bhe=MP;function Ohe(t){let e=new Xb(t),r=zb(Xb.prototype.request,e);return vt.extend(r,Xb.prototype,e,{allOwnKeys:!0}),vt.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return Ohe(Qf(t,i))},r}var On=Ohe(kv);On.Axios=Xb;On.CanceledError=Qu;On.CancelToken=Ihe;On.isCancel=Gb;On.VERSION=k5;On.toFormData=Ul;On.AxiosError=yr;On.Cancel=On.CanceledError;On.all=function(e){return Promise.all(e)};On.spread=wP;On.isAxiosError=_P;On.mergeConfig=Qf;On.AxiosHeaders=Kn;On.formToJSON=t=>M5(vt.isHTMLForm(t)?new FormData(t):t);On.getAdapter=R5.getAdapter;On.HttpStatusCode=Bhe;On.default=On;var B5=On;var{Axios:V9t,AxiosError:G9t,CanceledError:Y9t,isCancel:J9t,CancelToken:X9t,VERSION:Q9t,all:eMt,Cancel:tMt,isAxiosError:rMt,spread:iMt,toFormData:nMt,AxiosHeaders:aMt,HttpStatusCode:oMt,formToJSON:sMt,getAdapter:fMt,mergeConfig:uMt}=B5;X();ee();Q();var Lhe=vi(Nhe(),1),xP="axios-retry";function Dhe(t){let e=["ERR_CANCELED","ECONNABORTED"];return t.response||!t.code||e.includes(t.code)?!1:(0,Lhe.default)(t)}var $he=["get","head","options"],ize=$he.concat(["put","delete"]);function SP(t){return t.code!=="ECONNABORTED"&&(!t.response||t.response.status===429||t.response.status>=500&&t.response.status<=599)}function nze(t){return t.config?.method?SP(t)&&$he.indexOf(t.config.method)!==-1:!1}function Uhe(t){return t.config?.method?SP(t)&&ize.indexOf(t.config.method)!==-1:!1}function qhe(t){return Dhe(t)||Uhe(t)}function Fhe(t=void 0){let e=t?.response?.headers["retry-after"];if(!e)return 0;let r=(Number(e)||0)*1e3;return r===0&&(r=(new Date(e).valueOf()||0)-Date.now()),Math.max(0,r)}function aze(t=0,e=void 0){return Math.max(0,Fhe(e))}function oze(t=0,e=void 0,r=100){let a=2**t*r,i=Math.max(a,Fhe(e)),h=i*.2*Math.random();return i+h}var sze={retries:3,retryCondition:qhe,retryDelay:aze,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function fze(t,e){return{...sze,...e,...t[xP]}}function Che(t,e){let r=fze(t,e||{});return r.retryCount=r.retryCount||0,r.lastRequestTime=r.lastRequestTime||Date.now(),t[xP]=r,r}function uze(t,e){t.defaults.agent===e.agent&&delete e.agent,t.defaults.httpAgent===e.httpAgent&&delete e.httpAgent,t.defaults.httpsAgent===e.httpsAgent&&delete e.httpsAgent}async function hze(t,e){let{retries:r,retryCondition:a}=t,i=(t.retryCount||0)<r&&a(e);if(typeof i=="object")try{return await i!==!1}catch{return!1}return i}async function cze(t,e,r,a){e.retryCount+=1;let{retryDelay:i,shouldResetTimeout:h,onRetry:c}=e,d=i(e.retryCount,r);if(uze(t,a),!h&&a.timeout&&e.lastRequestTime){let b=Date.now()-e.lastRequestTime,g=a.timeout-b-d;if(g<=0)return Promise.reject(r);a.timeout=g}return a.transformRequest=[b=>b],await c(e.retryCount,r,a),new Promise(b=>{setTimeout(()=>b(t(a)),d)})}async function lze(t,e){t.retryCount>=t.retries&&await t.onMaxRetryTimesExceeded(e,t.retryCount)}var ep=(t,e)=>{let r=t.interceptors.request.use(i=>(Che(i,e),i[xP]?.validateResponse&&(i.validateStatus=()=>!1),i)),a=t.interceptors.response.use(null,async i=>{let{config:h}=i;if(!h)return Promise.reject(i);let c=Che(h,e);return i.response&&c.validateResponse?.(i.response)?i.response:await hze(c,i)?cze(t,c,i,h):(await lze(c,i),Promise.reject(i))});return{requestInterceptorId:r,responseInterceptorId:a}};ep.isNetworkError=Dhe;ep.isSafeRequestError=nze;ep.isIdempotentRequestError=Uhe;ep.isNetworkOrIdempotentRequestError=qhe;ep.exponentialDelay=oze;ep.isRetryableError=SP;var O5=ep;var IMt=({axiosConfig:t={},logger:e=Ff.default,retryConfig:r={retries:5,retryDelay:O5.exponentialDelay,retryCondition:a=>O5.isRetryableError(a),onRetry(a,i,h){e.error(`Retrying request ${h.url} attempt ${a}`,i)}}}={})=>{let a=B5.create({...t,maxRedirects:0,headers:{...t.headers,"x-source-version":`${V1}`,"x-source-identifier":"ar-io-sdk"},validateStatus:()=>!0});return O5(a,r),a};X();ee();Q();X();ee();Q();var AP=vi(zhe(),1);X();ee();Q();var vze=Object.defineProperty,mze=(t,e,r)=>e in t?vze(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ey=(t,e,r)=>(mze(t,typeof e!="symbol"?e+"":e,r),r),RP=class{constructor(e){ey(this,"value"),ey(this,"next"),this.value=e}},TP=class{constructor(){ey(this,"head"),ey(this,"tail"),ey(this,"_size",0),this.clear()}clear(){this.head=void 0,this.tail=void 0,this._size=0}push(e){let r=new RP(e);return this.head&&this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),this._size++,this._size}pop(){if(!this.head)return;let e=this.head;return this.head=this.head.next,this._size--,e.value}get size(){return this._size}*[Symbol.iterator](){let e=this.head;for(;e;)yield e.value,e=e.next}};function Hhe(t){if(!((Number.isInteger(t)||t===1/0)&&t>0))throw new TypeError("Expected `concurrency` to be a number greater than 1");let e=new TP,r=0,a=()=>{r--,e.size>0&&e.pop()()},i=async(d,b,g)=>{r++;let y=(async()=>d(...g))();b(y);try{await y}catch{}a()},h=(d,b,g)=>{e.push(i.bind(null,d,b,g)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.pop()()))()},c=(d,...b)=>new Promise(g=>{h(d,g,b)});return Object.defineProperties(c,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),c}var txt=async({address:t,registry:e=Xd.init()})=>{let r=await e.accessControlList({address:t});return[...new Set([...r.Owned,...r.Controlled])]};function Zhe(t,e){return new Promise((r,a)=>{let i=setTimeout(()=>{a(new Error("Timeout"))},t);e.then(h=>{clearTimeout(i),r(h)}).catch(h=>{clearTimeout(i),a(h)})})}var Khe=class extends AP.default{contract;timeoutMs;throttle;logger;constructor({contract:e=jb.init({processId:R1}),timeoutMs:r=6e4,concurrency:a=30,logger:i=Ff.default}={}){super(),this.contract=e,this.timeoutMs=r,this.throttle=Hhe(a),this.logger=i}async fetchProcessesOwnedByWallet({address:e,pageSize:r,antRegistry:a=Xd.init()}){let i={},h=await a.accessControlList({address:e}),c=new Set([...h.Owned,...h.Controlled]);await Zhe(this.timeoutMs,gze({contract:this.contract,emitter:this,pageSize:r})).catch(b=>(this.emit("error",`Error getting ArNS records: ${b}`),this.logger.error("Error getting ArNS records",{message:b?.message,stack:b?.stack}),{})).then(b=>{Object.entries(b).forEach(([g,y])=>{c.has(y.processId)&&(i[y.processId]==null&&(i[y.processId]={state:void 0,names:{}}),i[y.processId].names[g]=y)})});let d=Object.keys(i).length;this.emit("progress",0,d),await Promise.all(Object.keys(i).map(async(b,g)=>this.throttle(async()=>{if(i[b].state!==void 0){this.emit("progress",g+1,d);return}let y=c5.init({processId:b}),M=await Zhe(this.timeoutMs,y.getState()).catch(x=>{this.emit("error",`Error getting state for process ${b}: ${x}`)});(M?.Owner===e||M?.Controllers.includes(e))&&(i[b].state=M,this.emit("process",b,i[b])),this.emit("progress",g+1,d)}))),this.emit("end",i)}},gze=async({contract:t=jb.init({processId:R1}),emitter:e,logger:r=Ff.default,pageSize:a=5e4})=>{let i,h=Date.now(),c={};do{let d=await t.getArNSRecords({cursor:i,limit:a}).catch(b=>{r?.error("Error getting ArNS records",{message:b?.message,stack:b?.stack}),e?.emit("arns:error",`Error getting ArNS records: ${b}`)});if(!d)return{};d.items.forEach(b=>{let{name:g,...y}=b;c[g]=y}),r.debug("Fetched page of ArNS records",{totalRecordCount:d.totalItems,fetchedRecordCount:Object.keys(c).length,cursor:d.nextCursor}),e?.emit("arns:pageLoaded",{totalRecordCount:d.totalItems,fetchedRecordCount:Object.keys(c).length,records:d.items,cursor:d.nextCursor}),i=d.nextCursor}while(i!==void 0);return e?.emit("arns:end",c),r.debug("Fetched all ArNS records",{totalRecordCount:Object.keys(c).length,durationMs:Date.now()-h}),c};export{c5 as ANT,Xd as ANTRegistry,QT as ANT_LUA_ID,n4 as ANT_REGISTRY_ID,La as AOProcess,iee as AOS_MODULE_ID,Kct as ARNS_DEVNET_REGISTRY_TX,Zct as ARNS_TESTNET_REGISTRY_TX,ree as ARWEAVE_TX_REGEX,lee as AbortError,FFe as AntStateSchema,l5 as AoANTReadable,d5 as AoANTRegistryReadable,VO as AoANTRegistryWriteable,WO as AoANTWriteable,Khe as ArNSEventEmitter,S1 as ArconnectSigner,Xc as ArweaveSigner,see as BadRequest,Bf as BaseError,nee as DEFAULT_SCHEDULER_ID,zct as FQDN_REGEX,fee as FailedRequestError,jb as IO,p5 as IOReadable,tk as IOToken,YO as IOWriteable,G5e as IO_DEVNET_PROCESS_ID,R1 as IO_TESTNET_PROCESS_ID,Du as InvalidContractConfigurationError,cee as InvalidProcessConfigurationError,hee as InvalidSignerError,Ff as Logger,XT as MIO_PER_IO,oee as NotFound,Hct as SORT_KEY_REGEX,uee as UnknownError,a4 as WriteInteractionError,$l as createAoSigner,IMt as createAxiosInstance,L3t as evolveANT,gze as fetchAllArNSRecords,txt as getANTProcessesOwnedByWallet,Wct as ioDevnetProcessId,D3t as isAoANTState,qFe as isAoSigner,nlt as isBlockHeight,hlt as isLeasedArNSRecord,Fh as isProcessConfiguration,jh as isProcessIdConfiguration,rk as mIOToken,GO as safeDecode,C3t as spawnANT,aee as validateArweaveId};
192
+ `+h):a.stack=h}catch{}}throw a}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Qf(this.defaults,r);let{transitional:a,paramsSerializer:i,headers:h}=r;a!==void 0&&I5.assertOptions(a,{silentJSONParsing:ql.transitional(ql.boolean),forcedJSONParsing:ql.transitional(ql.boolean),clarifyTimeoutError:ql.transitional(ql.boolean)},!1),i!=null&&(vt.isFunction(i)?r.paramsSerializer={serialize:i}:I5.assertOptions(i,{encode:ql.function,serialize:ql.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let c=h&&vt.merge(h.common,h[r.method]);h&&vt.forEach(["delete","get","head","post","put","patch","common"],A=>{delete h[A]}),r.headers=Kn.concat(c,h);let d=[],b=!0;this.interceptors.request.forEach(function(k){typeof k.runWhen=="function"&&k.runWhen(r)===!1||(b=b&&k.synchronous,d.unshift(k.fulfilled,k.rejected))});let g=[];this.interceptors.response.forEach(function(k){g.push(k.fulfilled,k.rejected)});let y,M=0,x;if(!b){let A=[T5.bind(this),void 0];for(A.unshift.apply(A,d),A.push.apply(A,g),x=A.length,y=Promise.resolve(r);M<x;)y=y.then(A[M++],A[M++]);return y}x=d.length;let E=r;for(M=0;M<x;){let A=d[M++],k=d[M++];try{E=A(E)}catch(O){k.call(this,O);break}}try{y=T5.call(this,E)}catch(A){return Promise.reject(A)}for(M=0,x=g.length;M<x;)y=y.then(g[M++],g[M++]);return y}getUri(e){e=Qf(this.defaults,e);let r=Jb(e.baseURL,e.url);return Kb(r,e.params,e.paramsSerializer)}};vt.forEach(["delete","get","head","options"],function(e){Ov.prototype[e]=function(r,a){return this.request(Qf(a||{},{method:e,url:r,data:(a||{}).data}))}});vt.forEach(["post","put","patch"],function(e){function r(a){return function(h,c,d){return this.request(Qf(d||{},{method:e,headers:a?{"Content-Type":"multipart/form-data"}:{},url:h,data:c}))}}Ov.prototype[e]=r(),Ov.prototype[e+"Form"]=r(!0)});var Xb=Ov;X();ee();Q();var yP=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(h){r=h});let a=this;this.promise.then(i=>{if(!a._listeners)return;let h=a._listeners.length;for(;h-- >0;)a._listeners[h](i);a._listeners=null}),this.promise.then=i=>{let h,c=new Promise(d=>{a.subscribe(d),h=d}).then(i);return c.cancel=function(){a.unsubscribe(h)},c},e(function(h,c,d){a.reason||(a.reason=new Qu(h,c,d),r(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=a=>{e.abort(a)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},Ihe=yP;X();ee();Q();function wP(t){return function(r){return t.apply(null,r)}}X();ee();Q();function _P(t){return vt.isObject(t)&&t.isAxiosError===!0}X();ee();Q();var MP={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(MP).forEach(([t,e])=>{MP[e]=t});var Bhe=MP;function Ohe(t){let e=new Xb(t),r=zb(Xb.prototype.request,e);return vt.extend(r,Xb.prototype,e,{allOwnKeys:!0}),vt.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return Ohe(Qf(t,i))},r}var On=Ohe(kv);On.Axios=Xb;On.CanceledError=Qu;On.CancelToken=Ihe;On.isCancel=Gb;On.VERSION=k5;On.toFormData=Ul;On.AxiosError=yr;On.Cancel=On.CanceledError;On.all=function(e){return Promise.all(e)};On.spread=wP;On.isAxiosError=_P;On.mergeConfig=Qf;On.AxiosHeaders=Kn;On.formToJSON=t=>M5(vt.isHTMLForm(t)?new FormData(t):t);On.getAdapter=R5.getAdapter;On.HttpStatusCode=Bhe;On.default=On;var B5=On;var{Axios:G9t,AxiosError:Y9t,CanceledError:J9t,isCancel:X9t,CancelToken:Q9t,VERSION:eMt,all:tMt,Cancel:rMt,isAxiosError:iMt,spread:nMt,toFormData:aMt,AxiosHeaders:oMt,HttpStatusCode:sMt,formToJSON:fMt,getAdapter:uMt,mergeConfig:hMt}=B5;X();ee();Q();var Lhe=vi(Nhe(),1),xP="axios-retry";function Dhe(t){let e=["ERR_CANCELED","ECONNABORTED"];return t.response||!t.code||e.includes(t.code)?!1:(0,Lhe.default)(t)}var $he=["get","head","options"],ize=$he.concat(["put","delete"]);function SP(t){return t.code!=="ECONNABORTED"&&(!t.response||t.response.status===429||t.response.status>=500&&t.response.status<=599)}function nze(t){return t.config?.method?SP(t)&&$he.indexOf(t.config.method)!==-1:!1}function Uhe(t){return t.config?.method?SP(t)&&ize.indexOf(t.config.method)!==-1:!1}function qhe(t){return Dhe(t)||Uhe(t)}function Fhe(t=void 0){let e=t?.response?.headers["retry-after"];if(!e)return 0;let r=(Number(e)||0)*1e3;return r===0&&(r=(new Date(e).valueOf()||0)-Date.now()),Math.max(0,r)}function aze(t=0,e=void 0){return Math.max(0,Fhe(e))}function oze(t=0,e=void 0,r=100){let a=2**t*r,i=Math.max(a,Fhe(e)),h=i*.2*Math.random();return i+h}var sze={retries:3,retryCondition:qhe,retryDelay:aze,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function fze(t,e){return{...sze,...e,...t[xP]}}function Che(t,e){let r=fze(t,e||{});return r.retryCount=r.retryCount||0,r.lastRequestTime=r.lastRequestTime||Date.now(),t[xP]=r,r}function uze(t,e){t.defaults.agent===e.agent&&delete e.agent,t.defaults.httpAgent===e.httpAgent&&delete e.httpAgent,t.defaults.httpsAgent===e.httpsAgent&&delete e.httpsAgent}async function hze(t,e){let{retries:r,retryCondition:a}=t,i=(t.retryCount||0)<r&&a(e);if(typeof i=="object")try{return await i!==!1}catch{return!1}return i}async function cze(t,e,r,a){e.retryCount+=1;let{retryDelay:i,shouldResetTimeout:h,onRetry:c}=e,d=i(e.retryCount,r);if(uze(t,a),!h&&a.timeout&&e.lastRequestTime){let b=Date.now()-e.lastRequestTime,g=a.timeout-b-d;if(g<=0)return Promise.reject(r);a.timeout=g}return a.transformRequest=[b=>b],await c(e.retryCount,r,a),new Promise(b=>{setTimeout(()=>b(t(a)),d)})}async function lze(t,e){t.retryCount>=t.retries&&await t.onMaxRetryTimesExceeded(e,t.retryCount)}var ep=(t,e)=>{let r=t.interceptors.request.use(i=>(Che(i,e),i[xP]?.validateResponse&&(i.validateStatus=()=>!1),i)),a=t.interceptors.response.use(null,async i=>{let{config:h}=i;if(!h)return Promise.reject(i);let c=Che(h,e);return i.response&&c.validateResponse?.(i.response)?i.response:await hze(c,i)?cze(t,c,i,h):(await lze(c,i),Promise.reject(i))});return{requestInterceptorId:r,responseInterceptorId:a}};ep.isNetworkError=Dhe;ep.isSafeRequestError=nze;ep.isIdempotentRequestError=Uhe;ep.isNetworkOrIdempotentRequestError=qhe;ep.exponentialDelay=oze;ep.isRetryableError=SP;var O5=ep;var BMt=({axiosConfig:t={},logger:e=Ff.default,retryConfig:r={retries:5,retryDelay:O5.exponentialDelay,retryCondition:a=>O5.isRetryableError(a),onRetry(a,i,h){e.error(`Retrying request ${h.url} attempt ${a}`,i)}}}={})=>{let a=B5.create({...t,maxRedirects:0,headers:{...t.headers,"x-source-version":`${V1}`,"x-source-identifier":"ar-io-sdk"},validateStatus:()=>!0});return O5(a,r),a};X();ee();Q();X();ee();Q();var AP=vi(zhe(),1);X();ee();Q();var vze=Object.defineProperty,mze=(t,e,r)=>e in t?vze(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ey=(t,e,r)=>(mze(t,typeof e!="symbol"?e+"":e,r),r),RP=class{constructor(e){ey(this,"value"),ey(this,"next"),this.value=e}},TP=class{constructor(){ey(this,"head"),ey(this,"tail"),ey(this,"_size",0),this.clear()}clear(){this.head=void 0,this.tail=void 0,this._size=0}push(e){let r=new RP(e);return this.head&&this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),this._size++,this._size}pop(){if(!this.head)return;let e=this.head;return this.head=this.head.next,this._size--,e.value}get size(){return this._size}*[Symbol.iterator](){let e=this.head;for(;e;)yield e.value,e=e.next}};function Hhe(t){if(!((Number.isInteger(t)||t===1/0)&&t>0))throw new TypeError("Expected `concurrency` to be a number greater than 1");let e=new TP,r=0,a=()=>{r--,e.size>0&&e.pop()()},i=async(d,b,g)=>{r++;let y=(async()=>d(...g))();b(y);try{await y}catch{}a()},h=(d,b,g)=>{e.push(i.bind(null,d,b,g)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.pop()()))()},c=(d,...b)=>new Promise(g=>{h(d,g,b)});return Object.defineProperties(c,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),c}var rxt=async({address:t,registry:e=Xd.init()})=>{let r=await e.accessControlList({address:t});return[...new Set([...r.Owned,...r.Controlled])]};function Zhe(t,e){return new Promise((r,a)=>{let i=setTimeout(()=>{a(new Error("Timeout"))},t);e.then(h=>{clearTimeout(i),r(h)}).catch(h=>{clearTimeout(i),a(h)})})}var Khe=class extends AP.default{contract;timeoutMs;throttle;logger;constructor({contract:e=jb.init({processId:R1}),timeoutMs:r=6e4,concurrency:a=30,logger:i=Ff.default}={}){super(),this.contract=e,this.timeoutMs=r,this.throttle=Hhe(a),this.logger=i}async fetchProcessesOwnedByWallet({address:e,pageSize:r,antRegistry:a=Xd.init()}){let i={},h=await a.accessControlList({address:e}),c=new Set([...h.Owned,...h.Controlled]);await Zhe(this.timeoutMs,gze({contract:this.contract,emitter:this,pageSize:r})).catch(b=>(this.emit("error",`Error getting ArNS records: ${b}`),this.logger.error("Error getting ArNS records",{message:b?.message,stack:b?.stack}),{})).then(b=>{Object.entries(b).forEach(([g,y])=>{c.has(y.processId)&&(i[y.processId]==null&&(i[y.processId]={state:void 0,names:{}}),i[y.processId].names[g]=y)})});let d=Object.keys(i).length;this.emit("progress",0,d),await Promise.all(Object.keys(i).map(async(b,g)=>this.throttle(async()=>{if(i[b].state!==void 0){this.emit("progress",g+1,d);return}let y=c5.init({processId:b}),M=await Zhe(this.timeoutMs,y.getState()).catch(x=>{this.emit("error",`Error getting state for process ${b}: ${x}`)});(M?.Owner===e||M?.Controllers.includes(e))&&(i[b].state=M,this.emit("process",b,i[b])),this.emit("progress",g+1,d)}))),this.emit("end",i)}},gze=async({contract:t=jb.init({processId:R1}),emitter:e,logger:r=Ff.default,pageSize:a=5e4})=>{let i,h=Date.now(),c={};do{let d=await t.getArNSRecords({cursor:i,limit:a}).catch(b=>{r?.error("Error getting ArNS records",{message:b?.message,stack:b?.stack}),e?.emit("arns:error",`Error getting ArNS records: ${b}`)});if(!d)return{};d.items.forEach(b=>{let{name:g,...y}=b;c[g]=y}),r.debug("Fetched page of ArNS records",{totalRecordCount:d.totalItems,fetchedRecordCount:Object.keys(c).length,cursor:d.nextCursor}),e?.emit("arns:pageLoaded",{totalRecordCount:d.totalItems,fetchedRecordCount:Object.keys(c).length,records:d.items,cursor:d.nextCursor}),i=d.nextCursor}while(i!==void 0);return e?.emit("arns:end",c),r.debug("Fetched all ArNS records",{totalRecordCount:Object.keys(c).length,durationMs:Date.now()-h}),c};export{c5 as ANT,Xd as ANTRegistry,QT as ANT_LUA_ID,n4 as ANT_REGISTRY_ID,La as AOProcess,iee as AOS_MODULE_ID,Kct as ARNS_DEVNET_REGISTRY_TX,Zct as ARNS_TESTNET_REGISTRY_TX,ree as ARWEAVE_TX_REGEX,lee as AbortError,FFe as AntStateSchema,l5 as AoANTReadable,d5 as AoANTRegistryReadable,VO as AoANTRegistryWriteable,WO as AoANTWriteable,Khe as ArNSEventEmitter,S1 as ArconnectSigner,Xc as ArweaveSigner,see as BadRequest,Bf as BaseError,nee as DEFAULT_SCHEDULER_ID,zct as FQDN_REGEX,fee as FailedRequestError,jb as IO,p5 as IOReadable,tk as IOToken,YO as IOWriteable,G5e as IO_DEVNET_PROCESS_ID,R1 as IO_TESTNET_PROCESS_ID,Du as InvalidContractConfigurationError,cee as InvalidProcessConfigurationError,hee as InvalidSignerError,Ff as Logger,XT as MIO_PER_IO,oee as NotFound,Hct as SORT_KEY_REGEX,uee as UnknownError,a4 as WriteInteractionError,$l as createAoSigner,BMt as createAxiosInstance,L3t as evolveANT,gze as fetchAllArNSRecords,rxt as getANTProcessesOwnedByWallet,Wct as ioDevnetProcessId,D3t as isAoANTState,qFe as isAoSigner,nlt as isBlockHeight,hlt as isLeasedArNSRecord,Fh as isProcessConfiguration,jh as isProcessIdConfiguration,rk as mIOToken,GO as safeDecode,C3t as spawnANT,aee as validateArweaveId};
193
193
  /*! Bundled license information:
194
194
 
195
195
  @jspm/core/nodelibs/browser/buffer.js: