From ae105e6e46346ef78344058f1c05e0b37096cc51 Mon Sep 17 00:00:00 2001 From: juliopavila Date: Thu, 1 Aug 2024 20:13:31 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20gnosisgu?= =?UTF-8?q?ild/zodiac-safe-app@afa9e1051d4365b8ec63de6cddbbd9c4ce34336b=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/{index-CaiI26nW.js => index-BcZzR9qG.js} | 4 ++-- ...o_inflate.min-CwX3nVh0.js => pako_inflate.min-BGiCGMdN.js} | 2 +- index.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename assets/{index-CaiI26nW.js => index-BcZzR9qG.js} (99%) rename assets/{pako_inflate.min-CwX3nVh0.js => pako_inflate.min-BGiCGMdN.js} (99%) diff --git a/assets/index-CaiI26nW.js b/assets/index-BcZzR9qG.js similarity index 99% rename from assets/index-CaiI26nW.js rename to assets/index-BcZzR9qG.js index 0db4b72..6872541 100644 --- a/assets/index-CaiI26nW.js +++ b/assets/index-BcZzR9qG.js @@ -1865,7 +1865,7 @@ ${moe(x)}`),super(t.shortMessage,{cause:t,docsPath:f,metaMessages:[...t.metaMess The first placeholder is for the id of the proposal (e.g., an IPFS hash). The second is the hash of the concatenation of the EIP-712 transaction hashes.`,Kce=[{label:"Zodiac Reality Module (default)",value:"default"},{label:"Custom",value:"custom"}],Jce=[{label:"English",value:"english"}],Zce=en(e=>({container:{display:"flex",flexDirection:"column"},textSubdued:{color:"rgba(255 255 255 / 70%)"},textFieldSmall:{"& .MuiFormLabel-root":{fontSize:12}},select:{border:"1px solid rgba(217, 212, 173, 0.3)"},paperTemplateContainer:{marginTop:4,padding:e.spacing(1),background:"rgba(0, 0, 0, 0.2)"},templateQuestion:{fontFamily:"Roboto Mono","& .MuiInputBase-root":{border:"none",fontSize:"0.85rem"}},input:{"& .MuiInputBase-root":{padding:"9px 8px",borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},button:{width:"100%",padding:"4px 15px"},buttonContainer:{marginTop:8,cursor:"pointer"},icon:{color:Jt.tan[1e3],fontSize:"1rem",marginTop:3},text:{fontSize:"0.75rem"},tooltipIcon:{fontSize:"1rem"}})),Xce=({data:e,setData:t,ensName:n})=>{const f=Zce(),r=o=>s=>t({...e,[o]:s}),a=o=>e[o],i=o=>{t(o==="default"?{...e,templateQuestion:$S(n),templateType:o}:{...e,templateQuestion:"",templateType:o})};return ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,direction:"column",children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Oracle Template"})}),r0(fe,{item:!0,children:r0(ze,{variant:"body2",className:f.textSubdued,children:"The oracle template creates an appropriate question based on the data of the proposal. We highly recommend using the default Zodiac Reality Module template"})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,justifyContent:"space-between",spacing:2,alignItems:"center",children:[r0(fe,{item:!0,xs:6,children:r0(_S,{value:a("templateType"),options:Kce,onChange:o=>i(o.target.value),label:"Select template:",tooltipMsg:"The Zodiac Reality Module type has defaults set for connecting the Reality Module to Safesnap. If you need a more specific setup, use the \u2018Custom\u2019 type."})}),r0(fe,{item:!0,xs:6,children:r0(_S,{value:a("language"),options:Jce,disableUnderline:a("templateType")==="default",label:"Language:",disabled:a("templateType")==="default",onChange:({target:o})=>r("language")(o.value)})}),r0(Er,{children:ve(fe,{item:!0,xs:12,children:[ve(fe,{container:!0,justifyContent:"space-between",alignItems:"center",children:[r0(ze,{children:"Template question preview:"}),r0(l7,{title:g20,children:r0(Yce,{className:f.tooltipIcon})})]}),r0(wf,{className:f.paperTemplateContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0(Cr,{className:f.templateQuestion,value:a("templateQuestion"),onChange:({target:o})=>r("templateQuestion")(o.value),multiline:!0,minRows:5,disabled:a("templateType")==="default",placeholder:a("templateType")==="default"?$S(n):g20})})]})})]})})]})};var vG={},_ce=W5,$ce=mc;Object.defineProperty(vG,"__esModule",{value:!0});var wG=vG.default=void 0,eue=$ce(n0),tue=_ce(yc()),nue=(0,tue.default)(eue.createElement("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}),"WarningOutlined");wG=vG.default=nue;var v20;function AG(){return AG=Object.assign?Object.assign.bind():function(e){for(var t=1;tn0.createElement("svg",AG({xmlns:"http://www.w3.org/2000/svg",width:15,height:12,fill:"none"},e),v20||(v20=n0.createElement("path",{d:"M5.219 9.382 1.964 6.127.55 7.542l4 4A1 1 0 0 0 6 11.504l9-10L13.514.165z",clipRule:"evenodd"}))),A20=()=>{const[e,t]=n0.useState(!1),[n,f]=n0.useState();return{loading:e,error:n,execute:async(r,a)=>{t(!0),f(void 0);try{await Vce({apiKey:r,apiSecret:a}).then(i=>{if(t(!1),i.status===200)return f(!1);f(!0)})}catch{t(!1)}}}},fue="v4.0.0",rue=()=>`@ensdomains/ensjs@${fue}`;class ia extends Error{constructor(t,n={}){var r;super(),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsJsError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:rue()});const f=n.cause instanceof ia?n.cause.details:((r=n.cause)==null?void 0:r.message)??n.details;this.message=[t||"An error occurred","",...n.metaMessages?[...n.metaMessages,""]:[],...f?[`Details: ${f}`,""]:[],`Version: ${this.version}`].join(` `),n.cause&&(this.cause=n.cause),this.details=f,this.metaMessages=n.metaMessages,this.shortMessage=t}}class aue extends ia{constructor({coinType:t}){super(`Coin formatter not found for ${t}`),Object.defineProperty(this,"coinType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CoinFormatterNotFoundError"}),this.coinType=t}}class iue extends ia{constructor({functionIndex:t}){super(`Function at index ${t} is not batchable`),Object.defineProperty(this,"functionIndex",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FunctionNotBatchableError"}),this.functionIndex=t}}class oue extends ia{constructor(){super("No records specified"),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NoRecordsSpecifiedError"})}}class sue extends on{constructor(t,{account:n,docsPath:f,chain:r,data:a,gas:i,gasPrice:o,maxFeePerGas:s,maxPriorityFeePerGas:l,nonce:c,to:d,value:p}){var C;const x=tv({from:n==null?void 0:n.address,to:d,value:typeof p<"u"&&`${GU(p)} ${((C=r==null?void 0:r.nativeCurrency)==null?void 0:C.symbol)||"ETH"}`,data:a,gas:i,gasPrice:typeof o<"u"&&`${M1(o)} gwei`,maxFeePerGas:typeof s<"u"&&`${M1(s)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${M1(l)} gwei`,nonce:c});super(t.shortMessage,{cause:t,docsPath:f,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",x].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=t}}function lue(e,{docsPath:t,...n}){const f=(()=>{const r=nH(e,n);return r instanceof CS?e:r})();return new sue(f,{docsPath:t,...n})}class cue extends on{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class xG extends on{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class uue extends on{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${M1(t)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class due extends on{constructor({blockHash:t,blockNumber:n}){let f="Block";t&&(f=`Block at hash "${t}"`),n&&(f=`Block at number "${n}"`),super(`${f} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}const pue={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844"};function bue(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Yg(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Yg(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?pue[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof t.v=="bigint"){if(t.v===0n||t.v===27n)return 0;if(t.v===1n||t.v===28n)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),t.type==="legacy"&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),t.type==="eip2930"&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t.type==="eip1559"&&delete t.maxFeePerBlobGas,t}function hue(e){var n;const t=(n=e.transactions)==null?void 0:n.map(f=>typeof f=="string"?f:bue(f));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function eO(e,{blockHash:t,blockNumber:n,blockTag:f,includeTransactions:r}={}){var l,c,d;const a=f??"latest",i=r??!1,o=n!==void 0?pa(n):void 0;let s=null;if(t?s=await e.request({method:"eth_getBlockByHash",params:[t,i]},{dedupe:!0}):s=await e.request({method:"eth_getBlockByNumber",params:[o||a,i]},{dedupe:!!o}),!s)throw new due({blockHash:t,blockNumber:n});return(((d=(c=(l=e.chain)==null?void 0:l.formatters)==null?void 0:c.block)==null?void 0:d.format)||hue)(s)}async function x20(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function mue(e,t){var a,i,o;const{block:n,chain:f=e.chain,request:r}=t||{};if(typeof((a=f==null?void 0:f.fees)==null?void 0:a.defaultPriorityFee)=="function"){const s=n||await C1(e,eO,"getBlock")({});return f.fees.defaultPriorityFee({block:s,client:e,request:r})}if(typeof((i=f==null?void 0:f.fees)==null?void 0:i.defaultPriorityFee)<"u")return(o=f==null?void 0:f.fees)==null?void 0:o.defaultPriorityFee;try{const s=await e.request({method:"eth_maxPriorityFeePerGas"});return hS(s)}catch{const[s,l]=await Promise.all([n?Promise.resolve(n):C1(e,eO,"getBlock")({}),C1(e,x20,"getGasPrice")({})]);if(typeof s.baseFeePerGas!="bigint")throw new xG;const c=l-s.baseFeePerGas;return c<0n?0n:c}}async function E20(e,t){var c,d;const{block:n,chain:f=e.chain,request:r,type:a="eip1559"}=t||{},i=await(async()=>{var p,x;return typeof((p=f==null?void 0:f.fees)==null?void 0:p.baseFeeMultiplier)=="function"?f.fees.baseFeeMultiplier({block:n,client:e,request:r}):((x=f==null?void 0:f.fees)==null?void 0:x.baseFeeMultiplier)??1.2})();if(i<1)throw new cue;const o=10**(((c=i.toString().split(".")[1])==null?void 0:c.length)??0),s=p=>p*BigInt(Math.ceil(i*o))/BigInt(o),l=n||await C1(e,eO,"getBlock")({});if(typeof((d=f==null?void 0:f.fees)==null?void 0:d.estimateFeesPerGas)=="function"){const p=await f.fees.estimateFeesPerGas({block:n,client:e,multiply:s,request:r,type:a});if(p!==null)return p}if(a==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new xG;const p=typeof(r==null?void 0:r.maxPriorityFeePerGas)=="bigint"?r.maxPriorityFeePerGas:await mue(e,{block:l,chain:f,request:r}),x=s(l.baseFeePerGas);return{maxFeePerGas:(r==null?void 0:r.maxFeePerGas)??x+p,maxPriorityFeePerGas:p}}return{gasPrice:(r==null?void 0:r.gasPrice)??s(await C1(e,x20,"getGasPrice")({}))}}async function yue(e,{address:t,blockTag:n="latest",blockNumber:f}){const r=await e.request({method:"eth_getTransactionCount",params:[t,f?pa(f):n]},{dedupe:!!f});return Yg(r)}function T20(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),f=typeof e.blobs[0]=="string"?e.blobs.map(a=>T1(a)):e.blobs,r=[];for(const a of f)r.push(Uint8Array.from(t.blobToKzgCommitment(a)));return n==="bytes"?r:r.map(a=>yi(a))}function M20(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),f=typeof e.blobs[0]=="string"?e.blobs.map(i=>T1(i)):e.blobs,r=typeof e.commitments[0]=="string"?e.commitments.map(i=>T1(i)):e.commitments,a=[];for(let i=0;iyi(i))}function gue(e,t,n,f){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,f);const r=BigInt(32),a=BigInt(4294967295),i=Number(n>>r&a),o=Number(n&a),s=f?4:0,l=f?0:4;e.setUint32(t+s,i,f),e.setUint32(t+l,o,f)}const vue=(e,t,n)=>e&t^~e&n,wue=(e,t,n)=>e&t^e&n^t&n;class EG extends vS{constructor(t,n,f,r){super(),this.blockLen=t,this.outputLen=n,this.padOffset=f,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=TU(this.buffer)}update(t){Ed(this);const{view:n,buffer:f,blockLen:r}=this;t=Mc(t);const a=t.length;for(let i=0;ir-i&&(this.process(f,0),i=0);for(let d=i;dc.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d>>3,O=_5(x,17)^_5(x,19)^x>>>10;Pd[d]=O+Pd[d-7]+C+Pd[d-16]|0}let{A:f,B:r,C:a,D:i,E:o,F:s,G:l,H:c}=this;for(let d=0;d<64;d++){const p=_5(o,6)^_5(o,11)^_5(o,25),x=c+p+vue(o,s,l)+Aue[d]+Pd[d]|0,C=(_5(f,2)^_5(f,13)^_5(f,22))+wue(f,r,a)|0;c=l,l=s,s=o,o=i+x|0,i=a,a=r,r=f,f=x+C|0}f=f+this.A|0,r=r+this.B|0,a=a+this.C|0,i=i+this.D|0,o=o+this.E|0,s=s+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(f,r,a,i,o,s,l,c)}roundClean(){Pd.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const p8=wS(()=>new xue);function Eue(e,t){return p8(wd(e,{strict:!1})?Kg(e):e)}function Tue(e){const{commitment:t,version:n=1}=e,f=e.to??(typeof t=="string"?"hex":"bytes"),r=Eue(t);return r.set([n],0),f==="bytes"?r:yi(r)}function Mue(e){const{commitments:t,version:n}=e,f=e.to??(typeof t[0]=="string"?"hex":"bytes"),r=[];for(const a of t)r.push(Tue({commitment:a,to:f,version:n}));return r}const C20=6,S20=32,TG=4096,O20=S20*TG,k20=O20*C20-1-1*TG*C20;class Cue extends on{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlobSizeTooLargeError"})}}class Sue extends on{constructor(){super("Blob data must not be empty."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EmptyBlobError"})}}function Oue(e){const t=e.to??(typeof e.data=="string"?"hex":"bytes"),n=typeof e.data=="string"?T1(e.data):e.data,f=mi(n);if(!f)throw new Sue;if(f>k20)throw new Cue({maxSize:k20,size:f});const r=[];let a=!0,i=0;for(;a;){const o=Qc0(new Uint8Array(O20));let s=0;for(;so.bytes):r.map(o=>yi(o.bytes))}function kue(e){const{data:t,kzg:n,to:f}=e,r=e.blobs??Oue({data:t,to:f}),a=e.commitments??T20({blobs:r,kzg:n,to:f}),i=e.proofs??M20({blobs:r,commitments:a,kzg:n,to:f}),o=[];for(let s=0;s"u"&&c)if(c.nonceManager){const L=await O();d.nonce=await c.nonceManager.consume({address:c.address,chainId:L,client:e})}else d.nonce=await C1(e,yue,"getTransactionCount")({address:c.address,blockTag:"pending"});if((s.includes("fees")||s.includes("type"))&&typeof l>"u")try{d.type=Nue(d)}catch{const L=await x();d.type=typeof(L==null?void 0:L.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(s.includes("fees"))if(d.type!=="legacy"&&d.type!=="eip2930"){if(typeof d.maxFeePerGas>"u"||typeof d.maxPriorityFeePerGas>"u"){const L=await x(),{maxFeePerGas:D,maxPriorityFeePerGas:V}=await E20(e,{block:L,chain:r,request:d});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas"u"&&(d.gas=await C1(e,Pue,"estimateGas")({...d,account:c?{address:c.address,type:"json-rpc"}:void 0})),gv(d),delete d.parameters,d}async function Pue(e,t){var r,a,i;const n=t.account??e.account,f=n?fs(n):void 0;try{const{accessList:o,blobs:s,blobVersionedHashes:l,blockNumber:c,blockTag:d,data:p,gas:x,gasPrice:C,maxFeePerBlobGas:O,maxFeePerGas:L,maxPriorityFeePerGas:D,nonce:V,to:Y,value:i0,stateOverride:m0,...A0}=await MG(e,{...t,parameters:(f==null?void 0:f.type)==="local"?void 0:["blobVersionedHashes"]}),T0=(c?pa(c):void 0)||d,I0=Su0(m0);gv(t);const z0=(i=(a=(r=e.chain)==null?void 0:r.formatters)==null?void 0:a.transactionRequest)==null?void 0:i.format,oe=(z0||SS)({...fH(A0,{format:z0}),from:f==null?void 0:f.address,accessList:o,blobs:s,blobVersionedHashes:l,data:p,gas:x,gasPrice:C,maxFeePerBlobGas:O,maxFeePerGas:L,maxPriorityFeePerGas:D,nonce:V,to:Y,value:i0}),ae=await e.request({method:"eth_estimateGas",params:I0?[oe,T0??"latest",I0]:T0?[oe,T0]:[oe]});return BigInt(ae)}catch(o){throw lue(o,{...t,account:f,chain:e.chain})}}async function Iue(e){return new Promise(t=>setTimeout(t,e))}class nO extends on{constructor({docsPath:t}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."].join(` -`),{docsPath:t,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}function P20({chain:e,currentChainId:t}){if(!e)throw new soe;if(t!==e.id)throw new ooe({chain:e,currentChainId:t})}function Rue(e,{docsPath:t,...n}){const f=(()=>{const r=nH(e,n);return r instanceof CS?e:r})();return new voe(f,{docsPath:t,...n})}async function I20(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}async function Ja(e,t){var D,V,Y,i0;const{account:n=e.account,chain:f=e.chain,accessList:r,blobs:a,data:i,gas:o,gasPrice:s,maxFeePerBlobGas:l,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:p,to:x,value:C,...O}=t;if(!n)throw new nO({docsPath:"/docs/actions/wallet/sendTransaction"});const L=fs(n);try{gv(t);let m0;if(f!==null&&(m0=await C1(e,tO,"getChainId")({}),P20({currentChainId:m0,chain:f})),L.type==="local"){const I0=await C1(e,MG,"prepareTransactionRequest")({account:L,accessList:r,blobs:a,chain:f,chainId:m0,data:i,gas:o,gasPrice:s,maxFeePerBlobGas:l,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:p,parameters:[...N20,"sidecars"],to:x,value:C,...O}),z0=(D=f==null?void 0:f.serializers)==null?void 0:D.transaction,oe=await L.signTransaction(I0,{serializer:z0});return await C1(e,I20,"sendRawTransaction")({serializedTransaction:oe})}const A0=(i0=(Y=(V=e.chain)==null?void 0:V.formatters)==null?void 0:Y.transactionRequest)==null?void 0:i0.format,T0=(A0||SS)({...fH(O,{format:A0}),accessList:r,blobs:a,chainId:m0,data:i,from:L.address,gas:o,gasPrice:s,maxFeePerBlobGas:l,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:p,to:x,value:C});return await e.request({method:"eth_sendTransaction",params:[T0]},{retryCount:0})}catch(m0){throw Rue(m0,{...t,account:L,chain:t.chain||void 0})}}async function Bue(e,t){const{abi:n,address:f,args:r,dataSuffix:a,functionName:i,...o}=t,s=Pn({abi:n,args:r,functionName:i});return C1(e,Ja,"sendTransaction")({data:`${s}${a?a.replace("0x",""):""}`,to:f,...o})}async function Due(e,{chain:t}){const{id:n,name:f,nativeCurrency:r,rpcUrls:a,blockExplorers:i}=t;await e.request({method:"wallet_addEthereumChain",params:[{chainId:pa(n),chainName:f,nativeCurrency:r,rpcUrls:a.default.http,blockExplorerUrls:i?Object.values(i).map(({url:o})=>o):void 0}]},{dedupe:!0,retryCount:0})}const CG=256;let fO=CG,rO;function R20(e=11){if(!rO||fO+e>CG*2){rO="",fO=0;for(let t=0;t{const V=D(L);for(const i0 in C)delete V[i0];const Y={...L,...V};return Object.assign(Y,{extend:O(Y)})}}return Object.assign(C,{extend:O(C)})}const aO=new CU(8192);function Lue(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(aO.get(n))return aO.get(n);const f=e().finally(()=>aO.delete(n));return aO.set(n,f),f}function jue(e,{delay:t=100,retryCount:n=2,shouldRetry:f=()=>!0}={}){return new Promise((r,a)=>{const i=async({count:o=0}={})=>{const s=async({error:l})=>{const c=typeof t=="function"?t({count:o,error:l}):t;c&&await Iue(c),i({count:o+1})};try{const l=await e();r(l)}catch(l){if(o{const{dedupe:r=!1,retryDelay:a=150,retryCount:i=3,uid:o}={...t,...f},s=r?Cc(mS(`${o}.${V6(n)}`)):void 0;return Lue(()=>jue(async()=>{try{return await e(n)}catch(l){const c=l;switch(c.code){case nv.code:throw new nv(c);case fv.code:throw new fv(c);case rv.code:throw new rv(c);case av.code:throw new av(c);case r8.code:throw new r8(c);case iv.code:throw new iv(c);case ov.code:throw new ov(c);case sv.code:throw new sv(c);case lv.code:throw new lv(c);case cv.code:throw new cv(c);case r9.code:throw new r9(c);case uv.code:throw new uv(c);case a9.code:throw new a9(c);case dv.code:throw new dv(c);case pv.code:throw new pv(c);case bv.code:throw new bv(c);case hv.code:throw new hv(c);case mv.code:throw new mv(c);case 5e3:throw new a9(c);default:throw l instanceof on?l:new Moe(c)}}},{delay:({count:l,error:c})=>{var d;if(c&&c instanceof f8){const p=(d=c==null?void 0:c.headers)==null?void 0:d.get("Retry-After");if(p!=null&&p.match(/\d/))return Number.parseInt(p)*1e3}return~~(1<zue(l)}),{enabled:r,id:s})}}function zue(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===r9.code||e.code===r8.code:e instanceof f8&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function Vue({key:e,name:t,request:n,retryCount:f=3,retryDelay:r=150,timeout:a,type:i},o){const s=R20();return{config:{key:e,name:t,request:n,retryCount:f,retryDelay:r,timeout:a,type:i},request:Fue(n,{retryCount:f,retryDelay:r,uid:s}),value:o}}class Uue extends on{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}function Hue(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:f}){return new Promise((r,a)=>{(async()=>{let i;try{const o=new AbortController;n>0&&(i=setTimeout(()=>{f?o.abort():a(t)},n)),r(await e({signal:(o==null?void 0:o.signal)||null}))}catch(o){(o==null?void 0:o.name)==="AbortError"&&a(t),a(o)}finally{clearTimeout(i)}})()})}function Gue(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const D20=Gue();function que(e,t={}){return{async request(n){var d;const{body:f,onRequest:r=t.onRequest,onResponse:a=t.onResponse,timeout:i=t.timeout??1e4}=n,o={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:s,method:l,signal:c}=o;try{const p=await Hue(async({signal:C})=>{const O={...o,body:Array.isArray(f)?V6(f.map(D=>({jsonrpc:"2.0",id:D.id??D20.take(),...D}))):V6({jsonrpc:"2.0",id:f.id??D20.take(),...f}),headers:{"Content-Type":"application/json",...s},method:l||"POST",signal:c||(i>0?C:null)},L=new Request(e,O);return r&&await r(L),await fetch(e,O)},{errorInstance:new Eu0({body:f,url:e}),timeout:i,signal:!0});a&&await a(p);let x;if((d=p.headers.get("Content-Type"))!=null&&d.startsWith("application/json")?x=await p.json():(x=await p.text(),x=JSON.parse(x||"{}")),!p.ok)throw new f8({body:f,details:V6(x.error)||p.statusText,headers:p.headers,status:p.status,url:e});return x}catch(p){throw p instanceof f8||p instanceof Eu0?p:new f8({body:f,cause:p,url:e})}}}}function L20(e,t={}){const{batch:n,fetchOptions:f,key:r="http",name:a="HTTP JSON-RPC",onFetchRequest:i,onFetchResponse:o,retryDelay:s}=t;return({chain:l,retryCount:c,timeout:d})=>{const{batchSize:p=1e3,wait:x=0}=typeof n=="object"?n:{},C=t.retryCount??c,O=d??t.timeout??1e4,L=l==null?void 0:l.rpcUrls.default.http[0];if(!L)throw new Uue;const D=que(L,{fetchOptions:f,onRequest:i,onResponse:o,timeout:O});return Vue({key:r,name:a,async request({method:V,params:Y}){const i0={method:V,params:Y},{schedule:m0}=Mu0({id:L,wait:x,shouldSplitBatch(z0){return z0.length>p},fn:z0=>D.request({body:z0}),sort:(z0,oe)=>z0.id-oe.id}),A0=async z0=>n?m0(z0):[await D.request({body:z0})],[{error:T0,result:I0}]=await A0(i0);if(T0)throw new xu0({body:i0,error:T0,url:L});return I0},retryCount:C,retryDelay:s,timeout:O,type:"http"},{fetchOptions:f,url:L})}}class Wue extends on{constructor({callbackSelector:t,cause:n,data:f,extraData:r,sender:a,urls:i}){var o;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(o=n.metaMessages)!=null&&o.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(s=>` ${Wg(s)}`)],` Sender: ${a}`,` Data: ${f}`,` Callback selector: ${t}`,` Extra data: ${r}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class Que extends on{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Wg(n)}`,`Response: ${V6(t)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class Yue extends on{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function Kue(e,t){if(!F6(e,{strict:!1}))throw new Ad({address:e});if(!F6(t,{strict:!1}))throw new Ad({address:t});return e.toLowerCase()===t.toLowerCase()}const Jue="0x556f1830",j20={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function F20(e,{blockNumber:t,blockTag:n,data:f,to:r}){const{args:a}=HU({data:f,abi:[j20]}),[i,o,s,l,c]=a,{ccipRead:d}=e,p=d&&typeof(d==null?void 0:d.request)=="function"?d.request:z20;try{if(!Kue(r,i))throw new Yue({sender:i,to:r});const x=await p({data:s,sender:i,urls:o}),{data:C}=await Ou0(e,{blockNumber:t,blockTag:n,data:Oc([l,Xg([{type:"bytes"},{type:"bytes"}],[x,c])]),to:r});return C}catch(x){throw new Wue({callbackSelector:l,cause:x,data:f,extraData:c,sender:i,urls:o})}}async function z20({data:e,sender:t,urls:n}){var r;let f=new Error("An unknown error occurred.");for(let a=0;a{const c={...l};for(const d of s){const{name:p,type:x}=d;x==="address"&&(c[p]=c[p].toLowerCase())}return c},i=r.EIP712Domain?t?a(r.EIP712Domain,t):{}:{},o=(()=>{if(f!=="EIP712Domain")return a(r[f],n)})();return V6({domain:i,message:o,primaryType:f,types:r})}function ede(e){const{domain:t,message:n,primaryType:f,types:r}=e,a=(i,o)=>{for(const s of i){const{name:l,type:c}=s,d=o[l],p=c.match(_ue);if(p&&(typeof d=="number"||typeof d=="bigint")){const[O,L,D]=p;pa(d,{signed:L==="int",size:Number.parseInt(D)/8})}if(c==="address"&&typeof d=="string"&&!F6(d))throw new Ad({address:d});const x=c.match(Xue);if(x){const[O,L]=x;if(L&&mi(d)!==Number.parseInt(L))throw new nae({expectedSize:Number.parseInt(L),givenSize:mi(d)})}const C=r[c];C&&a(C,d)}};r.EIP712Domain&&t&&a(r.EIP712Domain,t),f!=="EIP712Domain"&&a(r[f],n)}function tde({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}const nde=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),U20=new Uint8Array(new Array(16).fill(0).map((e,t)=>t)),fde=U20.map(e=>(9*e+5)%16);let SG=[U20],OG=[fde];for(let e=0;e<4;e++)for(let t of[SG,OG])t.push(t[e].map(n=>nde[n]));const H20=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>new Uint8Array(e)),rde=SG.map((e,t)=>e.map(n=>H20[t][n])),ade=OG.map((e,t)=>e.map(n=>H20[t][n])),ide=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),ode=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function G20(e,t,n,f){return e===0?t^n^f:e===1?t&n|~t&f:e===2?(t|~n)^f:e===3?t&f|n&~f:t^(n|~f)}const iO=new Uint32Array(16);class sde extends EG{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:n,h2:f,h3:r,h4:a}=this;return[t,n,f,r,a]}set(t,n,f,r,a){this.h0=t|0,this.h1=n|0,this.h2=f|0,this.h3=r|0,this.h4=a|0}process(t,n){for(let x=0;x<16;x++,n+=4)iO[x]=t.getUint32(n,!0);let f=this.h0|0,r=f,a=this.h1|0,i=a,o=this.h2|0,s=o,l=this.h3|0,c=l,d=this.h4|0,p=d;for(let x=0;x<5;x++){const C=4-x,O=ide[x],L=ode[x],D=SG[x],V=OG[x],Y=rde[x],i0=ade[x];for(let m0=0;m0<16;m0++){const A0=gS(f+G20(x,a,o,l)+iO[D[m0]]+O,Y[m0])+d|0;f=d,d=l,l=gS(o,10)|0,o=a,a=A0}for(let m0=0;m0<16;m0++){const A0=gS(r+G20(C,i,s,c)+iO[V[m0]]+L,i0[m0])+p|0;r=p,p=c,c=gS(s,10)|0,s=i,i=A0}}this.set(this.h1+o+c|0,this.h2+l+p|0,this.h3+d+r|0,this.h4+f+i|0,this.h0+a+s|0)}roundClean(){iO.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const lde=wS(()=>new sde);class q20 extends vS{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,yae(t);const f=Mc(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,a=new Uint8Array(r);a.set(f.length>r?t.create().update(f).digest():f);for(let i=0;inew q20(e,t).update(n).digest();W20.create=(e,t)=>new q20(e,t);function cde(e,t){const{abi:n,args:f,bytecode:r,...a}=t,i=YU({abi:n,args:f,bytecode:r});return Ja(e,{...a,data:i})}async function ude(e){var t;return((t=e.account)==null?void 0:t.type)==="local"?[e.account.address]:(await e.request({method:"eth_accounts"},{dedupe:!0})).map(n=>AS(n))}async function dde(e){return await e.request({method:"wallet_getPermissions"},{dedupe:!0})}async function pde(e){return(await e.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(t=>t9(t))}async function bde(e,t){return e.request({method:"wallet_requestPermissions",params:[t]},{retryCount:0})}async function hde(e,{account:t=e.account,message:n}){if(!t)throw new nO({docsPath:"/docs/actions/wallet/signMessage"});const f=fs(t);if(f.type==="local")return f.signMessage({message:n});const r=typeof n=="string"?mS(n):n.raw instanceof Uint8Array?e8(n.raw):n.raw;return e.request({method:"personal_sign",params:[r,f.address]},{retryCount:0})}async function mde(e,t){var s,l,c,d,p;const{account:n=e.account,chain:f=e.chain,...r}=t;if(!n)throw new nO({docsPath:"/docs/actions/wallet/signTransaction"});const a=fs(n);gv({account:a,...t});const i=await C1(e,tO,"getChainId")({});f!==null&&P20({currentChainId:i,chain:f});const o=((c=(l=(f==null?void 0:f.formatters)||((s=e.chain)==null?void 0:s.formatters))==null?void 0:l.transactionRequest)==null?void 0:c.format)||SS;return a.type==="local"?a.signTransaction({...r,chainId:i},{serializer:(p=(d=e.chain)==null?void 0:d.serializers)==null?void 0:p.transaction}):await e.request({method:"eth_signTransaction",params:[{...o(r),chainId:pa(i),from:a.address}]},{retryCount:0})}async function yde(e,t){const{account:n=e.account,domain:f,message:r,primaryType:a}=t;if(!n)throw new nO({docsPath:"/docs/actions/wallet/signTypedData"});const i=fs(n),o={EIP712Domain:tde({domain:f}),...t.types};if(ede({domain:f,message:r,primaryType:a,types:o}),i.type==="local")return i.signTypedData({domain:f,message:r,primaryType:a,types:o});const s=$ue({domain:f,message:r,primaryType:a,types:o});return e.request({method:"eth_signTypedData_v4",params:[i.address,s]},{retryCount:0})}async function gde(e,{id:t}){await e.request({method:"wallet_switchEthereumChain",params:[{chainId:pa(t)}]},{retryCount:0})}async function vde(e,t){return await e.request({method:"wallet_watchAsset",params:t},{retryCount:0})}function wde(e){return{addChain:t=>Due(e,t),deployContract:t=>cde(e,t),getAddresses:()=>ude(e),getChainId:()=>tO(e),getPermissions:()=>dde(e),prepareTransactionRequest:t=>MG(e,t),requestAddresses:()=>pde(e),requestPermissions:t=>bde(e,t),sendRawTransaction:t=>I20(e,t),sendTransaction:t=>Ja(e,t),signMessage:t=>hde(e,t),signTransaction:t=>mde(e,t),signTypedData:t=>yde(e,t),switchChain:t=>gde(e,t),watchAsset:t=>vde(e,t),writeContract:t=>Bue(e,t)}}function Ade(e){const{key:t="wallet",name:n="Wallet Client",transport:f}=e;return B20({...e,key:t,name:n,transport:f,type:"walletClient"}).extend(wde)}const ai=({encode:e,decode:t})=>{const n=async function(f,...r){const{passthrough:a,...i}=e(f,...r),o=await Ou0(f,i).then(s=>s.data).catch(s=>{if(!(s instanceof on))throw s;return s});return a?t(f,o,a,...r):t(f,o,...r)};return n.batch=(...f)=>({args:f,encode:e,decode:t}),n.encode=e,n.decode=t,n},Rf=({blockNumber:e,client:t,contract:n})=>hu0({blockNumber:e,chain:t.chain,contract:n}),kG=[{inputs:[{name:"requireSuccess",type:"bool"},{components:[{name:"target",type:"address"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"tryAggregate",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"}],Q20=[{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],xde=(e,{transactions:t,requireSuccess:n=!1})=>({to:Rf({client:e,contract:"multicall3"}),data:Pn({abi:kG,functionName:"tryAggregate",args:[n,t.map(f=>({target:f.to,callData:f.data}))]})}),Ede=async(e,t,n)=>{if(typeof t=="object")throw yv(t,{abi:kG,functionName:"tryAggregate",args:[]});const f=Ya({abi:kG,functionName:"tryAggregate",data:t});return await Promise.all(f.map(async({success:r,returnData:a},i)=>{let o={success:r,returnData:a};if(!r&&a.startsWith("0x556f1830"))try{const s=await F20(e,{to:n[i].to,data:a});s&&(o={success:!0,returnData:s})}catch{}return o}))},rl=ai({encode:xde,decode:Ede}),Tde=(e,...t)=>{const n=t.map(({args:f,encode:r},a)=>{if(!r)throw new iue({functionIndex:a});return r(e,...f)});return{...rl.encode(e,{transactions:n}),passthrough:n}},Mde=async(e,t,n,...f)=>{const r=await rl.decode(e,t,n);if(!r)throw new Error("No response from multicall");return Promise.all(r.map((a,i)=>n[i].passthrough?f[i].decode(e,a.returnData,n[i].passthrough,...f[i].args):f[i].decode(e,a.returnData,...f[i].args)))},Cde=ai({encode:Tde,decode:Mde}),Y20=[{inputs:[{name:"node",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"}],NG=[{inputs:[{name:"node",type:"bytes32"},{name:"coinType",type:"uint256"}],name:"addr",outputs:[{name:"",type:"bytes"}],stateMutability:"view",type:"function"}],K20=[{inputs:[{name:"node",type:"bytes32"},{name:"key",type:"string"}],name:"text",outputs:[{name:"",type:"string"}],stateMutability:"view",type:"function"}],J20=[{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"}],Z20=[{inputs:[{name:"node",type:"bytes32"},{name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{name:"",type:"uint256"},{name:"",type:"bytes"}],stateMutability:"view",type:"function"}],Sde=[{inputs:[{name:"node",type:"bytes32"},{name:"key",type:"string"},{name:"value",type:"string"}],name:"setText",outputs:[],stateMutability:"nonpayable",type:"function"}],Ode=[{inputs:[{name:"node",type:"bytes32"},{name:"coinType",type:"uint256"},{name:"a",type:"bytes"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"}],kde=[{inputs:[{name:"node",type:"bytes32"},{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],name:"setABI",outputs:[],stateMutability:"nonpayable",type:"function"}],Nde=[{inputs:[{name:"node",type:"bytes32"},{name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],stateMutability:"nonpayable",type:"function"}],Pde=[{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"clearRecords",outputs:[],stateMutability:"nonpayable",type:"function"}],Ide=[{inputs:[{name:"data",type:"bytes[]"}],name:"multicall",outputs:[{name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"}],_r="0x0000000000000000000000000000000000000000";BigInt("18446744073709551615");const X20=864e13,_20=7776e3;class PG extends ia{constructor({fuses:t,minimum:n=0n,maximum:f=2n**32n,details:r}){super("Fuse value out of range",{metaMessages:[`- Fuse value: ${t}`,`- Allowed range: ${n}-${f}`],details:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FusesOutOfRangeError"})}}class Rde extends ia{constructor({fuses:t,details:n}){super("Restriction not allowed",{metaMessages:[`- Fuse value: ${t}`],details:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FusesRestrictionNotAllowed"})}}class $20 extends ia{constructor({fuses:t,details:n}){super("Invalid fuse value",{metaMessages:[`- Fuse value: ${t}`],details:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FusesInvalidFuseObjectError"})}}class Bde extends ia{constructor({fuse:t}){super(`${t} is not a valid named fuse`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FusesInvalidNamedFuseError"})}}class Dde extends ia{constructor({fuse:t}){super(`${t} is not a valid unnamed fuse`,{metaMessages:["- If you are trying to set a named fuse, use the named property"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FusesInvalidUnnamedFuseError"})}}class ep0 extends ia{constructor({label:t,details:n}){super("Invalid encoded label",{metaMessages:[`- Supplied label: ${t}`],details:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidEncodedLabelError"})}}class tp0 extends ia{constructor({labelhash:t,details:n}){super("Invalid labelhash",{metaMessages:[`- Supplied labelhash: ${t}`],details:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidLabelhashError"})}}class Lde extends ia{constructor({label:t,byteLength:n}){super("Supplied label was too long",{metaMessages:[`- Supplied label: ${t}`,"- Max byte length: 255",`- Actual byte length: ${n}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WrappedLabelTooLargeError"})}}class IG extends ia{constructor(){super("Invalid content hash"),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidContentHashError"})}}class jde extends ia{constructor({data:t}){super("Resolver address is required when data is supplied",{metaMessages:["Supplied data:",...Object.entries(t).map(([n,f])=>`- ${n}: ${f}`)]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResolverAddressRequiredError"})}}const Fde=typeof localStorage<"u";function RG(e){if(!(e.startsWith("[")&&e.endsWith("]")))throw new ep0({label:e,details:"Expected encoded labelhash to start and end with square brackets"});if(e.length!==66)throw new ep0({label:e,details:"Expected encoded labelhash to have a length of 66"});return`0x${e.slice(1,-1)}`}function np0(e){if(!e.startsWith("0x"))throw new tp0({labelhash:e,details:"Expected labelhash to start with 0x"});if(e.length!==66)throw new tp0({labelhash:e,details:"Expected labelhash to have a length of 66"});return`[${e.slice(2)}]`}function oO(e){return e.startsWith("[")&&e.endsWith("]")&&e.length===66}function zde(){return Fde?JSON.parse(localStorage.getItem("ensjs:labels"))||{}:{}}function Vde(e){const t=zde();return oO(e)&&t[RG(e)]||e}function BG(e){return!(e!=null&&e.includes("["))}function Ude(e){return e.split(".").map(t=>Vde(t)).join(".")}new Uint8Array(32).fill(0);const fp0=e=>e&&vo0(e);function Sr(e){let t=new Uint8Array(32).fill(0);if(!e)return yi(t);const n=e.split(".");for(let f=n.length-1;f>=0;f-=1){let r;if(oO(n[f]))r=T1(RG(n[f]));else{const a=fp0(n[f]);r=Cc(Ac(a),"bytes")}t=Cc(Oc([t,r]),"bytes")}return yi(t)}const Hde=(e,{name:t,supportedContentTypes:n=15n})=>({to:_r,data:Pn({abi:Z20,functionName:"ABI",args:[Sr(t),n]})}),Gde=async(e,t,{strict:n})=>{if(t==="0x")return null;try{const[f,r]=Ya({abi:Z20,functionName:"ABI",data:t});if(!f||!r)return null;const a=Number(f);if(!a)return null;let i,o=!1;switch(a){case 1:i=JSON.parse(wU(r)),o=!0;break;case 2:{const{inflate:s}=await WU(async()=>{const{inflate:l}=await import("./pako_inflate.min-CwX3nVh0.js").then(c=>c.p);return{inflate:l}},[]);i=JSON.parse(s(T1(r),{to:"string"})),o=!0;break}case 4:{const{cborDecode:s}=await WU(async()=>{const{cborDecode:l}=await Promise.resolve().then(()=>mIe);return{cborDecode:l}},void 0);i=await s(T1(r).buffer),o=!0;break}case 8:i=wU(r),o=!0;break;default:try{i=wU(r),o=!0}catch{i=r}}return{contentType:a,decoded:o,abi:i}}catch(f){if(n)throw f;return null}},sO=ai({encode:Hde,decode:Gde}),b8=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],DG={inputs:[{name:"reverseName",type:"bytes"}],name:"reverse",outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}],stateMutability:"view",type:"function"},LG=[...b8,DG],rp0=[...b8,{...DG,inputs:[...DG.inputs,{name:"gateways",type:"string[]"}]}],jG={inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],name:"resolve",outputs:[{name:"data",type:"bytes"},{name:"resolver",type:"address"}],stateMutability:"view",type:"function"},FG=[...b8,jG],ap0=[...b8,{...jG,inputs:[...jG.inputs,{name:"gateways",type:"string[]"}]}],zG={inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes[]"}],name:"resolve",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"",type:"tuple[]"},{name:"",type:"address"}],stateMutability:"view",type:"function"},VG=[...b8,zG],ip0=[...b8,{...zG,inputs:[...zG.inputs,{name:"gateways",type:"string[]"}]}],UG=[...b8,{inputs:[{name:"name",type:"bytes"}],name:"findResolver",outputs:[{name:"",type:"address"},{name:"",type:"bytes32"}],stateMutability:"view",type:"function"}],qde=e=>{if(!(e instanceof on))return;const t=e.walk(),n=typeof t.data=="object"?t.data.data:t.data;if(n!=="0x")return n},HG=(e,{strict:t,abi:n,args:f,functionName:r,address:a,docsPath:i,sender:o})=>{if(typeof e=="object"){if(!t){const s=qde(e);if(s)try{return HU({abi:n,data:s}),!1}catch{}}throw e instanceof vu0?e:yv(e,{abi:n,args:typeof f=="function"?f():f,functionName:r,address:a,docsPath:i,sender:o})}return!0};function Rv(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Ac(t).byteLength+2);let f=0;const r=t.split(".");for(let a=0;a255&&(i=Ac(np0(U6(r[a])))),n[f]=i.length,n.set(i,f+1),f+=i.length+1}return n.byteLength!==f+1?n.slice(0,f+1):n}function Wde(e){let t=0,n="";for(;t{const r=t.split(".").map(o=>Kg(o).byteLength>255?np0(U6(o)):o).join("."),a=Rf({client:e,contract:"ensUniversalResolver"}),i=[e8(Rv(r)),n];return{to:a,...f!=null&&f.length?{data:Pn({abi:ap0,functionName:"resolve",args:[...i,f]}),passthrough:{args:[...i,f],address:a}}:{data:Pn({abi:FG,functionName:"resolve",args:i}),passthrough:{args:i,address:a}}}},Yde=async(e,t,n,{strict:f,gatewayUrls:r})=>{if(!HG(t,{strict:f,abi:r?ap0:FG,args:n.args,functionName:"resolve",address:n.address}))return null;try{const a=Ya({abi:FG,functionName:"resolve",data:t});return{data:a[0],resolver:a[1]}}catch(a){if(f)throw a;return null}},Id=ai({encode:Qde,decode:Yde}),Kde=(e,{name:t,supportedContentTypes:n,gatewayUrls:f})=>{const r=sO.encode(e,{name:t,supportedContentTypes:n});return Id.encode(e,{name:t,data:r.data,gatewayUrls:f})},Jde=async(e,t,n,{strict:f,gatewayUrls:r})=>{const a=await Id.decode(e,t,n,{strict:f,gatewayUrls:r});return a?sO.decode(e,a.data,{strict:f}):null},Zde=ai({encode:Kde,decode:Jde}),op0=BigInt(0),lO=BigInt(1),Xde=BigInt(2);function h8(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Bv(e){if(!h8(e))throw new Error("Uint8Array expected")}const _de=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function w9(e){Bv(e);let t="";for(let n=0;n=Ic._0&&e<=Ic._9)return e-Ic._0;if(e>=Ic._A&&e<=Ic._F)return e-(Ic._A-10);if(e>=Ic._a&&e<=Ic._f)return e-(Ic._a-10)}function A9(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const f=new Uint8Array(n);for(let r=0,a=0;rop0;e>>=lO,t+=1);return t}function n2e(e,t){return e>>BigInt(t)&lO}function f2e(e,t,n){return e|(n?lO:op0)<(Xde<new Uint8Array(e),cp0=e=>Uint8Array.from(e);function up0(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let f=YG(e),r=YG(e),a=0;const i=()=>{f.fill(1),r.fill(0),a=0},o=(...c)=>n(r,f,...c),s=(c=YG())=>{r=o(cp0([0]),c),f=o(),c.length!==0&&(r=o(cp0([1]),c),f=o())},l=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let c=0;const d=[];for(;c{i(),s(c);let p;for(;!(p=d(l()));)s();return i(),p}}const r2e={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||h8(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Lv(e,t,n={}){const f=(r,a,i)=>{const o=r2e[a];if(typeof o!="function")throw new Error(`Invalid validator "${a}", expected function`);const s=e[r];if(!(i&&s===void 0)&&!o(s,e))throw new Error(`Invalid param ${String(r)}=${s} (${typeof s}), expected ${a}`)};for(const[r,a]of Object.entries(t))f(r,a,!1);for(const[r,a]of Object.entries(n))f(r,a,!0);return e}const a2e=Object.freeze(Object.defineProperty({__proto__:null,abytes:Bv,bitGet:n2e,bitLen:t2e,bitMask:QG,bitSet:f2e,bytesToHex:w9,bytesToNumberBE:m8,bytesToNumberLE:qG,concatBytes:Dv,createHmacDrbg:up0,ensureBytes:Q6,equalBytes:N1,hexToBytes:A9,hexToNumber:GG,isBytes:h8,numberToBytesBE:x9,numberToBytesLE:WG,numberToHexUnpadded:sp0,numberToVarBytesBE:$de,utf8ToBytes:e2e,validateObject:Lv},Symbol.toStringTag,{value:"Module"})),Ii=BigInt(0),Za=BigInt(1),y8=BigInt(2),i2e=BigInt(3),KG=BigInt(4),dp0=BigInt(5),pp0=BigInt(8);BigInt(9),BigInt(16);function P1(e,t){const n=e%t;return n>=Ii?n:t+n}function o2e(e,t,n){if(n<=Ii||t 0");if(n===Za)return Ii;let f=Za;for(;t>Ii;)t&Za&&(f=f*e%n),e=e*e%n,t>>=Za;return f}function qs(e,t,n){let f=e;for(;t-- >Ii;)f*=f,f%=n;return f}function JG(e,t){if(e===Ii||t<=Ii)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=P1(e,t),f=t,r=Ii,a=Za;for(;n!==Ii;){const i=f/n,o=f%n,s=r-a*i;f=n,n=o,r=a,a=s}if(f!==Za)throw new Error("invert: does not exist");return P1(r,t)}function s2e(e){const t=(e-Za)/y8;let n,f,r;for(n=e-Za,f=0;n%y8===Ii;n/=y8,f++);for(r=y8;r(f[r]="function",f),t);return Lv(e,n)}function d2e(e,t,n){if(n 0");if(n===Ii)return e.ONE;if(n===Za)return t;let f=e.ONE,r=t;for(;n>Ii;)n&Za&&(f=e.mul(f,r)),r=e.sqr(r),n>>=Za;return f}function p2e(e,t){const n=new Array(t.length),f=t.reduce((a,i,o)=>e.is0(i)?a:(n[o]=a,e.mul(a,i)),e.ONE),r=e.inv(f);return t.reduceRight((a,i,o)=>e.is0(i)?a:(n[o]=e.mul(a,n[o]),e.mul(a,i)),r),n}function bp0(e,t){const n=t!==void 0?t:e.toString(2).length,f=Math.ceil(n/8);return{nBitLength:n,nByteLength:f}}function b2e(e,t,n=!1,f={}){if(e<=Ii)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:r,nByteLength:a}=bp0(e,t);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const i=l2e(e),o=Object.freeze({ORDER:e,BITS:r,BYTES:a,MASK:QG(r),ZERO:Ii,ONE:Za,create:s=>P1(s,e),isValid:s=>{if(typeof s!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof s}`);return Ii<=s&&ss===Ii,isOdd:s=>(s&Za)===Za,neg:s=>P1(-s,e),eql:(s,l)=>s===l,sqr:s=>P1(s*s,e),add:(s,l)=>P1(s+l,e),sub:(s,l)=>P1(s-l,e),mul:(s,l)=>P1(s*l,e),pow:(s,l)=>d2e(o,s,l),div:(s,l)=>P1(s*JG(l,e),e),sqrN:s=>s*s,addN:(s,l)=>s+l,subN:(s,l)=>s-l,mulN:(s,l)=>s*l,inv:s=>JG(s,e),sqrt:f.sqrt||(s=>i(o,s)),invertBatch:s=>p2e(o,s),cmov:(s,l,c)=>c?l:s,toBytes:s=>n?WG(s,a):x9(s,a),fromBytes:s=>{if(s.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${s.length}`);return n?qG(s):m8(s)}});return Object.freeze(o)}function hp0(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function mp0(e){const t=hp0(e);return t+Math.ceil(t/2)}function h2e(e,t,n=!1){const f=e.length,r=hp0(t),a=mp0(t);if(f<16||f1024)throw new Error(`expected ${a}-1024 bytes of input, got ${f}`);const i=n?m8(e):qG(e),o=P1(i,t-Za)+Za;return n?WG(o,r):x9(o,r)}const m2e=BigInt(0),ZG=BigInt(1);function y2e(e,t){const n=(r,a)=>{const i=a.negate();return r?i:a},f=r=>{const a=Math.ceil(t/r)+1,i=2**(r-1);return{windows:a,windowSize:i}};return{constTimeNegate:n,unsafeLadder(r,a){let i=e.ZERO,o=r;for(;a>m2e;)a&ZG&&(i=i.add(o)),o=o.double(),a>>=ZG;return i},precomputeWindow(r,a){const{windows:i,windowSize:o}=f(a),s=[];let l=r,c=l;for(let d=0;d>=x,L>s&&(L-=p,i+=ZG);const D=O,V=O+Math.abs(L)-1,Y=C%2!==0,i0=L<0;L===0?c=c.add(n(Y,a[D])):l=l.add(n(i0,a[V]))}return{p:l,f:c}},wNAFCached(r,a,i,o){const s=r._WINDOW_SIZE||1;let l=a.get(r);return l||(l=this.precomputeWindow(r,s),s!==1&&a.set(r,o(l))),this.wNAF(s,l,i)}}}function yp0(e){return u2e(e.Fp),Lv(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...bp0(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function g2e(e){const t=yp0(e);Lv(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:f,a:r}=t;if(n){if(!f.eql(r,f.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:v2e,hexToBytes:w2e}=a2e,g8={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=g8;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const n=e[1],f=e.subarray(2,n+2);if(!n||f.length!==n)throw new t("Invalid signature integer: wrong length");if(f[0]&128)throw new t("Invalid signature integer: negative");if(f[0]===0&&!(f[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:v2e(f),l:e.subarray(n+2)}},toSig(e){const{Err:t}=g8,n=typeof e=="string"?w2e(e):e;Bv(n);let f=n.length;if(f<2||n[0]!=48)throw new t("Invalid signature tag");if(n[1]!==f-2)throw new t("Invalid signature: incorrect length");const{d:r,l:a}=g8._parseInt(n.subarray(2)),{d:i,l:o}=g8._parseInt(a);if(o.length)throw new t("Invalid signature: left bytes after parsing");return{r,s:i}},hexFromSig(e){const t=l=>Number.parseInt(l[0],16)&8?"00"+l:l,n=l=>{const c=l.toString(16);return c.length&1?`0${c}`:c},f=t(n(e.s)),r=t(n(e.r)),a=f.length/2,i=r.length/2,o=n(a),s=n(i);return`30${n(i+a+4)}02${s}${r}02${o}${f}`}},Rc=BigInt(0),Ws=BigInt(1);BigInt(2);const gp0=BigInt(3);BigInt(4);function A2e(e){const t=g2e(e),{Fp:n}=t,f=t.toBytes||((C,O,L)=>{const D=O.toAffine();return Dv(Uint8Array.from([4]),n.toBytes(D.x),n.toBytes(D.y))}),r=t.fromBytes||(C=>{const O=C.subarray(1),L=n.fromBytes(O.subarray(0,n.BYTES)),D=n.fromBytes(O.subarray(n.BYTES,2*n.BYTES));return{x:L,y:D}});function a(C){const{a:O,b:L}=t,D=n.sqr(C),V=n.mul(D,C);return n.add(n.add(V,n.mul(C,O)),L)}if(!n.eql(n.sqr(t.Gy),a(t.Gx)))throw new Error("bad generator point: equation left != right");function i(C){return typeof C=="bigint"&&Rcn.eql(Y,n.ZERO);return V(L)&&V(D)?d.ZERO:new d(L,D,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(O){const L=n.invertBatch(O.map(D=>D.pz));return O.map((D,V)=>D.toAffine(L[V])).map(d.fromAffine)}static fromHex(O){const L=d.fromAffine(r(Q6("pointHex",O)));return L.assertValidity(),L}static fromPrivateKey(O){return d.BASE.multiply(s(O))}_setWindowSize(O){this._WINDOW_SIZE=O,l.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:O,y:L}=this.toAffine();if(!n.isValid(O)||!n.isValid(L))throw new Error("bad point: x or y not FE");const D=n.sqr(L),V=a(O);if(!n.eql(D,V))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:O}=this.toAffine();if(n.isOdd)return!n.isOdd(O);throw new Error("Field doesn't support isOdd")}equals(O){c(O);const{px:L,py:D,pz:V}=this,{px:Y,py:i0,pz:m0}=O,A0=n.eql(n.mul(L,m0),n.mul(Y,V)),T0=n.eql(n.mul(D,m0),n.mul(i0,V));return A0&&T0}negate(){return new d(this.px,n.neg(this.py),this.pz)}double(){const{a:O,b:L}=t,D=n.mul(L,gp0),{px:V,py:Y,pz:i0}=this;let m0=n.ZERO,A0=n.ZERO,T0=n.ZERO,I0=n.mul(V,V),z0=n.mul(Y,Y),oe=n.mul(i0,i0),ae=n.mul(V,Y);return ae=n.add(ae,ae),T0=n.mul(V,i0),T0=n.add(T0,T0),m0=n.mul(O,T0),A0=n.mul(D,oe),A0=n.add(m0,A0),m0=n.sub(z0,A0),A0=n.add(z0,A0),A0=n.mul(m0,A0),m0=n.mul(ae,m0),T0=n.mul(D,T0),oe=n.mul(O,oe),ae=n.sub(I0,oe),ae=n.mul(O,ae),ae=n.add(ae,T0),T0=n.add(I0,I0),I0=n.add(T0,I0),I0=n.add(I0,oe),I0=n.mul(I0,ae),A0=n.add(A0,I0),oe=n.mul(Y,i0),oe=n.add(oe,oe),I0=n.mul(oe,ae),m0=n.sub(m0,I0),T0=n.mul(oe,z0),T0=n.add(T0,T0),T0=n.add(T0,T0),new d(m0,A0,T0)}add(O){c(O);const{px:L,py:D,pz:V}=this,{px:Y,py:i0,pz:m0}=O;let A0=n.ZERO,T0=n.ZERO,I0=n.ZERO;const z0=t.a,oe=n.mul(t.b,gp0);let ae=n.mul(L,Y),ye=n.mul(D,i0),P=n.mul(V,m0),F=n.add(L,D),Q=n.add(Y,i0);F=n.mul(F,Q),Q=n.add(ae,ye),F=n.sub(F,Q),Q=n.add(L,V);let H=n.add(Y,m0);return Q=n.mul(Q,H),H=n.add(ae,P),Q=n.sub(Q,H),H=n.add(D,V),A0=n.add(i0,m0),H=n.mul(H,A0),A0=n.add(ye,P),H=n.sub(H,A0),I0=n.mul(z0,Q),A0=n.mul(oe,P),I0=n.add(A0,I0),A0=n.sub(ye,I0),I0=n.add(ye,I0),T0=n.mul(A0,I0),ye=n.add(ae,ae),ye=n.add(ye,ae),P=n.mul(z0,P),Q=n.mul(oe,Q),ye=n.add(ye,P),P=n.sub(ae,P),P=n.mul(z0,P),Q=n.add(Q,P),ae=n.mul(ye,Q),T0=n.add(T0,ae),ae=n.mul(H,Q),A0=n.mul(F,A0),A0=n.sub(A0,ae),ae=n.mul(F,ye),I0=n.mul(H,I0),I0=n.add(I0,ae),new d(A0,T0,I0)}subtract(O){return this.add(O.negate())}is0(){return this.equals(d.ZERO)}wNAF(O){return x.wNAFCached(this,l,O,L=>{const D=n.invertBatch(L.map(V=>V.pz));return L.map((V,Y)=>V.toAffine(D[Y])).map(d.fromAffine)})}multiplyUnsafe(O){const L=d.ZERO;if(O===Rc)return L;if(o(O),O===Ws)return this;const{endo:D}=t;if(!D)return x.unsafeLadder(this,O);let{k1neg:V,k1:Y,k2neg:i0,k2:m0}=D.splitScalar(O),A0=L,T0=L,I0=this;for(;Y>Rc||m0>Rc;)Y&Ws&&(A0=A0.add(I0)),m0&Ws&&(T0=T0.add(I0)),I0=I0.double(),Y>>=Ws,m0>>=Ws;return V&&(A0=A0.negate()),i0&&(T0=T0.negate()),T0=new d(n.mul(T0.px,D.beta),T0.py,T0.pz),A0.add(T0)}multiply(O){o(O);let L=O,D,V;const{endo:Y}=t;if(Y){const{k1neg:i0,k1:m0,k2neg:A0,k2:T0}=Y.splitScalar(L);let{p:I0,f:z0}=this.wNAF(m0),{p:oe,f:ae}=this.wNAF(T0);I0=x.constTimeNegate(i0,I0),oe=x.constTimeNegate(A0,oe),oe=new d(n.mul(oe.px,Y.beta),oe.py,oe.pz),D=I0.add(oe),V=z0.add(ae)}else{const{p:i0,f:m0}=this.wNAF(L);D=i0,V=m0}return d.normalizeZ([D,V])[0]}multiplyAndAddUnsafe(O,L,D){const V=d.BASE,Y=(m0,A0)=>A0===Rc||A0===Ws||!m0.equals(V)?m0.multiplyUnsafe(A0):m0.multiply(A0),i0=Y(this,L).add(Y(O,D));return i0.is0()?void 0:i0}toAffine(O){const{px:L,py:D,pz:V}=this,Y=this.is0();O==null&&(O=Y?n.ONE:n.inv(V));const i0=n.mul(L,O),m0=n.mul(D,O),A0=n.mul(V,O);if(Y)return{x:n.ZERO,y:n.ZERO};if(!n.eql(A0,n.ONE))throw new Error("invZ was invalid");return{x:i0,y:m0}}isTorsionFree(){const{h:O,isTorsionFree:L}=t;if(O===Ws)return!0;if(L)return L(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:O,clearCofactor:L}=t;return O===Ws?this:L?L(d,this):this.multiplyUnsafe(t.h)}toRawBytes(O=!0){return this.assertValidity(),f(d,this,O)}toHex(O=!0){return w9(this.toRawBytes(O))}}d.BASE=new d(t.Gx,t.Gy,n.ONE),d.ZERO=new d(n.ZERO,n.ONE,n.ZERO);const p=t.nBitLength,x=y2e(d,t.endo?Math.ceil(p/2):p);return{CURVE:t,ProjectivePoint:d,normPrivateKeyToScalar:s,weierstrassEquation:a,isWithinCurveOrder:i}}function x2e(e){const t=yp0(e);return Lv(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function E2e(e){const t=x2e(e),{Fp:n,n:f}=t,r=n.BYTES+1,a=2*n.BYTES+1;function i(Q){return Rcw9(x9(Q,t.nByteLength));function C(Q){const H=f>>Ws;return Q>H}function O(Q){return C(Q)?o(-Q):Q}const L=(Q,H,u0)=>m8(Q.slice(H,u0));class D{constructor(H,u0,h0){this.r=H,this.s=u0,this.recovery=h0,this.assertValidity()}static fromCompact(H){const u0=t.nByteLength;return H=Q6("compactSignature",H,u0*2),new D(L(H,0,u0),L(H,u0,2*u0))}static fromDER(H){const{r:u0,s:h0}=g8.toSig(Q6("DER",H));return new D(u0,h0)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(H){return new D(this.r,this.s,H)}recoverPublicKey(H){const{r:u0,s:h0,recovery:g0}=this,o0=T0(Q6("msgHash",H));if(g0==null||![0,1,2,3].includes(g0))throw new Error("recovery id invalid");const N=g0===2||g0===3?u0+t.n:u0;if(N>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const t0=g0&1?"03":"02",S0=l.fromHex(t0+x(N)),s0=s(N),W=o(-o0*s0),D0=o(h0*s0),Y0=l.BASE.multiplyAndAddUnsafe(S0,W,D0);if(!Y0)throw new Error("point at infinify");return Y0.assertValidity(),Y0}hasHighS(){return C(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return A9(this.toDERHex())}toDERHex(){return g8.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return A9(this.toCompactHex())}toCompactHex(){return x(this.r)+x(this.s)}}const V={isValidPrivateKey(Q){try{return c(Q),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const Q=mp0(t.n);return h2e(t.randomBytes(Q),t.n)},precompute(Q=8,H=l.BASE){return H._setWindowSize(Q),H.multiply(BigInt(3)),H}};function Y(Q,H=!0){return l.fromPrivateKey(Q).toRawBytes(H)}function i0(Q){const H=h8(Q),u0=typeof Q=="string",h0=(H||u0)&&Q.length;return H?h0===r||h0===a:u0?h0===2*r||h0===2*a:Q instanceof l}function m0(Q,H,u0=!0){if(i0(Q))throw new Error("first arg must be private key");if(!i0(H))throw new Error("second arg must be public key");return l.fromHex(H).multiply(c(Q)).toRawBytes(u0)}const A0=t.bits2int||function(Q){const H=m8(Q),u0=Q.length*8-t.nBitLength;return u0>0?H>>BigInt(u0):H},T0=t.bits2int_modN||function(Q){return o(A0(Q))},I0=QG(t.nBitLength);function z0(Q){if(typeof Q!="bigint")throw new Error("bigint expected");if(!(Rc<=Q&&Qle in u0))throw new Error("sign() legacy options not supported");const{hash:h0,randomBytes:g0}=t;let{lowS:o0,prehash:N,extraEntropy:t0}=u0;o0==null&&(o0=!0),Q=Q6("msgHash",Q),N&&(Q=Q6("prehashed msgHash",h0(Q)));const S0=T0(Q),s0=c(H),W=[z0(s0),z0(S0)];if(t0!=null&&t0!==!1){const le=t0===!0?g0(n.BYTES):t0;W.push(Q6("extraEntropy",le))}const D0=Dv(...W),Y0=S0;function Z0(le){const ue=A0(le);if(!p(ue))return;const xe=s(ue),je=l.BASE.multiply(ue).toAffine(),Ge=o(je.x);if(Ge===Rc)return;const et=o(xe*o(Y0+Ge*s0));if(et===Rc)return;let St=(je.x===Ge?0:2)|Number(je.y&Ws),wt=et;return o0&&C(et)&&(wt=O(et),St^=1),new D(Ge,wt,St)}return{seed:D0,k2sig:Z0}}const ae={lowS:t.lowS,prehash:!1},ye={lowS:t.lowS,prehash:!1};function P(Q,H,u0=ae){const{seed:h0,k2sig:g0}=oe(Q,H,u0),o0=t;return up0(o0.hash.outputLen,o0.nByteLength,o0.hmac)(h0,g0)}l.BASE._setWindowSize(8);function F(Q,H,u0,h0=ye){var xe;const g0=Q;if(H=Q6("msgHash",H),u0=Q6("publicKey",u0),"strict"in h0)throw new Error("options.strict was renamed to lowS");const{lowS:o0,prehash:N}=h0;let t0,S0;try{if(typeof g0=="string"||h8(g0))try{t0=D.fromDER(g0)}catch(je){if(!(je instanceof g8.Err))throw je;t0=D.fromCompact(g0)}else if(typeof g0=="object"&&typeof g0.r=="bigint"&&typeof g0.s=="bigint"){const{r:je,s:Ge}=g0;t0=new D(je,Ge)}else throw new Error("PARSE");S0=l.fromHex(u0)}catch(je){if(je.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(o0&&t0.hasHighS())return!1;N&&(H=t.hash(H));const{r:s0,s:W}=t0,D0=T0(H),Y0=s(W),Z0=o(D0*Y0),le=o(s0*Y0),ue=(xe=l.BASE.multiplyAndAddUnsafe(S0,Z0,le))==null?void 0:xe.toAffine();return ue?o(ue.x)===s0:!1}return{CURVE:t,getPublicKey:Y,getSharedSecret:m0,sign:P,verify:F,ProjectivePoint:l,Signature:D,utils:V}}function T2e(e){return{hash:e,hmac:(t,...n)=>W20(e,t,kf(...n)),randomBytes:zae}}function M2e(e,t){const n=f=>E2e({...e,...T2e(f)});return Object.freeze({...n(t),create:n})}const vp0=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),wp0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),C2e=BigInt(1),XG=BigInt(2),Ap0=(e,t)=>(e+t/XG)/t;function S2e(e){const t=vp0,n=BigInt(3),f=BigInt(6),r=BigInt(11),a=BigInt(22),i=BigInt(23),o=BigInt(44),s=BigInt(88),l=e*e*e%t,c=l*l*e%t,d=qs(c,n,t)*c%t,p=qs(d,n,t)*c%t,x=qs(p,XG,t)*l%t,C=qs(x,r,t)*x%t,O=qs(C,a,t)*C%t,L=qs(O,o,t)*O%t,D=qs(L,s,t)*L%t,V=qs(D,o,t)*O%t,Y=qs(V,n,t)*c%t,i0=qs(Y,i,t)*C%t,m0=qs(i0,f,t)*l%t,A0=qs(m0,XG,t);if(!_G.eql(_G.sqr(A0),e))throw new Error("Cannot find square root");return A0}const _G=b2e(vp0,void 0,void 0,{sqrt:S2e}),xp0=M2e({a:BigInt(0),b:BigInt(7),Fp:_G,n:wp0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=wp0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),f=-C2e*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),r=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,i=BigInt("0x100000000000000000000000000000000"),o=Ap0(a*e,t),s=Ap0(-f*e,t);let l=P1(e-o*n-s*r,t),c=P1(-o*f-s*a,t);const d=l>i,p=c>i;if(d&&(l=t-l),p&&(c=t-c),l>i||c>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:p,k2:c}}}},p8);BigInt(0),xp0.ProjectivePoint;function cO(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function E9(...e){const t=a=>a,n=(a,i)=>o=>a(i(o)),f=e.map(a=>a.encode).reduceRight(n,t),r=e.map(a=>a.decode).reduce(n,t);return{encode:f,decode:r}}function jv(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(n=>{if(n<0||n>=e.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${e.length})`);return e[n]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const f=e.indexOf(n);if(f===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);return f})}}}function Fv(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let n of t)if(typeof n!="string")throw new Error(`join.encode: non-string input=${n}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function Ep0(e,t="="){if(typeof t!="string")throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let f of n)if(typeof f!="string")throw new Error(`padding.encode: non-string input=${f}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let r of n)if(typeof r!="string")throw new Error(`padding.decode: non-string input=${r}`);let f=n.length;if(f*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;f>0&&n[f-1]===t;f--)if(!((f-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,f)}}}function $G(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let f=0;const r=[],a=Array.from(e);for(a.forEach(i=>{if(i<0||i>=t)throw new Error(`Wrong integer: ${i}`)});;){let i=0,o=!0;for(let s=f;st?Tp0(t,e%t):e,uO=(e,t)=>e+(t-Tp0(e,t));function dO(e,t,n,f){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(uO(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${uO(t,n)}`);let r=0,a=0;const i=2**n-1,o=[];for(const s of e){if(s>=2**t)throw new Error(`convertRadix2: invalid data word=${s} from=${t}`);if(r=r<32)throw new Error(`convertRadix2: carry overflow pos=${a} from=${t}`);for(a+=t;a>=n;a-=n)o.push((r>>a-n&i)>>>0);r&=2**a-1}if(r=r<=t)throw new Error("Excess padding");if(!f&&r)throw new Error(`Non-zero padding: ${r}`);return f&&a>0&&o.push(r>>>0),o}function Mp0(e){return{encode:t=>{if(!cO(t))throw new Error("radix.encode input should be Uint8Array");return $G(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from($G(t,e,256))}}}function pO(e,t=!1){if(e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(uO(8,e)>32||uO(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!cO(n))throw new Error("radix2.encode input should be Uint8Array");return dO(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&typeof n[0]!="number")throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(dO(n,e,8,t))}}}function Cp0(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}function Sp0(e,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(n){if(!cO(n))throw new Error("checksum.encode: input should be Uint8Array");const f=t(n).slice(0,e),r=new Uint8Array(n.length+e);return r.set(n),r.set(f,n.length),r},decode(n){if(!cO(n))throw new Error("checksum.decode: input should be Uint8Array");const f=n.slice(0,-e),r=t(f).slice(0,e),a=n.slice(-e);for(let i=0;iE9(Mp0(58),jv(e),Fv("")),T9=kp0("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),O2e=kp0("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),Np0=[0,2,3,5,6,7,9,10,11],Pp0={encode(e){let t="";for(let n=0;nE9(Sp0(4,t=>e(e(t))),T9),eq=E9(jv("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Fv("")),Ip0=[996825010,642813549,513874426,1027748829,705979059];function zv(e){const t=e>>25;let n=(e&33554431)<<5;for(let f=0;f>f&1)===1&&(n^=Ip0[f]);return n}function Rp0(e,t,n=1){const f=e.length;let r=1;for(let a=0;a126)throw new Error(`Invalid prefix (${e})`);r=zv(r)^i>>5}r=zv(r);for(let a=0;ap)throw new TypeError(`Length ${x} exceeds limit ${p}`);const C=c.toLowerCase(),O=Rp0(C,d,t);return`${C}1${eq.encode(d)}${O}`}function o(c,d=90){if(typeof c!="string")throw new Error(`bech32.decode input should be string, not ${typeof c}`);if(c.length<8||d!==!1&&c.length>d)throw new TypeError(`Wrong string length: ${c.length} (${c}). Expected (8..${d})`);const p=c.toLowerCase();if(c!==p&&c!==c.toUpperCase())throw new Error("String must be lowercase or uppercase");const x=p.lastIndexOf("1");if(x===0||x===-1)throw new Error('Letter "1" must be present between prefix and data only');const C=p.slice(0,x),O=p.slice(x+1);if(O.length<6)throw new Error("Data must be at least 6 characters long");const L=eq.decode(O).slice(0,-6),D=Rp0(C,L,t);if(!O.endsWith(D))throw new Error(`Invalid checksum in ${c}: expected "${D}"`);return{prefix:C,words:L}}const s=Cp0(o);function l(c){const{prefix:d,words:p}=o(c,!1);return{prefix:d,words:p,bytes:f(p)}}return{encode:i,decode:o,decodeToBytes:l,decodeUnsafe:s,fromWords:f,fromWordsUnsafe:a,toWords:r}}const al=Bp0("bech32"),Vv=Bp0("bech32m"),Dp0=T9,no=Dp0.encode,Eo=Dp0.decode,Lp0=k2e(p8),To=Lp0.encode,I1=Lp0.decode,vi=(e,t)=>n=>{if(n[0]===118){if(n[1]!==169||n[n.length-2]!==136||n[n.length-1]!==172)throw new Error("Unrecognised address format");return To(kf(e,n.slice(3,3+n[2])))}if(n[0]===169){if(n[n.length-1]!==135)throw new Error("Unrecognised address format");return To(kf(t,n.slice(2,2+n[1])))}throw new Error("Unrecognised address format")},ii=(e,t)=>n=>{const f=I1(n),r=a=>a.every((i,o)=>ot=>{const n=xp0.ProjectivePoint.fromHex(t),f=jp0.encode(n.toRawBytes(!0)),r=no(f);return`${e}${r}`},Bd=e=>t=>{if(!t.startsWith(e))throw new Error("Unrecognised address format");const n=t.slice(e.length),f=Eo(n);return jp0.decode(f)},N2e="abbc",P2e=367,Fp0="ABBC",I2e=Rd(Fp0),R2e=Bd(Fp0),B2e={name:N2e,coinType:P2e,encode:I2e,decode:R2e},zp0=({bechLib:e,hrp:t,limit:n})=>f=>e.encode(t,e.toWords(f),n),Vp0=({bechLib:e,hrp:t,limit:n})=>f=>{const{prefix:r,words:a}=e.decode(f,n);if(r!==t)throw new Error("Unexpected human-readable part in bech32 encoded address");return new Uint8Array(e.fromWords(a))},Ri=(e,t)=>zp0({hrp:e,bechLib:al,limit:t}),Bi=(e,t)=>Vp0({hrp:e,bechLib:al,limit:t}),Up0=(e,t)=>zp0({hrp:e,bechLib:Vv,limit:t}),Hp0=(e,t)=>Vp0({hrp:e,bechLib:Vv,limit:t}),tq=e=>t=>{let n=t[0];if(n>=81&&n<=96)n-=80;else if(n!==0)throw new Error("Unrecognised address format");let f=[];return n>0&&n<17?(f=[n].concat(Vv.toWords(t.slice(2,t[1]+2))),Vv.encode(e,f)):(f=[n].concat(al.toWords(t.slice(2,t[1]+2))),al.encode(e,f))},nq=e=>t=>{const n=al.decodeUnsafe(t)||Vv.decodeUnsafe(t);if(!n)throw new Error("Unrecognised address format");const{prefix:f,words:r}=n;if(f!==e)throw new Error("Unexpected human-readable part in bech32 encoded address");const a=al.fromWords(r.slice(1));let i=r[0];return i>0&&(i+=80),kf(new Uint8Array([i,a.length]),new Uint8Array(a))},D2e=5960464477539064e-23,fq=4294967296,Gp0=9007199254740992,qp0=8192;function L2e(e,t){return typeof Object.is=="function"?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}class hO{constructor(t,n){Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tag",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.value=t,this.tag=n}}class Wp0{constructor(t){Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.value=t}}function Qp0(e){const t=new DataView(e),n=new Uint8Array(e);let f=0,r=(m0,A0)=>new hO(m0,A0),a=m0=>new Wp0(m0);function i(m0,A0){return f+=m0,A0}function o(m0){return i(m0,new Uint8Array(e,f,m0))}function s(){const m0=new ArrayBuffer(4),A0=new DataView(m0),T0=p(),I0=T0&32768;let z0=T0&31744;const oe=T0&1023;if(z0===31744)z0=261120;else if(z0!==0)z0+=114688;else if(oe!==0)return(I0?-1:1)*oe*D2e;return A0.setUint32(0,I0<<16|z0<<13|oe<<13),A0.getFloat32(0)}function l(){return i(4,t.getFloat32(f))}function c(){return i(8,t.getFloat64(f))}function d(){return i(1,n[f])}function p(){return i(2,t.getUint16(f))}function x(){return i(4,t.getUint32(f))}function C(){return x()*fq+x()}function O(){return n[f]!==255?!1:(f+=1,!0)}function L(m0){if(m0<24)return m0;if(m0===24)return d();if(m0===25)return p();if(m0===26)return x();if(m0===27)return C();if(m0===31)return-1;throw new Error("Invalid length encoding")}function D(m0){const A0=d();if(A0===255)return-1;const T0=L(A0&31);if(T0<0||A0>>5!==m0)throw new Error("Invalid indefinite length element");return T0}function V(m0,A0){for(let T0=0;T0>10),m0.push(56320|I0&1023))}}function Y(){const m0=d(),A0=m0>>5,T0=m0&31;let I0,z0;if(A0===7)switch(T0){case 25:return s();case 26:return l();case 27:return c()}if(z0=L(T0),z0<0&&(A0<2||6=0;)Q+=z0,F.push(o(z0));const H=new Uint8Array(Q);let u0=0;for(I0=0;I0=0;)V(oe,z0);else V(oe,z0);let ae="";for(I0=0;I0>2;for(let I0=0;I0>6),m0.push(128|I0&63)):(I0=(I0&1023)<<10,I0|=Y.charCodeAt(++i0)&1023,I0+=65536,m0.push(240|I0>>18),m0.push(128|I0>>12&63),m0.push(128|I0>>6&63),m0.push(128|I0&63))}return O(3,m0.length),c(m0);default:let A0,T0;if(Array.isArray(Y))for(A0=Y.length,O(4,A0),i0=0;i0{if(e>=0)return e;const t=new Uint32Array(1);return t[0]=e,t[0]},aq=e=>{let t=4294967295;for(const n of e){const f=(t^n)&255,r=rq==null?void 0:rq[f];if(r===void 0)throw new Error("tableIndex out of range 0-255");t=t>>>8^r}return j2e(t^4294967295)},Kp0=e=>{const t=aq(e),n=new hO(e.buffer,24),f=Yp0([n,t]),r=no(new Uint8Array(f));if(!r.startsWith("Ae2")&&!r.startsWith("Ddz"))throw new Error("Unrecognised address format");return r},Jp0=e=>{const t=Eo(e),n=Qp0(t.buffer),f=n[0];if(f===void 0)throw new Error("Unrecognised address format");const r=n[1],a=aq(f.value);if(r!==a)throw new Error("Unrecognised address format");return f.value},F2e="ada",z2e=1815,iq="addr",Zp0=104,V2e=Ri(iq,Zp0),U2e=Bi(iq,Zp0),H2e=e=>{try{return Kp0(e)}catch{return V2e(e)}},G2e=e=>e.toLowerCase().startsWith(iq)?U2e(e):Jp0(e),q2e={name:F2e,coinType:z2e,encode:H2e,decode:G2e},W2e="ae",Q2e=457,Y2e=e=>`ak_${To(e.slice(2))}`,K2e=e=>kf(new Uint8Array([48,120]),I1(e.slice(3))),J2e={name:W2e,coinType:Q2e,encode:Y2e,decode:K2e},Z2e="aib",X2e=55,Xp0=[new Uint8Array([23])],_p0=[new Uint8Array([5])],_2e=vi(Xp0[0],_p0[0]),$2e=ii(Xp0,_p0),epe={name:Z2e,coinType:X2e,encode:_2e,decode:$2e};function mO(e){let t=e.slice(2);t.length%2&&(t=`0${t}`);const n=new Uint8Array(t.length/2);for(let f=0;f0;)n.unshift(Number(t&BigInt(255))),t>>=BigInt(8);return new Uint8Array(n)}const v8=jc0,M9=Lae,rpe="aion",ape=425,ipe=/^[0-9A-Fa-f]{64}$/g,ope=e=>{if(e.length!==32)throw new Error("Unrecognised address format");return yO(e)},spe=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length!==64)throw new Error("Unrecognised address format");if(!ipe.test(t))throw new Error("Unrecognised address format");return M9(t)},lpe={name:rpe,coinType:ape,encode:ope,decode:spe},[cpe,upe]=Dn.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),Dd=new Uint32Array(80),Ld=new Uint32Array(80);class dpe extends EG{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:n,Bh:f,Bl:r,Ch:a,Cl:i,Dh:o,Dl:s,Eh:l,El:c,Fh:d,Fl:p,Gh:x,Gl:C,Hh:O,Hl:L}=this;return[t,n,f,r,a,i,o,s,l,c,d,p,x,C,O,L]}set(t,n,f,r,a,i,o,s,l,c,d,p,x,C,O,L){this.Ah=t|0,this.Al=n|0,this.Bh=f|0,this.Bl=r|0,this.Ch=a|0,this.Cl=i|0,this.Dh=o|0,this.Dl=s|0,this.Eh=l|0,this.El=c|0,this.Fh=d|0,this.Fl=p|0,this.Gh=x|0,this.Gl=C|0,this.Hh=O|0,this.Hl=L|0}process(t,n){for(let Y=0;Y<16;Y++,n+=4)Dd[Y]=t.getUint32(n),Ld[Y]=t.getUint32(n+=4);for(let Y=16;Y<80;Y++){const i0=Dd[Y-15]|0,m0=Ld[Y-15]|0,A0=Dn.rotrSH(i0,m0,1)^Dn.rotrSH(i0,m0,8)^Dn.shrSH(i0,m0,7),T0=Dn.rotrSL(i0,m0,1)^Dn.rotrSL(i0,m0,8)^Dn.shrSL(i0,m0,7),I0=Dd[Y-2]|0,z0=Ld[Y-2]|0,oe=Dn.rotrSH(I0,z0,19)^Dn.rotrBH(I0,z0,61)^Dn.shrSH(I0,z0,6),ae=Dn.rotrSL(I0,z0,19)^Dn.rotrBL(I0,z0,61)^Dn.shrSL(I0,z0,6),ye=Dn.add4L(T0,ae,Ld[Y-7],Ld[Y-16]),P=Dn.add4H(ye,A0,oe,Dd[Y-7],Dd[Y-16]);Dd[Y]=P|0,Ld[Y]=ye|0}let{Ah:f,Al:r,Bh:a,Bl:i,Ch:o,Cl:s,Dh:l,Dl:c,Eh:d,El:p,Fh:x,Fl:C,Gh:O,Gl:L,Hh:D,Hl:V}=this;for(let Y=0;Y<80;Y++){const i0=Dn.rotrSH(d,p,14)^Dn.rotrSH(d,p,18)^Dn.rotrBH(d,p,41),m0=Dn.rotrSL(d,p,14)^Dn.rotrSL(d,p,18)^Dn.rotrBL(d,p,41),A0=d&x^~d&O,T0=p&C^~p&L,I0=Dn.add5L(V,m0,T0,upe[Y],Ld[Y]),z0=Dn.add5H(I0,D,i0,A0,cpe[Y],Dd[Y]),oe=I0|0,ae=Dn.rotrSH(f,r,28)^Dn.rotrBH(f,r,34)^Dn.rotrBH(f,r,39),ye=Dn.rotrSL(f,r,28)^Dn.rotrBL(f,r,34)^Dn.rotrBL(f,r,39),P=f&a^f&o^a&o,F=r&i^r&s^i&s;D=O|0,V=L|0,O=x|0,L=C|0,x=d|0,C=p|0,{h:d,l:p}=Dn.add(l|0,c|0,z0|0,oe|0),l=o|0,c=s|0,o=a|0,s=i|0,a=f|0,i=r|0;const Q=Dn.add3L(oe,ye,F);f=Dn.add3H(Q,z0,ae,P),r=Q|0}({h:f,l:r}=Dn.add(this.Ah|0,this.Al|0,f|0,r|0)),{h:a,l:i}=Dn.add(this.Bh|0,this.Bl|0,a|0,i|0),{h:o,l:s}=Dn.add(this.Ch|0,this.Cl|0,o|0,s|0),{h:l,l:c}=Dn.add(this.Dh|0,this.Dl|0,l|0,c|0),{h:d,l:p}=Dn.add(this.Eh|0,this.El|0,d|0,p|0),{h:x,l:C}=Dn.add(this.Fh|0,this.Fl|0,x|0,C|0),{h:O,l:L}=Dn.add(this.Gh|0,this.Gl|0,O|0,L|0),{h:D,l:V}=Dn.add(this.Hh|0,this.Hl|0,D|0,V|0),this.set(f,r,a,i,o,s,l,c,d,p,x,C,O,L,D,V)}roundClean(){Dd.fill(0),Ld.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class ppe extends dpe{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}const bpe=wS(()=>new ppe),sq=Op0.encode,lq=Op0.decode,$p0=er.chain(er.radix2(5),er.alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),er.join("")),cq=$p0.encode,uq=$p0.decode,e80=e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"),hpe="algo",mpe=283,t80=er.checksum(4,e=>bpe(e).slice(-4)),ype=e=>{const t=t80.encode(e);return cq(t)},gpe=e=>{const t=uq(e);if(t.length!==36)throw new Error("Unrecognised address format");return t80.decode(t)},vpe={name:hpe,coinType:mpe,encode:ype,decode:gpe},wpe="ar",Ape=472,xpe=bO.encode,Epe=bO.decode,Tpe={name:wpe,coinType:Ape,encode:xpe,decode:Epe},Mpe="ardr",Cpe=16754,n80="ARDOR",f80="23456789ABCDEFGHJKLMNPQRSTUVWXYZ",r80=new Uint8Array([3,2,1,0,7,6,5,4,13,14,15,16,12,8,9,10,11]),a80=[0,0,1,18,2,5,19,11,3,29,6,27,20,8,12,23,4,10,30,17,7,22,28,26,21,25,9,16,13,14,24,15],i80=[1,2,4,8,16,5,10,20,13,26,17,7,14,28,29,31,27,19,3,6,12,24,21,15,30,25,23,11,22,9,18,1],Spe=(e,t)=>e===0||t===0?0:i80[(a80[e]+a80[t])%31],Ope=e=>{let t=0;for(let n=1;n<5;n++){let f=0;for(let r=0;r<31;r++){if(r>12&&r<27)continue;let a=r;r>26&&(a-=14),f^=Spe(e[a],i80[n*r%31])}t|=f}return t===0},kpe=e=>{const t=[];for(let n=0,f=0;n>4)+(r&15)]}return`${n80}-${t.slice(0,4).join("")}-${t.slice(4,8).join("")}-${t.slice(8,12).join("")}-${t.slice(12,17).join("")}`},Npe=e=>{if(!e.startsWith(`${n80}-`)||e.length!==26)throw new Error("Unrecognised address format");const t=e.slice(6),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);for(let f=0,r=0;f<20;f++){const a=t[f];if(a==="-")continue;const i=f80.indexOf(a);if(i===-1)throw new Error("Unrecognised address format");const o=r80[r++];n[o]=i}if(!Ope(n))throw new Error("Unrecognised address format");return n},Ppe={name:Mpe,coinType:Cpe,encode:kpe,decode:Npe},Ipe="ark",Rpe=111,Bpe=To,Dpe=e=>{const t=I1(e);if(t[0]!==23)throw new Error("Invalid address");return t},Lpe={name:Ipe,coinType:Rpe,encode:Bpe,decode:Dpe},jpe="atom",Fpe=118,zpe=Ri("cosmos"),Vpe=Bi("cosmos"),Upe={name:jpe,coinType:Fpe,encode:zpe,decode:Vpe},Hpe="avax",Gpe=9e3,o80="avax",qpe=Bi(o80),Wpe=Ri(o80),Qpe=e=>{let t;const[n,f]=e.split("-");return f?t=f:t=n,qpe(t)},Ype={name:Hpe,coinType:Gpe,encode:Wpe,decode:Qpe},il=({hrp:e,p2pkhVersions:t,p2shVersions:n})=>{const f=nq(e),r=ii(t,n);return a=>a.toLowerCase().startsWith(e+"1")?f(a):r(a)},ol=({hrp:e,p2pkhVersions:t,p2shVersions:n})=>{const f=tq(e),r=vi(t[0],n[0]);return a=>{try{return r(a)}catch{return f(a)}}},Kpe="bcd",Jpe=999,s80="bcd",l80=[new Uint8Array([0])],c80=[new Uint8Array([5])],Zpe=ol({hrp:s80,p2pkhVersions:l80,p2shVersions:c80}),Xpe=il({hrp:s80,p2pkhVersions:l80,p2shVersions:c80}),_pe={name:Kpe,coinType:Jpe,encode:Zpe,decode:Xpe},$pe="bitcoincash",u80=new Uint8Array([2,9,20,3,15,9,14,3,1,19,8,0]),d80=[160,192,224,256,320,384,448,512],e8e=Object.fromEntries(d80.map((e,t)=>[e,t])),p80=er.radix2(5),b80=er.chain(er.alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),er.join("")),t8e=e=>{const t=new Uint8Array(8);for(let n=0;n<8;n++)t[7-n]=Number(e&31n),e=e>>5n;return t},h80=e=>{const t=[656907472481n,522768456162n,1044723512260n,748107326120n,130178868336n];let n=1n;for(var f=0;f>35n;n=(n&34359738367n)<<5n^BigInt(a);for(var r=0;r>BigInt(r)&1n)===1n&&(n=n^t[r])}return n^1n},n8e=e=>{const t=e.toLowerCase();if(e===t)return t;const n=e.toUpperCase();if(e===n)return t;throw new Error("Unrecognised address format")},f8e=e=>{const t=kf(u80,new Uint8Array(e));return h80(t)===0n},dq=(e,t)=>{const n=new Uint8Array([e+e8e[t.length*8]]),f=p80.encode(kf(n,t)),r=new Uint8Array(f),a=kf(u80,r,new Uint8Array(8)),i=t8e(h80(a)),o=kf(r,i);return`${$pe}:${b80.encode(Array.from(o))}`},m80=e=>{const t=n8e(e);let[n,f]=t.split(":");if(!f)f=n;else if(n!=="bitcoincash")throw new Error("Unrecognised address format");const r=b80.decode(f);if(!f8e(r))throw new Error("Invalid checksum");const[a,...i]=p80.decode(Array.from(r.slice(0,-8)));if(d80[a&7]!==i.length*8)throw new Error("Unrecognised address format");return{type:a&120,hash:i}},r8e="bch",a8e=145,i8e=[new Uint8Array([0])],o8e=[new Uint8Array([5])],s8e=ii(i8e,o8e),l8e=e=>{if(e[0]===118){if(e[1]!==169||e[e.length-2]!==136||e[e.length-1]!==172)throw new Error("Unrecognised address format");return dq(0,e.slice(3,3+e[2]))}if(e[0]===169){if(e[e.length-1]!==135)throw new Error("Unrecognised address format");return dq(8,e.slice(2,2+e[1]))}throw new Error("Unrecognised address format")},c8e=e=>{try{return s8e(e)}catch{const{type:t,hash:n}=m80(e);if(t===0)return kf(new Uint8Array([118,169,20]),new Uint8Array(n),new Uint8Array([136,172]));if(t===8)return kf(new Uint8Array([169,20]),new Uint8Array(n),new Uint8Array([135]));throw new Error("Unrecognised address format")}},u8e={name:r8e,coinType:a8e,encode:l8e,decode:c8e},d8e="xmr",p8e=128,Uv=Pp0.encode,Hv=Pp0.decode,b8e={name:d8e,coinType:p8e,encode:Uv,decode:Hv},h8e="bcn",m8e=204,y8e=er.checksum(4,$5),g8e=e=>{const t=$5(e).slice(0,4);return Uv(kf(e,t))},v8e=e=>{const t=Hv(e),n=t.slice(0,-68);if(t.length<68||!N1(n,new Uint8Array([6]))&&!N1(n,new Uint8Array([206,246,34])))throw new Error("Unrecognised address format");return y8e.decode(t)},w8e={name:h8e,coinType:m8e,encode:g8e,decode:v8e},A8e="bdx",x8e=570,E8e=Uv,T8e=Hv,M8e={name:A8e,coinType:x8e,encode:E8e,decode:T8e},C8e="bnb",S8e=714,y80="bnb",O8e=Ri(y80),k8e=Bi(y80),N8e={name:C8e,coinType:S8e,encode:O8e,decode:k8e},P8e="bps",I8e=576,g80=[new Uint8Array([0])],v80=[new Uint8Array([5])],R8e=vi(g80[0],v80[0]),B8e=ii(g80,v80),D8e={name:P8e,coinType:I8e,encode:R8e,decode:B8e},L8e="bsv",j8e=236,F8e=e=>To(kf(new Uint8Array([0]),e)),z8e=e=>{const t=I1(e);if(t.length!==21)throw new Error("Unrecognised address format");if(t[0]!==0)throw new Error("Unrecognised address format");return t.slice(1)},V8e={name:L8e,coinType:j8e,encode:F8e,decode:z8e},U8e="btc",H8e=0,w80="bc",A80=[new Uint8Array([0])],x80=[new Uint8Array([5])],G8e=ol({hrp:w80,p2pkhVersions:A80,p2shVersions:x80}),q8e=il({hrp:w80,p2pkhVersions:A80,p2shVersions:x80}),W8e={name:U8e,coinType:H8e,encode:G8e,decode:q8e},Q8e="btg",Y8e=156,E80="btg",T80=[new Uint8Array([38])],M80=[new Uint8Array([23])],K8e=ol({hrp:E80,p2pkhVersions:T80,p2shVersions:M80}),J8e=il({hrp:E80,p2pkhVersions:T80,p2shVersions:M80}),Z8e={name:Q8e,coinType:Y8e,encode:K8e,decode:J8e},X8e="btm",_8e=153,C80="bm",$8e=tq(C80),ebe=nq(C80),tbe={name:X8e,coinType:_8e,encode:$8e,decode:ebe},nbe="bts",fbe=308,S80="BTS",rbe=Rd(S80),abe=Bd(S80),ibe={name:nbe,coinType:fbe,encode:rbe,decode:abe},obe="cca",sbe=489,O80=[new Uint8Array([11])],k80=[new Uint8Array([5])],lbe=vi(O80[0],k80[0]),cbe=ii(O80,k80),ube={name:obe,coinType:sbe,encode:lbe,decode:cbe},dbe="ccxx",pbe=571,N80="ccx",P80=[new Uint8Array([137])],I80=[new Uint8Array([75]),new Uint8Array([5])],bbe=ol({hrp:N80,p2pkhVersions:P80,p2shVersions:I80}),hbe=il({hrp:N80,p2pkhVersions:P80,p2shVersions:I80}),mbe={name:dbe,coinType:pbe,encode:bbe,decode:hbe},R80=({address:e,hash:t,length:n})=>{for(let f=0;f>1]>>4>=8&&e[f]&&(e[f]=e[f].toUpperCase()),(t[f>>1]&15)>=8&&e[f+1]&&(e[f+1]=e[f+1].toUpperCase());return`0x${e.join("")}`};function B80(e,t){const n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),f=$5(oq(n)),r=(t?n.substring(`${t}0x`.length):n).split("");return R80({address:r,hash:f,length:40})}function D80(e){return/^0x[a-fA-F0-9]{40}$/.test(e)}function ybe(e,t){return D80(e)&&B80(e,t)===e}const Mo=e=>t=>B80(yO(t),e),Co=e=>t=>{if(!ybe(t,e))throw new Error("Unrecognised address format");return mO(t)},gbe="celoLegacy",vbe=52752,wbe=Mo(),Abe=Co(),xbe={name:gbe,coinType:vbe,encode:wbe,decode:Abe},Ebe="ckb",Tbe=309,L80="ckb",Mbe=Ri(L80),Cbe=Bi(L80),Sbe={name:Ebe,coinType:Tbe,encode:Mbe,decode:Cbe},Obe="cloLegacy",kbe=820,Nbe=Mo(),Pbe=Co(),Ibe={name:Obe,coinType:kbe,encode:Nbe,decode:Pbe},Rbe="dash",Bbe=5,j80=[new Uint8Array([76])],F80=[new Uint8Array([16])],Dbe=vi(j80[0],F80[0]),Lbe=ii(j80,F80),jbe={name:Rbe,coinType:Bbe,encode:Dbe,decode:Lbe},Fbe="dcr",zbe=42,Vbe=no,Ube=Eo,Hbe={name:Fbe,coinType:zbe,encode:Vbe,decode:Ube},Gbe="dgb",qbe=20,z80="dgb",V80=[new Uint8Array([30])],U80=[new Uint8Array([63])],Wbe=ol({hrp:z80,p2pkhVersions:V80,p2shVersions:U80}),Qbe=il({hrp:z80,p2pkhVersions:V80,p2shVersions:U80}),Ybe={name:Gbe,coinType:qbe,encode:Wbe,decode:Qbe},Kbe="divi",Jbe=301,H80=[new Uint8Array([30])],G80=[new Uint8Array([13])],Zbe=vi(H80[0],G80[0]),Xbe=ii(H80,G80),_be={name:Kbe,coinType:Jbe,encode:Zbe,decode:Xbe},$be="doge",ehe=3,q80=[new Uint8Array([30])],W80=[new Uint8Array([22])],the=vi(q80[0],W80[0]),nhe=ii(q80,W80),fhe={name:$be,coinType:ehe,encode:the,decode:nhe},rhe=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class ahe extends vS{constructor(t,n,f={},r,a,i){if(super(),this.blockLen=t,this.outputLen=n,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,t8(t),t8(n),t8(r),n<0||n>r)throw new Error("outputLen bigger than keyLen");if(f.key!==void 0&&(f.key.length<1||f.key.length>r))throw new Error(`key must be up 1..${r} byte long or undefined`);if(f.salt!==void 0&&f.salt.length!==a)throw new Error(`salt must be ${a} byte long or undefined`);if(f.personalization!==void 0&&f.personalization.length!==i)throw new Error(`personalization must be ${i} byte long or undefined`);this.buffer32=Jg(this.buffer=new Uint8Array(t))}update(t){Ed(this);const{blockLen:n,buffer:f,buffer32:r}=this;t=Mc(t);const a=t.length,i=t.byteOffset,o=t.buffer;for(let s=0;sr[i]=Ec(a))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const f=t.slice(0,n);return this.destroy(),f}_cloneInto(t){const{buffer:n,length:f,finished:r,destroyed:a,outputLen:i,pos:o}=this;return t||(t=new this.constructor({dkLen:i})),t.set(...this.get()),t.length=f,t.finished=r,t.destroyed=a,t.outputLen=i,t.buffer.set(n),t.pos=o,t}}const wi=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),hn=new Uint32Array(32);function jd(e,t,n,f,r,a){const i=r[a],o=r[a+1];let s=hn[2*e],l=hn[2*e+1],c=hn[2*t],d=hn[2*t+1],p=hn[2*n],x=hn[2*n+1],C=hn[2*f],O=hn[2*f+1],L=Dn.add3L(s,c,i);l=Dn.add3H(L,l,d,o),s=L|0,{Dh:O,Dl:C}={Dh:O^l,Dl:C^s},{Dh:O,Dl:C}={Dh:Dn.rotr32H(O,C),Dl:Dn.rotr32L(O,C)},{h:x,l:p}=Dn.add(x,p,O,C),{Bh:d,Bl:c}={Bh:d^x,Bl:c^p},{Bh:d,Bl:c}={Bh:Dn.rotrSH(d,c,24),Bl:Dn.rotrSL(d,c,24)},hn[2*e]=s,hn[2*e+1]=l,hn[2*t]=c,hn[2*t+1]=d,hn[2*n]=p,hn[2*n+1]=x,hn[2*f]=C,hn[2*f+1]=O}function Fd(e,t,n,f,r,a){const i=r[a],o=r[a+1];let s=hn[2*e],l=hn[2*e+1],c=hn[2*t],d=hn[2*t+1],p=hn[2*n],x=hn[2*n+1],C=hn[2*f],O=hn[2*f+1],L=Dn.add3L(s,c,i);l=Dn.add3H(L,l,d,o),s=L|0,{Dh:O,Dl:C}={Dh:O^l,Dl:C^s},{Dh:O,Dl:C}={Dh:Dn.rotrSH(O,C,16),Dl:Dn.rotrSL(O,C,16)},{h:x,l:p}=Dn.add(x,p,O,C),{Bh:d,Bl:c}={Bh:d^x,Bl:c^p},{Bh:d,Bl:c}={Bh:Dn.rotrBH(d,c,63),Bl:Dn.rotrBL(d,c,63)},hn[2*e]=s,hn[2*e+1]=l,hn[2*t]=c,hn[2*t+1]=d,hn[2*n]=p,hn[2*n+1]=x,hn[2*f]=C,hn[2*f+1]=O}class ihe extends ahe{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=wi[0]|0,this.v0h=wi[1]|0,this.v1l=wi[2]|0,this.v1h=wi[3]|0,this.v2l=wi[4]|0,this.v2h=wi[5]|0,this.v3l=wi[6]|0,this.v3h=wi[7]|0,this.v4l=wi[8]|0,this.v4h=wi[9]|0,this.v5l=wi[10]|0,this.v5h=wi[11]|0,this.v6l=wi[12]|0,this.v6h=wi[13]|0,this.v7l=wi[14]|0,this.v7h=wi[15]|0;const n=t.key?t.key.length:0;if(this.v0l^=this.outputLen|n<<8|65536|16777216,t.salt){const f=Jg(Mc(t.salt));this.v4l^=Ec(f[0]),this.v4h^=Ec(f[1]),this.v5l^=Ec(f[2]),this.v5h^=Ec(f[3])}if(t.personalization){const f=Jg(Mc(t.personalization));this.v6l^=Ec(f[0]),this.v6h^=Ec(f[1]),this.v7l^=Ec(f[2]),this.v7h^=Ec(f[3])}if(t.key){const f=new Uint8Array(this.blockLen);f.set(Mc(t.key)),this.update(f)}}get(){let{v0l:t,v0h:n,v1l:f,v1h:r,v2l:a,v2h:i,v3l:o,v3h:s,v4l:l,v4h:c,v5l:d,v5h:p,v6l:x,v6h:C,v7l:O,v7h:L}=this;return[t,n,f,r,a,i,o,s,l,c,d,p,x,C,O,L]}set(t,n,f,r,a,i,o,s,l,c,d,p,x,C,O,L){this.v0l=t|0,this.v0h=n|0,this.v1l=f|0,this.v1h=r|0,this.v2l=a|0,this.v2h=i|0,this.v3l=o|0,this.v3h=s|0,this.v4l=l|0,this.v4h=c|0,this.v5l=d|0,this.v5h=p|0,this.v6l=x|0,this.v6h=C|0,this.v7l=O|0,this.v7h=L|0}compress(t,n,f){this.get().forEach((s,l)=>hn[l]=s),hn.set(wi,16);let{h:r,l:a}=Dn.fromBig(BigInt(this.length));hn[24]=wi[8]^a,hn[25]=wi[9]^r,f&&(hn[28]=~hn[28],hn[29]=~hn[29]);let i=0;const o=rhe;for(let s=0;s<12;s++)jd(0,4,8,12,t,n+2*o[i++]),Fd(0,4,8,12,t,n+2*o[i++]),jd(1,5,9,13,t,n+2*o[i++]),Fd(1,5,9,13,t,n+2*o[i++]),jd(2,6,10,14,t,n+2*o[i++]),Fd(2,6,10,14,t,n+2*o[i++]),jd(3,7,11,15,t,n+2*o[i++]),Fd(3,7,11,15,t,n+2*o[i++]),jd(0,5,10,15,t,n+2*o[i++]),Fd(0,5,10,15,t,n+2*o[i++]),jd(1,6,11,12,t,n+2*o[i++]),Fd(1,6,11,12,t,n+2*o[i++]),jd(2,7,8,13,t,n+2*o[i++]),Fd(2,7,8,13,t,n+2*o[i++]),jd(3,4,9,14,t,n+2*o[i++]),Fd(3,4,9,14,t,n+2*o[i++]);this.v0l^=hn[0]^hn[16],this.v0h^=hn[1]^hn[17],this.v1l^=hn[2]^hn[18],this.v1h^=hn[3]^hn[19],this.v2l^=hn[4]^hn[20],this.v2h^=hn[5]^hn[21],this.v3l^=hn[6]^hn[22],this.v3h^=hn[7]^hn[23],this.v4l^=hn[8]^hn[24],this.v4h^=hn[9]^hn[25],this.v5l^=hn[10]^hn[26],this.v5h^=hn[11]^hn[27],this.v6l^=hn[12]^hn[28],this.v6h^=hn[13]^hn[29],this.v7l^=hn[14]^hn[30],this.v7h^=hn[15]^hn[31],hn.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const w8=Fae(e=>new ihe(e)),ohe=new Uint8Array([83,83,53,56,80,82,69]),Q80=e=>w8(kf(ohe,e)).slice(0,2),pq=e=>t=>{const n=new Uint8Array([e]),f=kf(n,t),r=Q80(f);return no(kf(f,r))},bq=e=>t=>{const n=Eo(t);if(n[0]!==e)throw new Error("Unrecognized address format");const f=n.slice(33,35),r=Q80(n.slice(0,33));if(!N1(f,r))throw new Error("Unrecognized address format");return n.slice(1,33)},she="dot",lhe=354,Y80=0,che=pq(Y80),uhe=bq(Y80),dhe={name:she,coinType:lhe,encode:che,decode:uhe},phe="egld",bhe=508,hhe=Ri("erd"),mhe=Bi("erd"),yhe={name:phe,coinType:bhe,encode:hhe,decode:mhe},ghe="ela",vhe=2305,whe=no,Ahe=Eo,xhe={name:ghe,coinType:vhe,encode:whe,decode:Ahe},Ehe="eos",The=194,K80="EOS",Mhe=Rd(K80),Che=Bd(K80),She={name:Ehe,coinType:The,encode:Mhe,decode:Che},Ohe="etcLegacy",khe=61,Nhe=Mo(),Phe=Co(),Ihe={name:Ohe,coinType:khe,encode:Nhe,decode:Phe},Rhe="eth",Bhe=60,Dhe=Mo(),Lhe=Co(),hq={name:Rhe,coinType:Bhe,encode:Dhe,decode:Lhe},jhe="etn",Fhe=415,zhe=18,J80=er.checksum(4,$5),Vhe=e=>{const t=kf(new Uint8Array([zhe]),e),n=J80.encode(t);return Uv(n)},Uhe=e=>{const t=Hv(e);if(t[0]!==18)throw new Error("Unrecognised address format");return J80.decode(t).slice(1)},Hhe={name:jhe,coinType:Fhe,encode:Vhe,decode:Uhe},Ghe="ewtLegacy",qhe=246,Whe=Mo(),Qhe=Co(),Yhe={name:Ghe,coinType:qhe,encode:Whe,decode:Qhe},Z80=e=>{const t=[];do{let n=Number(e&127n);e>>=7n,e!=0n&&(n=n|128),t.push(n)}while(e!=0n);return Uint8Array.from(t)},X80=e=>{let t=0n,n=0n;for(const f of e){if(t|=BigInt(f&127)<{if(e.length<3||e[0]!=="f")return!1;if(e[1]==="0"){if(e.length>22)return!1}else if(e[1]==="1"||e[1]==="2"){if(e.length!==41)return!1}else if(e[1]==="3"){if(e.length!==86)return!1}else return!1;return!0},Xhe=e=>w8(e,{dkLen:4}),_he=e=>{const t=e.slice(1),n=e[0];if(n===0){const i=X80(t);return`f${n}${i}`}const f=w8(e,{dkLen:4}),r=kf(t,f),a=cq(r).toLowerCase();return`f${n}${a}`},$he=e=>{if(!Zhe(e))throw new Error("Unrecognised address format");const t=parseInt(e[1],10),n=new Uint8Array([t]),f=e.slice(2);if(t===0)return kf(n,Z80(BigInt(f)));const r=uq(f.toUpperCase()),a=r.slice(0,-4),i=r.slice(-4),o=kf(n,a),s=Xhe(o);if(!N1(i,s))throw new Error("Unrecognised address format");return o},e3e={name:Khe,coinType:Jhe,encode:_he,decode:$he},t3e="fio",n3e=235,_80="FIO",f3e=Rd(_80),r3e=Bd(_80),a3e={name:t3e,coinType:n3e,encode:f3e,decode:r3e},i3e="firo",o3e=136,$80=[new Uint8Array([82])],eb0=[new Uint8Array([7])],s3e=vi($80[0],eb0[0]),l3e=ii($80,eb0),c3e={name:i3e,coinType:o3e,encode:s3e,decode:l3e},u3e=64,d3e=[1n,2n,4n,8n,16n,32n,64n,128n,256n,512n,1024n,2048n,4096n,8192n,16384n,32768n,65536n,131072n,262144n,471693n,419994n,397615n,395339n,275453n,273067n,268625n,144334n,141953n,137544n,126816n,122570n,116281n,114136n,107829n,103596n,101446n,90923n,86683n,84547n,78212n,76098n,71873n,63506n,57383n,53262n,51260n,45085n,43057n,38955n,28724n,26666n,22553n,14343n,2002n,1831n,1678n,1660n,1437n,1259n,948n,874n,729n,455n,63n];function tb0(e){let t=0n;for(let n=0;n>1n;return t===0n&&e===0n}const p3e="flow",b3e=539,gO=8,h3e=e=>{let t=new Uint8Array(gO);return e.length>gO?t.set(e.slice(e.length-gO)):t.set(e,gO-e.length),yO(t).toLowerCase()},m3e=e=>{if(!tb0(BigInt(e)))throw new Error("Unrecognised address format");return M9(e.startsWith("0x")?e.slice(2):e)},y3e={name:p3e,coinType:b3e,encode:h3e,decode:m3e},mq=({hrp:e,p2pkhVersions:t,p2shVersions:n})=>{const f=Bi(e),r=ii(t,n);return a=>a.toLowerCase().startsWith(e)?f(a):r(a)},yq=({hrp:e,p2pkhVersions:t,p2shVersions:n})=>{const f=Ri(e),r=vi(t[0],n[0]);return a=>{try{return r(a)}catch{return f(a)}}},g3e="flux",v3e=19167,nb0="za",fb0=[new Uint8Array([28,184])],rb0=[new Uint8Array([28,189])],w3e=yq({hrp:nb0,p2pkhVersions:fb0,p2shVersions:rb0}),A3e=mq({hrp:nb0,p2pkhVersions:fb0,p2shVersions:rb0}),x3e={name:g3e,coinType:v3e,encode:w3e,decode:A3e},E3e="ftmLegacy",T3e=1007,M3e=Mo(),C3e=Co(),S3e={name:E3e,coinType:T3e,encode:M3e,decode:C3e},O3e="gnoLegacy",k3e=700,N3e=Mo(),P3e=Co(),I3e={name:O3e,coinType:k3e,encode:N3e,decode:P3e},R3e="goLegacy",B3e=6060,D3e=Mo(),L3e=Co(),j3e={name:R3e,coinType:B3e,encode:D3e,decode:L3e},F3e="grin",z3e=592,ab0="grin",V3e=Ri(ab0),U3e=Bi(ab0),H3e={name:F3e,coinType:z3e,encode:V3e,decode:U3e},G3e="gxc",q3e=2303,ib0="GXC",W3e=Rd(ib0),Q3e=Bd(ib0),Y3e={name:G3e,coinType:q3e,encode:W3e,decode:Q3e},K3e="hbar",J3e=3030,Z3e=e=>{if(e.length!==20)throw new Error("Unrecognised address format");const t=new DataView(e.buffer,0,20),n=t.getUint32(0),f=t.getBigUint64(4),r=t.getBigUint64(12,!1);return[n,f,r].join(".")},X3e=e=>{const t=new DataView(new ArrayBuffer(20),0,20),n=e.split(".");if(n.length!==3)throw new Error("Unrecognised address format");const f=Number(n[0]),r=BigInt(n[1]),a=BigInt(n[2]);return t.setUint32(0,f),t.setBigUint64(4,r),t.setBigUint64(12,a),new Uint8Array(t.buffer,0,20)},_3e={name:K3e,coinType:J3e,encode:Z3e,decode:X3e},$3e="hive",e9e=825,ob0="STM",t9e=Rd(ob0),n9e=Bd(ob0),f9e={name:$3e,coinType:e9e,encode:t9e,decode:n9e},r9e="hns",a9e=5353,sb0="hs",lb0=new Uint8Array([0]),i9e=e=>{if(e.length!==20)throw new Error("Unrecognised address format");return al.encode(sb0,[lb0[0],...al.toWords(e)])},o9e=e=>{const{prefix:t,words:n}=al.decode(e);if(t!==sb0)throw new Error("Unrecognised address format");const f=n[0],r=al.fromWords(n.slice(1));if(f!==lb0[0])throw new Error("Unrecognised address format");if(r.length!==20)throw new Error("Unrecognised address format");return new Uint8Array(r)},s9e={name:r9e,coinType:a9e,encode:i9e,decode:o9e},l9e="hnt",c9e=904,u9e=e=>{const t=kf(new Uint8Array([0]),e);return To(t)},d9e=e=>{const t=I1(e);if(t[0]!==0)throw new Error("Unrecognised address format");return t.slice(1)},p9e={name:l9e,coinType:c9e,encode:u9e,decode:d9e},b9e="icx",h9e=74,m9e=e=>{if(e.length!==21)throw new Error("Invalid address length");const t=e[0];if(t===0)return`hx${v8(e.slice(1))}`;if(t===1)return`cx${v8(e.slice(1))}`;throw new Error("Invalid address type")},y9e=e=>{const t=e.slice(0,2),n=e.slice(2);if(t==="hx")return kf(new Uint8Array([0]),M9(n));if(t==="cx")return kf(new Uint8Array([1]),M9(n));throw new Error("Invalid address prefix")},g9e={name:b9e,coinType:h9e,encode:m9e,decode:y9e},v9e="iost",w9e=291,A9e=no,x9e=Eo,E9e={name:v9e,coinType:w9e,encode:A9e,decode:x9e},T9e="iota",M9e=4218,cb0="iota",C9e=new Uint8Array([0]),S9e=Ri(cb0),O9e=Bi(cb0),k9e=e=>S9e(kf(C9e,e)),N9e=e=>O9e(e).slice(1),P9e={name:T9e,coinType:M9e,encode:k9e,decode:N9e},I9e="iotx",R9e=304,ub0="io",B9e=Ri(ub0),D9e=Bi(ub0),L9e={name:I9e,coinType:R9e,encode:B9e,decode:D9e},j9e="iris",F9e=566,db0="iaa",z9e=Ri(db0),V9e=Bi(db0),U9e={name:j9e,coinType:F9e,encode:z9e,decode:V9e},H9e="kava",G9e=459,pb0="kava",q9e=Ri(pb0),W9e=Bi(pb0),Q9e={name:H9e,coinType:G9e,encode:q9e,decode:W9e},Y9e="kmd",K9e=141,bb0=[new Uint8Array([60])],hb0=[new Uint8Array([85])],J9e=vi(bb0[0],hb0[0]),Z9e=ii(bb0,hb0),X9e={name:Y9e,coinType:K9e,encode:J9e,decode:Z9e},_9e="ksm",$9e=434,mb0=2,eme=pq(mb0),tme=bq(mb0),nme={name:_9e,coinType:$9e,encode:eme,decode:tme},fme="lcc",rme=192,yb0="lcc",gb0=[new Uint8Array([28])],vb0=[new Uint8Array([50]),new Uint8Array([5])],ame=ol({hrp:yb0,p2pkhVersions:gb0,p2shVersions:vb0}),ime=il({hrp:yb0,p2pkhVersions:gb0,p2shVersions:vb0}),ome={name:fme,coinType:rme,encode:ame,decode:ime},sme="lrg",lme=568,wb0=[new Uint8Array([30])],Ab0=[new Uint8Array([13])],cme=vi(wb0[0],Ab0[0]),ume=ii(wb0,Ab0),dme={name:sme,coinType:lme,encode:cme,decode:ume},pme="lsk",bme=134,hme=e=>`${npe(e)}L`,mme=e=>{if(e.length<2||e.length>22)throw new Error("Invalid address length");if(!e.endsWith("L")||e.includes("."))throw new Error("Invalid address format");return fpe(e.slice(0,-1))},yme={name:pme,coinType:bme,encode:hme,decode:mme},gme="ltc",vme=2,xb0="ltc",Eb0=[new Uint8Array([48])],Tb0=[new Uint8Array([50]),new Uint8Array([5])],wme=ol({hrp:xb0,p2pkhVersions:Eb0,p2shVersions:Tb0}),Ame=il({hrp:xb0,p2pkhVersions:Eb0,p2shVersions:Tb0}),xme={name:gme,coinType:vme,encode:wme,decode:Ame},Eme="luna",Tme=330,Mb0="terra",Mme=Ri(Mb0),Cme=Bi(Mb0),Sme={name:Eme,coinType:Tme,encode:Mme,decode:Cme},Ome="mona",kme=22,Cb0="mona",Sb0=[new Uint8Array([50])],Ob0=[new Uint8Array([55]),new Uint8Array([5])],Nme=ol({hrp:Cb0,p2pkhVersions:Sb0,p2shVersions:Ob0}),Pme=il({hrp:Cb0,p2pkhVersions:Sb0,p2shVersions:Ob0}),Ime={name:Ome,coinType:kme,encode:Nme,decode:Pme},Rme="mrx",Bme=326,Dme=To,Lme=I1,jme={name:Rme,coinType:Bme,encode:Dme,decode:Lme},Fme="nano",zme=165,kb0=(e,t,n)=>{const f=e.length*t%n,r=f===0?0:n-f;let a=0,i=0;const o=2**n-1,s=[];for(let l=0;l=2**t)throw new Error(`convertRadixNano: invalid data word=${c} from=${t}`);if(a=a<32)throw new Error(`convertRadixNano: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)s.push(a>>>i+r-n&o)}return a=a<0&&s.push(a>>>0),s},Vme={encode:e=>kb0(e,8,5),decode:e=>{const t=e.length*5%8;let n=kb0(e,5,8);return t!==0&&(n=n.slice(1)),Uint8Array.from(n)}},gq=er.chain(Vme,er.alphabet("13456789abcdefghijkmnopqrstuwxyz"),er.join("")),Ume=e=>{const t=gq.encode(e),n=w8(e,{dkLen:5}).reverse(),f=gq.encode(n);return`nano_${t}${f}`},Hme=e=>{const t=gq.decode(e.slice(5));return Uint8Array.from(t.slice(0,-5))},Gme={name:Fme,coinType:zme,encode:Ume,decode:Hme},qme="nas",Wme=2718,Nb0=er.checksum(4,Kae),Qme=e=>{const t=Nb0.encode(e);return no(t)},Yme=e=>{const t=Eo(e);if(t.length!==26||t[0]!==25||t[1]!==87&&t[1]!==88)throw new Error("Unrecognised address format");return Nb0.decode(t)},Kme={name:qme,coinType:Wme,encode:Qme,decode:Yme},Jme=/^(([a-z\d]+[\-_])*[a-z\d]+\.)*([a-z\d]+[\-_])*[a-z\d]+$/,vq=e=>!(e.length<2||e.length>64||!Jme.test(e)),Zme="near",Xme=397,_me=e=>{const t=tpe(e);if(!vq(t))throw new Error("Unrecognised address format");return t},$me=e=>{if(!vq(e))throw new Error("Unrecognised address format");return oq(e)},e4e={name:Zme,coinType:Xme,encode:_me,decode:$me},t4e="neo",n4e=888,f4e=To,r4e=I1,a4e={name:t4e,coinType:n4e,encode:f4e,decode:r4e},i4e="nim",o4e=242,wq="NQ",s4e=e=>{const t=e.toUpperCase().split("").map(f=>{const r=f.charCodeAt(0);return r>=48&&r<=57?f:(r-55).toString()}).join("");let n="";for(let f=0;f("00"+(98-s4e(e+wq+"00"))).slice(-2),Ib0=er.chain(er.radix2(5),er.alphabet("0123456789ABCDEFGHJKLMNPQRSTUVXY"),er.padding(5),er.join("")),l4e=e=>{const t=Ib0.encode(e),n=Pb0(t);return`${wq}${n}${t}`.replace(/.{4}/g,"$& ").trim()},c4e=e=>{if(!e.startsWith(wq))throw new Error("Unrecognised address format");const t=e.replace(/ /g,""),n=t.slice(2,4),f=t.slice(4);if(n!==Pb0(f))throw new Error("Unrecognised address format");return Ib0.decode(f)},u4e={name:i4e,coinType:o4e,encode:l4e,decode:c4e},d4e="nmc",p4e=7,b4e=To,h4e=I1,m4e={name:d4e,coinType:p4e,encode:b4e,decode:h4e},y4e="nostr",g4e=1237,Rb0="npub",v4e=Ri(Rb0),w4e=Bi(Rb0),A4e={name:y4e,coinType:g4e,encode:v4e,decode:w4e},x4e="nrgLegacy",E4e=9797,T4e=Mo(),M4e=Co(),C4e={name:x4e,coinType:E4e,encode:T4e,decode:M4e},S4e="nuls",O4e=8964,k4e=["a","b","c","d","e"],N4e=e=>{for(let t=0;t=97)return e.slice(t+1);throw new Error("Unrecognised address format")},P4e=e=>{const t=e[0]&255|(e[1]&255)<<8,n=new Uint8Array(e.length+1);let f=0;for(let a=0;a127?i-256:i;n[a]=o,f^=o}n[e.length]=f;let r;if(t===1)r="NULS";else if(t===2)r="tNULS";else{const a=kf(new Uint8Array([255&t>>0]),new Uint8Array([255&t>>8]));r=no(a).toUpperCase()}return r+k4e[r.length-1]+no(n)},I4e=e=>{let t;e.startsWith("NULS")?t=e.slice(5):e.startsWith("tNULS")?t=e.slice(6):t=N4e(e);const n=Eo(t);let f=0;for(let r=0;r127?a-256:a;n[r]=i,f^=i}if(f<0&&(f+=256),f!==n[n.length-1])throw new Error("Unrecognised address format");return n.slice(0,-1)},R4e={name:S4e,coinType:O4e,encode:P4e,decode:I4e},B4e="one",D4e=1023,Bb0="one",L4e=Ri(Bb0),j4e=Bi(Bb0),F4e={name:B4e,coinType:D4e,encode:L4e,decode:j4e},z4e="ont",V4e=1024,U4e=e=>{const t=kf(new Uint8Array([23]),e);return To(t)},H4e=e=>{const t=I1(e);if(t[0]!==23)throw new Error("Unrecognised address format");return t.slice(1)},G4e={name:z4e,coinType:V4e,encode:U4e,decode:H4e},q4e="poaLegacy",W4e=178,Q4e=Mo(),Y4e=Co(),K4e={name:q4e,coinType:W4e,encode:Q4e,decode:Y4e},J4e="ppc",Z4e=6,Db0=[new Uint8Array([55])],Lb0=[new Uint8Array([117])],X4e=vi(Db0[0],Lb0[0]),_4e=ii(Db0,Lb0),$4e={name:J4e,coinType:Z4e,encode:X4e,decode:_4e},eye="qtum",tye=2301,nye=To,fye=I1,rye={name:eye,coinType:tye,encode:nye,decode:fye},aye="rbtc",iye=137,jb0=30,oye=Mo(jb0),sye=Co(jb0),lye={name:aye,coinType:iye,encode:oye,decode:sye},cye="rdd",uye=4,Fb0=[new Uint8Array([61])],zb0=[new Uint8Array([5])],dye=vi(Fb0[0],zb0[0]),pye=ii(Fb0,zb0),bye={name:cye,coinType:uye,encode:dye,decode:pye},hye="rune",mye=931,Vb0="thor",yye=Ri(Vb0),gye=Bi(Vb0),vye={name:hye,coinType:mye,encode:yye,decode:gye},wye="rvn",Aye=175,Ub0=[new Uint8Array([60])],Hb0=[new Uint8Array([122])],xye=vi(Ub0[0],Hb0[0]),Eye=ii(Ub0,Hb0),Tye={name:wye,coinType:Aye,encode:xye,decode:Eye},Mye="sc",Cye=1991,Sye=32,Aq=6,Gb0=e=>w8(e,{dkLen:Sye}).slice(0,Aq),Oye=e=>{const t=Gb0(e);return v8(kf(e,t))},kye=e=>{if(e.length!==76)throw new Error("Unrecognised address format");const t=M9(e),n=t.slice(0,-Aq),f=t.slice(-Aq),r=Gb0(n);if(!N1(f,r))throw new Error("Unrecognised address format");return n},Nye={name:Mye,coinType:Cye,encode:Oye,decode:kye},Pye="sero",Iye=569,Rye=no,Bye=e=>{const t=Eo(e);if(t.length!==96)throw new Error("Unrecognised address format");return t},Dye={name:Pye,coinType:Iye,encode:Rye,decode:Bye},Lye="sol",jye=501,Fye=e=>{if(e.length!==32)throw new Error("Unrecognised address format");const t=no(e);if(t.length<32||t.length>44)throw new Error("Unrecognised address format");return t},zye=e=>{if(e.length<32||e.length>44)throw new Error("Unrecognised address format");const t=Eo(e);if(t.length!==32)throw new Error("Unrecognised address format");return t},Vye={name:Lye,coinType:jye,encode:Fye,decode:zye},Uye="srm",Hye=573,Gye=no,qye=Eo,Wye={name:Uye,coinType:Hye,encode:Gye,decode:qye},Qye="steem",Yye=135,qb0="STM",Kye=Rd(qb0),Jye=Bd(qb0),Zye={name:Qye,coinType:Yye,encode:Kye,decode:Jye},Xye="strat",_ye=105,Wb0=[new Uint8Array([63])],Qb0=[new Uint8Array([125])],$ye=vi(Wb0[0],Qb0[0]),e7e=ii(Wb0,Qb0),t7e={name:Xye,coinType:_ye,encode:$ye,decode:e7e},n7e="strk",f7e=9004,r7e=32,a7e=/^0x[a-fA-F0-9]{64}$/,Yb0=e=>{const t=v8(e).toLowerCase().split(""),n=e.findIndex(a=>a!==0),f=n>0?e.slice(n):e,r=new Uint8Array(32);return r.set($5(f),n),R80({address:t,hash:r,length:64})},i7e=e=>{if(e.length!==r7e)throw new Error("Unrecognised address format");return Yb0(e)},o7e=e=>{if(!a7e.test(e))throw new Error("Unrecognised address format");const t=mO(e);if(Yb0(t)!==e)throw new Error("Unrecognised address format");return t},s7e={name:n7e,coinType:f7e,encode:i7e,decode:o7e},l7e="stx",c7e=5757,u7e="S",Kb0=20,Gv=4,Jb0=new Uint8Array([22]),Zb0=new Uint8Array([20]),d7e={encode:e=>Xb0(e,8,5,!0),decode:e=>Uint8Array.from(Xb0(e,5,8,!1))},Xb0=(e,t,n,f)=>{let r=0,a=0;const i=2**n-1,o=[];for(const s of e.reverse()){r=s<=n;a-=n){const c=(r>>n*l&i)>>>0;o.unshift(c),l+=1}r=r>>n*l}if(!f&&a>=t)throw new Error("Excess padding");if(!f&&r)throw new Error(`Non-zero padding: ${r}`);return f&&a>0&&o.unshift(r>>>0),o},xq=er.chain(d7e,er.alphabet("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),er.join("")),Eq=e=>p8(p8(e)).slice(0,Gv),p7e=e=>{if(e.length!==Kb0+Gv)throw new Error("Unrecognised address format");const t=e.slice(0,Kb0),n=e.slice(-Gv);let f,r;if(N1(n,Eq(kf(Jb0,t))))f="P",r=xq.encode(e);else if(N1(n,Eq(kf(Zb0,t))))f="M",r=xq.encode(e);else throw new Error("Unrecognised address format");return`${u7e}${f}${r}`},b7e=e=>{if(e.length<6)throw new Error("Unrecognised address format");if(e[0]!=="S")throw new Error("Unrecognised address format");const t=e80(e),n=t[1];let f;if(n==="P")f=Jb0;else if(n==="M")f=Zb0;else throw new Error("Unrecognised address format");const r=xq.decode(t.slice(2)),a=r.slice(0,-Gv),i=r.slice(-Gv),o=Eq(kf(f,a));if(!N1(i,o))throw new Error("Unrecognised address format");return r},h7e={name:l7e,coinType:c7e,encode:p7e,decode:b7e},m7e="sys",y7e=57,_b0="sys",$b0=[new Uint8Array([63])],eh0=[new Uint8Array([5])],g7e=ol({hrp:_b0,p2pkhVersions:$b0,p2shVersions:eh0}),v7e=il({hrp:_b0,p2pkhVersions:$b0,p2shVersions:eh0}),w7e={name:m7e,coinType:y7e,encode:g7e,decode:v7e},A7e="tfuel",x7e=589,E7e=Mo(),T7e=Co(),M7e={name:A7e,coinType:x7e,encode:E7e,decode:T7e},C7e="thetaLegacy",S7e=500,O7e=Mo(),k7e=Co(),N7e={name:C7e,coinType:S7e,encode:O7e,decode:k7e},P7e="tomoLegacy",I7e=889,R7e=Mo(),B7e=Co(),D7e={name:P7e,coinType:I7e,encode:R7e,decode:B7e},L7e="trx",j7e=195,F7e=To,z7e=I1,V7e={name:L7e,coinType:j7e,encode:F7e,decode:z7e},U7e="ttLegacy",H7e=1001,G7e=Mo(),q7e=Co(),W7e={name:U7e,coinType:H7e,encode:G7e,decode:q7e},Q7e="vet",Y7e=818,K7e=Mo(),J7e=Co(),Z7e={name:Q7e,coinType:Y7e,encode:K7e,decode:J7e},X7e="via",_7e=14,th0=[new Uint8Array([71])],nh0=[new Uint8Array([33])],$7e=vi(th0[0],nh0[0]),ege=ii(th0,nh0),tge={name:X7e,coinType:_7e,encode:$7e,decode:ege},nge="vlx",fge=5655640,rge=no,age=Eo,ige={name:nge,coinType:fge,encode:rge,decode:age},oge="vlxLegacy",sge=574,lge=no,cge=Eo,uge={name:oge,coinType:sge,encode:lge,decode:cge},dge="vsys",pge=360,fh0=e=>{if(e[0]!==5||e[1]!==77||e.length!==26)return!1;const t=e.slice(-4),n=$5(w8(e.slice(0,-4),{dkLen:32})).slice(0,4);return!!N1(t,n)},bge=e=>{if(!fh0(e))throw new Error("Unrecognised address format");return no(e)},hge=e=>{const t=e.startsWith("address:")?e.slice(8):e;if(t.length>36)throw new Error("Unrecognised address format");const n=Eo(t);if(!fh0(n))throw new Error("Unrecognised address format");return n},mge={name:dge,coinType:pge,encode:bge,decode:hge},yge="wan",gge=5718350,rh0=e=>{const t=v8(e),n=t.split(""),f=$5(oq(t));let r;for(let a=0;a<40;a++)r=f[Math.floor(a/2)],a%2===0?r=r>>4:r&=15,n[a]>"9"&&r<=7&&(n[a]=n[a].toUpperCase());return`0x${n.join("")}`},vge=e=>rh0(e),wge=e=>{if(!D80(e))throw new Error("Unrecognised address format");const t=mO(e);if(rh0(t)!==e)throw new Error("Unrecognised address format");return t},Age={name:yge,coinType:gge,encode:vge,decode:wge},xge="waves",Ege=5741564,Tge=e=>$5(w8(e,{dkLen:32})),Mge=4,Cge=er.checksum(Mge,Tge),Sge=no,Oge=e=>{const t=Eo(e);if(t[0]!==1)throw new Error("Invalid address format");if(t[1]!==87||t.length!==26)throw new Error("Invalid address format");return Cge.decode(t),t},kge={name:xge,coinType:Ege,encode:Sge,decode:Oge},Nge="wicc",Pge=99999,ah0=[new Uint8Array([73])],ih0=[new Uint8Array([51])],Ige=vi(ah0[0],ih0[0]),Rge=ii(ah0,ih0),Bge={name:Nge,coinType:Pge,encode:Ige,decode:Rge},Dge="xch",Lge=8444,oh0="xch",sh0=90,jge=Up0(oh0,sh0),Fge=Hp0(oh0,sh0),zge={name:Dge,coinType:Lge,encode:jge,decode:Fge},Vge="xem",Uge=43,Hge=sq,Gge=e=>{const t=e.toUpperCase().replace(/-/g,"");if(!t||t.length!==40)throw new Error("Invalid address");const n=lq(t);if(v8($5(n.slice(0,21))).slice(0,8)!==v8(n.slice(21)))throw new Error("Invalid address");return n},qge={name:Vge,coinType:Uge,encode:Hge,decode:Gge},Wge="xhv",Qge=535,Yge=Uv,Kge=Hv,Jge={name:Wge,coinType:Qge,encode:Yge,decode:Kge},Zge="xlm",Xge=148,lh0=new Uint8Array([48]),ch0=e=>{let t=0;for(let n=0;n>>8&255;r^=f&255,r^=r>>>4,t=t<<8&65535,t^=r,r=r<<5&65535,t^=r,r=r<<7&65535,t^=r}return M9(t.toString(16).padStart(4,"0")).reverse()},_ge=e=>{const t=kf(lh0,e),n=ch0(t),f=kf(t,n);return sq(f)},$ge=e=>{const t=lq(e),n=t[0],f=t.slice(0,-2),r=f.slice(1),a=t.slice(-2);if(n!==lh0[0])throw new Error("Unrecognised address format");const i=ch0(f);if(!N1(a,i))throw new Error("Unrecognised address format");return r},eve={name:Zge,coinType:Xge,encode:_ge,decode:$ge},tve="xrp",nve=144,uh0=er.chain(er.checksum(4,e=>p8(p8(e))),O2e),fve=uh0.encode,rve=uh0.decode,ave={name:tve,coinType:nve,encode:fve,decode:rve},ive="xtz",ove=1729,sve=e=>{if(e.length!==22&&e.length!==21)throw new Error("Unrecognised address format");const t=e[0];if(t===0){let n;if(e[1]===0)n=new Uint8Array([6,161,159]);else if(e[1]===1)n=new Uint8Array([6,161,161]);else if(e[1]===2)n=new Uint8Array([6,161,164]);else throw new Error("Unrecognised address format");return To(kf(n,e.slice(2)))}if(t===1)return To(kf(new Uint8Array([2,90,121]),e.slice(1,21)));throw new Error("Unrecognised address format")},lve=e=>{const t=I1(e).slice(3),n=e.slice(0,3);if(n==="tz1")return kf(new Uint8Array([0,0]),t);if(n==="tz2")return kf(new Uint8Array([0,1]),t);if(n==="tz3")return kf(new Uint8Array([0,2]),t);if(n==="KT1")return kf(new Uint8Array([1]),t,new Uint8Array([0]));throw new Error("Unrecognised address format")},cve={name:ive,coinType:ove,encode:sve,decode:lve},uve="xvg",dve=77,dh0=[new Uint8Array([30])],ph0=[new Uint8Array([33])],pve=vi(dh0[0],ph0[0]),bve=ii(dh0,ph0),hve={name:uve,coinType:dve,encode:pve,decode:bve},mve="zec",yve=133,bh0="zs",hh0=[new Uint8Array([28,184])],mh0=[new Uint8Array([28,189])],gve=yq({hrp:bh0,p2pkhVersions:hh0,p2shVersions:mh0}),vve=mq({hrp:bh0,p2pkhVersions:hh0,p2shVersions:mh0}),wve={name:mve,coinType:yve,encode:gve,decode:vve},Ave="zen",xve=121,yh0=[new Uint8Array([32,137]),new Uint8Array([28,184]),new Uint8Array([32,150]),new Uint8Array([28,189]),new Uint8Array([22,154])],Eve=e=>{const t=e.slice(0,2);if(!yh0.some(n=>N1(n,t)))throw new Error("Invalid prefix");return To(e)},Tve=e=>{const t=I1(e),n=t.slice(0,2);if(!yh0.some(f=>N1(f,n)))throw new Error("Invalid prefix");return t},Mve={name:Ave,coinType:xve,encode:Eve,decode:Tve},Cve="zil",Sve=313,Ove=Ri("zil"),kve=Bi("zil"),Nve={name:Cve,coinType:Sve,encode:Ove,decode:kve},gh0=Object.freeze(Object.defineProperty({__proto__:null,abbc:B2e,ada:q2e,ae:J2e,aib:epe,aion:lpe,algo:vpe,ar:Tpe,ardr:Ppe,ark:Lpe,atom:Upe,avax:Ype,bcd:_pe,bch:u8e,bcn:w8e,bdx:M8e,bnb:N8e,bps:D8e,bsv:V8e,btc:W8e,btg:Z8e,btm:tbe,bts:ibe,cca:ube,ccxx:mbe,celoLegacy:xbe,ckb:Sbe,cloLegacy:Ibe,dash:jbe,dcr:Hbe,dgb:Ybe,divi:_be,doge:fhe,dot:dhe,egld:yhe,ela:xhe,eos:She,etcLegacy:Ihe,eth:hq,etn:Hhe,ewtLegacy:Yhe,fil:e3e,fio:a3e,firo:c3e,flow:y3e,flux:x3e,ftmLegacy:S3e,gnoLegacy:I3e,goLegacy:j3e,grin:H3e,gxc:Y3e,hbar:_3e,hive:f9e,hns:s9e,hnt:p9e,icx:g9e,iost:E9e,iota:P9e,iotx:L9e,iris:U9e,kava:Q9e,kmd:X9e,ksm:nme,lcc:ome,lrg:dme,lsk:yme,ltc:xme,luna:Sme,mona:Ime,mrx:jme,nano:Gme,nas:Kme,near:e4e,neo:a4e,nim:u4e,nmc:m4e,nostr:A4e,nrgLegacy:C4e,nuls:R4e,one:F4e,ont:G4e,poaLegacy:K4e,ppc:$4e,qtum:rye,rbtc:lye,rdd:bye,rune:vye,rvn:Tye,sc:Nye,sero:Dye,sol:Vye,srm:Wye,steem:Zye,strat:t7e,strk:s7e,stx:h7e,sys:w7e,tfuel:M7e,thetaLegacy:N7e,tomoLegacy:D7e,trx:V7e,ttLegacy:W7e,vet:Z7e,via:tge,vlx:ige,vlxLegacy:uge,vsys:mge,wan:Age,waves:kge,wicc:Bge,xch:zge,xem:qge,xhv:Jge,xlm:eve,xmr:b8e,xrp:ave,xtz:cve,xvg:hve,zec:wve,zen:Mve,zil:Nve},Symbol.toStringTag,{value:"Module"})),vh0=Object.freeze({"2147483658":["op","Optimism"],"2147483673":["cro","Cronos"],"2147483704":["bsc","BNB Smart Chain"],"2147483708":["go","GoChain"],"2147483709":["etc","Ethereum Classic"],"2147483736":["tomo","TomoChain"],"2147483747":["poa","POA"],"2147483748":["gno","Gnosis"],"2147483756":["tt","ThunderCore"],"2147483785":["matic","Polygon"],"2147483817":["manta","Manta Pacific"],"2147483894":["ewt","Energy Web"],"2147483898":["ftm","Fantom Opera"],"2147483936":["boba","Boba"],"2147483972":["zksync","zkSync"],"2147484009":["theta","Theta"],"2147484468":["clo","Callisto"],"2147484736":["metis","Metis"],"2147488648":["mantle","Mantle"],"2147492101":["base","Base"],"2147523445":["nrg","Energi"],"2147525809":["arb1","Arbitrum One"],"2147525868":["celo","Celo"],"2147526762":["avaxc","Avalanche C-Chain"],"2147542792":["linea","Linea"],"2148018000":["scr","Scroll"],"2155261425":["zora","Zora"]}),wh0=Object.freeze({0:["btc","Bitcoin"],2:["ltc","Litecoin"],3:["doge","Dogecoin"],4:["rdd","Reddcoin"],5:["dash","Dash"],6:["ppc","Peercoin"],7:["nmc","Namecoin"],14:["via","Viacoin"],20:["dgb","DigiByte"],22:["mona","Monacoin"],42:["dcr","Decred"],43:["xem","NEM"],55:["aib","AIB"],57:["sys","Syscoin"],60:["eth","Ethereum"],61:["etcLegacy","[LEGACY] Ethereum Classic"],74:["icx","ICON"],77:["xvg","Verge"],105:["strat","Stratis"],111:["ark","ARK"],118:["atom","Atom"],121:["zen","Zencash"],128:["xmr","Monero"],133:["zec","Zcash"],134:["lsk","Lisk"],135:["steem","Steem"],136:["firo","Firo"],137:["rbtc","RSK"],141:["kmd","Komodo"],144:["xrp","Ripple"],145:["bch","Bitcoin Cash"],148:["xlm","Stellar Lumens"],153:["btm","Bytom"],156:["btg","Bitcoin Gold"],165:["nano","Nano"],175:["rvn","Ravencoin"],178:["poaLegacy","[LEGACY] POA"],192:["lcc","LitecoinCash"],194:["eos","EOS"],195:["trx","Tron"],204:["bcn","Bytecoin"],235:["fio","FIO"],236:["bsv","BitcoinSV"],242:["nim","Nimiq"],246:["ewtLegacy","[LEGACY] Energy Web"],283:["algo","Algorand"],291:["iost","IOST"],301:["divi","Divi Project"],304:["iotx","IoTeX"],308:["bts","Bitshares"],309:["ckb","Nervos CKB"],313:["zil","Zilliqa"],326:["mrx","Metrix Coin"],330:["luna","Terra"],354:["dot","Polkadot"],360:["vsys","V Systems"],367:["abbc","ABBC"],397:["near","NEAR Protocol"],415:["etn","Electroneum"],425:["aion","Aion"],434:["ksm","Kusama"],457:["ae","\xE6ternity"],459:["kava","Kava"],461:["fil","Filecoin"],472:["ar","Arweave"],489:["cca","Counos"],500:["thetaLegacy","[LEGACY] Theta"],501:["sol","Solana"],508:["egld","MultiversX"],535:["xhv","Haven Protocol"],539:["flow","Flow"],566:["iris","Irisnet"],568:["lrg","Large Coin"],569:["sero","Super Zero Protocol"],570:["bdx","Beldex"],571:["ccxx","Counos X"],573:["srm","Serum"],574:["vlxLegacy","[LEGACY] Velas"],576:["bps","BitcoinPoS"],589:["tfuel","Theta Fuel"],592:["grin","Grin"],700:["gnoLegacy","[LEGACY] Gnosis"],714:["bnb","BNB"],818:["vet","VeChain"],820:["cloLegacy","[LEGACY] Callisto"],825:["hive","Hive"],888:["neo","NEO"],889:["tomoLegacy","[LEGACY] TomoChain"],904:["hnt","Helium"],931:["rune","THORChain"],999:["bcd","Bitcoin Diamond"],1001:["ttLegacy","[LEGACY] ThunderCore"],1007:["ftmLegacy","[LEGACY] Fantom"],1023:["one","HARMONY-ONE"],1024:["ont","Ontology"],1237:["nostr","Nostr"],1729:["xtz","Tezos"],1815:["ada","Cardano"],1991:["sc","Sia"],2301:["qtum","QTUM"],2303:["gxc","GXChain"],2305:["ela","Elastos"],2718:["nas","Nebulas"],3030:["hbar","Hedera HBAR"],4218:["iota","IOTA"],5353:["hns","Handshake"],5757:["stx","Stacks"],6060:["goLegacy","[LEGACY] GoChain"],8444:["xch","Chia"],8964:["nuls","NULS"],9e3:["avax","Avalanche"],9004:["strk","StarkNet"],9797:["nrgLegacy","[LEGACY] Energi"],16754:["ardr","Ardor"],19167:["flux","Flux"],52752:["celoLegacy","[LEGACY] Celo"],99999:["wicc","Waykichain"],5655640:["vlx","Velas"],5718350:["wan","Wanchain"],5741564:["waves","Waves"]}),Pve=Object.freeze({...wh0,...vh0}),Ive=Object.freeze(Object.fromEntries(Object.entries(vh0).map(([e,[t]])=>[t,parseInt(e)]))),Rve=Object.freeze(Object.fromEntries(Object.entries(wh0).map(([e,[t]])=>[t,parseInt(e)]))),Bve=Object.freeze({...Ive,...Rve}),vO=2147483648,Tq=e=>{if(!(e&vO))throw new Error("Coin type is not an EVM chain");return(vO-1&e)>>0},Dve=e=>{const t=gh0[e];if(!t){const n=Bve[e];if(!n)throw new Error(`Unsupported coin: ${e}`);const f=Tq(n),r=hq;return{name:e,coinType:n,evmChainId:f,encode:r.encode,decode:r.decode}}return t},Ah0=e=>{const t=Pve[String(e)];if(e>=vO){const f=Tq(e),r=!t,a=r?`Unknown Chain (${f})`:t[0],i=hq;return{name:a,coinType:e,evmChainId:f,isUnknownChain:r,encode:i.encode,decode:i.decode}}if(!t)throw new Error(`Unsupported coin type: ${e}`);const[n]=t;return gh0[n]},Lve=e=>{const t=typeof e=="string";return t&&Number.isNaN(parseInt(e))?{type:"name",value:e.toLowerCase().replace(/legacy$/,"Legacy")}:{type:"id",value:t?parseInt(e):e}},Mq=e=>{const t=Lve(e);let n;try{n=t.type==="id"?Ah0(t.value):Dve(t.value)}catch{throw new aue({coinType:e})}return n},jve=(e,{name:t,coin:n=60,bypassFormat:f})=>{const r=Mq(n);return r.coinType===60?{to:_r,data:Pn({abi:Y20,functionName:"addr",args:[Sr(t)]})}:f?{to:_r,data:Pn({abi:NG,functionName:"addr",args:[Sr(t),BigInt(n)]})}:{to:_r,data:Pn({abi:NG,functionName:"addr",args:[Sr(t),BigInt(r.coinType)]})}},Fve=async(e,t,{coin:n=60,strict:f})=>{if(t==="0x")return null;const r=Mq(n);let a;try{if(r.coinType===60?a=Ya({abi:Y20,functionName:"addr",data:t}):a=Ya({abi:NG,functionName:"addr",data:t}),!a)return null;const i=Qg(a);if(i==="0x"||i==="0x0"||i==="0x00")return null;const o=r.encode(T1(a));return o?{id:r.coinType,name:r.name,value:o}:null}catch(i){if(f)throw i;return null}},wO=ai({encode:jve,decode:Fve}),zve=(e,{name:t,coin:n,gatewayUrls:f})=>{const r=wO.encode(e,{name:t,coin:n});return Id.encode(e,{name:t,data:r.data,gatewayUrls:f})},Vve=async(e,t,n,{coin:f,strict:r,gatewayUrls:a})=>{const i=await Id.decode(e,t,n,{strict:r,gatewayUrls:a});return i?wO.decode(e,i.data,{coin:f,strict:r}):null},Cq=ai({encode:zve,decode:Vve}),xh0=[{inputs:[{name:"id",type:"uint256"}],name:"ownerOf",outputs:[{name:"owner",type:"address"}],stateMutability:"view",type:"function"}],Uve=[{inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}],Hve=[{inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"},{name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}],Eh0=[{inputs:[{name:"id",type:"uint256"}],name:"available",outputs:[{name:"available",type:"bool"}],stateMutability:"view",type:"function"}],Th0=[{inputs:[{name:"id",type:"uint256"}],name:"nameExpires",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"}],Mh0=[{inputs:[],name:"GRACE_PERIOD",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"}],Gve=[{inputs:[{name:"id",type:"uint256"},{name:"owner",type:"address"}],name:"reclaim",outputs:[],stateMutability:"nonpayable",type:"function"}],qve=[...Uve],Wve=[...Hve],Qve=[...xh0];class AO extends ia{constructor({parameter:t,allowedParameters:n,details:f}){super(`Additional parameter specified: ${t}`,{metaMessages:[`- Allowed parameters: ${n.join(", ")}`],details:f}),Object.defineProperty(this,"parameter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allowedParameters",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AdditionalParameterSpecifiedError"}),this.parameter=t,this.allowedParameters=n}}class Yve extends ia{constructor({parameter:t,details:n}){super(`Required parameter not specified: ${t}`,{details:n}),Object.defineProperty(this,"parameter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RequiredParameterNotSpecifiedError"}),this.parameter=t}}class Bc extends ia{constructor({nameType:t,supportedNameTypes:n,details:f}){super(`Unsupported name type: ${t}`,{metaMessages:[`- Supported name types: ${n.join(", ")}`],details:f}),Object.defineProperty(this,"nameType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportedTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedNameTypeError"}),this.nameType=t,this.supportedTypes=n}}class xO extends ia{constructor({contractType:t,supportedContractTypes:n,details:f}){super(`Invalid contract type: ${t}`,{metaMessages:[`- Supported contract types: ${n.join(", ")}`],details:f}),Object.defineProperty(this,"contractType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportedTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidContractTypeError"}),this.contractType=t,this.supportedTypes=n}}const sl=e=>{const t=e.split("."),n=t[t.length-1]==="eth";return t.length===0?"root":t.length===1?n?"eth-tld":"tld":t.length===2?n?"eth-2ld":"other-2ld":n?"eth-subname":"other-subname"},Kve=(e,{name:t})=>{const n=t.split("."),f=sl(t);if(f!=="eth-2ld")throw new Bc({nameType:f,supportedNameTypes:["eth-2ld"],details:"Currently only eth-2ld names can be checked for availability"});return{to:Rf({client:e,contract:"ensBaseRegistrarImplementation"}),data:Pn({abi:Eh0,functionName:"available",args:[BigInt(U6(n[0]))]})}},Jve=async(e,t)=>{if(typeof t=="object")throw t;return Ya({abi:Eh0,functionName:"available",data:t})},Zve=ai({encode:Kve,decode:Jve}),Xve=bO.encode,_ve=bO.decode,Sq=({name:e,prefix:t,encode:n,decode:f})=>({name:e,prefix:t,encode:r=>`${t}${n(r)}`,decode:r=>{if(!r.startsWith(t))throw new Error(`Multibase ${e} must start with ${t}`);return f(r.slice(t.length))}}),Dc=Sq({name:"base58btc",prefix:"z",encode:T9.encode,decode:T9.decode}),Ch0=er.chain(er.radix2(5),er.alphabet("abcdefghijklmnopqrstuvwxyz234567"),er.join("")),qv=Sq({name:"base32",prefix:"b",encode:e=>Ch0.encode(e),decode:e=>Ch0.decode(e)}),Sh0=er.chain(er.radix(36),er.alphabet("0123456789abcdefghijklmnopqrstuvwxyz"),er.join("")),Wv=Sq({name:"base36",prefix:"k",encode:Sh0.encode,decode:Sh0.decode}),Oh0=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};var kh0=128,$ve=127,ewe=~$ve,twe=Math.pow(2,31);const Qv=(e,t,n=0)=>{for(t=t||[],n=n||0;e>=twe;)t[n++]=e&255|kh0,e/=128;for(;e&ewe;)t[n++]=e&255|kh0,e>>>=7;return t[n]=e|0,t};var nwe=128,Nh0=127;const Yv=(e,f=0)=>{var n=0,f=f||0,r=0,a=f,i,o=e.length;do{if(a>=o)throw read.bytes=0,new RangeError("Could not decode varint");i=e[a++],n+=r<28?(i&Nh0)<=nwe);return[n,a-f]};var fwe=Math.pow(2,7),rwe=Math.pow(2,14),awe=Math.pow(2,21),iwe=Math.pow(2,28),owe=Math.pow(2,35),swe=Math.pow(2,42),lwe=Math.pow(2,49),cwe=Math.pow(2,56),uwe=Math.pow(2,63);const Kv=e=>e{const n=t.byteLength,f=Kv(e),r=f+Kv(n),a=new Uint8Array(r+n);return Qv(e,a,0),Qv(n,a,f),a.set(t,r),new Oq(e,n,t,a)},kq=e=>{const t=Oh0(e),[n,f]=Yv(t),[r,a]=Yv(t.subarray(f)),i=t.subarray(f+a);if(i.byteLength!==r)throw new Error("Incorrect length");return new Oq(n,r,i,t)},dwe=(e,t)=>{if(e===t)return!0;{const n=t;return e.code===n.code&&e.size===n.size&&n.bytes instanceof Uint8Array&&N1(e.bytes,n.bytes)}};function Ih0(e,t){const{bytes:n,version:f}=e;switch(f){case 0:return bwe(n,Nq(e),t??Dc.encode);default:return hwe(n,Nq(e),t??qv.encode)}}const Rh0=new WeakMap;function Nq(e){const t=Rh0.get(e);if(t==null){const n=new Map;return Rh0.set(e,n),n}return t}class ha{constructor(t,n,f,r){Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multihash",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"/",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n,this.version=t,this.multihash=f,this.bytes=r,this["/"]=r}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:t,multihash:n}=this;if(t!==C9)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(n.code!==mwe)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ha.createV0(n)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{const{code:t,digest:n}=this.multihash,f=Ph0(t,n);return ha.createV1(this.code,f)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return ha.equals(this,t)}static equals(t,n){const f=n;return f!=null&&t.code===f.code&&t.version===f.version&&dwe(t.multihash,f.multihash)}toString(t){return Ih0(this,t)}toJSON(){return{"/":Ih0(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;const n=t;if(n instanceof ha)return n;if(n["/"]!=null&&n["/"]===n.bytes||n.asCID===n){const{version:f,code:r,multihash:a,bytes:i}=n;return new ha(f,r,a,i??Bh0(f,r,a.bytes))}else if(n[ywe]===!0){const{version:f,multihash:r,code:a}=n,i=kq(r);return ha.create(f,a,i)}else return null}static create(t,n,f){if(typeof n!="number")throw new Error("String codecs are no longer supported");if(!(f.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(n!==C9)throw new Error(`Version 0 CID must use dag-pb (code: ${C9}) block encoding`);return new ha(t,n,f,f.bytes)}case 1:{const r=Bh0(t,n,f.bytes);return new ha(t,n,f,r)}default:throw new Error("Invalid version")}}static createV0(t){return ha.create(0,C9,t)}static createV1(t,n){return ha.create(1,t,n)}static decode(t){let[n,f]=ha.decodeFirst(t);if(f.length!==0&&([n,f]=ha.decodeFirst(Uint8Array.from([0,C9,...t])),f.length!==0))throw new Error("Incorrect length");return n}static decodeFirst(t){const n=ha.inspectBytes(t),f=n.size-n.multihashSize,r=Oh0(t.subarray(f,f+n.multihashSize));if(r.byteLength!==n.multihashSize)throw new Error("Incorrect length");const a=r.subarray(n.multihashSize-n.digestSize),i=new Oq(n.multihashCode,n.digestSize,a,r);return[n.version===0?ha.createV0(i):ha.createV1(n.codec,i),t.subarray(n.size)]}static inspectBytes(t){let n=0;const f=()=>{const[d,p]=Yv(t.subarray(n));return n+=p,d};let r=f(),a=C9;if(r===18?(r=0,n=0):a=f(),r!==0&&r!==1)throw new RangeError(`Invalid CID version ${r}`);const i=n,o=f(),s=f(),l=n+s,c=l-i;return{version:r,codec:a,multihashCode:o,digestSize:s,multihashSize:c,size:l}}static parse(t,n){const[f,r]=pwe(t,n),a=ha.decode(r);return Nq(a).set(f,t),a}}function pwe(e,t){switch(e[0]){case"Q":{const n=t??Dc;return[Dc.prefix,n.decode(`${Dc.prefix}${e}`)]}case Dc.prefix:{const n=t??Dc;return[Dc.prefix,n.decode(e)]}case qv.prefix:{const n=t??qv;return[qv.prefix,n.decode(e)]}case Wv.prefix:{const n=t??Wv;return[Wv.prefix,n.decode(e)]}default:return e=`z${e}`,[e[0],Dc.decode(e)]}}function bwe(e,t,n){const{prefix:f}=n;if(f!==Dc.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);const r=t.get(f);if(r==null){const a=n.encode(e).slice(1);return t.set(f,a),a}else return r}function hwe(e,t,n){const{prefix:f}=n,r=t.get(f);if(r==null){const a=n.encode(e);return t.set(f,a),a}else return r}const C9=112,mwe=18;function Bh0(e,t,n){const f=Kv(e),r=f+Kv(t),a=new Uint8Array(r+n.byteLength);return Qv(e,a,0),Qv(t,a,f),a.set(n,r),a}const ywe=Symbol.for("@ipld/js-cid/CID"),gwe=(e,t)=>{let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},Dh0={227:"ipfs",229:"ipns",228:"swarm",444:"onion",445:"onion3",11639056:"skynet",11704592:"arweave"},vwe={ipfs:227,ipns:229,swarm:228,onion:444,onion3:445,skynet:11639056,arweave:11704592},Pq=e=>{let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),t.length%2!==0)throw new Error("Invalid hex string");const n=new Uint8Array(t.length/2);for(let f=0;f{let t="";for(let n=0;n{try{const{multihash:t}=e;if(t.size<38){const n=kq(t.bytes);if(n.code===0&&n.size<36)return!1}return!0}catch{return!1}},jh0=e=>_ve(e),S9={skynet:e=>jh0(e),swarm:e=>{const t=Pq(e),n=Ph0(27,t);return ha.create(1,250,n).bytes},ipfs:e=>ha.parse(e).toV1().bytes,ipns:e=>{const t=ha.parse(e);return ha.create(1,114,t.multihash).bytes},utf8:e=>new TextEncoder().encode(e),arweave:e=>jh0(e)},O9={hexMultiHash:e=>{const t=ha.decode(e);return Lh0(kq(t.multihash.bytes).digest)},ipfs:e=>{const t=ha.decode(e).toV1();return t.toString(t.code===114?Wv:qv)},ipns:e=>{const t=ha.decode(e).toV1();return wwe(t)?t.toString(Wv):(console.warn("[ensdomains/content-hash] use of non-cryptographic identifiers in ipns-ns is deprecated and will be removed, migrate to ED25519 libp2p-key"),String.fromCodePoint(...ha.decode(e).multihash.digest))},utf8:e=>new TextDecoder().decode(e),base64:e=>Xve(e)},EO={skynet:{encode:S9.skynet,decode:O9.base64},swarm:{encode:S9.swarm,decode:O9.hexMultiHash},ipfs:{encode:S9.ipfs,decode:O9.ipfs},ipns:{encode:S9.ipns,decode:O9.ipns},arweave:{encode:S9.arweave,decode:O9.base64},default:{encode:S9.utf8,decode:O9.utf8}},Awe=e=>{const t=Pq(e),[n,f]=Yv(t),r=t.slice(f),a=Dh0[n];let i=EO[a];return i||(i=EO.default),i.decode(r)},xwe=(e,t)=>{let n=EO[e];n||(n=EO.default);const f=n.encode(t),r=vwe[e],a=Qv(r,new Uint8Array(Kv(r)));return Lh0(gwe(a,f))},Ewe=e=>{const t=Pq(e),[n]=Yv(t);return Dh0[n]};function Twe(e){return e.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave|ar):\/\/(.*)/)||e.match(/\/(ipfs)\/(.*)/)||e.match(/\/(ipns)\/(.*)/)}const Mwe=e=>{const t=Ewe(e);switch(t){case"ipfs":case"ipns":case"onion":case"onion3":return t;case"swarm":return"bzz";case"skynet":return"sia";case"arweave":return"ar";default:return null}},Cwe=e=>{switch(e){case"bzz":return"swarm";case"sia":return"skynet";case"ar":return"arweave";default:return e}};function Fh0(e){if(!e||e==="0x")return null;const t=Awe(e);return{protocolType:Mwe(e),decoded:t}}function Swe(e){const t=Twe(e);if(!t)return null;const[,n,f]=t;return{protocolType:n,decoded:f}}function Owe(e){const t=Swe(e);if(!t)throw new IG;const n=Cwe(t.protocolType);if(n==="onion"&&t.decoded.length!==16)throw new IG;if(n==="onion3"&&t.decoded.length!==56)throw new IG;return`0x${xwe(n,t.decoded)}`}const kwe=(e,{name:t})=>({to:_r,data:Pn({abi:J20,functionName:"contenthash",args:[Sr(t)]})}),Nwe=async(e,t,{strict:n})=>{if(t==="0x")return null;try{const f=Ya({abi:J20,functionName:"contenthash",data:t});return Fh0(f)}catch(f){if(n)throw f;return null}},TO=ai({encode:kwe,decode:Nwe}),Pwe=(e,{name:t,gatewayUrls:n})=>{const f=TO.encode(e,{name:t});return Id.encode(e,{name:t,data:f.data,gatewayUrls:n})},Iwe=async(e,t,n,{strict:f,gatewayUrls:r})=>{const a=await Id.decode(e,t,n,{strict:f,gatewayUrls:r});return a?TO.decode(e,a.data,{strict:f}):null},Rwe=ai({encode:Pwe,decode:Iwe}),Bwe=[{inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"id",type:"uint256"},{name:"amount",type:"uint256"},{name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}],Dwe=[{inputs:[{name:"node",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"}],zh0=[{inputs:[{name:"node",type:"bytes32"},{name:"label",type:"bytes32"},{name:"owner",type:"address"},{name:"resolver",type:"address"},{name:"ttl",type:"uint64"}],name:"setSubnodeRecord",outputs:[],stateMutability:"nonpayable",type:"function"}],Vh0=[{inputs:[{name:"node",type:"bytes32"},{name:"resolver",type:"address"}],name:"setResolver",outputs:[],stateMutability:"nonpayable",type:"function"}],Lwe=[{inputs:[{name:"node",type:"bytes32"},{name:"owner",type:"address"}],name:"setOwner",outputs:[],stateMutability:"nonpayable",type:"function"}],jwe=[{inputs:[{name:"node",type:"bytes32"},{name:"label",type:"bytes32"},{name:"owner",type:"address"}],name:"setSubnodeOwner",outputs:[{name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"}],Fwe=[{inputs:[{name:"node",type:"bytes32"},{name:"owner",type:"address"},{name:"resolver",type:"address"},{name:"ttl",type:"uint64"}],name:"setRecord",outputs:[],stateMutability:"nonpayable",type:"function"}],rs=[{inputs:[],name:"CannotUpgrade",type:"error"},{inputs:[],name:"IncompatibleParent",type:"error"},{inputs:[{name:"owner",type:"address"}],name:"IncorrectTargetOwner",type:"error"},{inputs:[],name:"IncorrectTokenType",type:"error"},{inputs:[{name:"labelHash",type:"bytes32"},{name:"expectedLabelhash",type:"bytes32"}],name:"LabelMismatch",type:"error"},{inputs:[{name:"label",type:"string"}],name:"LabelTooLong",type:"error"},{inputs:[],name:"LabelTooShort",type:"error"},{inputs:[],name:"NameIsNotWrapped",type:"error"},{inputs:[{name:"node",type:"bytes32"}],name:"OperationProhibited",type:"error"},{inputs:[{name:"node",type:"bytes32"},{name:"addr",type:"address"}],name:"Unauthorised",type:"error"}],Jv=[...rs,{inputs:[{name:"id",type:"uint256"}],name:"getData",outputs:[{name:"owner",type:"address"},{name:"fuses",type:"uint32"},{name:"expiry",type:"uint64"}],stateMutability:"view",type:"function"}],zwe=[...rs,{inputs:[{name:"node",type:"bytes32"},{name:"ownerControlledFuses",type:"uint16"}],name:"setFuses",outputs:[{name:"",type:"uint32"}],stateMutability:"nonpayable",type:"function"}],Vwe=[...rs,{inputs:[{name:"parentNode",type:"bytes32"},{name:"labelhash",type:"bytes32"},{name:"fuses",type:"uint32"},{name:"expiry",type:"uint64"}],name:"setChildFuses",outputs:[],stateMutability:"nonpayable",type:"function"}],Uh0=[...rs,{inputs:[{name:"parentNode",type:"bytes32"},{name:"label",type:"string"},{name:"owner",type:"address"},{name:"resolver",type:"address"},{name:"ttl",type:"uint64"},{name:"fuses",type:"uint32"},{name:"expiry",type:"uint64"}],name:"setSubnodeRecord",outputs:[{name:"node",type:"bytes32"}],stateMutability:"nonpayable",type:"function"}],Uwe=[...rs,{inputs:[{name:"node",type:"bytes32"},{name:"owner",type:"address"},{name:"resolver",type:"address"},{name:"ttl",type:"uint64"}],name:"setRecord",outputs:[],stateMutability:"nonpayable",type:"function"}],Hwe=[...rs,{inputs:[{name:"parentNode",type:"bytes32"},{name:"label",type:"string"},{name:"owner",type:"address"},{name:"fuses",type:"uint32"},{name:"expiry",type:"uint64"}],name:"setSubnodeOwner",outputs:[{name:"node",type:"bytes32"}],stateMutability:"nonpayable",type:"function"}],Gwe=[...rs,{inputs:[{name:"name",type:"bytes"},{name:"wrappedOwner",type:"address"},{name:"resolver",type:"address"}],name:"wrap",outputs:[],stateMutability:"nonpayable",type:"function"}],qwe=[...rs,{inputs:[{name:"parentNode",type:"bytes32"},{name:"labelhash",type:"bytes32"},{name:"controller",type:"address"}],name:"unwrap",outputs:[],stateMutability:"nonpayable",type:"function"}],Wwe=[...rs,{inputs:[{name:"labelhash",type:"bytes32"},{name:"registrant",type:"address"},{name:"controller",type:"address"}],name:"unwrapETH2LD",outputs:[],stateMutability:"nonpayable",type:"function"}],Iq=[...rs,{inputs:[{name:"",type:"bytes32"}],name:"names",outputs:[{name:"",type:"bytes"}],stateMutability:"view",type:"function"}],Qwe=[...rs,...Bwe],Ywe=[...rs,...xh0],Kwe=[...rs,...Vh0],Hh0=e=>{const t=BigInt(e)*1000n;return t>BigInt(X20)?new Date(X20):new Date(Number(t))},Rq=e=>e.length===2&&e[1]==="eth",Gh0=(e,t)=>e||(Rq(t)?"registrar":"nameWrapper"),Jwe=(e,{name:t,contract:n})=>{const f=t.split("."),r=Gh0(n,f),a=[{to:Rf({client:e,contract:"multicall3"}),data:Pn({abi:Q20,functionName:"getCurrentBlockTimestamp"})}];if(r==="nameWrapper")a.push({to:Rf({client:e,contract:"ensNameWrapper"}),data:Pn({abi:Jv,functionName:"getData",args:[BigInt(Sr(f.join(".")))]})});else{const i=Rf({client:e,contract:"ensBaseRegistrarImplementation"});a.push({to:i,data:Pn({abi:Th0,functionName:"nameExpires",args:[BigInt(U6(f[0]))]})}),a.push({to:i,data:Pn({abi:Mh0,functionName:"GRACE_PERIOD"})})}return rl.encode(e,{transactions:a})},Zwe=async(e,t,{name:n,contract:f})=>{if(typeof t=="object")throw t;const r=n.split("."),a=await rl.decode(e,t,[]),i=Ya({abi:Q20,functionName:"getCurrentBlockTimestamp",data:a[0].returnData}),o=Gh0(f,r);let s,l=0n;if(o==="nameWrapper"?[,,s]=Ya({abi:Jv,functionName:"getData",data:a[1].returnData}):(s=Ya({abi:Th0,functionName:"nameExpires",data:a[1].returnData}),l=Ya({abi:Mh0,functionName:"GRACE_PERIOD",data:a[2].returnData})),s===0n)return null;let c="active";return i>s+l?c="expired":i>s&&(c="gracePeriod"),{expiry:{date:Hh0(s),value:s},gracePeriod:Number(l),status:c}},Xwe=ai({encode:Jwe,decode:Zwe}),_we=(e,{address:t,gatewayUrls:n})=>{const f=`${t.toLowerCase().substring(2)}.addr.reverse`,r=Rf({client:e,contract:"ensUniversalResolver"}),a=[e8(Rv(f))];return{to:r,...n!=null&&n.length?{data:Pn({abi:rp0,functionName:"reverse",args:[...a,n]}),passthrough:{args:[...a,n],address:r}}:{data:Pn({abi:LG,functionName:"reverse",args:a}),passthrough:{args:a,address:r}}}},$we=async(e,t,n,{address:f,allowMismatch:r,strict:a,gatewayUrls:i})=>{if(!HG(t,{strict:a,abi:i?rp0:LG,args:n.args,functionName:"reverse",address:n.address}))return null;try{const[o,s,l,c]=Ya({abi:LG,functionName:"reverse",data:t});if(!o)return null;const d=t9(s)===t9(f);return!d&&!r?null:{name:fp0(o),match:d,reverseResolverAddress:l,resolverAddress:c}}catch(o){if(a)throw o;return null}},eAe=ai({encode:_we,decode:$we}),MO=({client:e,contract:t,namehash:n,labels:f})=>{switch(t){case"nameWrapper":return{to:Rf({client:e,contract:"ensNameWrapper"}),data:Pn({abi:Ywe,functionName:"ownerOf",args:[BigInt(n)]})};case"registry":return{to:Rf({client:e,contract:"ensRegistry"}),data:Pn({abi:Dwe,functionName:"owner",args:[n]})};case"registrar":return{to:Rf({client:e,contract:"ensBaseRegistrarImplementation"}),data:Pn({abi:Qve,functionName:"ownerOf",args:[BigInt(U6(f[0]))]})};default:throw new xO({contractType:t,supportedContractTypes:["nameWrapper","registry","registrar"]})}},tAe=(e,{name:t,contract:n})=>{const f=Sr(t),r=t.split(".");if(n||r.length===1)return MO({client:e,contract:n||"registry",namehash:f,labels:r});const a=MO({client:e,contract:"registry",namehash:f}),i=MO({client:e,contract:"nameWrapper",namehash:f}),o=[a,i];return Rq(r)&&o.push(MO({client:e,contract:"registrar",labels:r})),rl.encode(e,{transactions:o})},qh0=e=>ES([{type:"address"}],e)[0],nAe=async(e,t,{name:n,contract:f})=>{var c;if(typeof t=="object")throw t;const r=n.split(".");if(f||r.length===1){const d=qh0(t);return f==="registrar"?{ownershipLevel:"registrar",registrant:d}:{ownershipLevel:f||"registry",owner:d}}const a=await rl.decode(e,t,[]),[i,o,s]=[a[0].returnData,a[1].returnData,(c=a[2])==null?void 0:c.returnData].map(d=>d&&d!=="0x"?qh0(d):void 0),l=Rf({client:e,contract:"ensNameWrapper"});return r[r.length-1]==="eth"?s===l?{owner:o,ownershipLevel:"nameWrapper"}:s?{registrant:s,owner:i,ownershipLevel:"registrar"}:i!==_r?r.length===2?{registrant:null,owner:i,ownershipLevel:"registrar"}:i===l&&o&&o!==_r?{owner:o,ownershipLevel:"nameWrapper"}:{owner:i,ownershipLevel:"registry"}:null:i===l&&o&&o!==_r?{owner:o,ownershipLevel:"nameWrapper"}:i&&i!==_r?{owner:i,ownershipLevel:"registry"}:null},fAe=ai({encode:tAe,decode:nAe}),CO=[{inputs:[{name:"names",type:"string[]"},{name:"duration",type:"uint256"}],name:"rentPrice",outputs:[{name:"total",type:"uint256"}],stateMutability:"view",type:"function"}],rAe=[{inputs:[{name:"names",type:"string[]"},{name:"duration",type:"uint256"}],name:"renewAll",outputs:[],stateMutability:"payable",type:"function"}],SO=[{inputs:[{name:"commitment",type:"bytes32"}],name:"CommitmentTooNew",type:"error"},{inputs:[{name:"commitment",type:"bytes32"}],name:"CommitmentTooOld",type:"error"},{inputs:[{name:"duration",type:"uint256"}],name:"DurationTooShort",type:"error"},{inputs:[],name:"InsufficientValue",type:"error"},{inputs:[],name:"MaxCommitmentAgeTooHigh",type:"error"},{inputs:[],name:"MaxCommitmentAgeTooLow",type:"error"},{inputs:[{name:"name",type:"string"}],name:"NameNotAvailable",type:"error"},{inputs:[],name:"ResolverRequiredWhenDataSupplied",type:"error"},{inputs:[{name:"commitment",type:"bytes32"}],name:"UnexpiredCommitmentExists",type:"error"}],Wh0=[...SO,{inputs:[{name:"name",type:"string"},{name:"duration",type:"uint256"}],name:"rentPrice",outputs:[{components:[{name:"base",type:"uint256"},{name:"premium",type:"uint256"}],name:"price",type:"tuple"}],stateMutability:"view",type:"function"}],aAe=[...SO,{inputs:[{name:"commitment",type:"bytes32"}],name:"commit",outputs:[],stateMutability:"nonpayable",type:"function"}],iAe=[...SO,{inputs:[{name:"name",type:"string"},{name:"owner",type:"address"},{name:"duration",type:"uint256"},{name:"secret",type:"bytes32"},{name:"resolver",type:"address"},{name:"data",type:"bytes[]"},{name:"reverseRecord",type:"bool"},{name:"ownerControlledFuses",type:"uint16"}],name:"register",outputs:[],stateMutability:"payable",type:"function"}],oAe=[...SO,{inputs:[{name:"name",type:"string"},{name:"duration",type:"uint256"}],name:"renew",outputs:[],stateMutability:"payable",type:"function"}],sAe=(e,{nameOrNames:t,duration:n})=>{const f=(Array.isArray(t)?t:[t]).map(r=>{const a=r.split("."),i=sl(r);if(i!=="eth-2ld"&&i!=="tld")throw new Bc({nameType:i,supportedNameTypes:["eth-2ld","tld"],details:"Currently only the price of eth-2ld names can be fetched"});return a[0]});if(f.length>1){const r=Rf({client:e,contract:"ensBulkRenewal"});return rl.encode(e,{transactions:[{to:r,data:Pn({abi:CO,functionName:"rentPrice",args:[f,BigInt(n)]})},{to:r,data:Pn({abi:CO,functionName:"rentPrice",args:[f,0n]})}]})}return{to:Rf({client:e,contract:"ensEthRegistrarController"}),data:Pn({abi:Wh0,functionName:"rentPrice",args:[f[0],BigInt(n)]})}},lAe=async(e,t,{nameOrNames:n})=>{if(typeof t=="object")throw t;if(Array.isArray(n)&&n.length>1){const f=await rl.decode(e,t,[]),r=Ya({abi:CO,functionName:"rentPrice",data:f[0].returnData}),a=Ya({abi:CO,functionName:"rentPrice",data:f[1].returnData});return{base:r-a,premium:a}}return Ya({abi:Wh0,functionName:"rentPrice",data:t})},cAe=ai({encode:sAe,decode:lAe}),uAe=(e,{name:t,key:n})=>({to:_r,data:Pn({abi:K20,functionName:"text",args:[Sr(t),n]})}),dAe=async(e,t,{strict:n})=>{if(t==="0x")return null;try{return Ya({abi:K20,functionName:"text",data:t})||null}catch(f){if(n)throw f;return null}},OO=ai({encode:uAe,decode:dAe}),pAe=(e,{name:t,texts:n,coins:f,abi:r,contentHash:a})=>[...(n??[]).map(i=>({key:i,call:OO.encode(e,{name:t,key:i}),type:"text"})),...(f??[]).map(i=>({key:i,call:wO.encode(e,{name:t,coin:i}),type:"coin"})),...a?[{key:"contentHash",call:TO.encode(e,{name:t}),type:"contentHash"}]:[],...r?[{key:"abi",call:sO.encode(e,{name:t}),type:"abi"}]:[]],bAe=(e,{name:t,resolver:n,texts:f,coins:r,contentHash:a,abi:i,gatewayUrls:o})=>{const s=pAe(e,{name:t,texts:f,coins:r,contentHash:a,abi:i});if(n!=null&&n.address&&!n.fallbackOnly)return{...rl.encode(e,{transactions:s.map(d=>({to:n.address,data:d.call.data}))}),passthrough:{calls:s}};const l=Rf({client:e,contract:"ensUniversalResolver"}),c=[e8(Rv(t)),s.map(d=>d.call.data)];return{to:l,...o?{data:Pn({abi:ip0,functionName:"resolve",args:[...c,o]}),passthrough:{calls:s,args:[...c,o],address:l}}:{data:Pn({abi:VG,functionName:"resolve",args:c}),passthrough:{calls:s,args:c,address:l}}}},hAe=({texts:e,coins:t,abi:n,contentHash:f})=>({...e?{texts:[]}:{},...t?{coins:[]}:{},...f?{contentHash:null}:{},...n?{abi:null}:{}}),mAe=async(e,{item:t,call:n})=>{const{key:f,type:r}=n,a={key:f,type:r};if(r==="contentHash")try{const o=ES([{type:"bytes"}],t)[0];if(o==="0x"||hS(o)===0n)return{...a,value:null}}catch{}if(r==="text"){const o=await OO.decode(e,t,{strict:!1});return{...a,value:o}}if(r==="coin"){const o=await wO.decode(e,t,{coin:f,strict:!1});return{...a,value:o}}if(r==="contentHash"){const o=await TO.decode(e,t,{strict:!1});return{...a,value:o}}const i=await sO.decode(e,t,{strict:!1});return{...a,value:i}},yAe=(e,t)=>(t.type==="text"||t.type==="coin")&&!t.value?e:t.type==="text"?{...e,texts:[...e.texts||[],{key:t.key,value:t.value}]}:t.type==="coin"?{...e,coins:[...e.coins||[],t.value]}:t.type==="contentHash"?{...e,contentHash:t.value}:{...e,abi:t.value},gAe=async(e,t,n,{resolver:f,texts:r,coins:a,contentHash:i,abi:o,gatewayUrls:s})=>{const{calls:l}=n;let c=[],d;const p=hAe({texts:r,coins:a,contentHash:i,abi:o});if(f!=null&&f.address&&!f.fallbackOnly){const O=await rl.decode(e,t,n.calls.filter(L=>L).map(L=>L.call));d=f.address,c=O.map(L=>L.returnData)}else{if(!HG(t,{strict:!1,abi:s?ip0:VG,args:n.args,functionName:"resolve",address:n.address}))return{...p,resolverAddress:_r};const O=Ya({abi:VG,functionName:"resolve",data:t});[,d]=O,c=O[0].map((L,D)=>L.success?L.returnData:(l[D]=null,null))}const x=l.filter(O=>O),C=c.filter(O=>O);return(await Promise.all(C.map(async(O,L)=>mAe(e,{item:O,call:x[L]})))).reduce(yAe,{...p,resolverAddress:d})},vAe=ai({encode:bAe,decode:gAe}),wAe=(e,{name:t})=>{const n=Rf({client:e,contract:"ensUniversalResolver"}),f=[e8(Rv(t))];return{to:n,data:Pn({abi:UG,functionName:"findResolver",args:f}),passthrough:{address:n,args:f}}},AAe=async(e,t,n)=>{if(typeof t=="object")throw yv(t,{abi:UG,functionName:"findResolver",args:n.args,address:n.address});const f=Ya({abi:UG,functionName:"findResolver",data:t});return f[0]===_r?null:f[0]},xAe=ai({encode:wAe,decode:AAe}),EAe=(e,{name:t,key:n,gatewayUrls:f})=>{const r=OO.encode(e,{name:t,key:n});return Id.encode(e,{name:t,data:r.data,gatewayUrls:f})},TAe=async(e,t,n,{strict:f,gatewayUrls:r})=>{const a=await Id.decode(e,t,n,{strict:f,gatewayUrls:r});return a?OO.decode(e,a.data,{strict:f}):null},MAe=ai({encode:EAe,decode:TAe}),Bq={CANNOT_UNWRAP:1n,CANNOT_BURN_FUSES:2n,CANNOT_TRANSFER:4n,CANNOT_SET_RESOLVER:8n,CANNOT_SET_TTL:16n,CANNOT_CREATE_SUBDOMAIN:32n,CANNOT_APPROVE:64n},CAe=Object.keys(Bq),k9={PARENT_CANNOT_CONTROL:65536n,CAN_EXTEND_EXPIRY:262144n},SAe=Object.keys(k9);({...Bq,...k9});const Qh0={...k9,IS_DOT_ETH:131072n},OAe=Object.keys(Qh0),kAe=[128n,256n,512n,1024n,2048n,4096n,8192n,16384n,32768n],NAe=["0x80","0x100","0x200","0x400","0x800","0x1000","0x2000","0x4000","0x8000"],Yh0=[524288n,1048576n,2097152n,4194304n,8388608n,16777216n,33554432n,67108864n,134217728n,268435456n,536870912n,1073741824n,2147483648n],Kh0=["0x80000","0x100000","0x200000","0x400000","0x800000","0x1000000"],Zv={CHILD_CONTROLLED_FUSES:65535n,PARENT_CONTROLLED_FUSES:4294901760n,USER_SETTABLE_FUSES:4294836223n},Dq={Name:"child",Object:Bq,Keys:CAe,Range:Zv.CHILD_CONTROLLED_FUSES,Unnamed:kAe,UnnamedKeys:NAe,Minimum:0n,Maximum:2n**16n-1n},Jh0={Name:"parent",Object:k9,Keys:SAe,Range:Zv.PARENT_CONTROLLED_FUSES,Unnamed:Yh0,UnnamedKeys:Kh0,Minimum:2n**16n,Maximum:2n**32n},PAe={Name:"parent",Object:Qh0,Keys:OAe,Range:Zv.PARENT_CONTROLLED_FUSES,Unnamed:Yh0,UnnamedKeys:Kh0,Minimum:2n**16n,Maximum:2n**32n},Zh0=e=>{if(e>2n**32n||e<0n)throw new PG({fuses:e,details:`Fuse number must be limited to uint32, the supplied value was too ${e<0?"low":"high"}`});if((e&Zv.USER_SETTABLE_FUSES)!==e)throw new PG({fuses:e,details:"Fuse number must be limited to user settable fuses, the supplied value was not"})},Lq=({reference:e,object:t})=>{if(!t)return 0;if("number"in t){if("named"in t||"unnamed"in t)throw new $20({fuses:t,details:"Cannot specify both a fuse number and named/unnamed fuses."});if(Zh0(t.number),(t.number&e.Range)!==t.number)throw new PG({fuses:t.number,minimum:e.Minimum,maximum:e.Maximum,details:`Cannot specify a fuse value to set that is outside of the ${e.Name}'s control.`});return Number(t.number)}let n=0n;if("named"in t&&t.named)for(const f of t.named){if(!e.Keys.includes(f))throw new Bde({fuse:f});n|=e.Object[f]}if("unnamed"in t&&t.unnamed)for(const f of t.unnamed){if(!e.Unnamed.includes(f))throw new Dde({fuse:f});n|=f}return Number(n)},N9=({restriction:e,input:t})=>{if(e){if("parent"in t||"child"in t)throw new Rde({fuses:t,details:"Fuse restriction cannot be used when fuse category is specified"});return Lq({object:t,reference:e==="child"?Dq:Jh0})}if("number"in t){if("parent"in t||"child"in t)throw new $20({fuses:t,details:"Cannot specify both a fuse number and named/unnamed fuses."});return Zh0(t.number),Number(t.number)}const n="child"in t?Lq({object:t.child,reference:Dq}):0,f="parent"in t?Lq({object:t.parent,reference:Jh0}):0;return Number(n|f)},Xh0=({input:e,reference:t})=>({...Object.fromEntries(t.Keys.map(n=>[n,(e&t.Object[n])===t.Object[n]])),unnamed:Object.fromEntries(t.UnnamedKeys.map(n=>[n,(e&BigInt(n))===BigInt(n)]))}),jq=e=>{const t=BigInt(e);return{parent:Xh0({input:t,reference:PAe}),child:{...Xh0({input:t,reference:Dq}),CAN_DO_EVERYTHING:(t&Zv.CHILD_CONTROLLED_FUSES)===0n}}},IAe=(e,{name:t})=>{const n=Rf({client:e,contract:"ensNameWrapper"}),f=[BigInt(Sr(t))];return{to:n,data:Pn({abi:Jv,functionName:"getData",args:f}),passthrough:{address:n,args:f}}},RAe=async(e,t,n)=>{if(typeof t=="object")throw yv(t,{abi:Jv,functionName:"getData",args:n.args,address:n.address});const[f,r,a]=Ya({abi:Jv,functionName:"getData",data:t});if(f===_r)return null;const i=jq(r),o=a>0?Hh0(a):null;return{fuses:{...i,value:r},expiry:o?{date:o,value:a}:null,owner:f}},_h0=ai({encode:IAe,decode:RAe}),BAe=(e,{name:t})=>{const n=Rf({client:e,contract:"ensNameWrapper"}),f=[Sr(t)];return{to:n,data:Pn({abi:Iq,functionName:"names",args:f}),passthrough:{address:n,args:f}}},DAe=async(e,t,n)=>{if(typeof t=="object")throw yv(t,{abi:Iq,functionName:"names",args:n.args,address:n.address});const f=Ya({abi:Iq,functionName:"names",data:t});return!f||f==="0x"||BigInt(f)===0n?null:Wde(T1(f))},LAe=ai({encode:BAe,decode:DAe}),jAe=e=>({ensBatch:(...t)=>Cde(e,...t),getAbiRecord:t=>Zde(e,t),getAddressRecord:t=>Cq(e,t),getAvailable:t=>Zve(e,t),getContentHashRecord:t=>Rwe(e,t),getExpiry:t=>Xwe(e,t),getName:t=>eAe(e,t),getOwner:t=>fAe(e,t),getPrice:t=>cAe(e,t),getRecords:t=>vAe(e,t),getResolver:t=>xAe(e,t),getTextRecord:t=>MAe(e,t),getWrapperData:t=>_h0(e,t),getWrapperName:t=>LAe(e,t)}),Fq=JSON,FAe=e=>e.toUpperCase(),zAe=e=>{const t={};return e.forEach((n,f)=>{t[f]=n}),t},VAe=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},UAe=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0},HAe=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0};function kO(e,t){if(!e)throw new Error(t)}function GAe(e){return typeof e=="object"&&e!==null}function qAe(e,t){if(!e)throw new Error("Unexpected invariant triggered.")}const WAe=/\r\n|[\n\r]/g;function zq(e,t){let n=0,f=1;for(const r of e.body.matchAll(WAe)){if(typeof r.index=="number"||qAe(!1),r.index>=t)break;n=r.index+r[0].length,f+=1}return{line:f,column:t+1-n}}function QAe(e){return $h0(e.source,zq(e.source,e.start))}function $h0(e,t){const n=e.locationOffset.column-1,f="".padStart(n)+e.body,r=t.line-1,a=e.locationOffset.line-1,i=t.line+a,o=t.line===1?n:0,s=t.column+o,l=`${e.name}:${i}:${s} +`),{docsPath:t,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}function P20({chain:e,currentChainId:t}){if(!e)throw new soe;if(t!==e.id)throw new ooe({chain:e,currentChainId:t})}function Rue(e,{docsPath:t,...n}){const f=(()=>{const r=nH(e,n);return r instanceof CS?e:r})();return new voe(f,{docsPath:t,...n})}async function I20(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}async function Ja(e,t){var D,V,Y,i0;const{account:n=e.account,chain:f=e.chain,accessList:r,blobs:a,data:i,gas:o,gasPrice:s,maxFeePerBlobGas:l,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:p,to:x,value:C,...O}=t;if(!n)throw new nO({docsPath:"/docs/actions/wallet/sendTransaction"});const L=fs(n);try{gv(t);let m0;if(f!==null&&(m0=await C1(e,tO,"getChainId")({}),P20({currentChainId:m0,chain:f})),L.type==="local"){const I0=await C1(e,MG,"prepareTransactionRequest")({account:L,accessList:r,blobs:a,chain:f,chainId:m0,data:i,gas:o,gasPrice:s,maxFeePerBlobGas:l,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:p,parameters:[...N20,"sidecars"],to:x,value:C,...O}),z0=(D=f==null?void 0:f.serializers)==null?void 0:D.transaction,oe=await L.signTransaction(I0,{serializer:z0});return await C1(e,I20,"sendRawTransaction")({serializedTransaction:oe})}const A0=(i0=(Y=(V=e.chain)==null?void 0:V.formatters)==null?void 0:Y.transactionRequest)==null?void 0:i0.format,T0=(A0||SS)({...fH(O,{format:A0}),accessList:r,blobs:a,chainId:m0,data:i,from:L.address,gas:o,gasPrice:s,maxFeePerBlobGas:l,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:p,to:x,value:C});return await e.request({method:"eth_sendTransaction",params:[T0]},{retryCount:0})}catch(m0){throw Rue(m0,{...t,account:L,chain:t.chain||void 0})}}async function Bue(e,t){const{abi:n,address:f,args:r,dataSuffix:a,functionName:i,...o}=t,s=Pn({abi:n,args:r,functionName:i});return C1(e,Ja,"sendTransaction")({data:`${s}${a?a.replace("0x",""):""}`,to:f,...o})}async function Due(e,{chain:t}){const{id:n,name:f,nativeCurrency:r,rpcUrls:a,blockExplorers:i}=t;await e.request({method:"wallet_addEthereumChain",params:[{chainId:pa(n),chainName:f,nativeCurrency:r,rpcUrls:a.default.http,blockExplorerUrls:i?Object.values(i).map(({url:o})=>o):void 0}]},{dedupe:!0,retryCount:0})}const CG=256;let fO=CG,rO;function R20(e=11){if(!rO||fO+e>CG*2){rO="",fO=0;for(let t=0;t{const V=D(L);for(const i0 in C)delete V[i0];const Y={...L,...V};return Object.assign(Y,{extend:O(Y)})}}return Object.assign(C,{extend:O(C)})}const aO=new CU(8192);function Lue(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(aO.get(n))return aO.get(n);const f=e().finally(()=>aO.delete(n));return aO.set(n,f),f}function jue(e,{delay:t=100,retryCount:n=2,shouldRetry:f=()=>!0}={}){return new Promise((r,a)=>{const i=async({count:o=0}={})=>{const s=async({error:l})=>{const c=typeof t=="function"?t({count:o,error:l}):t;c&&await Iue(c),i({count:o+1})};try{const l=await e();r(l)}catch(l){if(o{const{dedupe:r=!1,retryDelay:a=150,retryCount:i=3,uid:o}={...t,...f},s=r?Cc(mS(`${o}.${V6(n)}`)):void 0;return Lue(()=>jue(async()=>{try{return await e(n)}catch(l){const c=l;switch(c.code){case nv.code:throw new nv(c);case fv.code:throw new fv(c);case rv.code:throw new rv(c);case av.code:throw new av(c);case r8.code:throw new r8(c);case iv.code:throw new iv(c);case ov.code:throw new ov(c);case sv.code:throw new sv(c);case lv.code:throw new lv(c);case cv.code:throw new cv(c);case r9.code:throw new r9(c);case uv.code:throw new uv(c);case a9.code:throw new a9(c);case dv.code:throw new dv(c);case pv.code:throw new pv(c);case bv.code:throw new bv(c);case hv.code:throw new hv(c);case mv.code:throw new mv(c);case 5e3:throw new a9(c);default:throw l instanceof on?l:new Moe(c)}}},{delay:({count:l,error:c})=>{var d;if(c&&c instanceof f8){const p=(d=c==null?void 0:c.headers)==null?void 0:d.get("Retry-After");if(p!=null&&p.match(/\d/))return Number.parseInt(p)*1e3}return~~(1<zue(l)}),{enabled:r,id:s})}}function zue(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===r9.code||e.code===r8.code:e instanceof f8&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function Vue({key:e,name:t,request:n,retryCount:f=3,retryDelay:r=150,timeout:a,type:i},o){const s=R20();return{config:{key:e,name:t,request:n,retryCount:f,retryDelay:r,timeout:a,type:i},request:Fue(n,{retryCount:f,retryDelay:r,uid:s}),value:o}}class Uue extends on{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}function Hue(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:f}){return new Promise((r,a)=>{(async()=>{let i;try{const o=new AbortController;n>0&&(i=setTimeout(()=>{f?o.abort():a(t)},n)),r(await e({signal:(o==null?void 0:o.signal)||null}))}catch(o){(o==null?void 0:o.name)==="AbortError"&&a(t),a(o)}finally{clearTimeout(i)}})()})}function Gue(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const D20=Gue();function que(e,t={}){return{async request(n){var d;const{body:f,onRequest:r=t.onRequest,onResponse:a=t.onResponse,timeout:i=t.timeout??1e4}=n,o={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:s,method:l,signal:c}=o;try{const p=await Hue(async({signal:C})=>{const O={...o,body:Array.isArray(f)?V6(f.map(D=>({jsonrpc:"2.0",id:D.id??D20.take(),...D}))):V6({jsonrpc:"2.0",id:f.id??D20.take(),...f}),headers:{"Content-Type":"application/json",...s},method:l||"POST",signal:c||(i>0?C:null)},L=new Request(e,O);return r&&await r(L),await fetch(e,O)},{errorInstance:new Eu0({body:f,url:e}),timeout:i,signal:!0});a&&await a(p);let x;if((d=p.headers.get("Content-Type"))!=null&&d.startsWith("application/json")?x=await p.json():(x=await p.text(),x=JSON.parse(x||"{}")),!p.ok)throw new f8({body:f,details:V6(x.error)||p.statusText,headers:p.headers,status:p.status,url:e});return x}catch(p){throw p instanceof f8||p instanceof Eu0?p:new f8({body:f,cause:p,url:e})}}}}function L20(e,t={}){const{batch:n,fetchOptions:f,key:r="http",name:a="HTTP JSON-RPC",onFetchRequest:i,onFetchResponse:o,retryDelay:s}=t;return({chain:l,retryCount:c,timeout:d})=>{const{batchSize:p=1e3,wait:x=0}=typeof n=="object"?n:{},C=t.retryCount??c,O=d??t.timeout??1e4,L=l==null?void 0:l.rpcUrls.default.http[0];if(!L)throw new Uue;const D=que(L,{fetchOptions:f,onRequest:i,onResponse:o,timeout:O});return Vue({key:r,name:a,async request({method:V,params:Y}){const i0={method:V,params:Y},{schedule:m0}=Mu0({id:L,wait:x,shouldSplitBatch(z0){return z0.length>p},fn:z0=>D.request({body:z0}),sort:(z0,oe)=>z0.id-oe.id}),A0=async z0=>n?m0(z0):[await D.request({body:z0})],[{error:T0,result:I0}]=await A0(i0);if(T0)throw new xu0({body:i0,error:T0,url:L});return I0},retryCount:C,retryDelay:s,timeout:O,type:"http"},{fetchOptions:f,url:L})}}class Wue extends on{constructor({callbackSelector:t,cause:n,data:f,extraData:r,sender:a,urls:i}){var o;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(o=n.metaMessages)!=null&&o.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(s=>` ${Wg(s)}`)],` Sender: ${a}`,` Data: ${f}`,` Callback selector: ${t}`,` Extra data: ${r}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class Que extends on{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Wg(n)}`,`Response: ${V6(t)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class Yue extends on{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function Kue(e,t){if(!F6(e,{strict:!1}))throw new Ad({address:e});if(!F6(t,{strict:!1}))throw new Ad({address:t});return e.toLowerCase()===t.toLowerCase()}const Jue="0x556f1830",j20={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function F20(e,{blockNumber:t,blockTag:n,data:f,to:r}){const{args:a}=HU({data:f,abi:[j20]}),[i,o,s,l,c]=a,{ccipRead:d}=e,p=d&&typeof(d==null?void 0:d.request)=="function"?d.request:z20;try{if(!Kue(r,i))throw new Yue({sender:i,to:r});const x=await p({data:s,sender:i,urls:o}),{data:C}=await Ou0(e,{blockNumber:t,blockTag:n,data:Oc([l,Xg([{type:"bytes"},{type:"bytes"}],[x,c])]),to:r});return C}catch(x){throw new Wue({callbackSelector:l,cause:x,data:f,extraData:c,sender:i,urls:o})}}async function z20({data:e,sender:t,urls:n}){var r;let f=new Error("An unknown error occurred.");for(let a=0;a{const c={...l};for(const d of s){const{name:p,type:x}=d;x==="address"&&(c[p]=c[p].toLowerCase())}return c},i=r.EIP712Domain?t?a(r.EIP712Domain,t):{}:{},o=(()=>{if(f!=="EIP712Domain")return a(r[f],n)})();return V6({domain:i,message:o,primaryType:f,types:r})}function ede(e){const{domain:t,message:n,primaryType:f,types:r}=e,a=(i,o)=>{for(const s of i){const{name:l,type:c}=s,d=o[l],p=c.match(_ue);if(p&&(typeof d=="number"||typeof d=="bigint")){const[O,L,D]=p;pa(d,{signed:L==="int",size:Number.parseInt(D)/8})}if(c==="address"&&typeof d=="string"&&!F6(d))throw new Ad({address:d});const x=c.match(Xue);if(x){const[O,L]=x;if(L&&mi(d)!==Number.parseInt(L))throw new nae({expectedSize:Number.parseInt(L),givenSize:mi(d)})}const C=r[c];C&&a(C,d)}};r.EIP712Domain&&t&&a(r.EIP712Domain,t),f!=="EIP712Domain"&&a(r[f],n)}function tde({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}const nde=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),U20=new Uint8Array(new Array(16).fill(0).map((e,t)=>t)),fde=U20.map(e=>(9*e+5)%16);let SG=[U20],OG=[fde];for(let e=0;e<4;e++)for(let t of[SG,OG])t.push(t[e].map(n=>nde[n]));const H20=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>new Uint8Array(e)),rde=SG.map((e,t)=>e.map(n=>H20[t][n])),ade=OG.map((e,t)=>e.map(n=>H20[t][n])),ide=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),ode=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function G20(e,t,n,f){return e===0?t^n^f:e===1?t&n|~t&f:e===2?(t|~n)^f:e===3?t&f|n&~f:t^(n|~f)}const iO=new Uint32Array(16);class sde extends EG{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:n,h2:f,h3:r,h4:a}=this;return[t,n,f,r,a]}set(t,n,f,r,a){this.h0=t|0,this.h1=n|0,this.h2=f|0,this.h3=r|0,this.h4=a|0}process(t,n){for(let x=0;x<16;x++,n+=4)iO[x]=t.getUint32(n,!0);let f=this.h0|0,r=f,a=this.h1|0,i=a,o=this.h2|0,s=o,l=this.h3|0,c=l,d=this.h4|0,p=d;for(let x=0;x<5;x++){const C=4-x,O=ide[x],L=ode[x],D=SG[x],V=OG[x],Y=rde[x],i0=ade[x];for(let m0=0;m0<16;m0++){const A0=gS(f+G20(x,a,o,l)+iO[D[m0]]+O,Y[m0])+d|0;f=d,d=l,l=gS(o,10)|0,o=a,a=A0}for(let m0=0;m0<16;m0++){const A0=gS(r+G20(C,i,s,c)+iO[V[m0]]+L,i0[m0])+p|0;r=p,p=c,c=gS(s,10)|0,s=i,i=A0}}this.set(this.h1+o+c|0,this.h2+l+p|0,this.h3+d+r|0,this.h4+f+i|0,this.h0+a+s|0)}roundClean(){iO.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const lde=wS(()=>new sde);class q20 extends vS{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,yae(t);const f=Mc(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,a=new Uint8Array(r);a.set(f.length>r?t.create().update(f).digest():f);for(let i=0;inew q20(e,t).update(n).digest();W20.create=(e,t)=>new q20(e,t);function cde(e,t){const{abi:n,args:f,bytecode:r,...a}=t,i=YU({abi:n,args:f,bytecode:r});return Ja(e,{...a,data:i})}async function ude(e){var t;return((t=e.account)==null?void 0:t.type)==="local"?[e.account.address]:(await e.request({method:"eth_accounts"},{dedupe:!0})).map(n=>AS(n))}async function dde(e){return await e.request({method:"wallet_getPermissions"},{dedupe:!0})}async function pde(e){return(await e.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(t=>t9(t))}async function bde(e,t){return e.request({method:"wallet_requestPermissions",params:[t]},{retryCount:0})}async function hde(e,{account:t=e.account,message:n}){if(!t)throw new nO({docsPath:"/docs/actions/wallet/signMessage"});const f=fs(t);if(f.type==="local")return f.signMessage({message:n});const r=typeof n=="string"?mS(n):n.raw instanceof Uint8Array?e8(n.raw):n.raw;return e.request({method:"personal_sign",params:[r,f.address]},{retryCount:0})}async function mde(e,t){var s,l,c,d,p;const{account:n=e.account,chain:f=e.chain,...r}=t;if(!n)throw new nO({docsPath:"/docs/actions/wallet/signTransaction"});const a=fs(n);gv({account:a,...t});const i=await C1(e,tO,"getChainId")({});f!==null&&P20({currentChainId:i,chain:f});const o=((c=(l=(f==null?void 0:f.formatters)||((s=e.chain)==null?void 0:s.formatters))==null?void 0:l.transactionRequest)==null?void 0:c.format)||SS;return a.type==="local"?a.signTransaction({...r,chainId:i},{serializer:(p=(d=e.chain)==null?void 0:d.serializers)==null?void 0:p.transaction}):await e.request({method:"eth_signTransaction",params:[{...o(r),chainId:pa(i),from:a.address}]},{retryCount:0})}async function yde(e,t){const{account:n=e.account,domain:f,message:r,primaryType:a}=t;if(!n)throw new nO({docsPath:"/docs/actions/wallet/signTypedData"});const i=fs(n),o={EIP712Domain:tde({domain:f}),...t.types};if(ede({domain:f,message:r,primaryType:a,types:o}),i.type==="local")return i.signTypedData({domain:f,message:r,primaryType:a,types:o});const s=$ue({domain:f,message:r,primaryType:a,types:o});return e.request({method:"eth_signTypedData_v4",params:[i.address,s]},{retryCount:0})}async function gde(e,{id:t}){await e.request({method:"wallet_switchEthereumChain",params:[{chainId:pa(t)}]},{retryCount:0})}async function vde(e,t){return await e.request({method:"wallet_watchAsset",params:t},{retryCount:0})}function wde(e){return{addChain:t=>Due(e,t),deployContract:t=>cde(e,t),getAddresses:()=>ude(e),getChainId:()=>tO(e),getPermissions:()=>dde(e),prepareTransactionRequest:t=>MG(e,t),requestAddresses:()=>pde(e),requestPermissions:t=>bde(e,t),sendRawTransaction:t=>I20(e,t),sendTransaction:t=>Ja(e,t),signMessage:t=>hde(e,t),signTransaction:t=>mde(e,t),signTypedData:t=>yde(e,t),switchChain:t=>gde(e,t),watchAsset:t=>vde(e,t),writeContract:t=>Bue(e,t)}}function Ade(e){const{key:t="wallet",name:n="Wallet Client",transport:f}=e;return B20({...e,key:t,name:n,transport:f,type:"walletClient"}).extend(wde)}const ai=({encode:e,decode:t})=>{const n=async function(f,...r){const{passthrough:a,...i}=e(f,...r),o=await Ou0(f,i).then(s=>s.data).catch(s=>{if(!(s instanceof on))throw s;return s});return a?t(f,o,a,...r):t(f,o,...r)};return n.batch=(...f)=>({args:f,encode:e,decode:t}),n.encode=e,n.decode=t,n},Rf=({blockNumber:e,client:t,contract:n})=>hu0({blockNumber:e,chain:t.chain,contract:n}),kG=[{inputs:[{name:"requireSuccess",type:"bool"},{components:[{name:"target",type:"address"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"tryAggregate",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"payable",type:"function"}],Q20=[{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],xde=(e,{transactions:t,requireSuccess:n=!1})=>({to:Rf({client:e,contract:"multicall3"}),data:Pn({abi:kG,functionName:"tryAggregate",args:[n,t.map(f=>({target:f.to,callData:f.data}))]})}),Ede=async(e,t,n)=>{if(typeof t=="object")throw yv(t,{abi:kG,functionName:"tryAggregate",args:[]});const f=Ya({abi:kG,functionName:"tryAggregate",data:t});return await Promise.all(f.map(async({success:r,returnData:a},i)=>{let o={success:r,returnData:a};if(!r&&a.startsWith("0x556f1830"))try{const s=await F20(e,{to:n[i].to,data:a});s&&(o={success:!0,returnData:s})}catch{}return o}))},rl=ai({encode:xde,decode:Ede}),Tde=(e,...t)=>{const n=t.map(({args:f,encode:r},a)=>{if(!r)throw new iue({functionIndex:a});return r(e,...f)});return{...rl.encode(e,{transactions:n}),passthrough:n}},Mde=async(e,t,n,...f)=>{const r=await rl.decode(e,t,n);if(!r)throw new Error("No response from multicall");return Promise.all(r.map((a,i)=>n[i].passthrough?f[i].decode(e,a.returnData,n[i].passthrough,...f[i].args):f[i].decode(e,a.returnData,...f[i].args)))},Cde=ai({encode:Tde,decode:Mde}),Y20=[{inputs:[{name:"node",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"}],NG=[{inputs:[{name:"node",type:"bytes32"},{name:"coinType",type:"uint256"}],name:"addr",outputs:[{name:"",type:"bytes"}],stateMutability:"view",type:"function"}],K20=[{inputs:[{name:"node",type:"bytes32"},{name:"key",type:"string"}],name:"text",outputs:[{name:"",type:"string"}],stateMutability:"view",type:"function"}],J20=[{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"}],Z20=[{inputs:[{name:"node",type:"bytes32"},{name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{name:"",type:"uint256"},{name:"",type:"bytes"}],stateMutability:"view",type:"function"}],Sde=[{inputs:[{name:"node",type:"bytes32"},{name:"key",type:"string"},{name:"value",type:"string"}],name:"setText",outputs:[],stateMutability:"nonpayable",type:"function"}],Ode=[{inputs:[{name:"node",type:"bytes32"},{name:"coinType",type:"uint256"},{name:"a",type:"bytes"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"}],kde=[{inputs:[{name:"node",type:"bytes32"},{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],name:"setABI",outputs:[],stateMutability:"nonpayable",type:"function"}],Nde=[{inputs:[{name:"node",type:"bytes32"},{name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],stateMutability:"nonpayable",type:"function"}],Pde=[{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"clearRecords",outputs:[],stateMutability:"nonpayable",type:"function"}],Ide=[{inputs:[{name:"data",type:"bytes[]"}],name:"multicall",outputs:[{name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"}],_r="0x0000000000000000000000000000000000000000";BigInt("18446744073709551615");const X20=864e13,_20=7776e3;class PG extends ia{constructor({fuses:t,minimum:n=0n,maximum:f=2n**32n,details:r}){super("Fuse value out of range",{metaMessages:[`- Fuse value: ${t}`,`- Allowed range: ${n}-${f}`],details:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FusesOutOfRangeError"})}}class Rde extends ia{constructor({fuses:t,details:n}){super("Restriction not allowed",{metaMessages:[`- Fuse value: ${t}`],details:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FusesRestrictionNotAllowed"})}}class $20 extends ia{constructor({fuses:t,details:n}){super("Invalid fuse value",{metaMessages:[`- Fuse value: ${t}`],details:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FusesInvalidFuseObjectError"})}}class Bde extends ia{constructor({fuse:t}){super(`${t} is not a valid named fuse`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FusesInvalidNamedFuseError"})}}class Dde extends ia{constructor({fuse:t}){super(`${t} is not a valid unnamed fuse`,{metaMessages:["- If you are trying to set a named fuse, use the named property"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FusesInvalidUnnamedFuseError"})}}class ep0 extends ia{constructor({label:t,details:n}){super("Invalid encoded label",{metaMessages:[`- Supplied label: ${t}`],details:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidEncodedLabelError"})}}class tp0 extends ia{constructor({labelhash:t,details:n}){super("Invalid labelhash",{metaMessages:[`- Supplied labelhash: ${t}`],details:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidLabelhashError"})}}class Lde extends ia{constructor({label:t,byteLength:n}){super("Supplied label was too long",{metaMessages:[`- Supplied label: ${t}`,"- Max byte length: 255",`- Actual byte length: ${n}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WrappedLabelTooLargeError"})}}class IG extends ia{constructor(){super("Invalid content hash"),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidContentHashError"})}}class jde extends ia{constructor({data:t}){super("Resolver address is required when data is supplied",{metaMessages:["Supplied data:",...Object.entries(t).map(([n,f])=>`- ${n}: ${f}`)]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResolverAddressRequiredError"})}}const Fde=typeof localStorage<"u";function RG(e){if(!(e.startsWith("[")&&e.endsWith("]")))throw new ep0({label:e,details:"Expected encoded labelhash to start and end with square brackets"});if(e.length!==66)throw new ep0({label:e,details:"Expected encoded labelhash to have a length of 66"});return`0x${e.slice(1,-1)}`}function np0(e){if(!e.startsWith("0x"))throw new tp0({labelhash:e,details:"Expected labelhash to start with 0x"});if(e.length!==66)throw new tp0({labelhash:e,details:"Expected labelhash to have a length of 66"});return`[${e.slice(2)}]`}function oO(e){return e.startsWith("[")&&e.endsWith("]")&&e.length===66}function zde(){return Fde?JSON.parse(localStorage.getItem("ensjs:labels"))||{}:{}}function Vde(e){const t=zde();return oO(e)&&t[RG(e)]||e}function BG(e){return!(e!=null&&e.includes("["))}function Ude(e){return e.split(".").map(t=>Vde(t)).join(".")}new Uint8Array(32).fill(0);const fp0=e=>e&&vo0(e);function Sr(e){let t=new Uint8Array(32).fill(0);if(!e)return yi(t);const n=e.split(".");for(let f=n.length-1;f>=0;f-=1){let r;if(oO(n[f]))r=T1(RG(n[f]));else{const a=fp0(n[f]);r=Cc(Ac(a),"bytes")}t=Cc(Oc([t,r]),"bytes")}return yi(t)}const Hde=(e,{name:t,supportedContentTypes:n=15n})=>({to:_r,data:Pn({abi:Z20,functionName:"ABI",args:[Sr(t),n]})}),Gde=async(e,t,{strict:n})=>{if(t==="0x")return null;try{const[f,r]=Ya({abi:Z20,functionName:"ABI",data:t});if(!f||!r)return null;const a=Number(f);if(!a)return null;let i,o=!1;switch(a){case 1:i=JSON.parse(wU(r)),o=!0;break;case 2:{const{inflate:s}=await WU(async()=>{const{inflate:l}=await import("./pako_inflate.min-BGiCGMdN.js").then(c=>c.p);return{inflate:l}},[]);i=JSON.parse(s(T1(r),{to:"string"})),o=!0;break}case 4:{const{cborDecode:s}=await WU(async()=>{const{cborDecode:l}=await Promise.resolve().then(()=>mIe);return{cborDecode:l}},void 0);i=await s(T1(r).buffer),o=!0;break}case 8:i=wU(r),o=!0;break;default:try{i=wU(r),o=!0}catch{i=r}}return{contentType:a,decoded:o,abi:i}}catch(f){if(n)throw f;return null}},sO=ai({encode:Hde,decode:Gde}),b8=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],DG={inputs:[{name:"reverseName",type:"bytes"}],name:"reverse",outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}],stateMutability:"view",type:"function"},LG=[...b8,DG],rp0=[...b8,{...DG,inputs:[...DG.inputs,{name:"gateways",type:"string[]"}]}],jG={inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],name:"resolve",outputs:[{name:"data",type:"bytes"},{name:"resolver",type:"address"}],stateMutability:"view",type:"function"},FG=[...b8,jG],ap0=[...b8,{...jG,inputs:[...jG.inputs,{name:"gateways",type:"string[]"}]}],zG={inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes[]"}],name:"resolve",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"",type:"tuple[]"},{name:"",type:"address"}],stateMutability:"view",type:"function"},VG=[...b8,zG],ip0=[...b8,{...zG,inputs:[...zG.inputs,{name:"gateways",type:"string[]"}]}],UG=[...b8,{inputs:[{name:"name",type:"bytes"}],name:"findResolver",outputs:[{name:"",type:"address"},{name:"",type:"bytes32"}],stateMutability:"view",type:"function"}],qde=e=>{if(!(e instanceof on))return;const t=e.walk(),n=typeof t.data=="object"?t.data.data:t.data;if(n!=="0x")return n},HG=(e,{strict:t,abi:n,args:f,functionName:r,address:a,docsPath:i,sender:o})=>{if(typeof e=="object"){if(!t){const s=qde(e);if(s)try{return HU({abi:n,data:s}),!1}catch{}}throw e instanceof vu0?e:yv(e,{abi:n,args:typeof f=="function"?f():f,functionName:r,address:a,docsPath:i,sender:o})}return!0};function Rv(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Ac(t).byteLength+2);let f=0;const r=t.split(".");for(let a=0;a255&&(i=Ac(np0(U6(r[a])))),n[f]=i.length,n.set(i,f+1),f+=i.length+1}return n.byteLength!==f+1?n.slice(0,f+1):n}function Wde(e){let t=0,n="";for(;t{const r=t.split(".").map(o=>Kg(o).byteLength>255?np0(U6(o)):o).join("."),a=Rf({client:e,contract:"ensUniversalResolver"}),i=[e8(Rv(r)),n];return{to:a,...f!=null&&f.length?{data:Pn({abi:ap0,functionName:"resolve",args:[...i,f]}),passthrough:{args:[...i,f],address:a}}:{data:Pn({abi:FG,functionName:"resolve",args:i}),passthrough:{args:i,address:a}}}},Yde=async(e,t,n,{strict:f,gatewayUrls:r})=>{if(!HG(t,{strict:f,abi:r?ap0:FG,args:n.args,functionName:"resolve",address:n.address}))return null;try{const a=Ya({abi:FG,functionName:"resolve",data:t});return{data:a[0],resolver:a[1]}}catch(a){if(f)throw a;return null}},Id=ai({encode:Qde,decode:Yde}),Kde=(e,{name:t,supportedContentTypes:n,gatewayUrls:f})=>{const r=sO.encode(e,{name:t,supportedContentTypes:n});return Id.encode(e,{name:t,data:r.data,gatewayUrls:f})},Jde=async(e,t,n,{strict:f,gatewayUrls:r})=>{const a=await Id.decode(e,t,n,{strict:f,gatewayUrls:r});return a?sO.decode(e,a.data,{strict:f}):null},Zde=ai({encode:Kde,decode:Jde}),op0=BigInt(0),lO=BigInt(1),Xde=BigInt(2);function h8(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Bv(e){if(!h8(e))throw new Error("Uint8Array expected")}const _de=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function w9(e){Bv(e);let t="";for(let n=0;n=Ic._0&&e<=Ic._9)return e-Ic._0;if(e>=Ic._A&&e<=Ic._F)return e-(Ic._A-10);if(e>=Ic._a&&e<=Ic._f)return e-(Ic._a-10)}function A9(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const f=new Uint8Array(n);for(let r=0,a=0;rop0;e>>=lO,t+=1);return t}function n2e(e,t){return e>>BigInt(t)&lO}function f2e(e,t,n){return e|(n?lO:op0)<(Xde<new Uint8Array(e),cp0=e=>Uint8Array.from(e);function up0(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let f=YG(e),r=YG(e),a=0;const i=()=>{f.fill(1),r.fill(0),a=0},o=(...c)=>n(r,f,...c),s=(c=YG())=>{r=o(cp0([0]),c),f=o(),c.length!==0&&(r=o(cp0([1]),c),f=o())},l=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let c=0;const d=[];for(;c{i(),s(c);let p;for(;!(p=d(l()));)s();return i(),p}}const r2e={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||h8(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Lv(e,t,n={}){const f=(r,a,i)=>{const o=r2e[a];if(typeof o!="function")throw new Error(`Invalid validator "${a}", expected function`);const s=e[r];if(!(i&&s===void 0)&&!o(s,e))throw new Error(`Invalid param ${String(r)}=${s} (${typeof s}), expected ${a}`)};for(const[r,a]of Object.entries(t))f(r,a,!1);for(const[r,a]of Object.entries(n))f(r,a,!0);return e}const a2e=Object.freeze(Object.defineProperty({__proto__:null,abytes:Bv,bitGet:n2e,bitLen:t2e,bitMask:QG,bitSet:f2e,bytesToHex:w9,bytesToNumberBE:m8,bytesToNumberLE:qG,concatBytes:Dv,createHmacDrbg:up0,ensureBytes:Q6,equalBytes:N1,hexToBytes:A9,hexToNumber:GG,isBytes:h8,numberToBytesBE:x9,numberToBytesLE:WG,numberToHexUnpadded:sp0,numberToVarBytesBE:$de,utf8ToBytes:e2e,validateObject:Lv},Symbol.toStringTag,{value:"Module"})),Ii=BigInt(0),Za=BigInt(1),y8=BigInt(2),i2e=BigInt(3),KG=BigInt(4),dp0=BigInt(5),pp0=BigInt(8);BigInt(9),BigInt(16);function P1(e,t){const n=e%t;return n>=Ii?n:t+n}function o2e(e,t,n){if(n<=Ii||t 0");if(n===Za)return Ii;let f=Za;for(;t>Ii;)t&Za&&(f=f*e%n),e=e*e%n,t>>=Za;return f}function qs(e,t,n){let f=e;for(;t-- >Ii;)f*=f,f%=n;return f}function JG(e,t){if(e===Ii||t<=Ii)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=P1(e,t),f=t,r=Ii,a=Za;for(;n!==Ii;){const i=f/n,o=f%n,s=r-a*i;f=n,n=o,r=a,a=s}if(f!==Za)throw new Error("invert: does not exist");return P1(r,t)}function s2e(e){const t=(e-Za)/y8;let n,f,r;for(n=e-Za,f=0;n%y8===Ii;n/=y8,f++);for(r=y8;r(f[r]="function",f),t);return Lv(e,n)}function d2e(e,t,n){if(n 0");if(n===Ii)return e.ONE;if(n===Za)return t;let f=e.ONE,r=t;for(;n>Ii;)n&Za&&(f=e.mul(f,r)),r=e.sqr(r),n>>=Za;return f}function p2e(e,t){const n=new Array(t.length),f=t.reduce((a,i,o)=>e.is0(i)?a:(n[o]=a,e.mul(a,i)),e.ONE),r=e.inv(f);return t.reduceRight((a,i,o)=>e.is0(i)?a:(n[o]=e.mul(a,n[o]),e.mul(a,i)),r),n}function bp0(e,t){const n=t!==void 0?t:e.toString(2).length,f=Math.ceil(n/8);return{nBitLength:n,nByteLength:f}}function b2e(e,t,n=!1,f={}){if(e<=Ii)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:r,nByteLength:a}=bp0(e,t);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const i=l2e(e),o=Object.freeze({ORDER:e,BITS:r,BYTES:a,MASK:QG(r),ZERO:Ii,ONE:Za,create:s=>P1(s,e),isValid:s=>{if(typeof s!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof s}`);return Ii<=s&&ss===Ii,isOdd:s=>(s&Za)===Za,neg:s=>P1(-s,e),eql:(s,l)=>s===l,sqr:s=>P1(s*s,e),add:(s,l)=>P1(s+l,e),sub:(s,l)=>P1(s-l,e),mul:(s,l)=>P1(s*l,e),pow:(s,l)=>d2e(o,s,l),div:(s,l)=>P1(s*JG(l,e),e),sqrN:s=>s*s,addN:(s,l)=>s+l,subN:(s,l)=>s-l,mulN:(s,l)=>s*l,inv:s=>JG(s,e),sqrt:f.sqrt||(s=>i(o,s)),invertBatch:s=>p2e(o,s),cmov:(s,l,c)=>c?l:s,toBytes:s=>n?WG(s,a):x9(s,a),fromBytes:s=>{if(s.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${s.length}`);return n?qG(s):m8(s)}});return Object.freeze(o)}function hp0(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function mp0(e){const t=hp0(e);return t+Math.ceil(t/2)}function h2e(e,t,n=!1){const f=e.length,r=hp0(t),a=mp0(t);if(f<16||f1024)throw new Error(`expected ${a}-1024 bytes of input, got ${f}`);const i=n?m8(e):qG(e),o=P1(i,t-Za)+Za;return n?WG(o,r):x9(o,r)}const m2e=BigInt(0),ZG=BigInt(1);function y2e(e,t){const n=(r,a)=>{const i=a.negate();return r?i:a},f=r=>{const a=Math.ceil(t/r)+1,i=2**(r-1);return{windows:a,windowSize:i}};return{constTimeNegate:n,unsafeLadder(r,a){let i=e.ZERO,o=r;for(;a>m2e;)a&ZG&&(i=i.add(o)),o=o.double(),a>>=ZG;return i},precomputeWindow(r,a){const{windows:i,windowSize:o}=f(a),s=[];let l=r,c=l;for(let d=0;d>=x,L>s&&(L-=p,i+=ZG);const D=O,V=O+Math.abs(L)-1,Y=C%2!==0,i0=L<0;L===0?c=c.add(n(Y,a[D])):l=l.add(n(i0,a[V]))}return{p:l,f:c}},wNAFCached(r,a,i,o){const s=r._WINDOW_SIZE||1;let l=a.get(r);return l||(l=this.precomputeWindow(r,s),s!==1&&a.set(r,o(l))),this.wNAF(s,l,i)}}}function yp0(e){return u2e(e.Fp),Lv(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...bp0(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function g2e(e){const t=yp0(e);Lv(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:f,a:r}=t;if(n){if(!f.eql(r,f.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:v2e,hexToBytes:w2e}=a2e,g8={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=g8;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const n=e[1],f=e.subarray(2,n+2);if(!n||f.length!==n)throw new t("Invalid signature integer: wrong length");if(f[0]&128)throw new t("Invalid signature integer: negative");if(f[0]===0&&!(f[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:v2e(f),l:e.subarray(n+2)}},toSig(e){const{Err:t}=g8,n=typeof e=="string"?w2e(e):e;Bv(n);let f=n.length;if(f<2||n[0]!=48)throw new t("Invalid signature tag");if(n[1]!==f-2)throw new t("Invalid signature: incorrect length");const{d:r,l:a}=g8._parseInt(n.subarray(2)),{d:i,l:o}=g8._parseInt(a);if(o.length)throw new t("Invalid signature: left bytes after parsing");return{r,s:i}},hexFromSig(e){const t=l=>Number.parseInt(l[0],16)&8?"00"+l:l,n=l=>{const c=l.toString(16);return c.length&1?`0${c}`:c},f=t(n(e.s)),r=t(n(e.r)),a=f.length/2,i=r.length/2,o=n(a),s=n(i);return`30${n(i+a+4)}02${s}${r}02${o}${f}`}},Rc=BigInt(0),Ws=BigInt(1);BigInt(2);const gp0=BigInt(3);BigInt(4);function A2e(e){const t=g2e(e),{Fp:n}=t,f=t.toBytes||((C,O,L)=>{const D=O.toAffine();return Dv(Uint8Array.from([4]),n.toBytes(D.x),n.toBytes(D.y))}),r=t.fromBytes||(C=>{const O=C.subarray(1),L=n.fromBytes(O.subarray(0,n.BYTES)),D=n.fromBytes(O.subarray(n.BYTES,2*n.BYTES));return{x:L,y:D}});function a(C){const{a:O,b:L}=t,D=n.sqr(C),V=n.mul(D,C);return n.add(n.add(V,n.mul(C,O)),L)}if(!n.eql(n.sqr(t.Gy),a(t.Gx)))throw new Error("bad generator point: equation left != right");function i(C){return typeof C=="bigint"&&Rcn.eql(Y,n.ZERO);return V(L)&&V(D)?d.ZERO:new d(L,D,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(O){const L=n.invertBatch(O.map(D=>D.pz));return O.map((D,V)=>D.toAffine(L[V])).map(d.fromAffine)}static fromHex(O){const L=d.fromAffine(r(Q6("pointHex",O)));return L.assertValidity(),L}static fromPrivateKey(O){return d.BASE.multiply(s(O))}_setWindowSize(O){this._WINDOW_SIZE=O,l.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:O,y:L}=this.toAffine();if(!n.isValid(O)||!n.isValid(L))throw new Error("bad point: x or y not FE");const D=n.sqr(L),V=a(O);if(!n.eql(D,V))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:O}=this.toAffine();if(n.isOdd)return!n.isOdd(O);throw new Error("Field doesn't support isOdd")}equals(O){c(O);const{px:L,py:D,pz:V}=this,{px:Y,py:i0,pz:m0}=O,A0=n.eql(n.mul(L,m0),n.mul(Y,V)),T0=n.eql(n.mul(D,m0),n.mul(i0,V));return A0&&T0}negate(){return new d(this.px,n.neg(this.py),this.pz)}double(){const{a:O,b:L}=t,D=n.mul(L,gp0),{px:V,py:Y,pz:i0}=this;let m0=n.ZERO,A0=n.ZERO,T0=n.ZERO,I0=n.mul(V,V),z0=n.mul(Y,Y),oe=n.mul(i0,i0),ae=n.mul(V,Y);return ae=n.add(ae,ae),T0=n.mul(V,i0),T0=n.add(T0,T0),m0=n.mul(O,T0),A0=n.mul(D,oe),A0=n.add(m0,A0),m0=n.sub(z0,A0),A0=n.add(z0,A0),A0=n.mul(m0,A0),m0=n.mul(ae,m0),T0=n.mul(D,T0),oe=n.mul(O,oe),ae=n.sub(I0,oe),ae=n.mul(O,ae),ae=n.add(ae,T0),T0=n.add(I0,I0),I0=n.add(T0,I0),I0=n.add(I0,oe),I0=n.mul(I0,ae),A0=n.add(A0,I0),oe=n.mul(Y,i0),oe=n.add(oe,oe),I0=n.mul(oe,ae),m0=n.sub(m0,I0),T0=n.mul(oe,z0),T0=n.add(T0,T0),T0=n.add(T0,T0),new d(m0,A0,T0)}add(O){c(O);const{px:L,py:D,pz:V}=this,{px:Y,py:i0,pz:m0}=O;let A0=n.ZERO,T0=n.ZERO,I0=n.ZERO;const z0=t.a,oe=n.mul(t.b,gp0);let ae=n.mul(L,Y),ye=n.mul(D,i0),P=n.mul(V,m0),F=n.add(L,D),Q=n.add(Y,i0);F=n.mul(F,Q),Q=n.add(ae,ye),F=n.sub(F,Q),Q=n.add(L,V);let H=n.add(Y,m0);return Q=n.mul(Q,H),H=n.add(ae,P),Q=n.sub(Q,H),H=n.add(D,V),A0=n.add(i0,m0),H=n.mul(H,A0),A0=n.add(ye,P),H=n.sub(H,A0),I0=n.mul(z0,Q),A0=n.mul(oe,P),I0=n.add(A0,I0),A0=n.sub(ye,I0),I0=n.add(ye,I0),T0=n.mul(A0,I0),ye=n.add(ae,ae),ye=n.add(ye,ae),P=n.mul(z0,P),Q=n.mul(oe,Q),ye=n.add(ye,P),P=n.sub(ae,P),P=n.mul(z0,P),Q=n.add(Q,P),ae=n.mul(ye,Q),T0=n.add(T0,ae),ae=n.mul(H,Q),A0=n.mul(F,A0),A0=n.sub(A0,ae),ae=n.mul(F,ye),I0=n.mul(H,I0),I0=n.add(I0,ae),new d(A0,T0,I0)}subtract(O){return this.add(O.negate())}is0(){return this.equals(d.ZERO)}wNAF(O){return x.wNAFCached(this,l,O,L=>{const D=n.invertBatch(L.map(V=>V.pz));return L.map((V,Y)=>V.toAffine(D[Y])).map(d.fromAffine)})}multiplyUnsafe(O){const L=d.ZERO;if(O===Rc)return L;if(o(O),O===Ws)return this;const{endo:D}=t;if(!D)return x.unsafeLadder(this,O);let{k1neg:V,k1:Y,k2neg:i0,k2:m0}=D.splitScalar(O),A0=L,T0=L,I0=this;for(;Y>Rc||m0>Rc;)Y&Ws&&(A0=A0.add(I0)),m0&Ws&&(T0=T0.add(I0)),I0=I0.double(),Y>>=Ws,m0>>=Ws;return V&&(A0=A0.negate()),i0&&(T0=T0.negate()),T0=new d(n.mul(T0.px,D.beta),T0.py,T0.pz),A0.add(T0)}multiply(O){o(O);let L=O,D,V;const{endo:Y}=t;if(Y){const{k1neg:i0,k1:m0,k2neg:A0,k2:T0}=Y.splitScalar(L);let{p:I0,f:z0}=this.wNAF(m0),{p:oe,f:ae}=this.wNAF(T0);I0=x.constTimeNegate(i0,I0),oe=x.constTimeNegate(A0,oe),oe=new d(n.mul(oe.px,Y.beta),oe.py,oe.pz),D=I0.add(oe),V=z0.add(ae)}else{const{p:i0,f:m0}=this.wNAF(L);D=i0,V=m0}return d.normalizeZ([D,V])[0]}multiplyAndAddUnsafe(O,L,D){const V=d.BASE,Y=(m0,A0)=>A0===Rc||A0===Ws||!m0.equals(V)?m0.multiplyUnsafe(A0):m0.multiply(A0),i0=Y(this,L).add(Y(O,D));return i0.is0()?void 0:i0}toAffine(O){const{px:L,py:D,pz:V}=this,Y=this.is0();O==null&&(O=Y?n.ONE:n.inv(V));const i0=n.mul(L,O),m0=n.mul(D,O),A0=n.mul(V,O);if(Y)return{x:n.ZERO,y:n.ZERO};if(!n.eql(A0,n.ONE))throw new Error("invZ was invalid");return{x:i0,y:m0}}isTorsionFree(){const{h:O,isTorsionFree:L}=t;if(O===Ws)return!0;if(L)return L(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:O,clearCofactor:L}=t;return O===Ws?this:L?L(d,this):this.multiplyUnsafe(t.h)}toRawBytes(O=!0){return this.assertValidity(),f(d,this,O)}toHex(O=!0){return w9(this.toRawBytes(O))}}d.BASE=new d(t.Gx,t.Gy,n.ONE),d.ZERO=new d(n.ZERO,n.ONE,n.ZERO);const p=t.nBitLength,x=y2e(d,t.endo?Math.ceil(p/2):p);return{CURVE:t,ProjectivePoint:d,normPrivateKeyToScalar:s,weierstrassEquation:a,isWithinCurveOrder:i}}function x2e(e){const t=yp0(e);return Lv(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function E2e(e){const t=x2e(e),{Fp:n,n:f}=t,r=n.BYTES+1,a=2*n.BYTES+1;function i(Q){return Rcw9(x9(Q,t.nByteLength));function C(Q){const H=f>>Ws;return Q>H}function O(Q){return C(Q)?o(-Q):Q}const L=(Q,H,u0)=>m8(Q.slice(H,u0));class D{constructor(H,u0,h0){this.r=H,this.s=u0,this.recovery=h0,this.assertValidity()}static fromCompact(H){const u0=t.nByteLength;return H=Q6("compactSignature",H,u0*2),new D(L(H,0,u0),L(H,u0,2*u0))}static fromDER(H){const{r:u0,s:h0}=g8.toSig(Q6("DER",H));return new D(u0,h0)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(H){return new D(this.r,this.s,H)}recoverPublicKey(H){const{r:u0,s:h0,recovery:g0}=this,o0=T0(Q6("msgHash",H));if(g0==null||![0,1,2,3].includes(g0))throw new Error("recovery id invalid");const N=g0===2||g0===3?u0+t.n:u0;if(N>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const t0=g0&1?"03":"02",S0=l.fromHex(t0+x(N)),s0=s(N),W=o(-o0*s0),D0=o(h0*s0),Y0=l.BASE.multiplyAndAddUnsafe(S0,W,D0);if(!Y0)throw new Error("point at infinify");return Y0.assertValidity(),Y0}hasHighS(){return C(this.s)}normalizeS(){return this.hasHighS()?new D(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return A9(this.toDERHex())}toDERHex(){return g8.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return A9(this.toCompactHex())}toCompactHex(){return x(this.r)+x(this.s)}}const V={isValidPrivateKey(Q){try{return c(Q),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const Q=mp0(t.n);return h2e(t.randomBytes(Q),t.n)},precompute(Q=8,H=l.BASE){return H._setWindowSize(Q),H.multiply(BigInt(3)),H}};function Y(Q,H=!0){return l.fromPrivateKey(Q).toRawBytes(H)}function i0(Q){const H=h8(Q),u0=typeof Q=="string",h0=(H||u0)&&Q.length;return H?h0===r||h0===a:u0?h0===2*r||h0===2*a:Q instanceof l}function m0(Q,H,u0=!0){if(i0(Q))throw new Error("first arg must be private key");if(!i0(H))throw new Error("second arg must be public key");return l.fromHex(H).multiply(c(Q)).toRawBytes(u0)}const A0=t.bits2int||function(Q){const H=m8(Q),u0=Q.length*8-t.nBitLength;return u0>0?H>>BigInt(u0):H},T0=t.bits2int_modN||function(Q){return o(A0(Q))},I0=QG(t.nBitLength);function z0(Q){if(typeof Q!="bigint")throw new Error("bigint expected");if(!(Rc<=Q&&Qle in u0))throw new Error("sign() legacy options not supported");const{hash:h0,randomBytes:g0}=t;let{lowS:o0,prehash:N,extraEntropy:t0}=u0;o0==null&&(o0=!0),Q=Q6("msgHash",Q),N&&(Q=Q6("prehashed msgHash",h0(Q)));const S0=T0(Q),s0=c(H),W=[z0(s0),z0(S0)];if(t0!=null&&t0!==!1){const le=t0===!0?g0(n.BYTES):t0;W.push(Q6("extraEntropy",le))}const D0=Dv(...W),Y0=S0;function Z0(le){const ue=A0(le);if(!p(ue))return;const xe=s(ue),je=l.BASE.multiply(ue).toAffine(),Ge=o(je.x);if(Ge===Rc)return;const et=o(xe*o(Y0+Ge*s0));if(et===Rc)return;let St=(je.x===Ge?0:2)|Number(je.y&Ws),wt=et;return o0&&C(et)&&(wt=O(et),St^=1),new D(Ge,wt,St)}return{seed:D0,k2sig:Z0}}const ae={lowS:t.lowS,prehash:!1},ye={lowS:t.lowS,prehash:!1};function P(Q,H,u0=ae){const{seed:h0,k2sig:g0}=oe(Q,H,u0),o0=t;return up0(o0.hash.outputLen,o0.nByteLength,o0.hmac)(h0,g0)}l.BASE._setWindowSize(8);function F(Q,H,u0,h0=ye){var xe;const g0=Q;if(H=Q6("msgHash",H),u0=Q6("publicKey",u0),"strict"in h0)throw new Error("options.strict was renamed to lowS");const{lowS:o0,prehash:N}=h0;let t0,S0;try{if(typeof g0=="string"||h8(g0))try{t0=D.fromDER(g0)}catch(je){if(!(je instanceof g8.Err))throw je;t0=D.fromCompact(g0)}else if(typeof g0=="object"&&typeof g0.r=="bigint"&&typeof g0.s=="bigint"){const{r:je,s:Ge}=g0;t0=new D(je,Ge)}else throw new Error("PARSE");S0=l.fromHex(u0)}catch(je){if(je.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(o0&&t0.hasHighS())return!1;N&&(H=t.hash(H));const{r:s0,s:W}=t0,D0=T0(H),Y0=s(W),Z0=o(D0*Y0),le=o(s0*Y0),ue=(xe=l.BASE.multiplyAndAddUnsafe(S0,Z0,le))==null?void 0:xe.toAffine();return ue?o(ue.x)===s0:!1}return{CURVE:t,getPublicKey:Y,getSharedSecret:m0,sign:P,verify:F,ProjectivePoint:l,Signature:D,utils:V}}function T2e(e){return{hash:e,hmac:(t,...n)=>W20(e,t,kf(...n)),randomBytes:zae}}function M2e(e,t){const n=f=>E2e({...e,...T2e(f)});return Object.freeze({...n(t),create:n})}const vp0=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),wp0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),C2e=BigInt(1),XG=BigInt(2),Ap0=(e,t)=>(e+t/XG)/t;function S2e(e){const t=vp0,n=BigInt(3),f=BigInt(6),r=BigInt(11),a=BigInt(22),i=BigInt(23),o=BigInt(44),s=BigInt(88),l=e*e*e%t,c=l*l*e%t,d=qs(c,n,t)*c%t,p=qs(d,n,t)*c%t,x=qs(p,XG,t)*l%t,C=qs(x,r,t)*x%t,O=qs(C,a,t)*C%t,L=qs(O,o,t)*O%t,D=qs(L,s,t)*L%t,V=qs(D,o,t)*O%t,Y=qs(V,n,t)*c%t,i0=qs(Y,i,t)*C%t,m0=qs(i0,f,t)*l%t,A0=qs(m0,XG,t);if(!_G.eql(_G.sqr(A0),e))throw new Error("Cannot find square root");return A0}const _G=b2e(vp0,void 0,void 0,{sqrt:S2e}),xp0=M2e({a:BigInt(0),b:BigInt(7),Fp:_G,n:wp0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=wp0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),f=-C2e*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),r=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,i=BigInt("0x100000000000000000000000000000000"),o=Ap0(a*e,t),s=Ap0(-f*e,t);let l=P1(e-o*n-s*r,t),c=P1(-o*f-s*a,t);const d=l>i,p=c>i;if(d&&(l=t-l),p&&(c=t-c),l>i||c>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:p,k2:c}}}},p8);BigInt(0),xp0.ProjectivePoint;function cO(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function E9(...e){const t=a=>a,n=(a,i)=>o=>a(i(o)),f=e.map(a=>a.encode).reduceRight(n,t),r=e.map(a=>a.decode).reduce(n,t);return{encode:f,decode:r}}function jv(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(n=>{if(n<0||n>=e.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${e.length})`);return e[n]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const f=e.indexOf(n);if(f===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);return f})}}}function Fv(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let n of t)if(typeof n!="string")throw new Error(`join.encode: non-string input=${n}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function Ep0(e,t="="){if(typeof t!="string")throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let f of n)if(typeof f!="string")throw new Error(`padding.encode: non-string input=${f}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let r of n)if(typeof r!="string")throw new Error(`padding.decode: non-string input=${r}`);let f=n.length;if(f*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;f>0&&n[f-1]===t;f--)if(!((f-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,f)}}}function $G(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let f=0;const r=[],a=Array.from(e);for(a.forEach(i=>{if(i<0||i>=t)throw new Error(`Wrong integer: ${i}`)});;){let i=0,o=!0;for(let s=f;st?Tp0(t,e%t):e,uO=(e,t)=>e+(t-Tp0(e,t));function dO(e,t,n,f){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(uO(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${uO(t,n)}`);let r=0,a=0;const i=2**n-1,o=[];for(const s of e){if(s>=2**t)throw new Error(`convertRadix2: invalid data word=${s} from=${t}`);if(r=r<32)throw new Error(`convertRadix2: carry overflow pos=${a} from=${t}`);for(a+=t;a>=n;a-=n)o.push((r>>a-n&i)>>>0);r&=2**a-1}if(r=r<=t)throw new Error("Excess padding");if(!f&&r)throw new Error(`Non-zero padding: ${r}`);return f&&a>0&&o.push(r>>>0),o}function Mp0(e){return{encode:t=>{if(!cO(t))throw new Error("radix.encode input should be Uint8Array");return $G(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from($G(t,e,256))}}}function pO(e,t=!1){if(e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(uO(8,e)>32||uO(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!cO(n))throw new Error("radix2.encode input should be Uint8Array");return dO(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&typeof n[0]!="number")throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(dO(n,e,8,t))}}}function Cp0(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}function Sp0(e,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(n){if(!cO(n))throw new Error("checksum.encode: input should be Uint8Array");const f=t(n).slice(0,e),r=new Uint8Array(n.length+e);return r.set(n),r.set(f,n.length),r},decode(n){if(!cO(n))throw new Error("checksum.decode: input should be Uint8Array");const f=n.slice(0,-e),r=t(f).slice(0,e),a=n.slice(-e);for(let i=0;iE9(Mp0(58),jv(e),Fv("")),T9=kp0("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),O2e=kp0("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),Np0=[0,2,3,5,6,7,9,10,11],Pp0={encode(e){let t="";for(let n=0;nE9(Sp0(4,t=>e(e(t))),T9),eq=E9(jv("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Fv("")),Ip0=[996825010,642813549,513874426,1027748829,705979059];function zv(e){const t=e>>25;let n=(e&33554431)<<5;for(let f=0;f>f&1)===1&&(n^=Ip0[f]);return n}function Rp0(e,t,n=1){const f=e.length;let r=1;for(let a=0;a126)throw new Error(`Invalid prefix (${e})`);r=zv(r)^i>>5}r=zv(r);for(let a=0;ap)throw new TypeError(`Length ${x} exceeds limit ${p}`);const C=c.toLowerCase(),O=Rp0(C,d,t);return`${C}1${eq.encode(d)}${O}`}function o(c,d=90){if(typeof c!="string")throw new Error(`bech32.decode input should be string, not ${typeof c}`);if(c.length<8||d!==!1&&c.length>d)throw new TypeError(`Wrong string length: ${c.length} (${c}). Expected (8..${d})`);const p=c.toLowerCase();if(c!==p&&c!==c.toUpperCase())throw new Error("String must be lowercase or uppercase");const x=p.lastIndexOf("1");if(x===0||x===-1)throw new Error('Letter "1" must be present between prefix and data only');const C=p.slice(0,x),O=p.slice(x+1);if(O.length<6)throw new Error("Data must be at least 6 characters long");const L=eq.decode(O).slice(0,-6),D=Rp0(C,L,t);if(!O.endsWith(D))throw new Error(`Invalid checksum in ${c}: expected "${D}"`);return{prefix:C,words:L}}const s=Cp0(o);function l(c){const{prefix:d,words:p}=o(c,!1);return{prefix:d,words:p,bytes:f(p)}}return{encode:i,decode:o,decodeToBytes:l,decodeUnsafe:s,fromWords:f,fromWordsUnsafe:a,toWords:r}}const al=Bp0("bech32"),Vv=Bp0("bech32m"),Dp0=T9,no=Dp0.encode,Eo=Dp0.decode,Lp0=k2e(p8),To=Lp0.encode,I1=Lp0.decode,vi=(e,t)=>n=>{if(n[0]===118){if(n[1]!==169||n[n.length-2]!==136||n[n.length-1]!==172)throw new Error("Unrecognised address format");return To(kf(e,n.slice(3,3+n[2])))}if(n[0]===169){if(n[n.length-1]!==135)throw new Error("Unrecognised address format");return To(kf(t,n.slice(2,2+n[1])))}throw new Error("Unrecognised address format")},ii=(e,t)=>n=>{const f=I1(n),r=a=>a.every((i,o)=>ot=>{const n=xp0.ProjectivePoint.fromHex(t),f=jp0.encode(n.toRawBytes(!0)),r=no(f);return`${e}${r}`},Bd=e=>t=>{if(!t.startsWith(e))throw new Error("Unrecognised address format");const n=t.slice(e.length),f=Eo(n);return jp0.decode(f)},N2e="abbc",P2e=367,Fp0="ABBC",I2e=Rd(Fp0),R2e=Bd(Fp0),B2e={name:N2e,coinType:P2e,encode:I2e,decode:R2e},zp0=({bechLib:e,hrp:t,limit:n})=>f=>e.encode(t,e.toWords(f),n),Vp0=({bechLib:e,hrp:t,limit:n})=>f=>{const{prefix:r,words:a}=e.decode(f,n);if(r!==t)throw new Error("Unexpected human-readable part in bech32 encoded address");return new Uint8Array(e.fromWords(a))},Ri=(e,t)=>zp0({hrp:e,bechLib:al,limit:t}),Bi=(e,t)=>Vp0({hrp:e,bechLib:al,limit:t}),Up0=(e,t)=>zp0({hrp:e,bechLib:Vv,limit:t}),Hp0=(e,t)=>Vp0({hrp:e,bechLib:Vv,limit:t}),tq=e=>t=>{let n=t[0];if(n>=81&&n<=96)n-=80;else if(n!==0)throw new Error("Unrecognised address format");let f=[];return n>0&&n<17?(f=[n].concat(Vv.toWords(t.slice(2,t[1]+2))),Vv.encode(e,f)):(f=[n].concat(al.toWords(t.slice(2,t[1]+2))),al.encode(e,f))},nq=e=>t=>{const n=al.decodeUnsafe(t)||Vv.decodeUnsafe(t);if(!n)throw new Error("Unrecognised address format");const{prefix:f,words:r}=n;if(f!==e)throw new Error("Unexpected human-readable part in bech32 encoded address");const a=al.fromWords(r.slice(1));let i=r[0];return i>0&&(i+=80),kf(new Uint8Array([i,a.length]),new Uint8Array(a))},D2e=5960464477539064e-23,fq=4294967296,Gp0=9007199254740992,qp0=8192;function L2e(e,t){return typeof Object.is=="function"?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}class hO{constructor(t,n){Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tag",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.value=t,this.tag=n}}class Wp0{constructor(t){Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.value=t}}function Qp0(e){const t=new DataView(e),n=new Uint8Array(e);let f=0,r=(m0,A0)=>new hO(m0,A0),a=m0=>new Wp0(m0);function i(m0,A0){return f+=m0,A0}function o(m0){return i(m0,new Uint8Array(e,f,m0))}function s(){const m0=new ArrayBuffer(4),A0=new DataView(m0),T0=p(),I0=T0&32768;let z0=T0&31744;const oe=T0&1023;if(z0===31744)z0=261120;else if(z0!==0)z0+=114688;else if(oe!==0)return(I0?-1:1)*oe*D2e;return A0.setUint32(0,I0<<16|z0<<13|oe<<13),A0.getFloat32(0)}function l(){return i(4,t.getFloat32(f))}function c(){return i(8,t.getFloat64(f))}function d(){return i(1,n[f])}function p(){return i(2,t.getUint16(f))}function x(){return i(4,t.getUint32(f))}function C(){return x()*fq+x()}function O(){return n[f]!==255?!1:(f+=1,!0)}function L(m0){if(m0<24)return m0;if(m0===24)return d();if(m0===25)return p();if(m0===26)return x();if(m0===27)return C();if(m0===31)return-1;throw new Error("Invalid length encoding")}function D(m0){const A0=d();if(A0===255)return-1;const T0=L(A0&31);if(T0<0||A0>>5!==m0)throw new Error("Invalid indefinite length element");return T0}function V(m0,A0){for(let T0=0;T0>10),m0.push(56320|I0&1023))}}function Y(){const m0=d(),A0=m0>>5,T0=m0&31;let I0,z0;if(A0===7)switch(T0){case 25:return s();case 26:return l();case 27:return c()}if(z0=L(T0),z0<0&&(A0<2||6=0;)Q+=z0,F.push(o(z0));const H=new Uint8Array(Q);let u0=0;for(I0=0;I0=0;)V(oe,z0);else V(oe,z0);let ae="";for(I0=0;I0>2;for(let I0=0;I0>6),m0.push(128|I0&63)):(I0=(I0&1023)<<10,I0|=Y.charCodeAt(++i0)&1023,I0+=65536,m0.push(240|I0>>18),m0.push(128|I0>>12&63),m0.push(128|I0>>6&63),m0.push(128|I0&63))}return O(3,m0.length),c(m0);default:let A0,T0;if(Array.isArray(Y))for(A0=Y.length,O(4,A0),i0=0;i0{if(e>=0)return e;const t=new Uint32Array(1);return t[0]=e,t[0]},aq=e=>{let t=4294967295;for(const n of e){const f=(t^n)&255,r=rq==null?void 0:rq[f];if(r===void 0)throw new Error("tableIndex out of range 0-255");t=t>>>8^r}return j2e(t^4294967295)},Kp0=e=>{const t=aq(e),n=new hO(e.buffer,24),f=Yp0([n,t]),r=no(new Uint8Array(f));if(!r.startsWith("Ae2")&&!r.startsWith("Ddz"))throw new Error("Unrecognised address format");return r},Jp0=e=>{const t=Eo(e),n=Qp0(t.buffer),f=n[0];if(f===void 0)throw new Error("Unrecognised address format");const r=n[1],a=aq(f.value);if(r!==a)throw new Error("Unrecognised address format");return f.value},F2e="ada",z2e=1815,iq="addr",Zp0=104,V2e=Ri(iq,Zp0),U2e=Bi(iq,Zp0),H2e=e=>{try{return Kp0(e)}catch{return V2e(e)}},G2e=e=>e.toLowerCase().startsWith(iq)?U2e(e):Jp0(e),q2e={name:F2e,coinType:z2e,encode:H2e,decode:G2e},W2e="ae",Q2e=457,Y2e=e=>`ak_${To(e.slice(2))}`,K2e=e=>kf(new Uint8Array([48,120]),I1(e.slice(3))),J2e={name:W2e,coinType:Q2e,encode:Y2e,decode:K2e},Z2e="aib",X2e=55,Xp0=[new Uint8Array([23])],_p0=[new Uint8Array([5])],_2e=vi(Xp0[0],_p0[0]),$2e=ii(Xp0,_p0),epe={name:Z2e,coinType:X2e,encode:_2e,decode:$2e};function mO(e){let t=e.slice(2);t.length%2&&(t=`0${t}`);const n=new Uint8Array(t.length/2);for(let f=0;f0;)n.unshift(Number(t&BigInt(255))),t>>=BigInt(8);return new Uint8Array(n)}const v8=jc0,M9=Lae,rpe="aion",ape=425,ipe=/^[0-9A-Fa-f]{64}$/g,ope=e=>{if(e.length!==32)throw new Error("Unrecognised address format");return yO(e)},spe=e=>{const t=e.startsWith("0x")?e.slice(2):e;if(t.length!==64)throw new Error("Unrecognised address format");if(!ipe.test(t))throw new Error("Unrecognised address format");return M9(t)},lpe={name:rpe,coinType:ape,encode:ope,decode:spe},[cpe,upe]=Dn.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),Dd=new Uint32Array(80),Ld=new Uint32Array(80);class dpe extends EG{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:n,Bh:f,Bl:r,Ch:a,Cl:i,Dh:o,Dl:s,Eh:l,El:c,Fh:d,Fl:p,Gh:x,Gl:C,Hh:O,Hl:L}=this;return[t,n,f,r,a,i,o,s,l,c,d,p,x,C,O,L]}set(t,n,f,r,a,i,o,s,l,c,d,p,x,C,O,L){this.Ah=t|0,this.Al=n|0,this.Bh=f|0,this.Bl=r|0,this.Ch=a|0,this.Cl=i|0,this.Dh=o|0,this.Dl=s|0,this.Eh=l|0,this.El=c|0,this.Fh=d|0,this.Fl=p|0,this.Gh=x|0,this.Gl=C|0,this.Hh=O|0,this.Hl=L|0}process(t,n){for(let Y=0;Y<16;Y++,n+=4)Dd[Y]=t.getUint32(n),Ld[Y]=t.getUint32(n+=4);for(let Y=16;Y<80;Y++){const i0=Dd[Y-15]|0,m0=Ld[Y-15]|0,A0=Dn.rotrSH(i0,m0,1)^Dn.rotrSH(i0,m0,8)^Dn.shrSH(i0,m0,7),T0=Dn.rotrSL(i0,m0,1)^Dn.rotrSL(i0,m0,8)^Dn.shrSL(i0,m0,7),I0=Dd[Y-2]|0,z0=Ld[Y-2]|0,oe=Dn.rotrSH(I0,z0,19)^Dn.rotrBH(I0,z0,61)^Dn.shrSH(I0,z0,6),ae=Dn.rotrSL(I0,z0,19)^Dn.rotrBL(I0,z0,61)^Dn.shrSL(I0,z0,6),ye=Dn.add4L(T0,ae,Ld[Y-7],Ld[Y-16]),P=Dn.add4H(ye,A0,oe,Dd[Y-7],Dd[Y-16]);Dd[Y]=P|0,Ld[Y]=ye|0}let{Ah:f,Al:r,Bh:a,Bl:i,Ch:o,Cl:s,Dh:l,Dl:c,Eh:d,El:p,Fh:x,Fl:C,Gh:O,Gl:L,Hh:D,Hl:V}=this;for(let Y=0;Y<80;Y++){const i0=Dn.rotrSH(d,p,14)^Dn.rotrSH(d,p,18)^Dn.rotrBH(d,p,41),m0=Dn.rotrSL(d,p,14)^Dn.rotrSL(d,p,18)^Dn.rotrBL(d,p,41),A0=d&x^~d&O,T0=p&C^~p&L,I0=Dn.add5L(V,m0,T0,upe[Y],Ld[Y]),z0=Dn.add5H(I0,D,i0,A0,cpe[Y],Dd[Y]),oe=I0|0,ae=Dn.rotrSH(f,r,28)^Dn.rotrBH(f,r,34)^Dn.rotrBH(f,r,39),ye=Dn.rotrSL(f,r,28)^Dn.rotrBL(f,r,34)^Dn.rotrBL(f,r,39),P=f&a^f&o^a&o,F=r&i^r&s^i&s;D=O|0,V=L|0,O=x|0,L=C|0,x=d|0,C=p|0,{h:d,l:p}=Dn.add(l|0,c|0,z0|0,oe|0),l=o|0,c=s|0,o=a|0,s=i|0,a=f|0,i=r|0;const Q=Dn.add3L(oe,ye,F);f=Dn.add3H(Q,z0,ae,P),r=Q|0}({h:f,l:r}=Dn.add(this.Ah|0,this.Al|0,f|0,r|0)),{h:a,l:i}=Dn.add(this.Bh|0,this.Bl|0,a|0,i|0),{h:o,l:s}=Dn.add(this.Ch|0,this.Cl|0,o|0,s|0),{h:l,l:c}=Dn.add(this.Dh|0,this.Dl|0,l|0,c|0),{h:d,l:p}=Dn.add(this.Eh|0,this.El|0,d|0,p|0),{h:x,l:C}=Dn.add(this.Fh|0,this.Fl|0,x|0,C|0),{h:O,l:L}=Dn.add(this.Gh|0,this.Gl|0,O|0,L|0),{h:D,l:V}=Dn.add(this.Hh|0,this.Hl|0,D|0,V|0),this.set(f,r,a,i,o,s,l,c,d,p,x,C,O,L,D,V)}roundClean(){Dd.fill(0),Ld.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class ppe extends dpe{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}const bpe=wS(()=>new ppe),sq=Op0.encode,lq=Op0.decode,$p0=er.chain(er.radix2(5),er.alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),er.join("")),cq=$p0.encode,uq=$p0.decode,e80=e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"),hpe="algo",mpe=283,t80=er.checksum(4,e=>bpe(e).slice(-4)),ype=e=>{const t=t80.encode(e);return cq(t)},gpe=e=>{const t=uq(e);if(t.length!==36)throw new Error("Unrecognised address format");return t80.decode(t)},vpe={name:hpe,coinType:mpe,encode:ype,decode:gpe},wpe="ar",Ape=472,xpe=bO.encode,Epe=bO.decode,Tpe={name:wpe,coinType:Ape,encode:xpe,decode:Epe},Mpe="ardr",Cpe=16754,n80="ARDOR",f80="23456789ABCDEFGHJKLMNPQRSTUVWXYZ",r80=new Uint8Array([3,2,1,0,7,6,5,4,13,14,15,16,12,8,9,10,11]),a80=[0,0,1,18,2,5,19,11,3,29,6,27,20,8,12,23,4,10,30,17,7,22,28,26,21,25,9,16,13,14,24,15],i80=[1,2,4,8,16,5,10,20,13,26,17,7,14,28,29,31,27,19,3,6,12,24,21,15,30,25,23,11,22,9,18,1],Spe=(e,t)=>e===0||t===0?0:i80[(a80[e]+a80[t])%31],Ope=e=>{let t=0;for(let n=1;n<5;n++){let f=0;for(let r=0;r<31;r++){if(r>12&&r<27)continue;let a=r;r>26&&(a-=14),f^=Spe(e[a],i80[n*r%31])}t|=f}return t===0},kpe=e=>{const t=[];for(let n=0,f=0;n>4)+(r&15)]}return`${n80}-${t.slice(0,4).join("")}-${t.slice(4,8).join("")}-${t.slice(8,12).join("")}-${t.slice(12,17).join("")}`},Npe=e=>{if(!e.startsWith(`${n80}-`)||e.length!==26)throw new Error("Unrecognised address format");const t=e.slice(6),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);for(let f=0,r=0;f<20;f++){const a=t[f];if(a==="-")continue;const i=f80.indexOf(a);if(i===-1)throw new Error("Unrecognised address format");const o=r80[r++];n[o]=i}if(!Ope(n))throw new Error("Unrecognised address format");return n},Ppe={name:Mpe,coinType:Cpe,encode:kpe,decode:Npe},Ipe="ark",Rpe=111,Bpe=To,Dpe=e=>{const t=I1(e);if(t[0]!==23)throw new Error("Invalid address");return t},Lpe={name:Ipe,coinType:Rpe,encode:Bpe,decode:Dpe},jpe="atom",Fpe=118,zpe=Ri("cosmos"),Vpe=Bi("cosmos"),Upe={name:jpe,coinType:Fpe,encode:zpe,decode:Vpe},Hpe="avax",Gpe=9e3,o80="avax",qpe=Bi(o80),Wpe=Ri(o80),Qpe=e=>{let t;const[n,f]=e.split("-");return f?t=f:t=n,qpe(t)},Ype={name:Hpe,coinType:Gpe,encode:Wpe,decode:Qpe},il=({hrp:e,p2pkhVersions:t,p2shVersions:n})=>{const f=nq(e),r=ii(t,n);return a=>a.toLowerCase().startsWith(e+"1")?f(a):r(a)},ol=({hrp:e,p2pkhVersions:t,p2shVersions:n})=>{const f=tq(e),r=vi(t[0],n[0]);return a=>{try{return r(a)}catch{return f(a)}}},Kpe="bcd",Jpe=999,s80="bcd",l80=[new Uint8Array([0])],c80=[new Uint8Array([5])],Zpe=ol({hrp:s80,p2pkhVersions:l80,p2shVersions:c80}),Xpe=il({hrp:s80,p2pkhVersions:l80,p2shVersions:c80}),_pe={name:Kpe,coinType:Jpe,encode:Zpe,decode:Xpe},$pe="bitcoincash",u80=new Uint8Array([2,9,20,3,15,9,14,3,1,19,8,0]),d80=[160,192,224,256,320,384,448,512],e8e=Object.fromEntries(d80.map((e,t)=>[e,t])),p80=er.radix2(5),b80=er.chain(er.alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),er.join("")),t8e=e=>{const t=new Uint8Array(8);for(let n=0;n<8;n++)t[7-n]=Number(e&31n),e=e>>5n;return t},h80=e=>{const t=[656907472481n,522768456162n,1044723512260n,748107326120n,130178868336n];let n=1n;for(var f=0;f>35n;n=(n&34359738367n)<<5n^BigInt(a);for(var r=0;r>BigInt(r)&1n)===1n&&(n=n^t[r])}return n^1n},n8e=e=>{const t=e.toLowerCase();if(e===t)return t;const n=e.toUpperCase();if(e===n)return t;throw new Error("Unrecognised address format")},f8e=e=>{const t=kf(u80,new Uint8Array(e));return h80(t)===0n},dq=(e,t)=>{const n=new Uint8Array([e+e8e[t.length*8]]),f=p80.encode(kf(n,t)),r=new Uint8Array(f),a=kf(u80,r,new Uint8Array(8)),i=t8e(h80(a)),o=kf(r,i);return`${$pe}:${b80.encode(Array.from(o))}`},m80=e=>{const t=n8e(e);let[n,f]=t.split(":");if(!f)f=n;else if(n!=="bitcoincash")throw new Error("Unrecognised address format");const r=b80.decode(f);if(!f8e(r))throw new Error("Invalid checksum");const[a,...i]=p80.decode(Array.from(r.slice(0,-8)));if(d80[a&7]!==i.length*8)throw new Error("Unrecognised address format");return{type:a&120,hash:i}},r8e="bch",a8e=145,i8e=[new Uint8Array([0])],o8e=[new Uint8Array([5])],s8e=ii(i8e,o8e),l8e=e=>{if(e[0]===118){if(e[1]!==169||e[e.length-2]!==136||e[e.length-1]!==172)throw new Error("Unrecognised address format");return dq(0,e.slice(3,3+e[2]))}if(e[0]===169){if(e[e.length-1]!==135)throw new Error("Unrecognised address format");return dq(8,e.slice(2,2+e[1]))}throw new Error("Unrecognised address format")},c8e=e=>{try{return s8e(e)}catch{const{type:t,hash:n}=m80(e);if(t===0)return kf(new Uint8Array([118,169,20]),new Uint8Array(n),new Uint8Array([136,172]));if(t===8)return kf(new Uint8Array([169,20]),new Uint8Array(n),new Uint8Array([135]));throw new Error("Unrecognised address format")}},u8e={name:r8e,coinType:a8e,encode:l8e,decode:c8e},d8e="xmr",p8e=128,Uv=Pp0.encode,Hv=Pp0.decode,b8e={name:d8e,coinType:p8e,encode:Uv,decode:Hv},h8e="bcn",m8e=204,y8e=er.checksum(4,$5),g8e=e=>{const t=$5(e).slice(0,4);return Uv(kf(e,t))},v8e=e=>{const t=Hv(e),n=t.slice(0,-68);if(t.length<68||!N1(n,new Uint8Array([6]))&&!N1(n,new Uint8Array([206,246,34])))throw new Error("Unrecognised address format");return y8e.decode(t)},w8e={name:h8e,coinType:m8e,encode:g8e,decode:v8e},A8e="bdx",x8e=570,E8e=Uv,T8e=Hv,M8e={name:A8e,coinType:x8e,encode:E8e,decode:T8e},C8e="bnb",S8e=714,y80="bnb",O8e=Ri(y80),k8e=Bi(y80),N8e={name:C8e,coinType:S8e,encode:O8e,decode:k8e},P8e="bps",I8e=576,g80=[new Uint8Array([0])],v80=[new Uint8Array([5])],R8e=vi(g80[0],v80[0]),B8e=ii(g80,v80),D8e={name:P8e,coinType:I8e,encode:R8e,decode:B8e},L8e="bsv",j8e=236,F8e=e=>To(kf(new Uint8Array([0]),e)),z8e=e=>{const t=I1(e);if(t.length!==21)throw new Error("Unrecognised address format");if(t[0]!==0)throw new Error("Unrecognised address format");return t.slice(1)},V8e={name:L8e,coinType:j8e,encode:F8e,decode:z8e},U8e="btc",H8e=0,w80="bc",A80=[new Uint8Array([0])],x80=[new Uint8Array([5])],G8e=ol({hrp:w80,p2pkhVersions:A80,p2shVersions:x80}),q8e=il({hrp:w80,p2pkhVersions:A80,p2shVersions:x80}),W8e={name:U8e,coinType:H8e,encode:G8e,decode:q8e},Q8e="btg",Y8e=156,E80="btg",T80=[new Uint8Array([38])],M80=[new Uint8Array([23])],K8e=ol({hrp:E80,p2pkhVersions:T80,p2shVersions:M80}),J8e=il({hrp:E80,p2pkhVersions:T80,p2shVersions:M80}),Z8e={name:Q8e,coinType:Y8e,encode:K8e,decode:J8e},X8e="btm",_8e=153,C80="bm",$8e=tq(C80),ebe=nq(C80),tbe={name:X8e,coinType:_8e,encode:$8e,decode:ebe},nbe="bts",fbe=308,S80="BTS",rbe=Rd(S80),abe=Bd(S80),ibe={name:nbe,coinType:fbe,encode:rbe,decode:abe},obe="cca",sbe=489,O80=[new Uint8Array([11])],k80=[new Uint8Array([5])],lbe=vi(O80[0],k80[0]),cbe=ii(O80,k80),ube={name:obe,coinType:sbe,encode:lbe,decode:cbe},dbe="ccxx",pbe=571,N80="ccx",P80=[new Uint8Array([137])],I80=[new Uint8Array([75]),new Uint8Array([5])],bbe=ol({hrp:N80,p2pkhVersions:P80,p2shVersions:I80}),hbe=il({hrp:N80,p2pkhVersions:P80,p2shVersions:I80}),mbe={name:dbe,coinType:pbe,encode:bbe,decode:hbe},R80=({address:e,hash:t,length:n})=>{for(let f=0;f>1]>>4>=8&&e[f]&&(e[f]=e[f].toUpperCase()),(t[f>>1]&15)>=8&&e[f+1]&&(e[f+1]=e[f+1].toUpperCase());return`0x${e.join("")}`};function B80(e,t){const n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),f=$5(oq(n)),r=(t?n.substring(`${t}0x`.length):n).split("");return R80({address:r,hash:f,length:40})}function D80(e){return/^0x[a-fA-F0-9]{40}$/.test(e)}function ybe(e,t){return D80(e)&&B80(e,t)===e}const Mo=e=>t=>B80(yO(t),e),Co=e=>t=>{if(!ybe(t,e))throw new Error("Unrecognised address format");return mO(t)},gbe="celoLegacy",vbe=52752,wbe=Mo(),Abe=Co(),xbe={name:gbe,coinType:vbe,encode:wbe,decode:Abe},Ebe="ckb",Tbe=309,L80="ckb",Mbe=Ri(L80),Cbe=Bi(L80),Sbe={name:Ebe,coinType:Tbe,encode:Mbe,decode:Cbe},Obe="cloLegacy",kbe=820,Nbe=Mo(),Pbe=Co(),Ibe={name:Obe,coinType:kbe,encode:Nbe,decode:Pbe},Rbe="dash",Bbe=5,j80=[new Uint8Array([76])],F80=[new Uint8Array([16])],Dbe=vi(j80[0],F80[0]),Lbe=ii(j80,F80),jbe={name:Rbe,coinType:Bbe,encode:Dbe,decode:Lbe},Fbe="dcr",zbe=42,Vbe=no,Ube=Eo,Hbe={name:Fbe,coinType:zbe,encode:Vbe,decode:Ube},Gbe="dgb",qbe=20,z80="dgb",V80=[new Uint8Array([30])],U80=[new Uint8Array([63])],Wbe=ol({hrp:z80,p2pkhVersions:V80,p2shVersions:U80}),Qbe=il({hrp:z80,p2pkhVersions:V80,p2shVersions:U80}),Ybe={name:Gbe,coinType:qbe,encode:Wbe,decode:Qbe},Kbe="divi",Jbe=301,H80=[new Uint8Array([30])],G80=[new Uint8Array([13])],Zbe=vi(H80[0],G80[0]),Xbe=ii(H80,G80),_be={name:Kbe,coinType:Jbe,encode:Zbe,decode:Xbe},$be="doge",ehe=3,q80=[new Uint8Array([30])],W80=[new Uint8Array([22])],the=vi(q80[0],W80[0]),nhe=ii(q80,W80),fhe={name:$be,coinType:ehe,encode:the,decode:nhe},rhe=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class ahe extends vS{constructor(t,n,f={},r,a,i){if(super(),this.blockLen=t,this.outputLen=n,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,t8(t),t8(n),t8(r),n<0||n>r)throw new Error("outputLen bigger than keyLen");if(f.key!==void 0&&(f.key.length<1||f.key.length>r))throw new Error(`key must be up 1..${r} byte long or undefined`);if(f.salt!==void 0&&f.salt.length!==a)throw new Error(`salt must be ${a} byte long or undefined`);if(f.personalization!==void 0&&f.personalization.length!==i)throw new Error(`personalization must be ${i} byte long or undefined`);this.buffer32=Jg(this.buffer=new Uint8Array(t))}update(t){Ed(this);const{blockLen:n,buffer:f,buffer32:r}=this;t=Mc(t);const a=t.length,i=t.byteOffset,o=t.buffer;for(let s=0;sr[i]=Ec(a))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const f=t.slice(0,n);return this.destroy(),f}_cloneInto(t){const{buffer:n,length:f,finished:r,destroyed:a,outputLen:i,pos:o}=this;return t||(t=new this.constructor({dkLen:i})),t.set(...this.get()),t.length=f,t.finished=r,t.destroyed=a,t.outputLen=i,t.buffer.set(n),t.pos=o,t}}const wi=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),hn=new Uint32Array(32);function jd(e,t,n,f,r,a){const i=r[a],o=r[a+1];let s=hn[2*e],l=hn[2*e+1],c=hn[2*t],d=hn[2*t+1],p=hn[2*n],x=hn[2*n+1],C=hn[2*f],O=hn[2*f+1],L=Dn.add3L(s,c,i);l=Dn.add3H(L,l,d,o),s=L|0,{Dh:O,Dl:C}={Dh:O^l,Dl:C^s},{Dh:O,Dl:C}={Dh:Dn.rotr32H(O,C),Dl:Dn.rotr32L(O,C)},{h:x,l:p}=Dn.add(x,p,O,C),{Bh:d,Bl:c}={Bh:d^x,Bl:c^p},{Bh:d,Bl:c}={Bh:Dn.rotrSH(d,c,24),Bl:Dn.rotrSL(d,c,24)},hn[2*e]=s,hn[2*e+1]=l,hn[2*t]=c,hn[2*t+1]=d,hn[2*n]=p,hn[2*n+1]=x,hn[2*f]=C,hn[2*f+1]=O}function Fd(e,t,n,f,r,a){const i=r[a],o=r[a+1];let s=hn[2*e],l=hn[2*e+1],c=hn[2*t],d=hn[2*t+1],p=hn[2*n],x=hn[2*n+1],C=hn[2*f],O=hn[2*f+1],L=Dn.add3L(s,c,i);l=Dn.add3H(L,l,d,o),s=L|0,{Dh:O,Dl:C}={Dh:O^l,Dl:C^s},{Dh:O,Dl:C}={Dh:Dn.rotrSH(O,C,16),Dl:Dn.rotrSL(O,C,16)},{h:x,l:p}=Dn.add(x,p,O,C),{Bh:d,Bl:c}={Bh:d^x,Bl:c^p},{Bh:d,Bl:c}={Bh:Dn.rotrBH(d,c,63),Bl:Dn.rotrBL(d,c,63)},hn[2*e]=s,hn[2*e+1]=l,hn[2*t]=c,hn[2*t+1]=d,hn[2*n]=p,hn[2*n+1]=x,hn[2*f]=C,hn[2*f+1]=O}class ihe extends ahe{constructor(t={}){super(128,t.dkLen===void 0?64:t.dkLen,t,64,16,16),this.v0l=wi[0]|0,this.v0h=wi[1]|0,this.v1l=wi[2]|0,this.v1h=wi[3]|0,this.v2l=wi[4]|0,this.v2h=wi[5]|0,this.v3l=wi[6]|0,this.v3h=wi[7]|0,this.v4l=wi[8]|0,this.v4h=wi[9]|0,this.v5l=wi[10]|0,this.v5h=wi[11]|0,this.v6l=wi[12]|0,this.v6h=wi[13]|0,this.v7l=wi[14]|0,this.v7h=wi[15]|0;const n=t.key?t.key.length:0;if(this.v0l^=this.outputLen|n<<8|65536|16777216,t.salt){const f=Jg(Mc(t.salt));this.v4l^=Ec(f[0]),this.v4h^=Ec(f[1]),this.v5l^=Ec(f[2]),this.v5h^=Ec(f[3])}if(t.personalization){const f=Jg(Mc(t.personalization));this.v6l^=Ec(f[0]),this.v6h^=Ec(f[1]),this.v7l^=Ec(f[2]),this.v7h^=Ec(f[3])}if(t.key){const f=new Uint8Array(this.blockLen);f.set(Mc(t.key)),this.update(f)}}get(){let{v0l:t,v0h:n,v1l:f,v1h:r,v2l:a,v2h:i,v3l:o,v3h:s,v4l:l,v4h:c,v5l:d,v5h:p,v6l:x,v6h:C,v7l:O,v7h:L}=this;return[t,n,f,r,a,i,o,s,l,c,d,p,x,C,O,L]}set(t,n,f,r,a,i,o,s,l,c,d,p,x,C,O,L){this.v0l=t|0,this.v0h=n|0,this.v1l=f|0,this.v1h=r|0,this.v2l=a|0,this.v2h=i|0,this.v3l=o|0,this.v3h=s|0,this.v4l=l|0,this.v4h=c|0,this.v5l=d|0,this.v5h=p|0,this.v6l=x|0,this.v6h=C|0,this.v7l=O|0,this.v7h=L|0}compress(t,n,f){this.get().forEach((s,l)=>hn[l]=s),hn.set(wi,16);let{h:r,l:a}=Dn.fromBig(BigInt(this.length));hn[24]=wi[8]^a,hn[25]=wi[9]^r,f&&(hn[28]=~hn[28],hn[29]=~hn[29]);let i=0;const o=rhe;for(let s=0;s<12;s++)jd(0,4,8,12,t,n+2*o[i++]),Fd(0,4,8,12,t,n+2*o[i++]),jd(1,5,9,13,t,n+2*o[i++]),Fd(1,5,9,13,t,n+2*o[i++]),jd(2,6,10,14,t,n+2*o[i++]),Fd(2,6,10,14,t,n+2*o[i++]),jd(3,7,11,15,t,n+2*o[i++]),Fd(3,7,11,15,t,n+2*o[i++]),jd(0,5,10,15,t,n+2*o[i++]),Fd(0,5,10,15,t,n+2*o[i++]),jd(1,6,11,12,t,n+2*o[i++]),Fd(1,6,11,12,t,n+2*o[i++]),jd(2,7,8,13,t,n+2*o[i++]),Fd(2,7,8,13,t,n+2*o[i++]),jd(3,4,9,14,t,n+2*o[i++]),Fd(3,4,9,14,t,n+2*o[i++]);this.v0l^=hn[0]^hn[16],this.v0h^=hn[1]^hn[17],this.v1l^=hn[2]^hn[18],this.v1h^=hn[3]^hn[19],this.v2l^=hn[4]^hn[20],this.v2h^=hn[5]^hn[21],this.v3l^=hn[6]^hn[22],this.v3h^=hn[7]^hn[23],this.v4l^=hn[8]^hn[24],this.v4h^=hn[9]^hn[25],this.v5l^=hn[10]^hn[26],this.v5h^=hn[11]^hn[27],this.v6l^=hn[12]^hn[28],this.v6h^=hn[13]^hn[29],this.v7l^=hn[14]^hn[30],this.v7h^=hn[15]^hn[31],hn.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const w8=Fae(e=>new ihe(e)),ohe=new Uint8Array([83,83,53,56,80,82,69]),Q80=e=>w8(kf(ohe,e)).slice(0,2),pq=e=>t=>{const n=new Uint8Array([e]),f=kf(n,t),r=Q80(f);return no(kf(f,r))},bq=e=>t=>{const n=Eo(t);if(n[0]!==e)throw new Error("Unrecognized address format");const f=n.slice(33,35),r=Q80(n.slice(0,33));if(!N1(f,r))throw new Error("Unrecognized address format");return n.slice(1,33)},she="dot",lhe=354,Y80=0,che=pq(Y80),uhe=bq(Y80),dhe={name:she,coinType:lhe,encode:che,decode:uhe},phe="egld",bhe=508,hhe=Ri("erd"),mhe=Bi("erd"),yhe={name:phe,coinType:bhe,encode:hhe,decode:mhe},ghe="ela",vhe=2305,whe=no,Ahe=Eo,xhe={name:ghe,coinType:vhe,encode:whe,decode:Ahe},Ehe="eos",The=194,K80="EOS",Mhe=Rd(K80),Che=Bd(K80),She={name:Ehe,coinType:The,encode:Mhe,decode:Che},Ohe="etcLegacy",khe=61,Nhe=Mo(),Phe=Co(),Ihe={name:Ohe,coinType:khe,encode:Nhe,decode:Phe},Rhe="eth",Bhe=60,Dhe=Mo(),Lhe=Co(),hq={name:Rhe,coinType:Bhe,encode:Dhe,decode:Lhe},jhe="etn",Fhe=415,zhe=18,J80=er.checksum(4,$5),Vhe=e=>{const t=kf(new Uint8Array([zhe]),e),n=J80.encode(t);return Uv(n)},Uhe=e=>{const t=Hv(e);if(t[0]!==18)throw new Error("Unrecognised address format");return J80.decode(t).slice(1)},Hhe={name:jhe,coinType:Fhe,encode:Vhe,decode:Uhe},Ghe="ewtLegacy",qhe=246,Whe=Mo(),Qhe=Co(),Yhe={name:Ghe,coinType:qhe,encode:Whe,decode:Qhe},Z80=e=>{const t=[];do{let n=Number(e&127n);e>>=7n,e!=0n&&(n=n|128),t.push(n)}while(e!=0n);return Uint8Array.from(t)},X80=e=>{let t=0n,n=0n;for(const f of e){if(t|=BigInt(f&127)<{if(e.length<3||e[0]!=="f")return!1;if(e[1]==="0"){if(e.length>22)return!1}else if(e[1]==="1"||e[1]==="2"){if(e.length!==41)return!1}else if(e[1]==="3"){if(e.length!==86)return!1}else return!1;return!0},Xhe=e=>w8(e,{dkLen:4}),_he=e=>{const t=e.slice(1),n=e[0];if(n===0){const i=X80(t);return`f${n}${i}`}const f=w8(e,{dkLen:4}),r=kf(t,f),a=cq(r).toLowerCase();return`f${n}${a}`},$he=e=>{if(!Zhe(e))throw new Error("Unrecognised address format");const t=parseInt(e[1],10),n=new Uint8Array([t]),f=e.slice(2);if(t===0)return kf(n,Z80(BigInt(f)));const r=uq(f.toUpperCase()),a=r.slice(0,-4),i=r.slice(-4),o=kf(n,a),s=Xhe(o);if(!N1(i,s))throw new Error("Unrecognised address format");return o},e3e={name:Khe,coinType:Jhe,encode:_he,decode:$he},t3e="fio",n3e=235,_80="FIO",f3e=Rd(_80),r3e=Bd(_80),a3e={name:t3e,coinType:n3e,encode:f3e,decode:r3e},i3e="firo",o3e=136,$80=[new Uint8Array([82])],eb0=[new Uint8Array([7])],s3e=vi($80[0],eb0[0]),l3e=ii($80,eb0),c3e={name:i3e,coinType:o3e,encode:s3e,decode:l3e},u3e=64,d3e=[1n,2n,4n,8n,16n,32n,64n,128n,256n,512n,1024n,2048n,4096n,8192n,16384n,32768n,65536n,131072n,262144n,471693n,419994n,397615n,395339n,275453n,273067n,268625n,144334n,141953n,137544n,126816n,122570n,116281n,114136n,107829n,103596n,101446n,90923n,86683n,84547n,78212n,76098n,71873n,63506n,57383n,53262n,51260n,45085n,43057n,38955n,28724n,26666n,22553n,14343n,2002n,1831n,1678n,1660n,1437n,1259n,948n,874n,729n,455n,63n];function tb0(e){let t=0n;for(let n=0;n>1n;return t===0n&&e===0n}const p3e="flow",b3e=539,gO=8,h3e=e=>{let t=new Uint8Array(gO);return e.length>gO?t.set(e.slice(e.length-gO)):t.set(e,gO-e.length),yO(t).toLowerCase()},m3e=e=>{if(!tb0(BigInt(e)))throw new Error("Unrecognised address format");return M9(e.startsWith("0x")?e.slice(2):e)},y3e={name:p3e,coinType:b3e,encode:h3e,decode:m3e},mq=({hrp:e,p2pkhVersions:t,p2shVersions:n})=>{const f=Bi(e),r=ii(t,n);return a=>a.toLowerCase().startsWith(e)?f(a):r(a)},yq=({hrp:e,p2pkhVersions:t,p2shVersions:n})=>{const f=Ri(e),r=vi(t[0],n[0]);return a=>{try{return r(a)}catch{return f(a)}}},g3e="flux",v3e=19167,nb0="za",fb0=[new Uint8Array([28,184])],rb0=[new Uint8Array([28,189])],w3e=yq({hrp:nb0,p2pkhVersions:fb0,p2shVersions:rb0}),A3e=mq({hrp:nb0,p2pkhVersions:fb0,p2shVersions:rb0}),x3e={name:g3e,coinType:v3e,encode:w3e,decode:A3e},E3e="ftmLegacy",T3e=1007,M3e=Mo(),C3e=Co(),S3e={name:E3e,coinType:T3e,encode:M3e,decode:C3e},O3e="gnoLegacy",k3e=700,N3e=Mo(),P3e=Co(),I3e={name:O3e,coinType:k3e,encode:N3e,decode:P3e},R3e="goLegacy",B3e=6060,D3e=Mo(),L3e=Co(),j3e={name:R3e,coinType:B3e,encode:D3e,decode:L3e},F3e="grin",z3e=592,ab0="grin",V3e=Ri(ab0),U3e=Bi(ab0),H3e={name:F3e,coinType:z3e,encode:V3e,decode:U3e},G3e="gxc",q3e=2303,ib0="GXC",W3e=Rd(ib0),Q3e=Bd(ib0),Y3e={name:G3e,coinType:q3e,encode:W3e,decode:Q3e},K3e="hbar",J3e=3030,Z3e=e=>{if(e.length!==20)throw new Error("Unrecognised address format");const t=new DataView(e.buffer,0,20),n=t.getUint32(0),f=t.getBigUint64(4),r=t.getBigUint64(12,!1);return[n,f,r].join(".")},X3e=e=>{const t=new DataView(new ArrayBuffer(20),0,20),n=e.split(".");if(n.length!==3)throw new Error("Unrecognised address format");const f=Number(n[0]),r=BigInt(n[1]),a=BigInt(n[2]);return t.setUint32(0,f),t.setBigUint64(4,r),t.setBigUint64(12,a),new Uint8Array(t.buffer,0,20)},_3e={name:K3e,coinType:J3e,encode:Z3e,decode:X3e},$3e="hive",e9e=825,ob0="STM",t9e=Rd(ob0),n9e=Bd(ob0),f9e={name:$3e,coinType:e9e,encode:t9e,decode:n9e},r9e="hns",a9e=5353,sb0="hs",lb0=new Uint8Array([0]),i9e=e=>{if(e.length!==20)throw new Error("Unrecognised address format");return al.encode(sb0,[lb0[0],...al.toWords(e)])},o9e=e=>{const{prefix:t,words:n}=al.decode(e);if(t!==sb0)throw new Error("Unrecognised address format");const f=n[0],r=al.fromWords(n.slice(1));if(f!==lb0[0])throw new Error("Unrecognised address format");if(r.length!==20)throw new Error("Unrecognised address format");return new Uint8Array(r)},s9e={name:r9e,coinType:a9e,encode:i9e,decode:o9e},l9e="hnt",c9e=904,u9e=e=>{const t=kf(new Uint8Array([0]),e);return To(t)},d9e=e=>{const t=I1(e);if(t[0]!==0)throw new Error("Unrecognised address format");return t.slice(1)},p9e={name:l9e,coinType:c9e,encode:u9e,decode:d9e},b9e="icx",h9e=74,m9e=e=>{if(e.length!==21)throw new Error("Invalid address length");const t=e[0];if(t===0)return`hx${v8(e.slice(1))}`;if(t===1)return`cx${v8(e.slice(1))}`;throw new Error("Invalid address type")},y9e=e=>{const t=e.slice(0,2),n=e.slice(2);if(t==="hx")return kf(new Uint8Array([0]),M9(n));if(t==="cx")return kf(new Uint8Array([1]),M9(n));throw new Error("Invalid address prefix")},g9e={name:b9e,coinType:h9e,encode:m9e,decode:y9e},v9e="iost",w9e=291,A9e=no,x9e=Eo,E9e={name:v9e,coinType:w9e,encode:A9e,decode:x9e},T9e="iota",M9e=4218,cb0="iota",C9e=new Uint8Array([0]),S9e=Ri(cb0),O9e=Bi(cb0),k9e=e=>S9e(kf(C9e,e)),N9e=e=>O9e(e).slice(1),P9e={name:T9e,coinType:M9e,encode:k9e,decode:N9e},I9e="iotx",R9e=304,ub0="io",B9e=Ri(ub0),D9e=Bi(ub0),L9e={name:I9e,coinType:R9e,encode:B9e,decode:D9e},j9e="iris",F9e=566,db0="iaa",z9e=Ri(db0),V9e=Bi(db0),U9e={name:j9e,coinType:F9e,encode:z9e,decode:V9e},H9e="kava",G9e=459,pb0="kava",q9e=Ri(pb0),W9e=Bi(pb0),Q9e={name:H9e,coinType:G9e,encode:q9e,decode:W9e},Y9e="kmd",K9e=141,bb0=[new Uint8Array([60])],hb0=[new Uint8Array([85])],J9e=vi(bb0[0],hb0[0]),Z9e=ii(bb0,hb0),X9e={name:Y9e,coinType:K9e,encode:J9e,decode:Z9e},_9e="ksm",$9e=434,mb0=2,eme=pq(mb0),tme=bq(mb0),nme={name:_9e,coinType:$9e,encode:eme,decode:tme},fme="lcc",rme=192,yb0="lcc",gb0=[new Uint8Array([28])],vb0=[new Uint8Array([50]),new Uint8Array([5])],ame=ol({hrp:yb0,p2pkhVersions:gb0,p2shVersions:vb0}),ime=il({hrp:yb0,p2pkhVersions:gb0,p2shVersions:vb0}),ome={name:fme,coinType:rme,encode:ame,decode:ime},sme="lrg",lme=568,wb0=[new Uint8Array([30])],Ab0=[new Uint8Array([13])],cme=vi(wb0[0],Ab0[0]),ume=ii(wb0,Ab0),dme={name:sme,coinType:lme,encode:cme,decode:ume},pme="lsk",bme=134,hme=e=>`${npe(e)}L`,mme=e=>{if(e.length<2||e.length>22)throw new Error("Invalid address length");if(!e.endsWith("L")||e.includes("."))throw new Error("Invalid address format");return fpe(e.slice(0,-1))},yme={name:pme,coinType:bme,encode:hme,decode:mme},gme="ltc",vme=2,xb0="ltc",Eb0=[new Uint8Array([48])],Tb0=[new Uint8Array([50]),new Uint8Array([5])],wme=ol({hrp:xb0,p2pkhVersions:Eb0,p2shVersions:Tb0}),Ame=il({hrp:xb0,p2pkhVersions:Eb0,p2shVersions:Tb0}),xme={name:gme,coinType:vme,encode:wme,decode:Ame},Eme="luna",Tme=330,Mb0="terra",Mme=Ri(Mb0),Cme=Bi(Mb0),Sme={name:Eme,coinType:Tme,encode:Mme,decode:Cme},Ome="mona",kme=22,Cb0="mona",Sb0=[new Uint8Array([50])],Ob0=[new Uint8Array([55]),new Uint8Array([5])],Nme=ol({hrp:Cb0,p2pkhVersions:Sb0,p2shVersions:Ob0}),Pme=il({hrp:Cb0,p2pkhVersions:Sb0,p2shVersions:Ob0}),Ime={name:Ome,coinType:kme,encode:Nme,decode:Pme},Rme="mrx",Bme=326,Dme=To,Lme=I1,jme={name:Rme,coinType:Bme,encode:Dme,decode:Lme},Fme="nano",zme=165,kb0=(e,t,n)=>{const f=e.length*t%n,r=f===0?0:n-f;let a=0,i=0;const o=2**n-1,s=[];for(let l=0;l=2**t)throw new Error(`convertRadixNano: invalid data word=${c} from=${t}`);if(a=a<32)throw new Error(`convertRadixNano: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)s.push(a>>>i+r-n&o)}return a=a<0&&s.push(a>>>0),s},Vme={encode:e=>kb0(e,8,5),decode:e=>{const t=e.length*5%8;let n=kb0(e,5,8);return t!==0&&(n=n.slice(1)),Uint8Array.from(n)}},gq=er.chain(Vme,er.alphabet("13456789abcdefghijkmnopqrstuwxyz"),er.join("")),Ume=e=>{const t=gq.encode(e),n=w8(e,{dkLen:5}).reverse(),f=gq.encode(n);return`nano_${t}${f}`},Hme=e=>{const t=gq.decode(e.slice(5));return Uint8Array.from(t.slice(0,-5))},Gme={name:Fme,coinType:zme,encode:Ume,decode:Hme},qme="nas",Wme=2718,Nb0=er.checksum(4,Kae),Qme=e=>{const t=Nb0.encode(e);return no(t)},Yme=e=>{const t=Eo(e);if(t.length!==26||t[0]!==25||t[1]!==87&&t[1]!==88)throw new Error("Unrecognised address format");return Nb0.decode(t)},Kme={name:qme,coinType:Wme,encode:Qme,decode:Yme},Jme=/^(([a-z\d]+[\-_])*[a-z\d]+\.)*([a-z\d]+[\-_])*[a-z\d]+$/,vq=e=>!(e.length<2||e.length>64||!Jme.test(e)),Zme="near",Xme=397,_me=e=>{const t=tpe(e);if(!vq(t))throw new Error("Unrecognised address format");return t},$me=e=>{if(!vq(e))throw new Error("Unrecognised address format");return oq(e)},e4e={name:Zme,coinType:Xme,encode:_me,decode:$me},t4e="neo",n4e=888,f4e=To,r4e=I1,a4e={name:t4e,coinType:n4e,encode:f4e,decode:r4e},i4e="nim",o4e=242,wq="NQ",s4e=e=>{const t=e.toUpperCase().split("").map(f=>{const r=f.charCodeAt(0);return r>=48&&r<=57?f:(r-55).toString()}).join("");let n="";for(let f=0;f("00"+(98-s4e(e+wq+"00"))).slice(-2),Ib0=er.chain(er.radix2(5),er.alphabet("0123456789ABCDEFGHJKLMNPQRSTUVXY"),er.padding(5),er.join("")),l4e=e=>{const t=Ib0.encode(e),n=Pb0(t);return`${wq}${n}${t}`.replace(/.{4}/g,"$& ").trim()},c4e=e=>{if(!e.startsWith(wq))throw new Error("Unrecognised address format");const t=e.replace(/ /g,""),n=t.slice(2,4),f=t.slice(4);if(n!==Pb0(f))throw new Error("Unrecognised address format");return Ib0.decode(f)},u4e={name:i4e,coinType:o4e,encode:l4e,decode:c4e},d4e="nmc",p4e=7,b4e=To,h4e=I1,m4e={name:d4e,coinType:p4e,encode:b4e,decode:h4e},y4e="nostr",g4e=1237,Rb0="npub",v4e=Ri(Rb0),w4e=Bi(Rb0),A4e={name:y4e,coinType:g4e,encode:v4e,decode:w4e},x4e="nrgLegacy",E4e=9797,T4e=Mo(),M4e=Co(),C4e={name:x4e,coinType:E4e,encode:T4e,decode:M4e},S4e="nuls",O4e=8964,k4e=["a","b","c","d","e"],N4e=e=>{for(let t=0;t=97)return e.slice(t+1);throw new Error("Unrecognised address format")},P4e=e=>{const t=e[0]&255|(e[1]&255)<<8,n=new Uint8Array(e.length+1);let f=0;for(let a=0;a127?i-256:i;n[a]=o,f^=o}n[e.length]=f;let r;if(t===1)r="NULS";else if(t===2)r="tNULS";else{const a=kf(new Uint8Array([255&t>>0]),new Uint8Array([255&t>>8]));r=no(a).toUpperCase()}return r+k4e[r.length-1]+no(n)},I4e=e=>{let t;e.startsWith("NULS")?t=e.slice(5):e.startsWith("tNULS")?t=e.slice(6):t=N4e(e);const n=Eo(t);let f=0;for(let r=0;r127?a-256:a;n[r]=i,f^=i}if(f<0&&(f+=256),f!==n[n.length-1])throw new Error("Unrecognised address format");return n.slice(0,-1)},R4e={name:S4e,coinType:O4e,encode:P4e,decode:I4e},B4e="one",D4e=1023,Bb0="one",L4e=Ri(Bb0),j4e=Bi(Bb0),F4e={name:B4e,coinType:D4e,encode:L4e,decode:j4e},z4e="ont",V4e=1024,U4e=e=>{const t=kf(new Uint8Array([23]),e);return To(t)},H4e=e=>{const t=I1(e);if(t[0]!==23)throw new Error("Unrecognised address format");return t.slice(1)},G4e={name:z4e,coinType:V4e,encode:U4e,decode:H4e},q4e="poaLegacy",W4e=178,Q4e=Mo(),Y4e=Co(),K4e={name:q4e,coinType:W4e,encode:Q4e,decode:Y4e},J4e="ppc",Z4e=6,Db0=[new Uint8Array([55])],Lb0=[new Uint8Array([117])],X4e=vi(Db0[0],Lb0[0]),_4e=ii(Db0,Lb0),$4e={name:J4e,coinType:Z4e,encode:X4e,decode:_4e},eye="qtum",tye=2301,nye=To,fye=I1,rye={name:eye,coinType:tye,encode:nye,decode:fye},aye="rbtc",iye=137,jb0=30,oye=Mo(jb0),sye=Co(jb0),lye={name:aye,coinType:iye,encode:oye,decode:sye},cye="rdd",uye=4,Fb0=[new Uint8Array([61])],zb0=[new Uint8Array([5])],dye=vi(Fb0[0],zb0[0]),pye=ii(Fb0,zb0),bye={name:cye,coinType:uye,encode:dye,decode:pye},hye="rune",mye=931,Vb0="thor",yye=Ri(Vb0),gye=Bi(Vb0),vye={name:hye,coinType:mye,encode:yye,decode:gye},wye="rvn",Aye=175,Ub0=[new Uint8Array([60])],Hb0=[new Uint8Array([122])],xye=vi(Ub0[0],Hb0[0]),Eye=ii(Ub0,Hb0),Tye={name:wye,coinType:Aye,encode:xye,decode:Eye},Mye="sc",Cye=1991,Sye=32,Aq=6,Gb0=e=>w8(e,{dkLen:Sye}).slice(0,Aq),Oye=e=>{const t=Gb0(e);return v8(kf(e,t))},kye=e=>{if(e.length!==76)throw new Error("Unrecognised address format");const t=M9(e),n=t.slice(0,-Aq),f=t.slice(-Aq),r=Gb0(n);if(!N1(f,r))throw new Error("Unrecognised address format");return n},Nye={name:Mye,coinType:Cye,encode:Oye,decode:kye},Pye="sero",Iye=569,Rye=no,Bye=e=>{const t=Eo(e);if(t.length!==96)throw new Error("Unrecognised address format");return t},Dye={name:Pye,coinType:Iye,encode:Rye,decode:Bye},Lye="sol",jye=501,Fye=e=>{if(e.length!==32)throw new Error("Unrecognised address format");const t=no(e);if(t.length<32||t.length>44)throw new Error("Unrecognised address format");return t},zye=e=>{if(e.length<32||e.length>44)throw new Error("Unrecognised address format");const t=Eo(e);if(t.length!==32)throw new Error("Unrecognised address format");return t},Vye={name:Lye,coinType:jye,encode:Fye,decode:zye},Uye="srm",Hye=573,Gye=no,qye=Eo,Wye={name:Uye,coinType:Hye,encode:Gye,decode:qye},Qye="steem",Yye=135,qb0="STM",Kye=Rd(qb0),Jye=Bd(qb0),Zye={name:Qye,coinType:Yye,encode:Kye,decode:Jye},Xye="strat",_ye=105,Wb0=[new Uint8Array([63])],Qb0=[new Uint8Array([125])],$ye=vi(Wb0[0],Qb0[0]),e7e=ii(Wb0,Qb0),t7e={name:Xye,coinType:_ye,encode:$ye,decode:e7e},n7e="strk",f7e=9004,r7e=32,a7e=/^0x[a-fA-F0-9]{64}$/,Yb0=e=>{const t=v8(e).toLowerCase().split(""),n=e.findIndex(a=>a!==0),f=n>0?e.slice(n):e,r=new Uint8Array(32);return r.set($5(f),n),R80({address:t,hash:r,length:64})},i7e=e=>{if(e.length!==r7e)throw new Error("Unrecognised address format");return Yb0(e)},o7e=e=>{if(!a7e.test(e))throw new Error("Unrecognised address format");const t=mO(e);if(Yb0(t)!==e)throw new Error("Unrecognised address format");return t},s7e={name:n7e,coinType:f7e,encode:i7e,decode:o7e},l7e="stx",c7e=5757,u7e="S",Kb0=20,Gv=4,Jb0=new Uint8Array([22]),Zb0=new Uint8Array([20]),d7e={encode:e=>Xb0(e,8,5,!0),decode:e=>Uint8Array.from(Xb0(e,5,8,!1))},Xb0=(e,t,n,f)=>{let r=0,a=0;const i=2**n-1,o=[];for(const s of e.reverse()){r=s<=n;a-=n){const c=(r>>n*l&i)>>>0;o.unshift(c),l+=1}r=r>>n*l}if(!f&&a>=t)throw new Error("Excess padding");if(!f&&r)throw new Error(`Non-zero padding: ${r}`);return f&&a>0&&o.unshift(r>>>0),o},xq=er.chain(d7e,er.alphabet("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),er.join("")),Eq=e=>p8(p8(e)).slice(0,Gv),p7e=e=>{if(e.length!==Kb0+Gv)throw new Error("Unrecognised address format");const t=e.slice(0,Kb0),n=e.slice(-Gv);let f,r;if(N1(n,Eq(kf(Jb0,t))))f="P",r=xq.encode(e);else if(N1(n,Eq(kf(Zb0,t))))f="M",r=xq.encode(e);else throw new Error("Unrecognised address format");return`${u7e}${f}${r}`},b7e=e=>{if(e.length<6)throw new Error("Unrecognised address format");if(e[0]!=="S")throw new Error("Unrecognised address format");const t=e80(e),n=t[1];let f;if(n==="P")f=Jb0;else if(n==="M")f=Zb0;else throw new Error("Unrecognised address format");const r=xq.decode(t.slice(2)),a=r.slice(0,-Gv),i=r.slice(-Gv),o=Eq(kf(f,a));if(!N1(i,o))throw new Error("Unrecognised address format");return r},h7e={name:l7e,coinType:c7e,encode:p7e,decode:b7e},m7e="sys",y7e=57,_b0="sys",$b0=[new Uint8Array([63])],eh0=[new Uint8Array([5])],g7e=ol({hrp:_b0,p2pkhVersions:$b0,p2shVersions:eh0}),v7e=il({hrp:_b0,p2pkhVersions:$b0,p2shVersions:eh0}),w7e={name:m7e,coinType:y7e,encode:g7e,decode:v7e},A7e="tfuel",x7e=589,E7e=Mo(),T7e=Co(),M7e={name:A7e,coinType:x7e,encode:E7e,decode:T7e},C7e="thetaLegacy",S7e=500,O7e=Mo(),k7e=Co(),N7e={name:C7e,coinType:S7e,encode:O7e,decode:k7e},P7e="tomoLegacy",I7e=889,R7e=Mo(),B7e=Co(),D7e={name:P7e,coinType:I7e,encode:R7e,decode:B7e},L7e="trx",j7e=195,F7e=To,z7e=I1,V7e={name:L7e,coinType:j7e,encode:F7e,decode:z7e},U7e="ttLegacy",H7e=1001,G7e=Mo(),q7e=Co(),W7e={name:U7e,coinType:H7e,encode:G7e,decode:q7e},Q7e="vet",Y7e=818,K7e=Mo(),J7e=Co(),Z7e={name:Q7e,coinType:Y7e,encode:K7e,decode:J7e},X7e="via",_7e=14,th0=[new Uint8Array([71])],nh0=[new Uint8Array([33])],$7e=vi(th0[0],nh0[0]),ege=ii(th0,nh0),tge={name:X7e,coinType:_7e,encode:$7e,decode:ege},nge="vlx",fge=5655640,rge=no,age=Eo,ige={name:nge,coinType:fge,encode:rge,decode:age},oge="vlxLegacy",sge=574,lge=no,cge=Eo,uge={name:oge,coinType:sge,encode:lge,decode:cge},dge="vsys",pge=360,fh0=e=>{if(e[0]!==5||e[1]!==77||e.length!==26)return!1;const t=e.slice(-4),n=$5(w8(e.slice(0,-4),{dkLen:32})).slice(0,4);return!!N1(t,n)},bge=e=>{if(!fh0(e))throw new Error("Unrecognised address format");return no(e)},hge=e=>{const t=e.startsWith("address:")?e.slice(8):e;if(t.length>36)throw new Error("Unrecognised address format");const n=Eo(t);if(!fh0(n))throw new Error("Unrecognised address format");return n},mge={name:dge,coinType:pge,encode:bge,decode:hge},yge="wan",gge=5718350,rh0=e=>{const t=v8(e),n=t.split(""),f=$5(oq(t));let r;for(let a=0;a<40;a++)r=f[Math.floor(a/2)],a%2===0?r=r>>4:r&=15,n[a]>"9"&&r<=7&&(n[a]=n[a].toUpperCase());return`0x${n.join("")}`},vge=e=>rh0(e),wge=e=>{if(!D80(e))throw new Error("Unrecognised address format");const t=mO(e);if(rh0(t)!==e)throw new Error("Unrecognised address format");return t},Age={name:yge,coinType:gge,encode:vge,decode:wge},xge="waves",Ege=5741564,Tge=e=>$5(w8(e,{dkLen:32})),Mge=4,Cge=er.checksum(Mge,Tge),Sge=no,Oge=e=>{const t=Eo(e);if(t[0]!==1)throw new Error("Invalid address format");if(t[1]!==87||t.length!==26)throw new Error("Invalid address format");return Cge.decode(t),t},kge={name:xge,coinType:Ege,encode:Sge,decode:Oge},Nge="wicc",Pge=99999,ah0=[new Uint8Array([73])],ih0=[new Uint8Array([51])],Ige=vi(ah0[0],ih0[0]),Rge=ii(ah0,ih0),Bge={name:Nge,coinType:Pge,encode:Ige,decode:Rge},Dge="xch",Lge=8444,oh0="xch",sh0=90,jge=Up0(oh0,sh0),Fge=Hp0(oh0,sh0),zge={name:Dge,coinType:Lge,encode:jge,decode:Fge},Vge="xem",Uge=43,Hge=sq,Gge=e=>{const t=e.toUpperCase().replace(/-/g,"");if(!t||t.length!==40)throw new Error("Invalid address");const n=lq(t);if(v8($5(n.slice(0,21))).slice(0,8)!==v8(n.slice(21)))throw new Error("Invalid address");return n},qge={name:Vge,coinType:Uge,encode:Hge,decode:Gge},Wge="xhv",Qge=535,Yge=Uv,Kge=Hv,Jge={name:Wge,coinType:Qge,encode:Yge,decode:Kge},Zge="xlm",Xge=148,lh0=new Uint8Array([48]),ch0=e=>{let t=0;for(let n=0;n>>8&255;r^=f&255,r^=r>>>4,t=t<<8&65535,t^=r,r=r<<5&65535,t^=r,r=r<<7&65535,t^=r}return M9(t.toString(16).padStart(4,"0")).reverse()},_ge=e=>{const t=kf(lh0,e),n=ch0(t),f=kf(t,n);return sq(f)},$ge=e=>{const t=lq(e),n=t[0],f=t.slice(0,-2),r=f.slice(1),a=t.slice(-2);if(n!==lh0[0])throw new Error("Unrecognised address format");const i=ch0(f);if(!N1(a,i))throw new Error("Unrecognised address format");return r},eve={name:Zge,coinType:Xge,encode:_ge,decode:$ge},tve="xrp",nve=144,uh0=er.chain(er.checksum(4,e=>p8(p8(e))),O2e),fve=uh0.encode,rve=uh0.decode,ave={name:tve,coinType:nve,encode:fve,decode:rve},ive="xtz",ove=1729,sve=e=>{if(e.length!==22&&e.length!==21)throw new Error("Unrecognised address format");const t=e[0];if(t===0){let n;if(e[1]===0)n=new Uint8Array([6,161,159]);else if(e[1]===1)n=new Uint8Array([6,161,161]);else if(e[1]===2)n=new Uint8Array([6,161,164]);else throw new Error("Unrecognised address format");return To(kf(n,e.slice(2)))}if(t===1)return To(kf(new Uint8Array([2,90,121]),e.slice(1,21)));throw new Error("Unrecognised address format")},lve=e=>{const t=I1(e).slice(3),n=e.slice(0,3);if(n==="tz1")return kf(new Uint8Array([0,0]),t);if(n==="tz2")return kf(new Uint8Array([0,1]),t);if(n==="tz3")return kf(new Uint8Array([0,2]),t);if(n==="KT1")return kf(new Uint8Array([1]),t,new Uint8Array([0]));throw new Error("Unrecognised address format")},cve={name:ive,coinType:ove,encode:sve,decode:lve},uve="xvg",dve=77,dh0=[new Uint8Array([30])],ph0=[new Uint8Array([33])],pve=vi(dh0[0],ph0[0]),bve=ii(dh0,ph0),hve={name:uve,coinType:dve,encode:pve,decode:bve},mve="zec",yve=133,bh0="zs",hh0=[new Uint8Array([28,184])],mh0=[new Uint8Array([28,189])],gve=yq({hrp:bh0,p2pkhVersions:hh0,p2shVersions:mh0}),vve=mq({hrp:bh0,p2pkhVersions:hh0,p2shVersions:mh0}),wve={name:mve,coinType:yve,encode:gve,decode:vve},Ave="zen",xve=121,yh0=[new Uint8Array([32,137]),new Uint8Array([28,184]),new Uint8Array([32,150]),new Uint8Array([28,189]),new Uint8Array([22,154])],Eve=e=>{const t=e.slice(0,2);if(!yh0.some(n=>N1(n,t)))throw new Error("Invalid prefix");return To(e)},Tve=e=>{const t=I1(e),n=t.slice(0,2);if(!yh0.some(f=>N1(f,n)))throw new Error("Invalid prefix");return t},Mve={name:Ave,coinType:xve,encode:Eve,decode:Tve},Cve="zil",Sve=313,Ove=Ri("zil"),kve=Bi("zil"),Nve={name:Cve,coinType:Sve,encode:Ove,decode:kve},gh0=Object.freeze(Object.defineProperty({__proto__:null,abbc:B2e,ada:q2e,ae:J2e,aib:epe,aion:lpe,algo:vpe,ar:Tpe,ardr:Ppe,ark:Lpe,atom:Upe,avax:Ype,bcd:_pe,bch:u8e,bcn:w8e,bdx:M8e,bnb:N8e,bps:D8e,bsv:V8e,btc:W8e,btg:Z8e,btm:tbe,bts:ibe,cca:ube,ccxx:mbe,celoLegacy:xbe,ckb:Sbe,cloLegacy:Ibe,dash:jbe,dcr:Hbe,dgb:Ybe,divi:_be,doge:fhe,dot:dhe,egld:yhe,ela:xhe,eos:She,etcLegacy:Ihe,eth:hq,etn:Hhe,ewtLegacy:Yhe,fil:e3e,fio:a3e,firo:c3e,flow:y3e,flux:x3e,ftmLegacy:S3e,gnoLegacy:I3e,goLegacy:j3e,grin:H3e,gxc:Y3e,hbar:_3e,hive:f9e,hns:s9e,hnt:p9e,icx:g9e,iost:E9e,iota:P9e,iotx:L9e,iris:U9e,kava:Q9e,kmd:X9e,ksm:nme,lcc:ome,lrg:dme,lsk:yme,ltc:xme,luna:Sme,mona:Ime,mrx:jme,nano:Gme,nas:Kme,near:e4e,neo:a4e,nim:u4e,nmc:m4e,nostr:A4e,nrgLegacy:C4e,nuls:R4e,one:F4e,ont:G4e,poaLegacy:K4e,ppc:$4e,qtum:rye,rbtc:lye,rdd:bye,rune:vye,rvn:Tye,sc:Nye,sero:Dye,sol:Vye,srm:Wye,steem:Zye,strat:t7e,strk:s7e,stx:h7e,sys:w7e,tfuel:M7e,thetaLegacy:N7e,tomoLegacy:D7e,trx:V7e,ttLegacy:W7e,vet:Z7e,via:tge,vlx:ige,vlxLegacy:uge,vsys:mge,wan:Age,waves:kge,wicc:Bge,xch:zge,xem:qge,xhv:Jge,xlm:eve,xmr:b8e,xrp:ave,xtz:cve,xvg:hve,zec:wve,zen:Mve,zil:Nve},Symbol.toStringTag,{value:"Module"})),vh0=Object.freeze({"2147483658":["op","Optimism"],"2147483673":["cro","Cronos"],"2147483704":["bsc","BNB Smart Chain"],"2147483708":["go","GoChain"],"2147483709":["etc","Ethereum Classic"],"2147483736":["tomo","TomoChain"],"2147483747":["poa","POA"],"2147483748":["gno","Gnosis"],"2147483756":["tt","ThunderCore"],"2147483785":["matic","Polygon"],"2147483817":["manta","Manta Pacific"],"2147483894":["ewt","Energy Web"],"2147483898":["ftm","Fantom Opera"],"2147483936":["boba","Boba"],"2147483972":["zksync","zkSync"],"2147484009":["theta","Theta"],"2147484468":["clo","Callisto"],"2147484736":["metis","Metis"],"2147488648":["mantle","Mantle"],"2147492101":["base","Base"],"2147523445":["nrg","Energi"],"2147525809":["arb1","Arbitrum One"],"2147525868":["celo","Celo"],"2147526762":["avaxc","Avalanche C-Chain"],"2147542792":["linea","Linea"],"2148018000":["scr","Scroll"],"2155261425":["zora","Zora"]}),wh0=Object.freeze({0:["btc","Bitcoin"],2:["ltc","Litecoin"],3:["doge","Dogecoin"],4:["rdd","Reddcoin"],5:["dash","Dash"],6:["ppc","Peercoin"],7:["nmc","Namecoin"],14:["via","Viacoin"],20:["dgb","DigiByte"],22:["mona","Monacoin"],42:["dcr","Decred"],43:["xem","NEM"],55:["aib","AIB"],57:["sys","Syscoin"],60:["eth","Ethereum"],61:["etcLegacy","[LEGACY] Ethereum Classic"],74:["icx","ICON"],77:["xvg","Verge"],105:["strat","Stratis"],111:["ark","ARK"],118:["atom","Atom"],121:["zen","Zencash"],128:["xmr","Monero"],133:["zec","Zcash"],134:["lsk","Lisk"],135:["steem","Steem"],136:["firo","Firo"],137:["rbtc","RSK"],141:["kmd","Komodo"],144:["xrp","Ripple"],145:["bch","Bitcoin Cash"],148:["xlm","Stellar Lumens"],153:["btm","Bytom"],156:["btg","Bitcoin Gold"],165:["nano","Nano"],175:["rvn","Ravencoin"],178:["poaLegacy","[LEGACY] POA"],192:["lcc","LitecoinCash"],194:["eos","EOS"],195:["trx","Tron"],204:["bcn","Bytecoin"],235:["fio","FIO"],236:["bsv","BitcoinSV"],242:["nim","Nimiq"],246:["ewtLegacy","[LEGACY] Energy Web"],283:["algo","Algorand"],291:["iost","IOST"],301:["divi","Divi Project"],304:["iotx","IoTeX"],308:["bts","Bitshares"],309:["ckb","Nervos CKB"],313:["zil","Zilliqa"],326:["mrx","Metrix Coin"],330:["luna","Terra"],354:["dot","Polkadot"],360:["vsys","V Systems"],367:["abbc","ABBC"],397:["near","NEAR Protocol"],415:["etn","Electroneum"],425:["aion","Aion"],434:["ksm","Kusama"],457:["ae","\xE6ternity"],459:["kava","Kava"],461:["fil","Filecoin"],472:["ar","Arweave"],489:["cca","Counos"],500:["thetaLegacy","[LEGACY] Theta"],501:["sol","Solana"],508:["egld","MultiversX"],535:["xhv","Haven Protocol"],539:["flow","Flow"],566:["iris","Irisnet"],568:["lrg","Large Coin"],569:["sero","Super Zero Protocol"],570:["bdx","Beldex"],571:["ccxx","Counos X"],573:["srm","Serum"],574:["vlxLegacy","[LEGACY] Velas"],576:["bps","BitcoinPoS"],589:["tfuel","Theta Fuel"],592:["grin","Grin"],700:["gnoLegacy","[LEGACY] Gnosis"],714:["bnb","BNB"],818:["vet","VeChain"],820:["cloLegacy","[LEGACY] Callisto"],825:["hive","Hive"],888:["neo","NEO"],889:["tomoLegacy","[LEGACY] TomoChain"],904:["hnt","Helium"],931:["rune","THORChain"],999:["bcd","Bitcoin Diamond"],1001:["ttLegacy","[LEGACY] ThunderCore"],1007:["ftmLegacy","[LEGACY] Fantom"],1023:["one","HARMONY-ONE"],1024:["ont","Ontology"],1237:["nostr","Nostr"],1729:["xtz","Tezos"],1815:["ada","Cardano"],1991:["sc","Sia"],2301:["qtum","QTUM"],2303:["gxc","GXChain"],2305:["ela","Elastos"],2718:["nas","Nebulas"],3030:["hbar","Hedera HBAR"],4218:["iota","IOTA"],5353:["hns","Handshake"],5757:["stx","Stacks"],6060:["goLegacy","[LEGACY] GoChain"],8444:["xch","Chia"],8964:["nuls","NULS"],9e3:["avax","Avalanche"],9004:["strk","StarkNet"],9797:["nrgLegacy","[LEGACY] Energi"],16754:["ardr","Ardor"],19167:["flux","Flux"],52752:["celoLegacy","[LEGACY] Celo"],99999:["wicc","Waykichain"],5655640:["vlx","Velas"],5718350:["wan","Wanchain"],5741564:["waves","Waves"]}),Pve=Object.freeze({...wh0,...vh0}),Ive=Object.freeze(Object.fromEntries(Object.entries(vh0).map(([e,[t]])=>[t,parseInt(e)]))),Rve=Object.freeze(Object.fromEntries(Object.entries(wh0).map(([e,[t]])=>[t,parseInt(e)]))),Bve=Object.freeze({...Ive,...Rve}),vO=2147483648,Tq=e=>{if(!(e&vO))throw new Error("Coin type is not an EVM chain");return(vO-1&e)>>0},Dve=e=>{const t=gh0[e];if(!t){const n=Bve[e];if(!n)throw new Error(`Unsupported coin: ${e}`);const f=Tq(n),r=hq;return{name:e,coinType:n,evmChainId:f,encode:r.encode,decode:r.decode}}return t},Ah0=e=>{const t=Pve[String(e)];if(e>=vO){const f=Tq(e),r=!t,a=r?`Unknown Chain (${f})`:t[0],i=hq;return{name:a,coinType:e,evmChainId:f,isUnknownChain:r,encode:i.encode,decode:i.decode}}if(!t)throw new Error(`Unsupported coin type: ${e}`);const[n]=t;return gh0[n]},Lve=e=>{const t=typeof e=="string";return t&&Number.isNaN(parseInt(e))?{type:"name",value:e.toLowerCase().replace(/legacy$/,"Legacy")}:{type:"id",value:t?parseInt(e):e}},Mq=e=>{const t=Lve(e);let n;try{n=t.type==="id"?Ah0(t.value):Dve(t.value)}catch{throw new aue({coinType:e})}return n},jve=(e,{name:t,coin:n=60,bypassFormat:f})=>{const r=Mq(n);return r.coinType===60?{to:_r,data:Pn({abi:Y20,functionName:"addr",args:[Sr(t)]})}:f?{to:_r,data:Pn({abi:NG,functionName:"addr",args:[Sr(t),BigInt(n)]})}:{to:_r,data:Pn({abi:NG,functionName:"addr",args:[Sr(t),BigInt(r.coinType)]})}},Fve=async(e,t,{coin:n=60,strict:f})=>{if(t==="0x")return null;const r=Mq(n);let a;try{if(r.coinType===60?a=Ya({abi:Y20,functionName:"addr",data:t}):a=Ya({abi:NG,functionName:"addr",data:t}),!a)return null;const i=Qg(a);if(i==="0x"||i==="0x0"||i==="0x00")return null;const o=r.encode(T1(a));return o?{id:r.coinType,name:r.name,value:o}:null}catch(i){if(f)throw i;return null}},wO=ai({encode:jve,decode:Fve}),zve=(e,{name:t,coin:n,gatewayUrls:f})=>{const r=wO.encode(e,{name:t,coin:n});return Id.encode(e,{name:t,data:r.data,gatewayUrls:f})},Vve=async(e,t,n,{coin:f,strict:r,gatewayUrls:a})=>{const i=await Id.decode(e,t,n,{strict:r,gatewayUrls:a});return i?wO.decode(e,i.data,{coin:f,strict:r}):null},Cq=ai({encode:zve,decode:Vve}),xh0=[{inputs:[{name:"id",type:"uint256"}],name:"ownerOf",outputs:[{name:"owner",type:"address"}],stateMutability:"view",type:"function"}],Uve=[{inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}],Hve=[{inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"},{name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}],Eh0=[{inputs:[{name:"id",type:"uint256"}],name:"available",outputs:[{name:"available",type:"bool"}],stateMutability:"view",type:"function"}],Th0=[{inputs:[{name:"id",type:"uint256"}],name:"nameExpires",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"}],Mh0=[{inputs:[],name:"GRACE_PERIOD",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"}],Gve=[{inputs:[{name:"id",type:"uint256"},{name:"owner",type:"address"}],name:"reclaim",outputs:[],stateMutability:"nonpayable",type:"function"}],qve=[...Uve],Wve=[...Hve],Qve=[...xh0];class AO extends ia{constructor({parameter:t,allowedParameters:n,details:f}){super(`Additional parameter specified: ${t}`,{metaMessages:[`- Allowed parameters: ${n.join(", ")}`],details:f}),Object.defineProperty(this,"parameter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allowedParameters",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AdditionalParameterSpecifiedError"}),this.parameter=t,this.allowedParameters=n}}class Yve extends ia{constructor({parameter:t,details:n}){super(`Required parameter not specified: ${t}`,{details:n}),Object.defineProperty(this,"parameter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RequiredParameterNotSpecifiedError"}),this.parameter=t}}class Bc extends ia{constructor({nameType:t,supportedNameTypes:n,details:f}){super(`Unsupported name type: ${t}`,{metaMessages:[`- Supported name types: ${n.join(", ")}`],details:f}),Object.defineProperty(this,"nameType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportedTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedNameTypeError"}),this.nameType=t,this.supportedTypes=n}}class xO extends ia{constructor({contractType:t,supportedContractTypes:n,details:f}){super(`Invalid contract type: ${t}`,{metaMessages:[`- Supported contract types: ${n.join(", ")}`],details:f}),Object.defineProperty(this,"contractType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportedTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidContractTypeError"}),this.contractType=t,this.supportedTypes=n}}const sl=e=>{const t=e.split("."),n=t[t.length-1]==="eth";return t.length===0?"root":t.length===1?n?"eth-tld":"tld":t.length===2?n?"eth-2ld":"other-2ld":n?"eth-subname":"other-subname"},Kve=(e,{name:t})=>{const n=t.split("."),f=sl(t);if(f!=="eth-2ld")throw new Bc({nameType:f,supportedNameTypes:["eth-2ld"],details:"Currently only eth-2ld names can be checked for availability"});return{to:Rf({client:e,contract:"ensBaseRegistrarImplementation"}),data:Pn({abi:Eh0,functionName:"available",args:[BigInt(U6(n[0]))]})}},Jve=async(e,t)=>{if(typeof t=="object")throw t;return Ya({abi:Eh0,functionName:"available",data:t})},Zve=ai({encode:Kve,decode:Jve}),Xve=bO.encode,_ve=bO.decode,Sq=({name:e,prefix:t,encode:n,decode:f})=>({name:e,prefix:t,encode:r=>`${t}${n(r)}`,decode:r=>{if(!r.startsWith(t))throw new Error(`Multibase ${e} must start with ${t}`);return f(r.slice(t.length))}}),Dc=Sq({name:"base58btc",prefix:"z",encode:T9.encode,decode:T9.decode}),Ch0=er.chain(er.radix2(5),er.alphabet("abcdefghijklmnopqrstuvwxyz234567"),er.join("")),qv=Sq({name:"base32",prefix:"b",encode:e=>Ch0.encode(e),decode:e=>Ch0.decode(e)}),Sh0=er.chain(er.radix(36),er.alphabet("0123456789abcdefghijklmnopqrstuvwxyz"),er.join("")),Wv=Sq({name:"base36",prefix:"k",encode:Sh0.encode,decode:Sh0.decode}),Oh0=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};var kh0=128,$ve=127,ewe=~$ve,twe=Math.pow(2,31);const Qv=(e,t,n=0)=>{for(t=t||[],n=n||0;e>=twe;)t[n++]=e&255|kh0,e/=128;for(;e&ewe;)t[n++]=e&255|kh0,e>>>=7;return t[n]=e|0,t};var nwe=128,Nh0=127;const Yv=(e,f=0)=>{var n=0,f=f||0,r=0,a=f,i,o=e.length;do{if(a>=o)throw read.bytes=0,new RangeError("Could not decode varint");i=e[a++],n+=r<28?(i&Nh0)<=nwe);return[n,a-f]};var fwe=Math.pow(2,7),rwe=Math.pow(2,14),awe=Math.pow(2,21),iwe=Math.pow(2,28),owe=Math.pow(2,35),swe=Math.pow(2,42),lwe=Math.pow(2,49),cwe=Math.pow(2,56),uwe=Math.pow(2,63);const Kv=e=>e{const n=t.byteLength,f=Kv(e),r=f+Kv(n),a=new Uint8Array(r+n);return Qv(e,a,0),Qv(n,a,f),a.set(t,r),new Oq(e,n,t,a)},kq=e=>{const t=Oh0(e),[n,f]=Yv(t),[r,a]=Yv(t.subarray(f)),i=t.subarray(f+a);if(i.byteLength!==r)throw new Error("Incorrect length");return new Oq(n,r,i,t)},dwe=(e,t)=>{if(e===t)return!0;{const n=t;return e.code===n.code&&e.size===n.size&&n.bytes instanceof Uint8Array&&N1(e.bytes,n.bytes)}};function Ih0(e,t){const{bytes:n,version:f}=e;switch(f){case 0:return bwe(n,Nq(e),t??Dc.encode);default:return hwe(n,Nq(e),t??qv.encode)}}const Rh0=new WeakMap;function Nq(e){const t=Rh0.get(e);if(t==null){const n=new Map;return Rh0.set(e,n),n}return t}class ha{constructor(t,n,f,r){Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multihash",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"/",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n,this.version=t,this.multihash=f,this.bytes=r,this["/"]=r}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:t,multihash:n}=this;if(t!==C9)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(n.code!==mwe)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ha.createV0(n)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{const{code:t,digest:n}=this.multihash,f=Ph0(t,n);return ha.createV1(this.code,f)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return ha.equals(this,t)}static equals(t,n){const f=n;return f!=null&&t.code===f.code&&t.version===f.version&&dwe(t.multihash,f.multihash)}toString(t){return Ih0(this,t)}toJSON(){return{"/":Ih0(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;const n=t;if(n instanceof ha)return n;if(n["/"]!=null&&n["/"]===n.bytes||n.asCID===n){const{version:f,code:r,multihash:a,bytes:i}=n;return new ha(f,r,a,i??Bh0(f,r,a.bytes))}else if(n[ywe]===!0){const{version:f,multihash:r,code:a}=n,i=kq(r);return ha.create(f,a,i)}else return null}static create(t,n,f){if(typeof n!="number")throw new Error("String codecs are no longer supported");if(!(f.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(n!==C9)throw new Error(`Version 0 CID must use dag-pb (code: ${C9}) block encoding`);return new ha(t,n,f,f.bytes)}case 1:{const r=Bh0(t,n,f.bytes);return new ha(t,n,f,r)}default:throw new Error("Invalid version")}}static createV0(t){return ha.create(0,C9,t)}static createV1(t,n){return ha.create(1,t,n)}static decode(t){let[n,f]=ha.decodeFirst(t);if(f.length!==0&&([n,f]=ha.decodeFirst(Uint8Array.from([0,C9,...t])),f.length!==0))throw new Error("Incorrect length");return n}static decodeFirst(t){const n=ha.inspectBytes(t),f=n.size-n.multihashSize,r=Oh0(t.subarray(f,f+n.multihashSize));if(r.byteLength!==n.multihashSize)throw new Error("Incorrect length");const a=r.subarray(n.multihashSize-n.digestSize),i=new Oq(n.multihashCode,n.digestSize,a,r);return[n.version===0?ha.createV0(i):ha.createV1(n.codec,i),t.subarray(n.size)]}static inspectBytes(t){let n=0;const f=()=>{const[d,p]=Yv(t.subarray(n));return n+=p,d};let r=f(),a=C9;if(r===18?(r=0,n=0):a=f(),r!==0&&r!==1)throw new RangeError(`Invalid CID version ${r}`);const i=n,o=f(),s=f(),l=n+s,c=l-i;return{version:r,codec:a,multihashCode:o,digestSize:s,multihashSize:c,size:l}}static parse(t,n){const[f,r]=pwe(t,n),a=ha.decode(r);return Nq(a).set(f,t),a}}function pwe(e,t){switch(e[0]){case"Q":{const n=t??Dc;return[Dc.prefix,n.decode(`${Dc.prefix}${e}`)]}case Dc.prefix:{const n=t??Dc;return[Dc.prefix,n.decode(e)]}case qv.prefix:{const n=t??qv;return[qv.prefix,n.decode(e)]}case Wv.prefix:{const n=t??Wv;return[Wv.prefix,n.decode(e)]}default:return e=`z${e}`,[e[0],Dc.decode(e)]}}function bwe(e,t,n){const{prefix:f}=n;if(f!==Dc.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);const r=t.get(f);if(r==null){const a=n.encode(e).slice(1);return t.set(f,a),a}else return r}function hwe(e,t,n){const{prefix:f}=n,r=t.get(f);if(r==null){const a=n.encode(e);return t.set(f,a),a}else return r}const C9=112,mwe=18;function Bh0(e,t,n){const f=Kv(e),r=f+Kv(t),a=new Uint8Array(r+n.byteLength);return Qv(e,a,0),Qv(t,a,f),a.set(n,r),a}const ywe=Symbol.for("@ipld/js-cid/CID"),gwe=(e,t)=>{let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},Dh0={227:"ipfs",229:"ipns",228:"swarm",444:"onion",445:"onion3",11639056:"skynet",11704592:"arweave"},vwe={ipfs:227,ipns:229,swarm:228,onion:444,onion3:445,skynet:11639056,arweave:11704592},Pq=e=>{let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),t.length%2!==0)throw new Error("Invalid hex string");const n=new Uint8Array(t.length/2);for(let f=0;f{let t="";for(let n=0;n{try{const{multihash:t}=e;if(t.size<38){const n=kq(t.bytes);if(n.code===0&&n.size<36)return!1}return!0}catch{return!1}},jh0=e=>_ve(e),S9={skynet:e=>jh0(e),swarm:e=>{const t=Pq(e),n=Ph0(27,t);return ha.create(1,250,n).bytes},ipfs:e=>ha.parse(e).toV1().bytes,ipns:e=>{const t=ha.parse(e);return ha.create(1,114,t.multihash).bytes},utf8:e=>new TextEncoder().encode(e),arweave:e=>jh0(e)},O9={hexMultiHash:e=>{const t=ha.decode(e);return Lh0(kq(t.multihash.bytes).digest)},ipfs:e=>{const t=ha.decode(e).toV1();return t.toString(t.code===114?Wv:qv)},ipns:e=>{const t=ha.decode(e).toV1();return wwe(t)?t.toString(Wv):(console.warn("[ensdomains/content-hash] use of non-cryptographic identifiers in ipns-ns is deprecated and will be removed, migrate to ED25519 libp2p-key"),String.fromCodePoint(...ha.decode(e).multihash.digest))},utf8:e=>new TextDecoder().decode(e),base64:e=>Xve(e)},EO={skynet:{encode:S9.skynet,decode:O9.base64},swarm:{encode:S9.swarm,decode:O9.hexMultiHash},ipfs:{encode:S9.ipfs,decode:O9.ipfs},ipns:{encode:S9.ipns,decode:O9.ipns},arweave:{encode:S9.arweave,decode:O9.base64},default:{encode:S9.utf8,decode:O9.utf8}},Awe=e=>{const t=Pq(e),[n,f]=Yv(t),r=t.slice(f),a=Dh0[n];let i=EO[a];return i||(i=EO.default),i.decode(r)},xwe=(e,t)=>{let n=EO[e];n||(n=EO.default);const f=n.encode(t),r=vwe[e],a=Qv(r,new Uint8Array(Kv(r)));return Lh0(gwe(a,f))},Ewe=e=>{const t=Pq(e),[n]=Yv(t);return Dh0[n]};function Twe(e){return e.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave|ar):\/\/(.*)/)||e.match(/\/(ipfs)\/(.*)/)||e.match(/\/(ipns)\/(.*)/)}const Mwe=e=>{const t=Ewe(e);switch(t){case"ipfs":case"ipns":case"onion":case"onion3":return t;case"swarm":return"bzz";case"skynet":return"sia";case"arweave":return"ar";default:return null}},Cwe=e=>{switch(e){case"bzz":return"swarm";case"sia":return"skynet";case"ar":return"arweave";default:return e}};function Fh0(e){if(!e||e==="0x")return null;const t=Awe(e);return{protocolType:Mwe(e),decoded:t}}function Swe(e){const t=Twe(e);if(!t)return null;const[,n,f]=t;return{protocolType:n,decoded:f}}function Owe(e){const t=Swe(e);if(!t)throw new IG;const n=Cwe(t.protocolType);if(n==="onion"&&t.decoded.length!==16)throw new IG;if(n==="onion3"&&t.decoded.length!==56)throw new IG;return`0x${xwe(n,t.decoded)}`}const kwe=(e,{name:t})=>({to:_r,data:Pn({abi:J20,functionName:"contenthash",args:[Sr(t)]})}),Nwe=async(e,t,{strict:n})=>{if(t==="0x")return null;try{const f=Ya({abi:J20,functionName:"contenthash",data:t});return Fh0(f)}catch(f){if(n)throw f;return null}},TO=ai({encode:kwe,decode:Nwe}),Pwe=(e,{name:t,gatewayUrls:n})=>{const f=TO.encode(e,{name:t});return Id.encode(e,{name:t,data:f.data,gatewayUrls:n})},Iwe=async(e,t,n,{strict:f,gatewayUrls:r})=>{const a=await Id.decode(e,t,n,{strict:f,gatewayUrls:r});return a?TO.decode(e,a.data,{strict:f}):null},Rwe=ai({encode:Pwe,decode:Iwe}),Bwe=[{inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"id",type:"uint256"},{name:"amount",type:"uint256"},{name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}],Dwe=[{inputs:[{name:"node",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"}],zh0=[{inputs:[{name:"node",type:"bytes32"},{name:"label",type:"bytes32"},{name:"owner",type:"address"},{name:"resolver",type:"address"},{name:"ttl",type:"uint64"}],name:"setSubnodeRecord",outputs:[],stateMutability:"nonpayable",type:"function"}],Vh0=[{inputs:[{name:"node",type:"bytes32"},{name:"resolver",type:"address"}],name:"setResolver",outputs:[],stateMutability:"nonpayable",type:"function"}],Lwe=[{inputs:[{name:"node",type:"bytes32"},{name:"owner",type:"address"}],name:"setOwner",outputs:[],stateMutability:"nonpayable",type:"function"}],jwe=[{inputs:[{name:"node",type:"bytes32"},{name:"label",type:"bytes32"},{name:"owner",type:"address"}],name:"setSubnodeOwner",outputs:[{name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"}],Fwe=[{inputs:[{name:"node",type:"bytes32"},{name:"owner",type:"address"},{name:"resolver",type:"address"},{name:"ttl",type:"uint64"}],name:"setRecord",outputs:[],stateMutability:"nonpayable",type:"function"}],rs=[{inputs:[],name:"CannotUpgrade",type:"error"},{inputs:[],name:"IncompatibleParent",type:"error"},{inputs:[{name:"owner",type:"address"}],name:"IncorrectTargetOwner",type:"error"},{inputs:[],name:"IncorrectTokenType",type:"error"},{inputs:[{name:"labelHash",type:"bytes32"},{name:"expectedLabelhash",type:"bytes32"}],name:"LabelMismatch",type:"error"},{inputs:[{name:"label",type:"string"}],name:"LabelTooLong",type:"error"},{inputs:[],name:"LabelTooShort",type:"error"},{inputs:[],name:"NameIsNotWrapped",type:"error"},{inputs:[{name:"node",type:"bytes32"}],name:"OperationProhibited",type:"error"},{inputs:[{name:"node",type:"bytes32"},{name:"addr",type:"address"}],name:"Unauthorised",type:"error"}],Jv=[...rs,{inputs:[{name:"id",type:"uint256"}],name:"getData",outputs:[{name:"owner",type:"address"},{name:"fuses",type:"uint32"},{name:"expiry",type:"uint64"}],stateMutability:"view",type:"function"}],zwe=[...rs,{inputs:[{name:"node",type:"bytes32"},{name:"ownerControlledFuses",type:"uint16"}],name:"setFuses",outputs:[{name:"",type:"uint32"}],stateMutability:"nonpayable",type:"function"}],Vwe=[...rs,{inputs:[{name:"parentNode",type:"bytes32"},{name:"labelhash",type:"bytes32"},{name:"fuses",type:"uint32"},{name:"expiry",type:"uint64"}],name:"setChildFuses",outputs:[],stateMutability:"nonpayable",type:"function"}],Uh0=[...rs,{inputs:[{name:"parentNode",type:"bytes32"},{name:"label",type:"string"},{name:"owner",type:"address"},{name:"resolver",type:"address"},{name:"ttl",type:"uint64"},{name:"fuses",type:"uint32"},{name:"expiry",type:"uint64"}],name:"setSubnodeRecord",outputs:[{name:"node",type:"bytes32"}],stateMutability:"nonpayable",type:"function"}],Uwe=[...rs,{inputs:[{name:"node",type:"bytes32"},{name:"owner",type:"address"},{name:"resolver",type:"address"},{name:"ttl",type:"uint64"}],name:"setRecord",outputs:[],stateMutability:"nonpayable",type:"function"}],Hwe=[...rs,{inputs:[{name:"parentNode",type:"bytes32"},{name:"label",type:"string"},{name:"owner",type:"address"},{name:"fuses",type:"uint32"},{name:"expiry",type:"uint64"}],name:"setSubnodeOwner",outputs:[{name:"node",type:"bytes32"}],stateMutability:"nonpayable",type:"function"}],Gwe=[...rs,{inputs:[{name:"name",type:"bytes"},{name:"wrappedOwner",type:"address"},{name:"resolver",type:"address"}],name:"wrap",outputs:[],stateMutability:"nonpayable",type:"function"}],qwe=[...rs,{inputs:[{name:"parentNode",type:"bytes32"},{name:"labelhash",type:"bytes32"},{name:"controller",type:"address"}],name:"unwrap",outputs:[],stateMutability:"nonpayable",type:"function"}],Wwe=[...rs,{inputs:[{name:"labelhash",type:"bytes32"},{name:"registrant",type:"address"},{name:"controller",type:"address"}],name:"unwrapETH2LD",outputs:[],stateMutability:"nonpayable",type:"function"}],Iq=[...rs,{inputs:[{name:"",type:"bytes32"}],name:"names",outputs:[{name:"",type:"bytes"}],stateMutability:"view",type:"function"}],Qwe=[...rs,...Bwe],Ywe=[...rs,...xh0],Kwe=[...rs,...Vh0],Hh0=e=>{const t=BigInt(e)*1000n;return t>BigInt(X20)?new Date(X20):new Date(Number(t))},Rq=e=>e.length===2&&e[1]==="eth",Gh0=(e,t)=>e||(Rq(t)?"registrar":"nameWrapper"),Jwe=(e,{name:t,contract:n})=>{const f=t.split("."),r=Gh0(n,f),a=[{to:Rf({client:e,contract:"multicall3"}),data:Pn({abi:Q20,functionName:"getCurrentBlockTimestamp"})}];if(r==="nameWrapper")a.push({to:Rf({client:e,contract:"ensNameWrapper"}),data:Pn({abi:Jv,functionName:"getData",args:[BigInt(Sr(f.join(".")))]})});else{const i=Rf({client:e,contract:"ensBaseRegistrarImplementation"});a.push({to:i,data:Pn({abi:Th0,functionName:"nameExpires",args:[BigInt(U6(f[0]))]})}),a.push({to:i,data:Pn({abi:Mh0,functionName:"GRACE_PERIOD"})})}return rl.encode(e,{transactions:a})},Zwe=async(e,t,{name:n,contract:f})=>{if(typeof t=="object")throw t;const r=n.split("."),a=await rl.decode(e,t,[]),i=Ya({abi:Q20,functionName:"getCurrentBlockTimestamp",data:a[0].returnData}),o=Gh0(f,r);let s,l=0n;if(o==="nameWrapper"?[,,s]=Ya({abi:Jv,functionName:"getData",data:a[1].returnData}):(s=Ya({abi:Th0,functionName:"nameExpires",data:a[1].returnData}),l=Ya({abi:Mh0,functionName:"GRACE_PERIOD",data:a[2].returnData})),s===0n)return null;let c="active";return i>s+l?c="expired":i>s&&(c="gracePeriod"),{expiry:{date:Hh0(s),value:s},gracePeriod:Number(l),status:c}},Xwe=ai({encode:Jwe,decode:Zwe}),_we=(e,{address:t,gatewayUrls:n})=>{const f=`${t.toLowerCase().substring(2)}.addr.reverse`,r=Rf({client:e,contract:"ensUniversalResolver"}),a=[e8(Rv(f))];return{to:r,...n!=null&&n.length?{data:Pn({abi:rp0,functionName:"reverse",args:[...a,n]}),passthrough:{args:[...a,n],address:r}}:{data:Pn({abi:LG,functionName:"reverse",args:a}),passthrough:{args:a,address:r}}}},$we=async(e,t,n,{address:f,allowMismatch:r,strict:a,gatewayUrls:i})=>{if(!HG(t,{strict:a,abi:i?rp0:LG,args:n.args,functionName:"reverse",address:n.address}))return null;try{const[o,s,l,c]=Ya({abi:LG,functionName:"reverse",data:t});if(!o)return null;const d=t9(s)===t9(f);return!d&&!r?null:{name:fp0(o),match:d,reverseResolverAddress:l,resolverAddress:c}}catch(o){if(a)throw o;return null}},eAe=ai({encode:_we,decode:$we}),MO=({client:e,contract:t,namehash:n,labels:f})=>{switch(t){case"nameWrapper":return{to:Rf({client:e,contract:"ensNameWrapper"}),data:Pn({abi:Ywe,functionName:"ownerOf",args:[BigInt(n)]})};case"registry":return{to:Rf({client:e,contract:"ensRegistry"}),data:Pn({abi:Dwe,functionName:"owner",args:[n]})};case"registrar":return{to:Rf({client:e,contract:"ensBaseRegistrarImplementation"}),data:Pn({abi:Qve,functionName:"ownerOf",args:[BigInt(U6(f[0]))]})};default:throw new xO({contractType:t,supportedContractTypes:["nameWrapper","registry","registrar"]})}},tAe=(e,{name:t,contract:n})=>{const f=Sr(t),r=t.split(".");if(n||r.length===1)return MO({client:e,contract:n||"registry",namehash:f,labels:r});const a=MO({client:e,contract:"registry",namehash:f}),i=MO({client:e,contract:"nameWrapper",namehash:f}),o=[a,i];return Rq(r)&&o.push(MO({client:e,contract:"registrar",labels:r})),rl.encode(e,{transactions:o})},qh0=e=>ES([{type:"address"}],e)[0],nAe=async(e,t,{name:n,contract:f})=>{var c;if(typeof t=="object")throw t;const r=n.split(".");if(f||r.length===1){const d=qh0(t);return f==="registrar"?{ownershipLevel:"registrar",registrant:d}:{ownershipLevel:f||"registry",owner:d}}const a=await rl.decode(e,t,[]),[i,o,s]=[a[0].returnData,a[1].returnData,(c=a[2])==null?void 0:c.returnData].map(d=>d&&d!=="0x"?qh0(d):void 0),l=Rf({client:e,contract:"ensNameWrapper"});return r[r.length-1]==="eth"?s===l?{owner:o,ownershipLevel:"nameWrapper"}:s?{registrant:s,owner:i,ownershipLevel:"registrar"}:i!==_r?r.length===2?{registrant:null,owner:i,ownershipLevel:"registrar"}:i===l&&o&&o!==_r?{owner:o,ownershipLevel:"nameWrapper"}:{owner:i,ownershipLevel:"registry"}:null:i===l&&o&&o!==_r?{owner:o,ownershipLevel:"nameWrapper"}:i&&i!==_r?{owner:i,ownershipLevel:"registry"}:null},fAe=ai({encode:tAe,decode:nAe}),CO=[{inputs:[{name:"names",type:"string[]"},{name:"duration",type:"uint256"}],name:"rentPrice",outputs:[{name:"total",type:"uint256"}],stateMutability:"view",type:"function"}],rAe=[{inputs:[{name:"names",type:"string[]"},{name:"duration",type:"uint256"}],name:"renewAll",outputs:[],stateMutability:"payable",type:"function"}],SO=[{inputs:[{name:"commitment",type:"bytes32"}],name:"CommitmentTooNew",type:"error"},{inputs:[{name:"commitment",type:"bytes32"}],name:"CommitmentTooOld",type:"error"},{inputs:[{name:"duration",type:"uint256"}],name:"DurationTooShort",type:"error"},{inputs:[],name:"InsufficientValue",type:"error"},{inputs:[],name:"MaxCommitmentAgeTooHigh",type:"error"},{inputs:[],name:"MaxCommitmentAgeTooLow",type:"error"},{inputs:[{name:"name",type:"string"}],name:"NameNotAvailable",type:"error"},{inputs:[],name:"ResolverRequiredWhenDataSupplied",type:"error"},{inputs:[{name:"commitment",type:"bytes32"}],name:"UnexpiredCommitmentExists",type:"error"}],Wh0=[...SO,{inputs:[{name:"name",type:"string"},{name:"duration",type:"uint256"}],name:"rentPrice",outputs:[{components:[{name:"base",type:"uint256"},{name:"premium",type:"uint256"}],name:"price",type:"tuple"}],stateMutability:"view",type:"function"}],aAe=[...SO,{inputs:[{name:"commitment",type:"bytes32"}],name:"commit",outputs:[],stateMutability:"nonpayable",type:"function"}],iAe=[...SO,{inputs:[{name:"name",type:"string"},{name:"owner",type:"address"},{name:"duration",type:"uint256"},{name:"secret",type:"bytes32"},{name:"resolver",type:"address"},{name:"data",type:"bytes[]"},{name:"reverseRecord",type:"bool"},{name:"ownerControlledFuses",type:"uint16"}],name:"register",outputs:[],stateMutability:"payable",type:"function"}],oAe=[...SO,{inputs:[{name:"name",type:"string"},{name:"duration",type:"uint256"}],name:"renew",outputs:[],stateMutability:"payable",type:"function"}],sAe=(e,{nameOrNames:t,duration:n})=>{const f=(Array.isArray(t)?t:[t]).map(r=>{const a=r.split("."),i=sl(r);if(i!=="eth-2ld"&&i!=="tld")throw new Bc({nameType:i,supportedNameTypes:["eth-2ld","tld"],details:"Currently only the price of eth-2ld names can be fetched"});return a[0]});if(f.length>1){const r=Rf({client:e,contract:"ensBulkRenewal"});return rl.encode(e,{transactions:[{to:r,data:Pn({abi:CO,functionName:"rentPrice",args:[f,BigInt(n)]})},{to:r,data:Pn({abi:CO,functionName:"rentPrice",args:[f,0n]})}]})}return{to:Rf({client:e,contract:"ensEthRegistrarController"}),data:Pn({abi:Wh0,functionName:"rentPrice",args:[f[0],BigInt(n)]})}},lAe=async(e,t,{nameOrNames:n})=>{if(typeof t=="object")throw t;if(Array.isArray(n)&&n.length>1){const f=await rl.decode(e,t,[]),r=Ya({abi:CO,functionName:"rentPrice",data:f[0].returnData}),a=Ya({abi:CO,functionName:"rentPrice",data:f[1].returnData});return{base:r-a,premium:a}}return Ya({abi:Wh0,functionName:"rentPrice",data:t})},cAe=ai({encode:sAe,decode:lAe}),uAe=(e,{name:t,key:n})=>({to:_r,data:Pn({abi:K20,functionName:"text",args:[Sr(t),n]})}),dAe=async(e,t,{strict:n})=>{if(t==="0x")return null;try{return Ya({abi:K20,functionName:"text",data:t})||null}catch(f){if(n)throw f;return null}},OO=ai({encode:uAe,decode:dAe}),pAe=(e,{name:t,texts:n,coins:f,abi:r,contentHash:a})=>[...(n??[]).map(i=>({key:i,call:OO.encode(e,{name:t,key:i}),type:"text"})),...(f??[]).map(i=>({key:i,call:wO.encode(e,{name:t,coin:i}),type:"coin"})),...a?[{key:"contentHash",call:TO.encode(e,{name:t}),type:"contentHash"}]:[],...r?[{key:"abi",call:sO.encode(e,{name:t}),type:"abi"}]:[]],bAe=(e,{name:t,resolver:n,texts:f,coins:r,contentHash:a,abi:i,gatewayUrls:o})=>{const s=pAe(e,{name:t,texts:f,coins:r,contentHash:a,abi:i});if(n!=null&&n.address&&!n.fallbackOnly)return{...rl.encode(e,{transactions:s.map(d=>({to:n.address,data:d.call.data}))}),passthrough:{calls:s}};const l=Rf({client:e,contract:"ensUniversalResolver"}),c=[e8(Rv(t)),s.map(d=>d.call.data)];return{to:l,...o?{data:Pn({abi:ip0,functionName:"resolve",args:[...c,o]}),passthrough:{calls:s,args:[...c,o],address:l}}:{data:Pn({abi:VG,functionName:"resolve",args:c}),passthrough:{calls:s,args:c,address:l}}}},hAe=({texts:e,coins:t,abi:n,contentHash:f})=>({...e?{texts:[]}:{},...t?{coins:[]}:{},...f?{contentHash:null}:{},...n?{abi:null}:{}}),mAe=async(e,{item:t,call:n})=>{const{key:f,type:r}=n,a={key:f,type:r};if(r==="contentHash")try{const o=ES([{type:"bytes"}],t)[0];if(o==="0x"||hS(o)===0n)return{...a,value:null}}catch{}if(r==="text"){const o=await OO.decode(e,t,{strict:!1});return{...a,value:o}}if(r==="coin"){const o=await wO.decode(e,t,{coin:f,strict:!1});return{...a,value:o}}if(r==="contentHash"){const o=await TO.decode(e,t,{strict:!1});return{...a,value:o}}const i=await sO.decode(e,t,{strict:!1});return{...a,value:i}},yAe=(e,t)=>(t.type==="text"||t.type==="coin")&&!t.value?e:t.type==="text"?{...e,texts:[...e.texts||[],{key:t.key,value:t.value}]}:t.type==="coin"?{...e,coins:[...e.coins||[],t.value]}:t.type==="contentHash"?{...e,contentHash:t.value}:{...e,abi:t.value},gAe=async(e,t,n,{resolver:f,texts:r,coins:a,contentHash:i,abi:o,gatewayUrls:s})=>{const{calls:l}=n;let c=[],d;const p=hAe({texts:r,coins:a,contentHash:i,abi:o});if(f!=null&&f.address&&!f.fallbackOnly){const O=await rl.decode(e,t,n.calls.filter(L=>L).map(L=>L.call));d=f.address,c=O.map(L=>L.returnData)}else{if(!HG(t,{strict:!1,abi:s?ip0:VG,args:n.args,functionName:"resolve",address:n.address}))return{...p,resolverAddress:_r};const O=Ya({abi:VG,functionName:"resolve",data:t});[,d]=O,c=O[0].map((L,D)=>L.success?L.returnData:(l[D]=null,null))}const x=l.filter(O=>O),C=c.filter(O=>O);return(await Promise.all(C.map(async(O,L)=>mAe(e,{item:O,call:x[L]})))).reduce(yAe,{...p,resolverAddress:d})},vAe=ai({encode:bAe,decode:gAe}),wAe=(e,{name:t})=>{const n=Rf({client:e,contract:"ensUniversalResolver"}),f=[e8(Rv(t))];return{to:n,data:Pn({abi:UG,functionName:"findResolver",args:f}),passthrough:{address:n,args:f}}},AAe=async(e,t,n)=>{if(typeof t=="object")throw yv(t,{abi:UG,functionName:"findResolver",args:n.args,address:n.address});const f=Ya({abi:UG,functionName:"findResolver",data:t});return f[0]===_r?null:f[0]},xAe=ai({encode:wAe,decode:AAe}),EAe=(e,{name:t,key:n,gatewayUrls:f})=>{const r=OO.encode(e,{name:t,key:n});return Id.encode(e,{name:t,data:r.data,gatewayUrls:f})},TAe=async(e,t,n,{strict:f,gatewayUrls:r})=>{const a=await Id.decode(e,t,n,{strict:f,gatewayUrls:r});return a?OO.decode(e,a.data,{strict:f}):null},MAe=ai({encode:EAe,decode:TAe}),Bq={CANNOT_UNWRAP:1n,CANNOT_BURN_FUSES:2n,CANNOT_TRANSFER:4n,CANNOT_SET_RESOLVER:8n,CANNOT_SET_TTL:16n,CANNOT_CREATE_SUBDOMAIN:32n,CANNOT_APPROVE:64n},CAe=Object.keys(Bq),k9={PARENT_CANNOT_CONTROL:65536n,CAN_EXTEND_EXPIRY:262144n},SAe=Object.keys(k9);({...Bq,...k9});const Qh0={...k9,IS_DOT_ETH:131072n},OAe=Object.keys(Qh0),kAe=[128n,256n,512n,1024n,2048n,4096n,8192n,16384n,32768n],NAe=["0x80","0x100","0x200","0x400","0x800","0x1000","0x2000","0x4000","0x8000"],Yh0=[524288n,1048576n,2097152n,4194304n,8388608n,16777216n,33554432n,67108864n,134217728n,268435456n,536870912n,1073741824n,2147483648n],Kh0=["0x80000","0x100000","0x200000","0x400000","0x800000","0x1000000"],Zv={CHILD_CONTROLLED_FUSES:65535n,PARENT_CONTROLLED_FUSES:4294901760n,USER_SETTABLE_FUSES:4294836223n},Dq={Name:"child",Object:Bq,Keys:CAe,Range:Zv.CHILD_CONTROLLED_FUSES,Unnamed:kAe,UnnamedKeys:NAe,Minimum:0n,Maximum:2n**16n-1n},Jh0={Name:"parent",Object:k9,Keys:SAe,Range:Zv.PARENT_CONTROLLED_FUSES,Unnamed:Yh0,UnnamedKeys:Kh0,Minimum:2n**16n,Maximum:2n**32n},PAe={Name:"parent",Object:Qh0,Keys:OAe,Range:Zv.PARENT_CONTROLLED_FUSES,Unnamed:Yh0,UnnamedKeys:Kh0,Minimum:2n**16n,Maximum:2n**32n},Zh0=e=>{if(e>2n**32n||e<0n)throw new PG({fuses:e,details:`Fuse number must be limited to uint32, the supplied value was too ${e<0?"low":"high"}`});if((e&Zv.USER_SETTABLE_FUSES)!==e)throw new PG({fuses:e,details:"Fuse number must be limited to user settable fuses, the supplied value was not"})},Lq=({reference:e,object:t})=>{if(!t)return 0;if("number"in t){if("named"in t||"unnamed"in t)throw new $20({fuses:t,details:"Cannot specify both a fuse number and named/unnamed fuses."});if(Zh0(t.number),(t.number&e.Range)!==t.number)throw new PG({fuses:t.number,minimum:e.Minimum,maximum:e.Maximum,details:`Cannot specify a fuse value to set that is outside of the ${e.Name}'s control.`});return Number(t.number)}let n=0n;if("named"in t&&t.named)for(const f of t.named){if(!e.Keys.includes(f))throw new Bde({fuse:f});n|=e.Object[f]}if("unnamed"in t&&t.unnamed)for(const f of t.unnamed){if(!e.Unnamed.includes(f))throw new Dde({fuse:f});n|=f}return Number(n)},N9=({restriction:e,input:t})=>{if(e){if("parent"in t||"child"in t)throw new Rde({fuses:t,details:"Fuse restriction cannot be used when fuse category is specified"});return Lq({object:t,reference:e==="child"?Dq:Jh0})}if("number"in t){if("parent"in t||"child"in t)throw new $20({fuses:t,details:"Cannot specify both a fuse number and named/unnamed fuses."});return Zh0(t.number),Number(t.number)}const n="child"in t?Lq({object:t.child,reference:Dq}):0,f="parent"in t?Lq({object:t.parent,reference:Jh0}):0;return Number(n|f)},Xh0=({input:e,reference:t})=>({...Object.fromEntries(t.Keys.map(n=>[n,(e&t.Object[n])===t.Object[n]])),unnamed:Object.fromEntries(t.UnnamedKeys.map(n=>[n,(e&BigInt(n))===BigInt(n)]))}),jq=e=>{const t=BigInt(e);return{parent:Xh0({input:t,reference:PAe}),child:{...Xh0({input:t,reference:Dq}),CAN_DO_EVERYTHING:(t&Zv.CHILD_CONTROLLED_FUSES)===0n}}},IAe=(e,{name:t})=>{const n=Rf({client:e,contract:"ensNameWrapper"}),f=[BigInt(Sr(t))];return{to:n,data:Pn({abi:Jv,functionName:"getData",args:f}),passthrough:{address:n,args:f}}},RAe=async(e,t,n)=>{if(typeof t=="object")throw yv(t,{abi:Jv,functionName:"getData",args:n.args,address:n.address});const[f,r,a]=Ya({abi:Jv,functionName:"getData",data:t});if(f===_r)return null;const i=jq(r),o=a>0?Hh0(a):null;return{fuses:{...i,value:r},expiry:o?{date:o,value:a}:null,owner:f}},_h0=ai({encode:IAe,decode:RAe}),BAe=(e,{name:t})=>{const n=Rf({client:e,contract:"ensNameWrapper"}),f=[Sr(t)];return{to:n,data:Pn({abi:Iq,functionName:"names",args:f}),passthrough:{address:n,args:f}}},DAe=async(e,t,n)=>{if(typeof t=="object")throw yv(t,{abi:Iq,functionName:"names",args:n.args,address:n.address});const f=Ya({abi:Iq,functionName:"names",data:t});return!f||f==="0x"||BigInt(f)===0n?null:Wde(T1(f))},LAe=ai({encode:BAe,decode:DAe}),jAe=e=>({ensBatch:(...t)=>Cde(e,...t),getAbiRecord:t=>Zde(e,t),getAddressRecord:t=>Cq(e,t),getAvailable:t=>Zve(e,t),getContentHashRecord:t=>Rwe(e,t),getExpiry:t=>Xwe(e,t),getName:t=>eAe(e,t),getOwner:t=>fAe(e,t),getPrice:t=>cAe(e,t),getRecords:t=>vAe(e,t),getResolver:t=>xAe(e,t),getTextRecord:t=>MAe(e,t),getWrapperData:t=>_h0(e,t),getWrapperName:t=>LAe(e,t)}),Fq=JSON,FAe=e=>e.toUpperCase(),zAe=e=>{const t={};return e.forEach((n,f)=>{t[f]=n}),t},VAe=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},UAe=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0},HAe=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0};function kO(e,t){if(!e)throw new Error(t)}function GAe(e){return typeof e=="object"&&e!==null}function qAe(e,t){if(!e)throw new Error("Unexpected invariant triggered.")}const WAe=/\r\n|[\n\r]/g;function zq(e,t){let n=0,f=1;for(const r of e.body.matchAll(WAe)){if(typeof r.index=="number"||qAe(!1),r.index>=t)break;n=r.index+r[0].length,f+=1}return{line:f,column:t+1-n}}function QAe(e){return $h0(e.source,zq(e.source,e.start))}function $h0(e,t){const n=e.locationOffset.column-1,f="".padStart(n)+e.body,r=t.line-1,a=e.locationOffset.line-1,i=t.line+a,o=t.line===1?n:0,s=t.column+o,l=`${e.name}:${i}:${s} `,c=f.split(/\r\n|[\n\r]/g),d=c[r];if(d.length>120){const p=Math.floor(s/80),x=s%80,C=[];for(let O=0;O["|",O]),["|","^".padStart(x)],["|",C[p+1]]])}return l+e30([[`${i-1} |`,c[r-1]],[`${i} |`,d],["|","^".padStart(s)],[`${i+1} |`,c[r+1]]])}function e30(e){const t=e.filter(([f,r])=>r!==void 0),n=Math.max(...t.map(([f])=>f.length));return t.map(([f,r])=>f.padStart(n)+(r?" "+r:"")).join(` `)}function YAe(e){const t=e[0];return t==null||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}let KAe=class Zy0 extends Error{constructor(t,...n){var f,r,a;const{nodes:i,source:o,positions:s,path:l,originalError:c,extensions:d}=YAe(n);super(t),this.name="GraphQLError",this.path=l??void 0,this.originalError=c??void 0,this.nodes=t30(Array.isArray(i)?i:i?[i]:void 0);const p=t30((f=this.nodes)===null||f===void 0?void 0:f.map(C=>C.loc).filter(C=>C!=null));this.source=o??(p==null||(r=p[0])===null||r===void 0?void 0:r.source),this.positions=s??(p==null?void 0:p.map(C=>C.start)),this.locations=s&&o?s.map(C=>zq(o,C)):p==null?void 0:p.map(C=>zq(C.source,C.start));const x=GAe(c==null?void 0:c.extensions)?c==null?void 0:c.extensions:void 0;this.extensions=(a=d??x)!==null&&a!==void 0?a:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?Object.defineProperty(this,"stack",{value:c.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Zy0):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(t+=` @@ -2216,7 +2216,7 @@ spurious results.`)}}return!1};jO.instanceOf=Kxe,Object.defineProperty(B9,"__esM ${U30} ${H30} ${G30} - `,x={id:Sr(t),orderBy:a,orderDirection:i,first:o,whereFilter:d},C=await l.request(p,x);return C.domain?C.domain.subdomains.map(O=>q30({...O,parent:{name:t}})):[]},TTe=e=>({getDecodedName:t=>oTe(e,t),getNameHistory:t=>sTe(e,t),getNamesForAddress:t=>bTe(e,t),getSubgraphRecords:t=>vTe(e,t),getSubgraphRegistrant:t=>ATe(e,t),getSubnames:t=>ETe(e,t)}),W30=e=>Pn({abi:Pde,functionName:"clearRecords",args:[e]}),Q30=(e,{name:t,resolverAddress:n})=>({to:n,data:W30(Sr(t))});async function Y30(e,{name:t,resolverAddress:n,...f}){const r={...Q30(e,{name:t,resolverAddress:n}),...f};return Ja(e,r)}Y30.makeFunctionData=Q30;const K30=({namehash:e,contentType:t,encodedData:n})=>Pn({abi:kde,functionName:"setABI",args:[e,BigInt(t),n]}),J30=({namehash:e,coin:t,value:n})=>{const f=Mq(t),r=f.coinType;let a=n?f.decode(n):"0x";return r===60&&a==="0x"&&(a=f.decode("0x0000000000000000000000000000000000000000")),typeof a!="string"&&(a=yi(a)),Pn({abi:Ode,functionName:"setAddr",args:[e,BigInt(r),a]})},Z30=({namehash:e,contentHash:t})=>{let n="0x";return t&&(n=Owe(t)),Pn({abi:Nde,functionName:"setContenthash",args:[e,n]})},X30=({namehash:e,key:t,value:n})=>Pn({abi:Sde,functionName:"setText",args:[e,t,n??""]}),_30=({namehash:e,clearRecords:t,contentHash:n,texts:f,coins:r,abi:a})=>{const i=[];if(t&&i.push(W30(e)),n!==void 0){const o=Z30({namehash:e,contentHash:n});o&&i.push(o)}if(a!==void 0){const o=Array.isArray(a)?a:[a];for(const s of o){const l=K30({namehash:e,...s});l&&i.push(l)}}if(f&&f.length>0){const o=f.map(s=>X30({namehash:e,...s}));o&&i.push(...o)}if(r&&r.length>0){const o=r.map(s=>J30({namehash:e,...s}));o&&i.push(...o)}return i},$30=({name:e,owner:t,duration:n,resolverAddress:f=_r,records:{coins:r=[],...a}={texts:[],coins:[]},reverseRecord:i,fuses:o,secret:s})=>{const l=U6(e.split(".")[0]),c=Sr(e),d=o?N9({restriction:"child",input:o}):0;i&&!r.find(x=>typeof x.coin=="string"&&x.coin.toLowerCase()==="eth"||(typeof x.coin=="string"?parseInt(x.coin)===60:x.coin===60))&&r.push({coin:60,value:t});const p=a?_30({namehash:c,coins:r,...a}):[];if(p.length>0&&f===_r)throw new jde({data:{name:e,owner:t,duration:n,resolverAddress:f,records:a,reverseRecord:i,fuses:o}});return[l,t,BigInt(n),s,f,p,!!i,d]},MTe=e=>{const[t,...n]=$30(e);return[e.name.split(".")[0],...n]},CTe=e=>Cc(Xg([{name:"name",type:"bytes32"},{name:"owner",type:"address"},{name:"duration",type:"uint256"},{name:"secret",type:"bytes32"},{name:"resolver",type:"address"},{name:"data",type:"bytes[]"},{name:"reverseRecord",type:"bool"},{name:"ownerControlledFuses",type:"uint16"}],e)),STe=e=>CTe($30(e)),OTe=2n**64n-1n,kTe=(e,t=0n)=>{if(!e)return t;if(typeof e=="bigint")return e;if(typeof e=="string"||typeof e=="number")return BigInt(e);if(e instanceof Date)return BigInt(Math.floor(e.getTime()/1e3));throw new TypeError("Expiry must be a bigint, string, number or Date")},iw=e=>{const t=Ac(e);if(t.byteLength>255)throw new Lde({label:e,byteLength:t.byteLength})},NTe=e=>e&&BigInt(e)&k9.PARENT_CANNOT_CONTROL?OTe:0n,e90=(e,t)=>{const n=t.name.split("."),f=sl(t.name);if(f!=="eth-2ld")throw new Bc({nameType:f,supportedNameTypes:["eth-2ld"],details:"Only 2ld-eth name registration is supported"});return iw(n[0]),{to:Rf({client:e,contract:"ensEthRegistrarController"}),data:Pn({abi:aAe,functionName:"commit",args:[STe(t)]})}};async function t90(e,{name:t,owner:n,duration:f,secret:r,resolverAddress:a,records:i,reverseRecord:o,fuses:s,...l}){const c={...e90(e,{name:t,owner:n,duration:f,secret:r,resolverAddress:a,records:i,reverseRecord:o,fuses:s}),...l};return Ja(e,c)}t90.makeFunctionData=e90;const H9=e=>{const t=e.split("."),n=t.shift(),f=Sr(t.join("."));return{label:n,labelhash:U6(n),parentNode:f}},n90=(e,{name:t,contract:n,owner:f,resolverAddress:r=Rf({client:e,contract:"ensPublicResolver"}),expiry:a,fuses:i})=>{const o=sl(t);if(o==="tld"||o==="root")throw new Bc({nameType:o,supportedNameTypes:["eth-2ld","eth-subname","other-2ld","other-subname"]});const{label:s,labelhash:l,parentNode:c}=H9(t);switch(n){case"registry":return{to:Rf({client:e,contract:"ensRegistry"}),data:Pn({abi:zh0,functionName:"setSubnodeRecord",args:[c,l,f,r,BigInt(0)]})};case"nameWrapper":{iw(s);const d=i?N9({input:i}):0,p=a?kTe(a):NTe(d);return{to:Rf({client:e,contract:"ensNameWrapper"}),data:Pn({abi:Uh0,functionName:"setSubnodeRecord",args:[c,s,f,r,BigInt(0),d,p]})}}default:throw new xO({contractType:n,supportedContractTypes:["registry","nameWrapper"]})}};class PTe extends ia{constructor({parentName:t}){super(`Create subname error: ${t} as burned CANNOT_CREATE_SUBDOMAIN fuse`),Object.defineProperty(this,"parentName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CreateSubnamePermissionDeniedError"}),this.parentName=t}}class ITe extends ia{constructor({parentName:t}){super(`Create subname error: Cannot burn PARENT_CANNOT_CONTROL when ${t} has not burned CANNOT_UNWRAP fuse`),Object.defineProperty(this,"parentName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CreateSubnameParentNotLockedError"}),this.parentName=t}}const RTe=async(e,{name:t,fuses:n,contract:f})=>{var l,c,d,p;if(f!=="nameWrapper")return;const r=t.split(".").slice(1).join(".");if(r==="eth")return;const a=await _h0(e,{name:r});if((c=(l=a==null?void 0:a.fuses)==null?void 0:l.child)!=null&&c.CANNOT_CREATE_SUBDOMAIN)throw new PTe({parentName:r});const i=n?N9({input:n}):0,o=n&&BigInt(i)&k9.PARENT_CANNOT_CONTROL,s=(p=(d=a==null?void 0:a.fuses)==null?void 0:d.child)==null?void 0:p.CANNOT_UNWRAP;if(o&&!s)throw new ITe({parentName:r})};async function f90(e,{name:t,contract:n,owner:f,resolverAddress:r,expiry:a,fuses:i,...o}){await RTe(e,{name:t,fuses:i,contract:n});const s={...n90(e,{name:t,contract:n,owner:f,resolverAddress:r,expiry:a,fuses:i}),...o};return Ja(e,s)}f90.makeFunctionData=n90;const r90=(e,{name:t,contract:n,asOwner:f})=>{const r=sl(t);if(r!=="eth-subname"&&r!=="other-subname")throw new Bc({nameType:r,supportedNameTypes:["eth-subname","other-subname"],details:"Cannot delete a name that is not a subname"});switch(n){case"registry":{const a=Rf({client:e,contract:"ensRegistry"});if(f)return{to:a,data:Pn({abi:Fwe,functionName:"setRecord",args:[Sr(t),_r,_r,BigInt(0)]})};const{labelhash:i,parentNode:o}=H9(t);return{to:a,data:Pn({abi:zh0,functionName:"setSubnodeRecord",args:[o,i,_r,_r,BigInt(0)]})}}case"nameWrapper":{const a=Rf({client:e,contract:"ensNameWrapper"});if(f)return{to:a,data:Pn({abi:Uwe,functionName:"setRecord",args:[Sr(t),_r,_r,BigInt(0)]})};const{label:i,parentNode:o}=H9(t);return{to:a,data:Pn({abi:Uh0,functionName:"setSubnodeRecord",args:[o,i,_r,_r,BigInt(0),0,BigInt(0)]})}}default:throw new xO({contractType:n,supportedContractTypes:["registry","nameWrapper"]})}};async function a90(e,{name:t,contract:n,asOwner:f,...r}){const a={...r90(e,{name:t,contract:n,asOwner:f}),...r};return Ja(e,a)}a90.makeFunctionData=r90;const i90=(e,{value:t,...n})=>{const f=sl(n.name);if(f!=="eth-2ld")throw new Bc({nameType:f,supportedNameTypes:["eth-2ld"],details:"Only 2ld-eth name registration is supported"});const r=n.name.split(".");return iw(r[0]),{to:Rf({client:e,contract:"ensEthRegistrarController"}),data:Pn({abi:iAe,functionName:"register",args:MTe(n)}),value:t}};async function o90(e,{name:t,owner:n,duration:f,secret:r,resolverAddress:a,records:i,reverseRecord:o,fuses:s,value:l,...c}){const d={...i90(e,{name:t,owner:n,duration:f,secret:r,resolverAddress:a,records:i,reverseRecord:o,fuses:s,value:l}),...c};return Ja(e,d)}o90.makeFunctionData=i90;const s90=(e,{nameOrNames:t,duration:n,value:f})=>{const r=(Array.isArray(t)?t:[t]).map(a=>{const i=a.split("."),o=sl(a);if(o!=="eth-2ld")throw new Bc({nameType:o,supportedNameTypes:["eth-2ld"],details:"Only 2ld-eth renewals are currently supported"});return i[0]});return r.length===1?{to:Rf({client:e,contract:"ensEthRegistrarController"}),data:Pn({abi:oAe,functionName:"renew",args:[r[0],BigInt(n)]}),value:f}:{to:Rf({client:e,contract:"ensBulkRenewal"}),data:Pn({abi:rAe,functionName:"renewAll",args:[r,BigInt(n)]}),value:f}};async function l90(e,{nameOrNames:t,duration:n,value:f,...r}){const a={...s90(e,{nameOrNames:t,duration:n,value:f}),...r};return Ja(e,a)}l90.makeFunctionData=s90;const c90=(e,{name:t,encodedAbi:n,resolverAddress:f})=>({to:f,data:K30({namehash:Sr(t),...n})});async function u90(e,{name:t,encodedAbi:n,resolverAddress:f,...r}){const a={...c90(e,{name:t,encodedAbi:n,resolverAddress:f}),...r};return Ja(e,a)}u90.makeFunctionData=c90;const d90=(e,{name:t,coin:n,value:f,resolverAddress:r})=>({to:r,data:J30({namehash:Sr(t),coin:n,value:f})});async function p90(e,{name:t,coin:n,value:f,resolverAddress:r,...a}){const i={...d90(e,{name:t,coin:n,value:f,resolverAddress:r}),...a};return Ja(e,i)}p90.makeFunctionData=d90;const b90=(e,{name:t,fuses:n,expiry:f})=>{const r=N9({input:n}),a=t.split("."),i=U6(a.shift()),o=Sr(a.join("."));return{to:Rf({client:e,contract:"ensNameWrapper"}),data:Pn({abi:Vwe,functionName:"setChildFuses",args:[o,i,r,BigInt(f??0)]})}};async function h90(e,{name:t,fuses:n,expiry:f,...r}){const a={...b90(e,{name:t,fuses:n,expiry:f}),...r};return Ja(e,a)}h90.makeFunctionData=b90;const m90=(e,{name:t,contentHash:n,resolverAddress:f})=>({to:f,data:Z30({namehash:Sr(t),contentHash:n})});async function y90(e,{name:t,contentHash:n,resolverAddress:f,...r}){const a={...m90(e,{name:t,contentHash:n,resolverAddress:f}),...r};return Ja(e,a)}y90.makeFunctionData=m90;const g90=(e,{name:t,fuses:n})=>{const f=N9({restriction:"child",input:n});return{to:Rf({client:e,contract:"ensNameWrapper"}),data:Pn({abi:zwe,functionName:"setFuses",args:[Sr(t),f]})}};async function v90(e,{name:t,fuses:n,...f}){const r={...g90(e,{name:t,fuses:n}),...f};return Ja(e,r)}v90.makeFunctionData=g90;const BTe=[{inputs:[{name:"addr",type:"address"},{name:"owner",type:"address"},{name:"resolver",type:"address"},{name:"name",type:"string"}],name:"setNameForAddr",outputs:[{name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"}],DTe=[{inputs:[{name:"name",type:"string"}],name:"setName",outputs:[{name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"}],w90=(e,{name:t,address:n,resolverAddress:f=Rf({client:e,contract:"ensPublicResolver"})})=>{const r=Rf({client:e,contract:"ensReverseRegistrar"});return n?{to:r,data:Pn({abi:BTe,functionName:"setNameForAddr",args:[n,e.account.address,f||Rf({client:e,contract:"ensPublicResolver"}),t]})}:{to:r,data:Pn({abi:DTe,functionName:"setName",args:[t]})}};async function A90(e,{name:t,address:n,resolverAddress:f,...r}){const a={...w90({...e,account:fs(r.account||e.account)},{name:t,address:n,resolverAddress:f}),...r};return Ja(e,a)}A90.makeFunctionData=w90;const x90=(e,{name:t,resolverAddress:n,...f})=>{const r=_30({namehash:Sr(t),...f});if(r.length===0)throw new oue;return r.length===1?{to:n,data:r[0]}:{to:n,data:Pn({abi:Ide,functionName:"multicall",args:[r]})}};async function E90(e,{name:t,resolverAddress:n,clearRecords:f,contentHash:r,texts:a,coins:i,abi:o,...s}){const l={...x90(e,{name:t,resolverAddress:n,clearRecords:f,contentHash:r,texts:a,coins:i,abi:o}),...s};return Ja(e,l)}E90.makeFunctionData=x90;const T90=(e,{name:t,contract:n,resolverAddress:f})=>{if(n!=="registry"&&n!=="nameWrapper")throw new Error(`Unknown contract: ${n}`);const r=Rf({client:e,contract:n==="nameWrapper"?"ensNameWrapper":"ensRegistry"}),a=[Sr(t),f],i="setResolver";return n==="nameWrapper"?{to:r,data:Pn({abi:Kwe,functionName:i,args:a})}:{to:r,data:Pn({abi:Vh0,functionName:i,args:a})}};async function M90(e,{name:t,contract:n,resolverAddress:f,...r}){const a={...T90(e,{name:t,contract:n,resolverAddress:f}),...r};return Ja(e,a)}M90.makeFunctionData=T90;const C90=(e,{name:t,key:n,value:f,resolverAddress:r})=>({to:r,data:X30({namehash:Sr(t),key:n,value:f})});async function S90(e,{name:t,key:n,value:f,resolverAddress:r,...a}){const i={...C90(e,{name:t,key:n,value:f,resolverAddress:r}),...a};return Ja(e,i)}S90.makeFunctionData=C90;const O90=(e,{name:t,newOwnerAddress:n,contract:f,reclaim:r,asParent:a})=>{if(r&&f!=="registrar")throw new AO({parameter:"reclaim",allowedParameters:["name","newOwnerAddress","contract"],details:"Can't reclaim a name from any contract other than the registrar"});switch(f){case"registry":{const i=Rf({client:e,contract:"ensRegistry"});if(a){const{labelhash:o,parentNode:s}=H9(t);return{to:i,data:Pn({abi:jwe,functionName:"setSubnodeOwner",args:[s,o,n]})}}return{to:i,data:Pn({abi:Lwe,functionName:"setOwner",args:[Sr(t),n]})}}case"registrar":{if(a)throw new AO({parameter:"asParent",allowedParameters:["name","newOwnerAddress","contract","reclaim"],details:"Can't transfer a name as the parent owner on the registrar"});const i=sl(t);if(i!=="eth-2ld")throw new Bc({nameType:i,supportedNameTypes:["eth-2ld"],details:"Only eth-2ld names can be transferred on the registrar contract"});const o=t.split("."),s=BigInt(U6(o[0]));return{to:Rf({client:e,contract:"ensBaseRegistrarImplementation"}),data:Pn(r?{abi:Gve,functionName:"reclaim",args:[s,n]}:{abi:qve,functionName:"safeTransferFrom",args:[e.account.address,n,s]})}}case"nameWrapper":{const i=Rf({client:e,contract:"ensNameWrapper"});if(a){const{label:o,parentNode:s}=H9(t);return{to:i,data:Pn({abi:Hwe,functionName:"setSubnodeOwner",args:[s,o,n,0,BigInt(0)]})}}return{to:i,data:Pn({abi:Qwe,functionName:"safeTransferFrom",args:[e.account.address,n,BigInt(Sr(t)),BigInt(1),"0x"]})}}default:throw new xO({contractType:f,supportedContractTypes:["registry","registrar","nameWrapper"]})}};async function k90(e,{name:t,newOwnerAddress:n,contract:f,reclaim:r,asParent:a,...i}){const o={...O90({...e,account:fs(i.account||e.account)},{name:t,newOwnerAddress:n,contract:f,reclaim:r,asParent:a}),...i};return Ja(e,o)}k90.makeFunctionData=O90;const N90=(e,{name:t,newOwnerAddress:n,newRegistrantAddress:f})=>{const{labelhash:r,parentNode:a}=H9(t),i=Rf({client:e,contract:"ensNameWrapper"});if(sl(t)==="eth-2ld"){if(!f)throw new Yve({parameter:"newRegistrantAddress",details:"Must provide newRegistrantAddress for eth-2ld names"});return{to:i,data:Pn({abi:Wwe,functionName:"unwrapETH2LD",args:[r,f,n]})}}if(f)throw new AO({parameter:"newRegistrantAddress",allowedParameters:["name","newOwnerAddress"],details:"newRegistrantAddress can only be specified for eth-2ld names"});return{to:i,data:Pn({abi:qwe,functionName:"unwrap",args:[a,r,n]})}};async function P90(e,{name:t,newOwnerAddress:n,newRegistrantAddress:f,...r}){const a={...N90(e,{name:t,newOwnerAddress:n,newRegistrantAddress:f}),...r};return Ja(e,a)}P90.makeFunctionData=N90;const I90=(e,{name:t,newOwnerAddress:n,fuses:f,resolverAddress:r=Rf({client:e,contract:"ensPublicResolver"})})=>{const a=t.split("."),i=Rq(a),o=Rf({client:e,contract:"ensNameWrapper"});if(i){iw(a[0]);const s=f?N9({restriction:"child",input:f}):0,l=BigInt(U6(a[0])),c=Xg([{name:"label",type:"string"},{name:"wrappedOwner",type:"address"},{name:"ownerControlledFuses",type:"uint16"},{name:"resolverAddress",type:"address"}],[a[0],n,s,r]);return{to:Rf({client:e,contract:"ensBaseRegistrarImplementation"}),data:Pn({abi:Wve,functionName:"safeTransferFrom",args:[e.account.address,o,l,c]})}}if(f)throw new AO({parameter:"fuses",allowedParameters:["name","wrappedOwner","resolverAddress"],details:"Fuses cannot be initially set when wrapping non eth-2ld names"});return a.forEach(s=>iw(s)),{to:o,data:Pn({abi:Gwe,functionName:"wrap",args:[e8(Rv(t)),n,r]})}};async function R90(e,{name:t,newOwnerAddress:n,fuses:f,resolverAddress:r,...a}){const i={...I90({...e,account:fs(a.account||e.account)},{name:t,newOwnerAddress:n,fuses:f,resolverAddress:r}),...a};return Ja(e,i)}R90.makeFunctionData=I90;const LTe=e=>({clearRecords:t=>Y30(e,t),commitName:t=>t90(e,t),createSubname:t=>f90(e,t),deleteSubname:t=>a90(e,t),registerName:t=>o90(e,t),renewNames:t=>l90(e,t),setAbiRecord:t=>u90(e,t),setAddressRecord:t=>p90(e,t),setChildFuses:t=>h90(e,t),setContentHashRecord:t=>y90(e,t),setFuses:t=>v90(e,t),setPrimaryName:t=>A90(e,t),setRecords:t=>E90(e,t),setResolver:t=>M90(e,t),setTextRecord:t=>S90(e,t),transferName:t=>k90(e,t),unwrapName:t=>P90(e,t),wrapName:t=>R90(e,t)});class jTe extends ia{constructor({chainId:t,supportedChains:n,details:f}){super(`Unsupported chain: ${t}`,{metaMessages:[`- Supported chains: ${n.join(", ")}`],details:f}),Object.defineProperty(this,"chainId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportedChains",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedChainError"}),this.chainId=t,this.supportedChains=n}}class FTe extends ia{constructor(){super("No chain provided"),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NoChainError"})}}const B90=[1,5,17e3,11155111],zTe={1:{ensBaseRegistrarImplementation:{address:"0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"},ensBulkRenewal:{address:"0xa12159e5131b1eEf6B4857EEE3e1954744b5033A"},ensDnsRegistrar:{address:"0xB32cB5677a7C971689228EC835800432B339bA2B"},ensDnssecImpl:{address:"0x0fc3152971714E5ed7723FAFa650F86A4BaF30C5"},ensEthRegistrarController:{address:"0x253553366Da8546fC250F225fe3d25d0C782303b"},ensNameWrapper:{address:"0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401"},ensPublicResolver:{address:"0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63"},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensReverseRegistrar:{address:"0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67"}},5:{ensBaseRegistrarImplementation:{address:"0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"},ensBulkRenewal:{address:"0x6d9F26FfBcF1c6f0bAe9F2C1f7fBe8eE6B1d8d4d"},ensDnsRegistrar:{address:"0x8edc487D26F6c8Fa76e032066A3D4F87E273515d"},ensDnssecImpl:{address:"0xF427c4AdED8B6dfde604865c1a7E953B160C26f0"},ensEthRegistrarController:{address:"0xCc5e7dB10E65EED1BBD105359e7268aa660f6734"},ensNameWrapper:{address:"0x114D4603199df73e7D157787f8778E21fCd13066"},ensPublicResolver:{address:"0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750"},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensReverseRegistrar:{address:"0x6d9F26FfBcF1c6f0bAe9F2C1f7fBe8eE6B1d8d4d"},ensUniversalResolver:{address:"0x898A1182F3C2BBBF0b16b4DfEf63E9c3e9eB4821"}},17e3:{ensBaseRegistrarImplementation:{address:"0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"},ensBulkRenewal:{address:"0xbc4cfB363F948E64Cd73Da6438F64CB37E2e33d1"},ensDnsRegistrar:{address:"0x458d278AEd4cE82BAeC384170f39198b01B8351c"},ensDnssecImpl:{address:"0x283af0b28c62c092c9727f1ee09c02ca627eb7f5"},ensEthRegistrarController:{address:"0x179Be112b24Ad4cFC392eF8924DfA08C20Ad8583"},ensNameWrapper:{address:"0xab50971078225D365994dc1Edcb9b7FD72Bb4862"},ensPublicResolver:{address:"0x9010A27463717360cAD99CEA8bD39b8705CCA238"},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensReverseRegistrar:{address:"0x132AC0B116a73add4225029D1951A9A707Ef673f"},ensUniversalResolver:{address:"0xa6ac935d4971e3cd133b950ae053becd16fe7f3b"}},11155111:{ensBaseRegistrarImplementation:{address:"0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"},ensBulkRenewal:{address:"0x4EF77b90762Eddb33C8Eba5B5a19558DaE53D7a1"},ensDnsRegistrar:{address:"0x5a07C75Ae469Bf3ee2657B588e8E6ABAC6741b4f"},ensDnssecImpl:{address:"0xe62E4b6cE018Ad6e916fcC24545e20a33b9d8653"},ensEthRegistrarController:{address:"0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72"},ensNameWrapper:{address:"0x0635513f179D50A207757E05759CbD106d7dFcE8"},ensPublicResolver:{address:"0x8FADE66B79cC9f707aB26799354482EB93a5B7dD"},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensReverseRegistrar:{address:"0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6"},ensUniversalResolver:{address:"0xc8af999e38273d658be1b921b88a9ddf005769cc"}}},VTe={1:{ens:{url:"https://api.thegraph.com/subgraphs/name/ensdomains/ens"}},5:{ens:{url:"https://api.thegraph.com/subgraphs/name/ensdomains/ensgoerli"}},17e3:{ens:{url:"https://api.studio.thegraph.com/query/49574/ensholesky/version/latest"}},11155111:{ens:{url:"https://api.studio.thegraph.com/query/49574/enssepolia/version/latest"}}},D90=e=>{if(!e)throw new FTe;if(!B90.includes(e.id))throw new jTe({chainId:e.id,supportedChains:B90});return{...e,contracts:{...e.contracts,...zTe[e.id]},subgraphs:{...VTe[e.id]}}},UTe=({batch:e,chain:t,key:n="ensPublic",name:f="ENS Public Client",transport:r,pollingInterval:a})=>B20({batch:e,chain:D90(t),key:n,name:f,pollingInterval:a,transport:r,type:"ensPublicClient"}).extend(jAe).extend(TTe),HTe=({account:e,chain:t,key:n="ensWallet",name:f="ENS Wallet Client",transport:r,pollingInterval:a})=>Ade({account:e,chain:D90(t),key:n,name:f,pollingInterval:a,transport:r}).extend(LTe),L90=V20({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),j90=V20({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.sepolia.org"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",blockCreated:5317080}},testnet:!0}),F90="production",z90=()=>{const[e,t]=n0.useState(void 0),[n,f]=n0.useState(!0),[r,a]=n0.useState(!1);return n0.useEffect(()=>{(async()=>{try{const i=UTe({chain:F90==="development"?j90:L90,transport:L20()}),o=HTe({chain:F90==="development"?j90:L90,transport:L20()});t(i)}catch{a(!0)}finally{f(!1)}})()},[]),{ensClient:e,loading:n,error:r}};var cW={},GTe=W5,qTe=mc;Object.defineProperty(cW,"__esModule",{value:!0});var ow=cW.default=void 0,WTe=qTe(n0),QTe=GTe(yc()),YTe=(0,QTe.default)(WTe.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}),"Done");ow=cW.default=YTe;const uW=86400,V90=en(e=>({doneIcon:{marginRight:4,fill:"#A8E07E",width:"16px"},errorIcon:{fill:"rgba(244, 67, 54, 1)",width:"20px"},warningIcon:{fill:"rgba(230, 230, 54, 1)",width:"20px"},fields:{marginBottom:e.spacing(1)},loadMessage:{textAlign:"center"},loadingContainer:{marginRight:4,padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:14,width:14,border:`1px solid ${Jt.tan[300]}`},spinner:{width:"8px !important",height:"8px !important",color:`${Jt.tan[300]} !important`},loading:{width:"15px !important",height:"15px !important",marginRight:8},addSpinner:{color:"white !important",fill:"white !important",opacity:"100% !important"},detailsContainer:{width:"95%"},messageContainer:{width:"85%",fill:"rgba(244, 67, 54, 1)"},errorMessageDetails:{fontSize:12,textDecoration:"underline",cursor:"pointer",color:"rgba(244, 67, 54, 1)"},warningMessageDetails:{fontSize:12,textDecoration:"underline",cursor:"pointer",color:"rgba(230, 230, 54, 1)"},textSubdued:{color:"rgba(255 255 255 / 70%)"},errorMessage:{fontSize:12,color:"rgba(244, 67, 54, 1)",fontWeight:"bolder"},warningMessage:{fontSize:12,color:"rgba(230, 230, 54, 1)"},linkStyle:{color:"white"},flexRow:{display:"flex",flexDirection:"row"},textFieldSmall:{"& .MuiFormLabel-root":{fontSize:12}},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},inputError:{"& .MuiInputBase-root":{borderColor:"rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.1)","&::before":{borderColor:"rgba(244, 67, 54, 0.3)"}}},errorContainer:{margin:8,display:"flex",alignItems:"center"}})),KTe=dn({switchBase:{"&.Mui-checked":{color:"white"}},colorSecondary:{"&.Mui-checked + .MuiSwitch-track":{backgroundColor:Jt.tan[500]}},track:{backgroundColor:"black"}})(De0),sw=({status:e,message:t,link:n})=>{const f=V90();return e&&ve(fe,{container:!0,spacing:1,alignItems:"center",children:[ve(fe,{item:!0,xs:1,children:[e==="error"&&r0(gc,{className:f.errorIcon}),e==="warning"&&r0(wG,{className:f.warningIcon})]}),r0(fe,{item:!0,className:f.detailsContainer,xs:11,children:ve(fe,{container:!0,justifyContent:"space-between",alignItems:"center",children:[r0(fe,{item:!0,className:f.messageContainer,children:r0(ze,{className:e==="error"?f.errorMessage:f.warningMessage,children:t})}),n?r0(fe,{item:!0,children:r0(d1,{className:e==="error"?f.errorMessageDetails:f.warningMessageDetails,href:n,target:"_blank",children:"Details"})}):r0(fe,{})]})})]})},JTe=({open:e,onClose:t,onSubmit:n})=>{const f=V90(),{sdk:r,safe:a,provider:i}=hi(),{ensClient:o}=z90(),s=n0.useMemo(()=>new D3(1,"0de1a96486754f8b98f284d093905198"),[]),l=n0.useMemo(()=>new D3(5,"0de1a96486754f8b98f284d093905198"),[]),c=G3[a.chainId].nativeAsset,[d,p]=n0.useState({snapshotEns:"",timeout:(uW*2).toString(),cooldown:(uW*2).toString(),expiration:(uW*7).toString(),bond:"0.1"}),[x,C]=n0.useState(!1),[O,L]=n0.useState(!1),[D,V]=n0.useState(!1),[Y,i0]=n0.useState(""),[m0,A0]=n0.useState(!1),[T0,I0]=n0.useState(!1),z0=!!d.snapshotEns&&d.snapshotEns.includes(".eth")&&!x&&O&&D,[oe,ae]=n0.useState({snapshotEns:z0,bond:!!d.bond}),[ye,P]=n0.useState(!1),[F,Q]=n0.useState(""),[H,u0]=n0.useState(""),[h0,g0]=n0.useState(!1),[o0,N]=n0.useState(""),[t0,S0]=n0.useState([]),[s0,W]=n0.useState(""),[D0,Y0]=n0.useState(""),[Z0,le]=n0.useState(""),[ue,xe]=n0.useState("form"),je=Object.values(oe).every(y=>y),Ge=/^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/.test(o0)&&!t0.includes(o0),et=je&&(!ye||F!==void 0&&H!==void 0&&t0.length>0),[St,wt]=n0.useState(!1),zt=n0.useCallback(async()=>{var y,Z;if(o&&(y=await Cq(o,{name:d.snapshotEns}))!=null&&y.value){const z=await gG(d.snapshotEns,a.chainId),v=await Goe(d.snapshotEns,"daorequirements",i);if(i0(v[0]),V(z!==void 0),z!==void 0){I0(!!((Z=z.plugins)!=null&&Z.safeSnap));const k=await Iu0(i,o,d.snapshotEns,a.safeAddress);A0(k),console.log({isController:k,snapshotSpace:z}),console.log({snapshotSpace:z})}}},[d.snapshotEns,a.chainId,a.safeAddress,s,l]),pn=gc0(()=>{V(!1),i0(""),A0(!1),I0(!1),L(!1),d.snapshotEns&&d.snapshotEns.includes(".eth")&&(C(!0),(async()=>(await zt(),C(!1),L(!0)))())},300);n0.useEffect(()=>{pn()},[d.snapshotEns]);const{loading:k0,execute:d0,error:J}=A20(),X=gc0(async()=>{g0(!1),await d0(F,H),g0(!0)},300);n0.useEffect(()=>{F&&H&&X()},[F,H]),n0.useEffect(()=>{if(a.chainId){const y=a.chainId===1?"1":a.chainId===100?"1500":a.chainId===137?"1000":"1";p(Z=>({...Z,bond:y}))}},[a.chainId]),n0.useEffect(()=>{ae({snapshotEns:z0,bond:!!d.bond})},[d,x,z0]);const A=(y,Z,z)=>{p({...d,[y]:Z})},c0=async()=>{var y;wt(!0);try{const Z=pg(d.bond,c.decimals),z={...d,oracle:jg(a.chainId),arbitrator:s60(a.chainId),executor:a.safeAddress,bond:Z.toString()},v={templateType:"default",language:"english",category:"DAO proposal",templateQuestion:$S(z.snapshotEns)},k=await vc0(i,a.safeAddress,m20,a.chainId,z,v);let M=[...k.txs];const _=(y=k.meta)==null?void 0:y.daoModuleExpectedAddress;if(m0&&a.chainId===1){if(_==null)throw new Error("The calculated reality module address is 'null'. This should be handled in the 'statusCallback' function.");const q=await i.getSigner(),{txs:K}=await y20(q,z.snapshotEns,_,a.chainId);M.push(K[0])}if(ye){const q={apiKey:F,secretKey:H,discordKey:s0,email:t0,slackKey:"",telegram:{botToken:D0,chatId:Z0}};await h20(a.chainId,_,z.oracle,q)}await r.txs.send({txs:M}),n&&n(),t&&t()}catch(Z){console.log("Error deploying module: ",Z)}wt(!1)},m=y=>{const Z=y.target.value||"0";let z=Z.startsWith("0")&&Z.length>1?Z.substr(1):Z;z=z.startsWith(".")?"0"+z:z;try{pg(z,c.decimals),A("bond",z)}catch(v){console.warn("invalid bond",Z,v)}},f0=()=>x?"":d.snapshotEns.includes(".eth")&&!x&&!D?f.inputError:d.snapshotEns.includes(".eth")&&!x&&D?f.input:"";return r0(L6,{open:e,onClose:t,title:"Kleros Snapshot Module",description:"Execute transactions for successful Snapshot proposals using Reality.eth, secured by Kleros.",icon:"reality",tags:["Stackable","From Kleros"],hideButton:!0,readMoreLink:"https://kleros.gitbook.io/docs/integrations/types-of-integrations/1.-dispute-resolution-integration-plan/channel-partners/kleros-reality-module",children:ue==="form"?ve(Er,{children:[r0(ze,{gutterBottom:!0,children:"Parameters"}),ve(fe,{container:!0,spacing:2,className:f.fields,children:[ve(fe,{item:!0,xs:12,children:[r0(Cr,{value:d.snapshotEns,onChange:y=>A("snapshotEns",y.target.value),label:"Enter the Snapshot ENS name.",placeholder:"ex: gnosis.eth",className:`${f.textFieldSmall} ${f0()}`,rightIcon:ve(Er,{children:[x&&r0(ua,{className:f.loadingContainer,children:r0(fi.Loader,{size:"sm",className:f.spinner})}),d.snapshotEns.includes(".eth")&&!x&&!D&&r0(gc,{className:f.errorIcon}),d.snapshotEns.includes(".eth")&&!x&&D&&r0(ow,{className:f.doneIcon})]})}),!x&&O&&!z0&&r0(sw,{message:"This Snapshot space does not exist.",status:"error"})]}),r0(fe,{item:!0,xs:6,children:r0(Zo,{label:"Timeout",defaultValue:d.timeout,defaultUnit:"days",onChange:y=>A("timeout",y)})}),r0(fe,{item:!0,xs:6,children:r0(Zo,{label:"Cooldown",defaultValue:d.cooldown,defaultUnit:"days",onChange:y=>A("cooldown",y)})}),r0(fe,{item:!0,xs:6,children:r0(Zo,{label:"Expiration",defaultValue:d.expiration,defaultUnit:"days",onChange:y=>A("expiration",y)})}),r0(fe,{item:!0,xs:6,children:r0(Cr,{label:"Bond",prefix:c.symbol,color:"secondary",value:d.bond,onChange:m})})]}),ve(fe,{container:!0,spacing:2,children:[r0(fe,{item:!0,xs:6,children:r0(ze,{variant:"body1",children:"Configure Monitoring"})}),ve(fe,{xs:6,item:!0,style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[r0("div",{}),r0(KTe,{value:ye,onClick:()=>{P(!ye)}})]})]}),ye&&ve(fe,{container:!0,direction:"column",spacing:2,className:f.fields,children:[r0(fe,{item:!0,xs:12,children:ve(ze,{variant:"body2",children:["Setting up an effective monitoring strategy is critical for the security of your safe. First, you need to"," ",r0(d1,{className:f.linkStyle,underline:"always",href:"https://defender.openzeppelin.com/#/auth/sign-in",target:"_blank",children:"create an Open Zeppelin account"}),"."]})}),r0(fe,{item:!0,xs:12,children:r0(Cr,{value:F,onChange:y=>{Q(y.target.value)},label:"API Key",placeholder:"3pwZzZZZzzZZZzzZZzZZZAAaaAAaaZZzz",rightIcon:k0?r0(ua,{className:f.loadingContainer,children:r0(fi.Loader,{size:"sm",className:f.spinner})}):h0&&!J&&r0(ua,{className:f.loadingContainer,children:r0(w20,{className:f.spinner})})})}),r0(fe,{item:!0,xs:12,children:r0(Cr,{value:H,onChange:y=>{u0(y.target.value)},label:"API Secret",placeholder:"2LUwZwwuUuuUUzzZZdDddooodudDDdaaDDdaAAAddDDadDzZZzdDDdcCCdDDaaAA",rightIcon:k0?r0(ua,{className:f.loadingContainer,children:r0(fi.Loader,{size:"sm",className:f.spinner})}):h0&&!J&&r0(ua,{className:f.loadingContainer,children:r0(w20,{className:f.spinner})})})}),h0&&J&&r0(fe,{item:!0,xs:12,children:r0(sw,{message:"These credentials are wrong.",status:"error"})}),ve(fe,{item:!0,xs:12,children:[ve(fe,{item:!0,style:{display:"flex"},children:[r0(ze,{children:"Email"}),r0(ze,{style:{fontStyle:"italic",opacity:"0.7"},children:"\xA0(required)"})]}),r0(ze,{variant:"body2",children:"Enter as many email addresses as you need"}),r0(Cr,{placeholder:"john@doe.com",value:o0,onChange:y=>{N(y.target.value)},onKeyDown:y=>{y.key==="Enter"&&Ge&&(S0([...t0,o0]),N(""))},rightIcon:r0(Er,{children:Ge?r0(ua,{className:f.loadingContainer,children:ve(ap,{size:"small",onClick:()=>{S0([...t0,o0]),N("")},children:[" ",r0(fi.Icon,{size:"sm",type:"add",color:"primary"})]})}):null})}),t0.length>0?t0.map(y=>ve(fe,{container:!0,children:[r0(fe,{item:!0,xs:1,children:r0(ap,{size:"small",onClick:()=>S0(t0.filter(Z=>Z!==y)),children:r0(fi.Icon,{size:"sm",type:"delete",color:"warning"})})}),r0(fe,{item:!0,xs:11,children:r0(ze,{children:y})})]},y)):r0(ze,{style:{fontStyle:"italic",opacity:"0.7"},children:Ge?"Press Enter or click + to add this email":"(No emails entered, at least one is required)"})]}),ve(fe,{item:!0,xs:12,children:[ve(fe,{item:!0,style:{display:"flex"},children:[r0(ze,{children:"Discord Integration"}),r0(ze,{style:{fontStyle:"italic",opacity:"0.7"},children:"\xA0(optional)"})]}),ve(fe,{container:!0,style:{display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[r0(ze,{variant:"body2",children:"Include the Discord channel's url key"}),r0(d1,{className:f.linkStyle,href:"https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks",target:"_blank",children:"Learn more"})]}),r0(Cr,{value:s0,onChange:y=>{W(y.target.value)},placeholder:"https://discord.com/api/webhooks/.../"})]}),ve(fe,{item:!0,xs:12,children:[ve(fe,{item:!0,style:{display:"flex"},children:[r0(ze,{children:"Telegram Integration"}),r0(ze,{style:{fontStyle:"italic",opacity:"0.7"},children:"\xA0(optional)"})]}),ve(fe,{container:!0,style:{display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[r0(ze,{variant:"body2",children:"Include the Telegram bot token and Chat ID"}),r0(d1,{className:f.linkStyle,href:"https://core.telegram.org/bots#6-botfather",target:"_blank",children:"Learn more"})]}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,direction:"row",alignItems:"center",justifyContent:"space-between",children:[r0(fe,{item:!0,children:r0(Cr,{placeholder:"123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11",value:D0,onChange:y=>{Y0(y.target.value)}})}),r0(fe,{item:!0,children:r0(Cr,{placeholder:"1234567890",value:Z0,onChange:y=>{le(y.target.value)}})})]})})]})]}),r0(E1,{fullWidth:!0,startIcon:r0($p,{}),onClick:()=>{xe("confirm")},disabled:!et,style:{marginTop:"16px"},children:et||!ye?"Add Module":k0?"Validating OpenZeppelin Credentials...":!h0||J?"Missing OpenZeppelin API":"Missing Email"})]}):ve(Er,{children:[r0(ze,{children:"It's almost ready! Just a reminder:"}),O&&(z0?m0&&a.chainId===1?T0?r0("div",{children:"SafeSnap plugin is already installed, and will be overwritten."}):r0("div",{children:"The SafeSnap plugin will be automatically installed."}):r0("div",{style:{marginTop:"4px"},children:r0(sw,{message:"Install SafeSnap after creating the module.",link:"https://kleros.gitbook.io/docs/integrations/types-of-integrations/1.-dispute-resolution-integration-plan/channel-partners/kleros-reality-module#safesnap",status:"warning"})}):r0(sw,{message:"This Snapshot space does not exist.",status:"error"})),O&&Y===""&&r0(sw,{message:"Missing DAO requirements ENS record.",link:"https://kleros.gitbook.io/docs/integrations/types-of-integrations/1.-dispute-resolution-integration-plan/channel-partners/kleros-reality-module#missing-daorequirements",status:"warning"}),ve(fe,{container:!0,spacing:2,style:{display:"flex",flexDirection:"row",marginTop:"16px"},children:[r0(fe,{item:!0,xs:6,children:r0(E1,{fullWidth:!0,disabled:St,startIcon:r0($p,{style:{rotate:"270deg"}}),onClick:()=>xe("form"),children:"Return"})}),r0(fe,{item:!0,xs:6,children:r0(E1,{fullWidth:!0,disabled:St,startIcon:St?r0(fi.Loader,{size:"xs",className:f.addSpinner}):r0($p,{}),onClick:()=>{c0()},children:"Add Module"})}),St&&ye&&r0(fe,{xs:12,style:{marginLeft:"8px"},children:r0("div",{children:"This can take around a minute, please wait..."})})]})]})})},ZTe=en(e=>({addButton:{marginTop:e.spacing(2)},addTransactionButton:{marginTop:e.spacing(1)},addIcon:{stroke:e.palette.common.white,width:20,height:20},inputParam:{marginTop:e.spacing(2)},errorMessage:{marginTop:e.spacing(1),color:"red"}})),XTe=({onSubmit:e,open:t,onClose:n})=>{const{sdk:f,safe:r,provider:a}=hi(),i=ZTe(),[o,s]=n0.useState({owner:!1,avatar:!1,target:!1,domainId:!0,sender:!0}),[l,c]=n0.useState({owner:r.safeAddress,avatar:r.safeAddress,target:r.safeAddress,domainId:0,sender:""}),d=(x,C,O)=>{s({...o,[x]:!O}),c({...l,[x]:C})},p=async()=>{try{const x={...l},C=await hX0(a,r.safeAddress,r.chainId,x);await f.txs.send({txs:C}),e&&e(),n&&n()}catch(x){console.error("Error deploying module: ",x)}};return ve(L6,{hideButton:!0,open:t,onClose:n,title:"Connext Module",description:"This module allows for execution of transactions initiated by a designated address on the other chain via Connext.",tags:["From Connext"],icon:"connext",readMoreLink:"https://github.com/gnosis/zodiac-module-connext/",children:[r0(ze,{gutterBottom:!0,children:"Parameters"}),r0(Ba,{placeholder:"Origin Sender Address",label:"Origin sender address",param:_n.from("address"),onChange:(x,C)=>d("sender",x,C)}),r0(Ba,{placeholder:"Connext origin domain ID",label:"Connext origin domain ID",className:i.inputParam,param:_n.from("uint256"),onChange:(x,C)=>d("domainId",x,C)}),r0(ze,{className:i.errorMessage,children:eV(r.chainId)?null:"Not supported network for the Module"}),r0(E1,{fullWidth:!0,disableElevation:!0,className:i.addButton,variant:"contained",disabled:o.domainId||o.sender||!eV(r.chainId),startIcon:r0($p,{}),onClick:p,children:"Add Module"})]})},_Te=({selected:e,onClose:t,onSubmit:n})=>ve(Er,{children:[r0(tte,{open:e===Cn.TELLOR,onClose:t,onSubmit:()=>n&&n(Cn.TELLOR)}),r0(fte,{open:e===Cn.OPTIMISTIC_GOVERNOR,onClose:t,onSubmit:()=>n&&n(Cn.OPTIMISTIC_GOVERNOR)}),r0(ate,{open:e===Cn.DELAY,onClose:t,onSubmit:()=>n&&n(Cn.DELAY)}),r0(lte,{open:e===Cn.BRIDGE,onClose:t,onSubmit:()=>n&&n(Cn.BRIDGE)}),r0(ute,{open:e===Cn.EXIT,onClose:t,onSubmit:()=>n&&n(Cn.EXIT)}),r0(hte,{open:e===Cn.ROLES_V1,onClose:t,onSubmit:()=>n&&n(Cn.ROLES_V1)}),r0(nre,{open:e===Cn.ROLES_V2,onClose:t,onSubmit:()=>n&&n(Cn.ROLES_V2)}),r0(sre,{open:e===Cn.REALITY_ETH,onClose:t,onSubmit:()=>n&&n(Cn.REALITY_ETH)}),r0(JTe,{open:e===Cn.KLEROS_REALITY,onClose:t,onSubmit:()=>n&&n(Cn.KLEROS_REALITY)}),r0(XTe,{open:e===Cn.CONNEXT,onClose:t,onSubmit:()=>n&&n(Cn.CONNEXT)}),r0(ote,{open:e===Cn.UNKNOWN,onClose:t,onSubmit:()=>n&&n(Cn.UNKNOWN)})]}),$Te=en(e=>({root:{padding:e.spacing(1.5)},gridContainer:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:e.spacing(2)},paper:{padding:e.spacing(2.5,2)},title:{marginBottom:e.spacing(2)},introBox:{gridColumn:"1/3","@media (max-width:930px)":{gridColumn:"1/2"}},firstModule:{gridColumn:1},link:{color:e.palette.text.primary}})),eMe=()=>{const e=$Te(),t=A1(),{safe:n}=uo.useSafeAppsSDK(),f=lr(l=>K3(l).length>0),[r,a]=n0.useState(),i=()=>{t(hc(n)),t(qC(!0))},o=pz[n.chainId],s=f?"Add another mod":"Start by adding a mod";return ve("div",{className:e.root,children:[ve("div",{className:e.gridContainer,children:[r0("div",{className:e.introBox,children:ve(wf,{variant:"outlined",className:e.paper,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[r0(ze,{variant:"h5",className:e.title,children:s}),ve(ze,{variant:"body2",children:["Built according to an open standard, the Zodiac collection of tools are mods that support, expand, and transform how organizations operate. Learn more about Zodiac in"," ",r0("a",{href:"https://gnosisguild.mirror.xyz/OuhG5s2X5uSVBx1EK4tKPhnUc91Wh9YM0fwSnC8UNcg",target:"_blank",rel:"noopener noreferrer",className:e.link,children:"this article"})," ","and about Gnosis Safe modules more generally in"," ",r0("a",{href:"https://help.gnosis-safe.io/en/articles/4934378-what-is-a-module",target:"_blank",rel:"noopener noreferrer",className:e.link,children:"this article"}),"."]})]})}),r0(ns,{title:"Bridge Module",description:"Enables an address on one chain to control an avatar on another chain using an Arbitrary Message Bridge (AMB)",icon:"bridge",onClick:()=>a(Cn.BRIDGE),className:e.firstModule,available:!!o[_e.BRIDGE]}),r0(ns,{title:"Delay Modifier",description:"Enables a time delay between when a module initiates a transaction and when it can be executed",icon:"delay",onClick:()=>a(Cn.DELAY),available:!!o[_e.DELAY]}),r0(ns,{title:"Exit Module",description:"Enables participants to redeem a designated token for a proportional share of this account\u2019digital assets",icon:"exit",onClick:()=>a(Cn.EXIT),available:!!o[_e.EXIT_ERC20]}),r0(ns,{title:"Roles Modifier",description:"Allows avatars to enforce granular, role-based, permissions for attached modules",icon:"roles",onClick:()=>a(Cn.ROLES_V2),available:!!o[_e.ROLES_V2]}),r0(ns,{title:"Reality Module Wizard",description:"Use a wizard to enable on-chain execution based on the outcome of events reported by the Reality.eth oracle",icon:"reality",onClick:()=>t(WC(!0)),available:[rn.MAINNET,rn.SEPOLIA].includes(n.chainId)}),r0(ns,{title:"Reality Module",description:"Enables on-chain execution based on the outcome of events reported by the Reality.eth oracle",icon:"reality",onClick:()=>a(Cn.REALITY_ETH),available:[rn.MAINNET,rn.SEPOLIA].includes(n.chainId)}),r0(ns,{title:"Kleros Snapshot Module",description:"Execute transactions for successful Snapshot proposals using Reality.eth, secured by Kleros.",icon:"reality",onClick:()=>a(Cn.KLEROS_REALITY),available:hc0.includes(n.chainId)}),r0(ns,{title:"Tellor Module",description:"Enables on-chain execution of successful Snapshot proposals reported by the Tellor oracle",icon:"tellor",onClick:()=>a(Cn.TELLOR),available:!!o[_e.TELLOR]}),r0(ns,{title:"UMA oSnap Module",description:"Enables on-chain execution of successful Snapshot proposals utilizing UMA's optimistic oracle.",icon:"optimisticGov",onClick:()=>a(Cn.OPTIMISTIC_GOVERNOR),available:!0}),r0(ns,{title:"Governor Module",description:"Enables an Open Zeppelin Governor contract as a module.",icon:"ozGov",onClick:()=>t(bV(!0)),available:!!o[_e.OZ_GOVERNOR]}),r0(ns,{title:"Connext Module",description:"Enables an address on one chain to control an avatar on another chain using Connext as the messaging layer.",icon:"connext",onClick:()=>a(Cn.CONNEXT),available:!!o[_e.CONNEXT]}),r0(ns,{title:"Roles Modifier v1",description:"Legacy version of the Roles Modifier",icon:"roles",deprecated:!0,onClick:()=>a(Cn.ROLES_V1),available:!!o[_e.ROLES_V1]}),r0(ns,{title:"Custom Module",description:"Enable a custom contract as a module",icon:"custom",onClick:()=>a(Cn.UNKNOWN),available:!0})]}),r0(_Te,{selected:r,onClose:()=>a(void 0),onSubmit:i})]})},tMe=en(e=>({content:{padding:e.spacing(2.5),marginTop:e.spacing(3)}})),nMe=({address:e,abi:t})=>{const n=tMe();return ve(Er,{children:[r0(al0,{value:"read",disabled:!0}),r0(wf,{borderStyle:"double",className:n.content,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0(Z50,{preview:!0,address:e,abi:t})})]})},fMe=en(e=>({root:{padding:e.spacing(3)},paper:{padding:e.spacing(2.5),maxWidth:500},title:{marginBottom:e.spacing(2)},header:{display:"grid",gridTemplateColumns:"50px auto",gridGap:e.spacing(2),alignItems:"center",marginBottom:e.spacing(3)},addressText:{margin:e.spacing(0,2,0,3),fontWeight:"bold"},icon:{marginLeft:"16px"},buttons:{marginTop:e.spacing(3),opacity:.5}}));function rMe(){const e=lr(Vg);if(!e)return null;const t=oV(e.module);return!t||!t.abi?null:r0(nMe,{address:e.address,abi:t.abi})}const aMe=()=>{const e=fMe(),t=lr(pV)===1;return ve("div",{className:e.root,children:[ve("div",{className:e.header,children:[r0(md,{variant:"circle",width:50,height:50}),r0(md,{variant:"rect",width:380,height:20})]}),t?r0(rMe,{}):ve(wf,{borderStyle:"double",className:e.paper,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[r0(ze,{variant:"h5",className:e.title,children:"Waiting on module approval"}),r0(ze,{children:"Once this module transaction has been approved by the other signers, you will be able to read and write to it."})]})]})},iMe=en(e=>({container:{display:"flex",flexDirection:"column"},textSubdued:{color:"rgba(255 255 255 / 70%)"},input:{"& .MuiInputBase-root":{padding:"9px 8px",borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}}})),oMe=({data:e,setData:t})=>{const n=iMe(),{safe:f}=uo.useSafeAppsSDK(),r=f.chainId===1?q90:W90,[a,i]=n0.useState("");n0.useEffect(()=>{if(e&&r.length&&a===""){const c=r.filter(d=>d.label.includes(e.instanceAddress));i(c[0].value)}},[e,r,a]);const o=c=>d=>t({...e,[c]:d}),s=c=>e[c],l=c=>{if(c==="custom"){o("instanceType")(c);return}const d=c.substr(c.indexOf("-")+1),p=c.substr(0,c.indexOf("-"));i(c),o("instanceAddress")(d),o("instanceType")(p)};return ve(fe,{container:!0,spacing:2,className:n.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Oracle Instance"})}),r0(fe,{item:!0,children:r0(ze,{variant:"body2",className:n.textSubdued,children:"The oracle instance sets the appropriate bond token. It's recommended to use the default (ETH) oracle instance unless you have a specific reason to use something like a native token which can potentially be more prone to price manipulation."})})]})}),r0(fe,{item:!0,children:r0(_S,{value:a,options:r,disableUnderline:!0,label:"Select oracle:",onChange:({target:c})=>{l(c.value)}})}),s("instanceType")==="custom"&&r0(fe,{item:!0,children:ve(fe,{container:!0,justifyContent:"space-between",alignItems:"center",spacing:1,children:[r0(fe,{item:!0,sm:10,children:r0(Cr,{label:"Contract Address",value:s("instanceAddress"),borderStyle:"double",className:n.input,onChange:c=>o("instanceAddress")(c.target.value)})}),r0(fe,{item:!0,sm:2,children:r0(ze,{style:{marginTop:15},children:"WEENUS"})})]})})]})},sMe=172800,U90=86400,lMe=172800,cMe=172800,uMe=172800,H90=0,dMe=604800,pMe=432e3,G90=86400,bMe="We highly recommend that your timeout delay exceeds 48 hours.",hMe="Your timeout delay must exceed 24 hours.",mMe="We highly recommend that your cooldown delay exceeds 48 hours.",yMe="Your cooldown delay must exceed 0",gMe="We highly recommend that your expiration delay exceeds cooldown + 5 days.",vMe="Your expiration delay must exceeds cooldown + 1 days.",jc=(e,t,n)=>{const f=parseInt(t),r=parseInt(n);switch(e){case"timeout":if(f{const n=parseInt(t);switch(e){case"timeout":if(n>=U90&&n=H90&&n=G90&&n({errorIcon:{fill:"rgba(244, 67, 54, 1)"},warningIcon:{fill:Jt.tan[800]},message:{fontSize:12,color:"rgba(244, 67, 54, 1)"},warningMessage:{fontSize:12,color:Jt.tan[800]}})),lw=({type:e,message:t})=>{const n=wMe();return ve(fe,{container:!0,spacing:1,alignItems:"center",children:[e==="error"&&ve(fe,{item:!0,children:[r0(gc,{className:n.errorIcon})," "]}),e==="warning"&&r0(fe,{item:!0,children:r0(KV,{className:n.warningIcon})}),r0(fe,{item:!0,children:r0(ze,{className:e==="error"?n.message:n.warningMessage,children:t})})]})},q9=({type:e,delayValue:t,dependsDelayValue:n})=>{const f=jc("timeout",parseInt(t)),r=jc("cooldown",parseInt(t)),a=jc("expiration",parseInt(t),n),i=G9("timeout",parseInt(t)),o=G9("cooldown",parseInt(t)),s=G9("expiration",parseInt(t)),[l,c]=n0.useState(void 0),[d,p]=n0.useState(void 0),[x,C]=n0.useState(void 0);return n0.useEffect(()=>{if(!f)return c({type:"error",message:hMe});if(!i)return c({type:"warning",message:bMe});c(void 0)},[f,i]),n0.useEffect(()=>{if(!r)return p({type:"error",message:yMe});if(!o)return p({type:"warning",message:mMe});p(void 0)},[r,o]),n0.useEffect(()=>{if(!a)return C({type:"error",message:vMe});if(!s)return C({type:"warning",message:gMe});C(void 0)},[a,s]),ve(n0.Fragment,{children:[e==="timeout"&&l&&r0(fe,{item:!0,children:r0(lw,{type:l.type,message:l.message})}),e==="cooldown"&&d&&r0(fe,{item:!0,children:r0(lw,{type:d.type,message:d.message})}),e==="expiration"&&x&&r0(fe,{item:!0,children:r0(lw,{type:x.type,message:x.message})})]})},AMe=en(()=>({container:{display:"flex",flexDirection:"column"},textSubdued:{color:"rgba(255 255 255 / 70%)"}})),xMe=({data:e,setData:t})=>{const n=AMe(),f=c=>e[c],r=f("timeout"),a=f("cooldown"),i=f("expiration"),o=jc("timeout",r),s=jc("cooldown",a),l=jc("expiration",i,a);return ve(fe,{container:!0,spacing:2,className:n.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:n.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Delay Configuration"})}),r0(fe,{item:!0,children:r0(ze,{variant:"body2",className:n.textSubdued,children:"These Parameters are very important for your DAO's security and should be considered carefully. Allowing enough time in these configurations will enable the safe to have a final chance to veto or circumvent any potential malicious proposals that have snuck through."})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:6,alignItems:"center",justifyContent:"space-between",children:[r0(fe,{item:!0,xs:4,children:r0(Zo,{variant:o?"secondary":"error",alertType:o?void 0:"error",label:"Timeout",tooltipMsg:"Duration that answers can be submitted to the oracle (resets when a new answer is submitted)",valueUnit:f("timeoutUnit"),value:r,onChange:(c,d)=>{t({...e,timeout:c,timeoutUnit:d})}})}),r0(fe,{item:!0,xs:4,children:r0(Zo,{variant:s?"secondary":"error",alertType:s?void 0:"error",label:"Cooldown",tooltipMsg:"Duration required before the transaction can be executed (after the timeout has expired).",valueUnit:f("cooldownUnit"),value:a,onChange:(c,d)=>{t({...e,cooldown:c,cooldownUnit:d})}})}),r0(fe,{item:!0,xs:4,children:r0(Zo,{variant:l?"secondary":"error",alertType:l?void 0:"error",label:"Expiration",tooltipMsg:"Duration that a transaction is valid in seconds (or 0 if valid forever) after the cooldown (note this applies to all proposals on this module).",valueUnit:f("expirationUnit"),value:i??0,onChange:(c,d)=>{t({...e,expiration:c,expirationUnit:d})}})})]})}),r0(q9,{type:"timeout",delayValue:parseInt(r)}),r0(q9,{type:"cooldown",delayValue:parseInt(a)}),r0(q9,{type:"expiration",delayValue:parseInt(i),dependsDelayValue:parseInt(a)})]})},EMe=en(e=>({container:{display:"flex",flexDirection:"column"},textSubdued:{color:"rgba(255 255 255 / 70%)"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},error:{"& .MuiInputBase-root":{borderColor:"rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.1)","&::before":{borderColor:"rgba(244, 67, 54, 0.3)"}}}})),GO=.1,TMe=({data:e,setData:t})=>{const n=EMe(),f=a=>i=>t({...e,[a]:i}),r=(a=>e[a])("bond");return ve(fe,{container:!0,spacing:2,className:n.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:n.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Bond"})}),r0(fe,{item:!0,children:ve(ze,{variant:"body2",className:n.textSubdued,children:["Minimum bond required for an answer to be accepted. New answers must be submitted with double the previous bond. For more on why a bond is required in an escalation-game-based oracle, read more in the"," ",r0(d1,{underline:"always",href:"http://reality.eth.link/app/docs/html/whitepaper.html",target:"_blank",color:"inherit",children:"Reality.eth whitepaper."})]})})]})}),r0(fe,{item:!0,children:r0(Cr,{label:"Bond",color:"secondary",borderStyle:"double",className:rf("bond")(a.target.value)})}),r({container:{display:"flex",flexDirection:"column"},textSubdued:{color:"rgba(255 255 255 / 70%)"}})),CMe=({data:e,setData:t})=>{const n=MMe(),f=a=>i=>t({...e,[a]:i}),r=a=>e[a];return ve(fe,{container:!0,spacing:2,className:n.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Arbitration"})}),r0(fe,{item:!0,children:ve(ze,{variant:"body2",className:n.textSubdued,children:["An arbitrator is responsible for providing a final answer to a question when there is a dispute, in exchange for a fee. In most cases, the bond escalation-game eliminates the need for this. However, if you feel it's necessary to include a backup arbitration strategy incase of a dispute, you can select one from below. Read more in the"," ",r0(d1,{underline:"always",href:"https://reality.eth.link/app/docs/html/arbitrators.html",target:"_blank",color:"inherit",children:"Reality.eth arbitrators documentation"}),"."]})})]})}),r0(fe,{item:!0,children:r0(_S,{value:r("arbitratorOption"),options:[{label:"No arbitration (highest bond wins)",value:W3.NO_ARBITRATOR},{label:"Kleros",value:W3.KLEROS}],disableUnderline:!0,label:"Arbitrator:",onChange:({target:a})=>f("arbitratorOption")(a.value)})})]})},SMe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},icon:{fill:"white",width:"20px"},divider:{marginTop:8,marginBottom:8},warningModal:{maxWidth:650},errorPaperContainer:{width:"100%",padding:e.spacing(1),background:"rgba(0, 0, 0, 0.2)",border:0,borderRadius:4,display:"inline-block","& .MuiTypography-root":{fontFamily:"Roboto Mono"}}})),q90=[{label:"ETH-0x5b7dD1E86623548AF054A4985F7fc8Ccbb554E2c",value:"ETH-0x5b7dD1E86623548AF054A4985F7fc8Ccbb554E2c"},{label:"GNO-0x33aa365a53a4c9ba777fb5f450901a8eef73f0a9",value:"GNO-0x33aa365a53a4c9ba777fb5f450901a8eef73f0a9"}],W90=[{label:"ETH-0x6F80C5cBCF9FbC2dA2F0675E56A5900BB70Df72f",value:"ETH-0x6F80C5cBCF9FbC2dA2F0675E56A5900BB70Df72f"}],OMe=({handleBack:e,handleNext:t,setupData:n})=>{const f=SMe(),{safe:r}=uo.useSafeAppsSDK(),a=r.chainId===1?q90:W90,[i,o]=n0.useState(!1);if((n==null?void 0:n.proposal.ensName)==null)throw new Error("ENS name is not set");const[s,l]=n0.useState({templateType:"default",language:"english",category:"DAO proposal",templateQuestion:$S(n==null?void 0:n.proposal.ensName)}),[c,d]=n0.useState({instanceAddress:a[0].value.substr(a[0].value.indexOf("-")+1),instanceType:a[0].value.substr(0,a[0].value.indexOf("-"))}),[p,x]=n0.useState({timeout:sMe,timeoutUnit:"days",cooldown:cMe,cooldownUnit:"days",expiration:dMe,expirationUnit:"days"}),[C,O]=n0.useState({bond:.1}),{timeout:L,cooldown:D,expiration:V}=p,{bond:Y}=C,i0=jc("timeout",L),m0=jc("cooldown",D),A0=jc("expiration",V,D),T0=G9("timeout",L),I0=G9("cooldown",D),z0=G9("expiration",V),[oe,ae]=n0.useState({arbitratorOption:W3.NO_ARBITRATOR}),ye=()=>({templateData:s,instanceData:c,delayData:p,bondData:C,arbitratorData:oe}),P=()=>{if([T0,I0,z0].includes(!1)||Y{if(n&&n.oracle){const{bondData:F,delayData:Q,instanceData:H,templateData:u0,arbitratorData:h0}=n.oracle;O(F),x(Q),d(H),l(u0),ae(h0)}},[n]),(n==null?void 0:n.proposal.ensName)==null)throw new Error("The ENS name is not available, it needs to already be in the setupData, before initiating this step.");return ve(wf,{borderStyle:"single",className:f.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[ve(fe,{container:!0,spacing:4,className:f.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Set up the Oracle"})}),r0(fe,{item:!0,children:ve(ze,{children:["Now, it's time to set up the oracle for your reality module. The oracle ensures the results of proposals are brought accurately on-chain. The Reality.eth oracle uses a mechanism known as the"," ",r0(Jo,{underline:"always",href:"https://reality.eth.limo/app/docs/html/whitepaper.html",target:"_blank",color:"inherit",children:"escalation game"})," ","to generate correct answers that can be used as inputs for smart contracts. The following parameters are very important for your DAO's security and should be considered carefully."]})})]})}),r0(fe,{item:!0,children:r0(zo,{})}),r0(fe,{item:!0,children:r0(Xce,{data:s,setData:l,ensName:n==null?void 0:n.proposal.ensName})}),r0(fe,{item:!0,children:r0(oMe,{data:c,setData:d})}),r0(fe,{item:!0,children:r0(xMe,{data:p,setData:x})}),r0(fe,{item:!0,children:r0(TMe,{data:C,setData:O})}),r0(fe,{item:!0,children:r0(CMe,{data:oe,setData:ae})}),r0(fe,{item:!0,style:{paddingBottom:0},children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:()=>e(ye()),children:"Back"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",disabled:[i0,m0,A0].includes(!1),onClick:P,children:"Next"})})]})})]}),r0(_r0,{className:f.warningModal,open:i,isOpen:i,onClose:()=>o(!i),children:ve(fe,{container:!0,spacing:1,direction:"column",children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,alignItems:"center",children:[r0(fe,{item:!0,children:r0(gc,{className:f.icon})}),r0(fe,{item:!0,children:r0(ze,{variant:"h4",children:"Security Risk Detected"})})]})}),r0(fe,{item:!0,children:r0(ze,{children:"The following security risks have been detected. We highly recommend that you resolve them before moving forward, as these can leave to loss of funds."})}),r0(fe,{item:!0,children:ve(wf,{borderStyle:"single",className:f.errorPaperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[r0(q9,{type:"timeout",delayValue:L}),r0(q9,{type:"cooldown",delayValue:D}),r0(q9,{type:"expiration",delayValue:V,dependsDelayValue:D}),Yt(ye()),children:"Proceed"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",onClick:()=>o(!1),children:"Resolve (Recommended)"})})]})})]})})]})},kMe=en(e=>({icon:{fill:"white",width:"20px"},paperContainer:{padding:e.spacing(2),background:"rgba(244, 67, 54, 0.1)",border:"1px solid rgba(244, 67, 54, 0.3)","&, &:before, &:after":{border:"1px solid rgba(244, 67, 54, 0.3)"}},addressPaperContainer:{width:"100%",padding:e.spacing(1),background:"rgba(0, 0, 0, 0.2)",border:0,borderRadius:4,display:"inline-block","& .MuiTypography-root":{fontFamily:"Roboto Mono"}}})),NMe=({title:e,type:t,address:n})=>{const f=kMe();return ve(fe,{container:!0,spacing:1,direction:"column",children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,alignItems:"center",children:[r0(fe,{item:!0,children:r0(gc,{className:f.icon})}),r0(fe,{item:!0,children:r0(ze,{variant:"h4",children:e})})]})}),r0(fe,{item:!0,children:ve(ze,{children:[t==="controller"&&"The safe you are currently using with Zodiac is not the controller of the ENS you've entered. Try one of the following: ",t==="owner"&&"The ENS that you've entered is not owned by a safe. This gives unilateral control to the individual with this address: ",t==="safesnap"&&"The Snapshot space has already installed the Safesnap plugin.",t==="snapshot"&&e.includes("Invalid")&&"The current snapshot settings file is invalid. Check the browser console for validation details. The schema for validating the settings file can be found",t==="snapshot"&&e.includes("Invalid")&&ve(Er,{children:[" ",r0(Jo,{underline:"always",href:"https://github.com/snapshot-labs/snapshot.js/blob/master/src/schemas/space.json",target:"_blank",color:"inherit",children:"here."})]}),t==="snapshot"&&!e.includes("Invalid")&&"The ENS you've entered is not setup with a Snapshot space. To setup a snapshot space with this ENS, follow the guide",t==="snapshot"&&!e.includes("Invalid")&&ve(Er,{children:[" ",r0(Jo,{underline:"always",href:"https://docs.snapshot.org/spaces/create",target:"_blank",color:"inherit",children:"here."})]})]})}),n&&r0(fe,{item:!0,children:r0(wf,{borderStyle:"double",className:f.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0(wf,{borderStyle:"single",className:f.addressPaperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0(ze,{variant:"body2",children:n})})})}),["controller","owner"].includes(t)&&r0(fe,{item:!0,children:ve(ze,{children:[t==="controller"&&"- Check that your ENS is typed correctly.",t==="owner"&&"We highly recommend transferring the ENS to a multisig safe before continuing."]})}),t==="controller"&&r0(fe,{item:!0,children:ve(ze,{children:["- Update your ENS controller settings via the"," ",r0(Jo,{underline:"always",href:"https://docs.ens.domains/contract-api-reference/.eth-permanent-registrar/controller",target:"_blank",color:"inherit",children:"ENS."})]})})]})},PMe=en(e=>({message:{fontSize:12,color:"rgba(244, 67, 54, 1)"},messageDetails:{fontSize:12,textDecoration:"underline",cursor:"pointer"},errorIcon:{fill:"rgba(244, 67, 54, 1)",width:"20px"},detailsContainer:{width:"95%"},messageContainer:{width:"85%"}})),qO=({status:e,message:t,type:n,address:f})=>{const r=PMe(),[a,i]=n0.useState(!1),o=(()=>{switch(n){case"controller":return"Safe not controller of ENS";case"owner":return"Security Risk Detected";case"snapshot":return t!=null&&t.includes("invalid")?"Invalid Snapshot settings file":"Snapshot space not found";case"safesnap":return"Safesnap plugin is already installed";default:return""}})();return e&&ve(fe,{container:!0,spacing:1,alignItems:"center",children:[ve(fe,{item:!0,children:[e==="error"&&r0(gc,{className:r.errorIcon}),e==="warning"&&r0(wG,{className:r.errorIcon})]}),r0(fe,{item:!0,className:r.detailsContainer,children:ve(fe,{container:!0,justifyContent:"space-between",alignItems:"center",children:[r0(fe,{item:!0,className:r.messageContainer,children:r0(ze,{className:r.message,children:t})}),r0(fe,{item:!0,children:r0(ze,{className:r.messageDetails,onClick:()=>i(!a),children:"Details"})})]})}),r0(_r0,{open:a,isOpen:a,onClose:()=>i(!a),children:r0(NMe,{title:o,type:n,address:f})})]})},WO=(e,t,n,f,r,a,i)=>{if(!t){if(e==="snapshot"&&!r||e==="snapshot"&&!a||e==="controller"&&!n||e==="safesnap"&&i)return"error";if(e==="owner"&&!f)return"warning"}return null},QO=(e,t,n,f,r,a)=>e==="snapshot"&&!f?"The ENS name should have a Snapshot space created.":e==="snapshot"&&!r?"Your snapshot settings file is invalid.":e==="controller"&&!t?"The safe must be the controller of the ENS name.":e==="owner"&&!n?"The safe is not the owner of the ENS name. We highly recommend transferring the ENS to this safe or enter a different ENS before continuing.":e==="safesnap"&&a?"The plugin is already installed on the Snapshot space.":null;function IMe(e,t=500){const[n,f]=n0.useState(e),[r,a]=n0.useState(e);return n0.useEffect(()=>{f(e)},[e]),n0.useEffect(()=>{const i=setTimeout(()=>{a(n)},t);return()=>{clearTimeout(i)}},[n,t]),[n,r,f]}const RMe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},doneIcon:{marginRight:4,fill:"#A8E07E",width:"16px"},errorIcon:{marginRight:4,fill:"rgba(244, 67, 54, 1)",width:"16px"},loadingContainer:{marginRight:4,padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:14,width:14,border:`1px solid ${Jt.tan[300]}`},spinner:{width:"8px !important",height:"8px !important",color:`${Jt.tan[300]} !important`},loading:{width:"15px !important",height:"15px !important",marginRight:8},radio:{marginLeft:-2,padding:2,"& ~ .MuiFormControlLabel-label":{fontSize:12,marginLeft:4},"&$checked":{color:Jt.tan[1e3]}},checked:{},textSubdued:{color:"rgba(255 255 255 / 70%)"},textFieldSmall:{"& .MuiFormLabel-root":{fontSize:12}},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},inputError:{"& .MuiInputBase-root":{borderColor:"rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.1)","&::before":{borderColor:"rgba(244, 67, 54, 0.3)"}}},errorContainer:{margin:8,display:"flex",alignItems:"center"}})),BMe=({handleNext:e,handleBack:t,setupData:n})=>{const{ensClient:f}=z90(),{safe:r,provider:a}=hi(),i=RMe(),[o,s,l]=IMe(""),[c,d]=n0.useState(""),[p,x]=n0.useState(!1),[C,O]=n0.useState(!1),[L,D]=n0.useState(!1),[V,Y]=n0.useState(!1),[i0,m0]=n0.useState(!1),[A0,T0]=n0.useState(!1),[I0,z0]=n0.useState(!1);n0.useEffect(()=>{a&&n&&n.proposal&&l(n.proposal.ensName)},[]),n0.useEffect(()=>{(async()=>s&&f&&(await f.getSubgraphRecords({name:s})?(z0(!0),T0(!0),(async()=>await oe())()):(z0(!1),D(!1),x(!1))))()},[s,f]);const oe=async()=>{var F;if(!f)return;const P=(F=await Cq(f,{name:s}))==null?void 0:F.value;if(P){const Q=await gG(o,r.chainId);console.log(Q);const H=await Hoe(f,o,r.safeAddress),u0=await Iu0(a,f,o,r.safeAddress),h0=Q==null?void 0:Q.plugins;h0&&O(!!h0.safeSnap),Y(!!Q),x(H),D(u0),d(P),T0(!1);return}else{d(""),T0(!1),x(!1),D(!1),Y(!1),m0(!1),O(!1);return}},ae=()=>({ensName:o}),ye=P=>{P===""?(D(!1),x(!1),Y(!1),m0(!1),l("")):l(P)};return r0(wf,{borderStyle:"single",className:i.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:4,className:i.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:i.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Configure Proposal Space"})}),r0(fe,{item:!0,children:r0(ze,{children:"Add your preferred proposal type below to get started. If you're unsure, we recommend starting with Snapshot."})}),r0(fe,{item:!0,children:ve(ze,{children:["Don't have a snapshot space setup yet?"," ",r0(Jo,{underline:"always",href:f0e(r,"https://snapshot.org/#/setup?step=1"),target:"_blank",color:"inherit",children:"Get started here."})]})})]})}),r0(fe,{item:!0,children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:i.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Proposal Configuration"})}),r0(fe,{item:!0,children:r0(ze,{variant:"body2",className:i.textSubdued,children:"Enter your snapshot space ENS domain below to get started. The Safe must be the controller of this ENS domain."})}),ve(fe,{item:!0,children:[r0(Cr,{value:o,onChange:({target:P})=>ye(P.value),label:"Enter the Snapshot ENS name.",placeholder:"ex: gnosis.eth",borderStyle:"double",className:`${i.textFieldSmall} ${o.includes(".eth")&&!A0&&(!V||!L||!p)?i.inputError:i.input}`,rightIcon:ve(Er,{children:[A0&&r0(ua,{className:i.loadingContainer,children:r0(fi.Loader,{size:"sm",className:i.spinner})}),o.includes(".eth")&&!A0&&(!V||!L||!p)&&r0(gc,{className:i.errorIcon}),o.includes(".eth")&&!A0&&V&&L&&p&&r0(ow,{className:i.doneIcon})]})}),r0("br",{}),r0("br",{}),I0&&ve(Er,{children:[r0(qO,{type:"snapshot",status:WO("snapshot",A0,!1,!1,V,i0,!1),message:QO("snapshot",!1,!1,V,i0,!1)}),r0(qO,{type:"safesnap",status:WO("safesnap",A0,!1,!1,!1,!1,C),message:QO("safesnap",!1,!1,!1,!1,C)}),r0(qO,{type:"controller",status:WO("controller",A0,L,!1,!1,!1,!1),message:QO("controller",L,!1,!1,!1,!1)}),r0(qO,{type:"owner",status:WO("owner",A0,!1,p,!1,!1,!1),message:QO("owner",!1,p,!1,!1,!1),address:c})]})]})]})}),r0(fe,{item:!0,style:{paddingBottom:0},children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:()=>t(ae()),children:"Cancel"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",disabled:!L||C,onClick:()=>e(ae()),children:"Next"})})]})})]})})},DMe=en(()=>({circle:{padding:6,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:25,width:25,border:`1px solid ${Jt.tan[300]}`,background:Jt.blue[500]},label:{display:"inline",fontFamily:"Roboto Mono",cursor:"pointer","&:hover":{textDecoration:"underline"}}})),Q90=({label:e,number:t,disabled:n,onClick:f})=>{const r=DMe();return ve(fe,{container:!0,spacing:1,alignItems:"center",onClick:()=>{!n&&f()},children:[r0(fe,{item:!0,children:r0(ua,{className:r.circle,children:r0(ze,{children:t})})}),r0(fe,{item:!0,children:r0(ze,{className:r.label,children:e})})]})};var dW={},LMe=W5,jMe=mc;Object.defineProperty(dW,"__esModule",{value:!0});var pW=dW.default=void 0,FMe=jMe(n0),zMe=LMe(yc()),VMe=(0,zMe.default)(FMe.createElement("path",{d:"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward");pW=dW.default=VMe;var bW={},UMe=W5,HMe=mc;Object.defineProperty(bW,"__esModule",{value:!0});var Y90=bW.default=void 0,GMe=HMe(n0),qMe=UMe(yc()),WMe=(0,qMe.default)(GMe.createElement("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Y90=bW.default=WMe;var hW={},QMe=W5,YMe=mc;Object.defineProperty(hW,"__esModule",{value:!0});var K90=hW.default=void 0,KMe=YMe(n0),JMe=QMe(yc()),ZMe=(0,JMe.default)(KMe.createElement("path",{d:"M19 13H5v-2h14v2z"}),"Remove");K90=hW.default=ZMe;var mW={},XMe=W5,_Me=mc;Object.defineProperty(mW,"__esModule",{value:!0});var yW=mW.default=void 0,$Me=_Me(n0),eCe=XMe(yc()),tCe=(0,eCe.default)($Me.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear");yW=mW.default=tCe;const nCe=en(e=>({message:{fontSize:"0.9rem"},messageError:{fontSize:"0.9rem",color:"rgba(244, 67, 54, 1)"},circle:{padding:6,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,background:Jt.tan[1e3]},loadingContainer:{padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,border:`1px solid ${Jt.tan[300]}`},errorContainer:{padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,border:"1px solid rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.3)"},errorIcon:{width:"12px",height:"12px",color:"#F44336"},loading:{width:"12px !important",height:"12px !important",color:`${Jt.tan[300]} !important`},doneIcon:{fill:"black",width:"16px"}})),fCe=({statusLog:e})=>{const t=nCe();return r0(fe,{container:!0,spacing:1,alignItems:"center",children:e.map((n,f)=>r0(fe,{item:!0,xs:12,children:ve(fe,{container:!0,spacing:1,alignItems:"center",children:[ve(fe,{item:!0,children:[e.length>f+1&&!n.error&&r0(ua,{className:t.circle,children:r0(ow,{className:t.doneIcon})}),e.length===f+1&&!n.error&&r0(ua,{className:t.loadingContainer,children:r0(fi.Loader,{size:"sm",className:t.loading})}),e.length===f+1&&n.error&&r0(ua,{className:t.errorContainer,children:r0(yW,{className:t.errorIcon})})]}),r0(fe,{item:!0,children:r0(ze,{className:n.error?t.messageError:t.message,children:n.msg})})]},f)},`status-${f}`))})},rCe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},paperTemplateContainer:{marginTop:4,padding:e.spacing(2),background:"rgba(0, 0, 0, 0.2)"},textSubdued:{color:"rgba(255 255 255 / 70%)"},icon:{fill:"white",cursor:"pointer"},collapse:{textDecoration:"underline",cursor:"pointer"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},textarea:{"& .MuiInputBase-root":{padding:e.spacing(2),background:"rgba(0, 0, 0, 0.2)",borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},link:{fontFamily:"Roboto Mono",fontSize:12,textDecoration:"underline",fontWeight:"bold"},label:{fontFamily:"Roboto Mono",fontSize:12,fontWeight:"bold"},loading:{width:"15px !important",height:"15px !important"}})),aCe=[{label:"Proposal",number:1,section:0},{label:"Oracle",number:2,section:1},{label:"Monitoring",number:3,section:2}],iCe=({handleBack:e,handleNext:t,goToStep:n,delayModules:f,setupData:r,loading:a,statusLog:i})=>{const o=rCe(),{safe:s}=uo.useSafeAppsSDK(),[l,c]=n0.useState(),[d,p]=n0.useState(!1),[x,C]=n0.useState(void 0),[O,L]=n0.useState(f.length===1?f[0].address:""),D=r&&r.monitoring;return n0.useEffect(()=>{r&&r.proposal&&c(jce(s.chainId,r.proposal.ensName)),r&&r.oracle&&C(r.oracle)},[r]),r0(wf,{borderStyle:"single",className:o.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:4,className:o.container,children:[!d&&ve(Er,{children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:o.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Review"})}),r0(fe,{item:!0,children:r0(ze,{children:"Here is an overview of your reality module configuration. Please review carefully. Once you've confirmed that the details are correct, you can submit the transaction which will add the reality module to this safe, and automatically integrate the SafeSnap plugin with the snapshot space you've include."})})]})}),r0(fe,{item:!0,children:r0(zo,{})}),aCe.map(V=>ve(Pt.Fragment,{children:[r0(fe,{item:!0,children:r0(Q90,{label:V.label,number:V.number,disabled:a,onClick:()=>n(V.section)})}),V.label==="Proposal"&&ve(fe,{item:!0,children:[r0(ze,{children:"Snapshot Space:"}),r0(d1,{color:"inherit",href:l,target:"_blank",className:o.link,children:l})]}),V.label==="Oracle"&&x&&r&&r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,direction:"column",children:[ve(fe,{item:!0,children:[r0(ze,{children:"Template question preview:"}),r0(wf,{className:o.paperTemplateContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0(ze,{children:r.oracle.templateData.templateQuestion})})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Oracle Address:"}),r0(d1,{color:"inherit",href:`${Zz[s.chainId]}/search?f=0&q=${x.instanceData.instanceAddress}`,target:"_blank",className:o.link,children:x.instanceData.instanceAddress})]}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,justifyContent:"space-between",alignItems:"center",children:[ve(fe,{item:!0,children:[r0(ze,{children:"Timeout:"}),ve(ze,{className:o.label,children:[(BigInt(x.delayData.timeout)/BigInt(_p[x.delayData.timeoutUnit])).toString()," ",x.delayData.timeoutUnit]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Cooldown:"}),ve(ze,{className:o.label,children:[(BigInt(x.delayData.cooldown)/BigInt(_p[x.delayData.cooldownUnit])).toString()," ",x.delayData.cooldownUnit]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Expiration:"}),ve(ze,{className:o.label,children:[(BigInt(x.delayData.expiration)/BigInt(_p[x.delayData.expirationUnit])).toString()," ",x.delayData.expirationUnit]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Bond:"}),ve(ze,{className:o.label,children:[x.bondData.bond," ETH"]})]})]})}),ve(fe,{item:!0,children:[r0(ze,{children:"Arbitrator:"}),ve(ze,{className:o.label,children:[x.arbitratorData.arbitratorOption===0&&"No arbitration (highest bond wins)",x.arbitratorData.arbitratorOption===1&&"Kleros"]})]})]})}),V.label==="Monitoring"&&D&&r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,direction:"column",children:[ve(fe,{item:!0,children:[r0(ze,{children:"API key/secret:"}),r0(ze,{className:o.label,children:"Valid"})]}),D.email.length>0&&ve(fe,{item:!0,children:[r0(ze,{children:"Emails:"}),D.email.map((Y,i0)=>ve(ze,{className:o.label,children:["- ",Y]},i0))]}),D.discordKey!==""&&ve(fe,{item:!0,children:[r0(ze,{children:"Discord:"}),r0(ze,{className:o.label,children:D.discordKey})]}),D.telegram.botToken!==""&&ve(fe,{item:!0,children:[r0(ze,{children:"Telegram:"}),ve(ze,{className:o.label,children:["Bot token: ",D.telegram.botToken]}),ve(ze,{className:o.label,children:["Chat ID: ",D.telegram.chatId]})]}),D.slackKey!==""&&ve(fe,{item:!0,children:[r0(ze,{children:"Slack:"}),r0(ze,{className:o.label,children:D.slackKey})]})]})}),r0(fe,{item:!0,children:r0(zo,{})})]},V.label)),f.length>=1&&r0(fe,{item:!0,children:r0(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:ve(fe,{item:!0,children:[r0(ze,{variant:"h6",gutterBottom:!0,children:"Deploy Options"}),r0(eS,{description:oCe,modules:f,value:O,onChange:V=>L(V),type:Cn.DELAY})]})})})]}),i.length>0&&r0(fe,{item:!0,onClick:()=>p(!d),children:ve(fe,{container:!0,spacing:1,children:[r0(fe,{item:!0,children:d?r0(Y90,{className:o.icon}):r0(K90,{className:o.icon})}),r0(fe,{item:!0,className:o.collapse,children:r0(ze,{children:d?"Show More":"Show Less"})})]})}),i.length>0&&r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:o.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Setting up Module"})}),r0(fe,{item:!0,children:r0(fCe,{statusLog:i})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:e,disabled:a,children:"Back"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",startIcon:a?r0(fi.Loader,{className:o.loading,size:"sm",color:"background"}):r0(pW,{}),disabled:a,onClick:()=>{p(!0),t(r)},children:"Submit"})})]})})]})})},oCe=ve(ze,{variant:"body2",children:["This will add a time delay to any transactions created by this module."," ",r0("b",{children:"Note that this delay is cumulative with the cooldown set above"})," (e.g. if both are set to 24 hours, the cumulative delay before the transaction can be executed will be 48 hours)."]}),sCe=en(()=>({paperContainer:{background:"rgba(0, 0, 0, 0.2)"},message:{fontSize:12,color:"rgba(244, 67, 54, 1)"}})),lCe={control:(e,t)=>({...e,background:"none",border:"none",fontFamily:"Roboto Mono !important",color:"yellow !important",boxShadow:(t.isFocused,null),"&:hover":{border:"none"}}),option:e=>({...e,color:"white",backgroundColor:"#101010",cursor:"pointer"}),menu:e=>({...e,borderRadius:0,backgroundColor:"#101010",marginTop:0}),menuList:e=>({...e,padding:0}),multiValue:e=>({...e,color:"white !important",background:Jt.tan[300],maxWidth:"calc(28% - 4px)","&:hover":{background:Jt.tan[300]},"& > div":{color:"white !important"},"& > div[role=button]:hover":{cursor:"pointer",color:"blue",background:Jt.tan[500]}})},cCe=e=>{const t=sCe();return ve(fe,{container:!0,spacing:1,direction:"column",children:[r0(fe,{item:!0,children:r0(wf,{className:t.paperContainer,borderStyle:"double",placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0(uc0,{...e,isMulti:!0,styles:lCe,options:e.options,theme:n=>({...n,colors:{...n.colors,font:"#101010",primary25:"#101010",primary:"#101010",neutral80:"white"}})})})}),e.invalidText&&r0(fe,{item:!0,children:r0(ze,{className:t.message,children:e.invalidText})})]})},J90=e=>{const t=n0.useRef();return n0.useEffect(()=>{t.current=e},[e]),t.current},uCe=en(e=>({message:{fontSize:"0.9rem"},messageError:{fontSize:"0.8rem",color:"rgba(244, 67, 54, 1)"},circle:{padding:6,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,background:Jt.tan[1e3]},loadingContainer:{padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,border:`1px solid ${Jt.tan[300]}`},errorContainer:{padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,border:"1px solid rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.3)"},errorIcon:{width:"12px",height:"12px",color:"#F44336"},loading:{width:"12px !important",height:"12px !important",color:`${Jt.tan[300]} !important`},doneIcon:{fill:"black",width:"16px"}})),dCe=({status:e,message:t})=>{const n=uCe();return e&&ve(fe,{container:!0,spacing:1,alignItems:"center",children:[ve(fe,{item:!0,children:[e==="success"&&r0(ua,{className:n.circle,children:r0(ow,{className:n.doneIcon})}),e==="loading"&&r0(ua,{className:n.loadingContainer,children:r0(fi.Loader,{size:"sm",className:n.loading})}),e==="error"&&r0(ua,{className:n.errorContainer,children:r0(yW,{className:n.errorIcon})})]}),r0(fe,{item:!0,children:r0(ze,{className:e==="error"?n.messageError:n.message,children:t})})]})},pCe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},textSubdued:{color:"rgba(255 255 255 / 70%)"},inputContainer:{width:"50%"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},inputError:{"& .MuiInputBase-root":{borderColor:"rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.1)","&::before":{borderColor:"rgba(244, 67, 54, 0.3)"}}},textarea:{"& .MuiInputBase-root":{padding:e.spacing(2),background:"rgba(0, 0, 0, 0.2)",borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},spinner:{width:"8px !important",height:"8px !important",color:`${Jt.tan[300]} !important`}})),bCe={apiKey:"",secretKey:"",email:[],discordKey:"",telegram:{botToken:"",chatId:""},slackKey:""},hCe=({handleBack:e,handleNext:t,setupData:n})=>{const f=pCe(),{loading:r,execute:a,error:i}=A20(),o=n==null?void 0:n.monitoring,[s,l]=n0.useState(o??bCe),[c,d]=n0.useState([]),[p,x]=n0.useState(!1),[C,O]=n0.useState(!1),{apiKey:L,secretKey:D,email:V,discordKey:Y,slackKey:i0,telegram:m0}=s,A0=J90(L),T0=J90(D);n0.useEffect(()=>{if(o&&o.email.length){const F=[];o.email.forEach(Q=>F.push({label:Q,value:Q})),d(F)}},[o]),n0.useEffect(()=>{!r&&![L,D].includes("")&&!C&&(O(!0),(async()=>await a(L,D))())},[L,D,r,C,a]),n0.useEffect(()=>{(A0!==L||T0!==D)&&C&&O(!1)},[L,D,A0,T0,C]);const I0=(F,Q)=>{if(F.preventDefault(),["chatId","botToken"].includes(Q)){const H={...s.telegram,[Q]:F.target.value};l({...s,telegram:H});return}l({...s,[Q]:F.target.value})},z0=F=>/\S+@\S+\.\S+/.test(F),oe=F=>{var H;const Q=(H=F[F.length-1])==null?void 0:H.value;z0(Q)||Q==null?(x(!1),d(F),l({...s,email:F.map(u0=>u0.value)})):x(!0)},ae=()=>r?"Validating API credentials...":i?"The API credentials that you have provided are not valid. Please verify that you have the correct information.":!i&&typeof i=="boolean"?"API credentials are valid.":null,ye=()=>r?"loading":i?"error":!i&&typeof i=="boolean"?"success":null,P=()=>{const{botToken:F,chatId:Q}=m0;return!!(r||i||F===""&&Q!==""||F!==""&&Q===""||F===""&&Q===""&&Y===""&&i0===""&&V.length===0)};return r0(wf,{borderStyle:"single",className:f.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:4,className:f.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Configure Monitoring"})}),r0(fe,{item:!0,children:ve(ze,{children:["Setting up an effective monitoring strategy is critical for the security of your safe. In order to set up the monitoring for this module, you'll need to first"," ",r0(Jo,{underline:"always",href:"https://defender.openzeppelin.com/#/auth/sign-in",target:"_blank",color:"inherit",children:"create an Open Zeppelin account."})]})})]})}),r0(fe,{item:!0,children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"API Configuration"})}),r0(fe,{item:!0,children:ve(ze,{children:["Include the API Key and Secret Key from your Open Zeppelin account below. Follow the Open Zeppelin guide ","",r0(Jo,{underline:"always",href:"https://docs.openzeppelin.com/defender/v2/manage.html#relayer-api-keys",target:"_blank",color:"inherit",children:"here."})]})}),r0(fe,{item:!0,children:r0(Cr,{label:"API Key",placeholder:"0f9u8yuiahkjdh8qhiflahfjajdhafa",borderStyle:"double",value:s.apiKey,onChange:F=>I0(F,"apiKey"),className:i?f.inputError:f.input})}),r0(fe,{item:!0,children:r0(Cr,{label:"API Secret",placeholder:"hkjdh8qhiflahfjajdhafa0f9u8yuiahkjdh8qhiflahfjajdhafa",value:s.secretKey,onChange:F=>I0(F,"secretKey"),borderStyle:"double",className:i?f.inputError:f.input})}),r0(fe,{item:!0,children:r0(dCe,{status:ye(),message:ae()})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Email"})}),r0(fe,{item:!0,children:r0(ze,{children:"Add as many emails as you'd like."})}),r0(fe,{item:!0,children:r0(cCe,{invalidText:p?"Please provide a valid email":void 0,onChange:F=>oe(F),value:c})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Discord"})}),r0(fe,{item:!0,children:ve(ze,{children:["To add a Discord integration, include the Discord channel's url including key below. Find out more"," ",r0(Jo,{underline:"always",href:"https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks",target:"_blank",color:"inherit",children:"here."})]})}),r0(fe,{item:!0,children:r0(Cr,{label:"Discord Key",placeholder:"key",borderStyle:"double",className:f.input,value:s.discordKey,onChange:F=>I0(F,"discordKey")})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Telegram"})}),r0(fe,{item:!0,children:ve(ze,{children:["To add a Telegram integration, include the telegram bot token and chat ID below. Find out more"," ",r0(Jo,{underline:"always",href:"https://core.telegram.org/bots#6-botfather",target:"_blank",color:"inherit",children:"here."})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,direction:"row",alignItems:"center",justifyContent:"space-between",children:[r0(fe,{item:!0,className:f.inputContainer,children:r0(Cr,{label:"Bot token",placeholder:"abc",borderStyle:"double",className:f.input,value:s.telegram.botToken,onChange:F=>I0(F,"botToken")})}),r0(fe,{item:!0,className:f.inputContainer,children:r0(Cr,{label:"Chat ID",placeholder:"123",borderStyle:"double",className:f.input,value:s.telegram.chatId,onChange:F=>I0(F,"chatId")})})]})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Slack"})}),r0(fe,{item:!0,children:ve(ze,{children:["To add a Slack integration, include the Slack channel's url including key below. Find out more"," ",r0(Jo,{underline:"always",href:"https://docs.openzeppelin.com/defender/sentinel#notifications",target:"_blank",color:"inherit",children:"here."})]})}),r0(fe,{item:!0,children:r0(Cr,{label:"Slack Channel URL",placeholder:"https://slack.com/url/key",borderStyle:"double",className:f.input,value:s.slackKey,onChange:F=>I0(F,"slackKey")})})]})}),r0(fe,{item:!0,style:{paddingBottom:0},children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:()=>e(s),children:"Back"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",type:"submit",disabled:P(),onClick:()=>t(s),children:"Next"})})]})})]})})},mCe=["proposal","oracle","monitoring","review"],yCe=en(e=>({root:{height:"100%",display:"flex",flexDirection:"column",padding:e.spacing(1.5),overflowY:"auto"},container:{display:"flex",flexDirection:"column"},tag:{background:e.palette.secondary.main},paperContainer:{padding:e.spacing(2)},paperTitle:{margin:0},step:{"& text":{fontFamily:"Roboto Mono"},"& .step-label":{textTransform:"capitalize",display:"inline",fontFamily:"Roboto Mono","&.clickable":{cursor:"pointer","&:hover":{textDecoration:"underline"}}}},stepperRoot:{backgroundColor:"transparent",border:"none",padding:e.spacing(0),"& .MuiStepIcon-active":{color:e.palette.secondary.main,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%"},"& .MuiStepIcon-completed":{background:e.palette.text.primary,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%",color:e.palette.secondary.main},"& .Mui-disabled .MuiStepIcon-root":{color:e.palette.primary.main,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%"}}})),gCe=()=>{const e=yCe(),{sdk:t,safe:n,provider:f}=hi(),r=lr(UC),a=A1(),i=lr(K3),[o,s]=n0.useState(i.length),[l,c]=n0.useState([]),[d,p]=n0.useState(0),[x,C]=n0.useState({proposal:!1,oracle:!1,monitoring:!1,review:!1}),[O,L]=n0.useState(!1),[D,V]=n0.useState(),Y=(A0,T0)=>{x[T0]&&p(A0)},i0=(A0,T0,I0)=>z0=>{p(A0),C({...x,[T0]:I0}),V({...D,[T0]:z0})},m0=async A0=>{const T0=[];if(L(!0),D==null)throw L(!1),new Error("No setup data");const I0=A0!==""||A0==null?n.safeAddress:A0,z0=(oe,ae)=>{if(ae!=null)throw ae.name==="OpenError"?T0.push({error:!0,msg:ae.toString()+"This error can be caused by add/track blockers. Please disable any blockers (for instance, the Brave Shield) and try again."}):T0.push({error:!0,msg:ae.toString()}),ae;T0.push({error:!1,msg:oe}),c(T0)};try{await Gce(f,t,n,I0,D,z0)}catch(oe){L(!1),console.error(oe)}a(hc(n)),a(qC(!0))};return n0.useEffect(()=>{O&&i.length>o&&(s(i.length),L(!1),a(WC(!1)))},[a,O,o,i]),r0("div",{className:e.root,children:ve(fe,{container:!0,spacing:2,className:e.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,children:[r0(fe,{item:!0,children:r0(sg,{icon:"reality",size:60})}),ve(fe,{item:!0,children:[r0(ze,{variant:"h5",children:"Reality Module"}),r0(ol0,{className:e.tag,tags:["Stackable","From Gnosis Guild"]})]})]})}),r0(fe,{item:!0,children:ve(ze,{gutterBottom:!0,children:["Allows Reality.eth questions to execute a transaction when resolved."," ",r0(Jo,{underline:"always",href:"https://www.zodiac.wiki/documentation/reality-module",target:"_blank",color:"inherit",children:"Read more here."})]})}),r0(fe,{item:!0,children:r0(zo,{})}),r0(fe,{item:!0,children:ve(wf,{borderStyle:"single",className:e.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[ve(fe,{container:!0,justifyContent:"space-between",alignItems:"center",style:{marginBottom:15},children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",gutterBottom:!0,className:e.paperTitle,children:"Add Reality Module"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"outlined",onClick:()=>a(WC(!1)),children:"Cancel"})})]}),r0(MD,{activeStep:d,className:e.stepperRoot,orientation:"vertical",children:mCe.map((A0,T0)=>ve(ED,{className:e.step,children:[ve(TD,{onClick:()=>Y(T0,A0),children:[r0(ze,{variant:"h6",className:Wf(T0<=d&&"clickable","step-label"),children:A0})," "]}),ve(Be0,{children:[A0==="proposal"&&r0(BMe,{handleNext:i0(T0+1,A0,!0),handleBack:()=>a(WC(!1)),setupData:D}),A0==="oracle"&&r0(OMe,{handleNext:i0(T0+1,A0,!0),handleBack:i0(d-1,A0,!1),setupData:D}),A0==="monitoring"&&r0(hCe,{handleNext:i0(T0+1,A0,!0),handleBack:i0(d-1,A0,!1),setupData:D}),A0==="review"&&r0(iCe,{handleNext:m0,handleBack:i0(d-1,A0,!1),goToStep:p,setupData:D,delayModules:r,loading:O,statusLog:l})]})]},A0))})]})})]})})},vCe=["function getVotes(address account) external view returns (uint256)","function getPastVotes(address account, uint256 blockNumber) external view returns (uint256)","function getPastTotalSupply(uint256 blockNumber) external view returns (uint256)","function delegates(address account) external view returns (address)","function delegate(address delegatee) external","function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external"],gW="0xD028d504316FEc029CFa36bdc3A8f053F6E5a6e4",Z90=1234,wCe=e=>async t=>{const n=new pf(t,vCe,e);try{await Promise.all([n.getVotes(gW),n.getPastVotes(gW,Z90),n.getPastTotalSupply(Z90),n.delegates(gW)]),n.functions.delegateBySig.name}catch(f){return console.log(f),!1}return!0},ACe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},radio:{marginLeft:-2,padding:2,"& ~ .MuiFormControlLabel-label":{fontSize:12,marginLeft:4},"&$checked":{color:Jt.tan[1e3]}},checked:{},errorColor:{color:"rgba(244, 67, 54, 1)"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},inputError:{"& .MuiInputBase-root":{borderColor:"rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.1)","&::before":{borderColor:"rgba(244, 67, 54, 0.3)"}}}})),xCe={tokenAddress:void 0,tokenName:"",tokenSymbol:"",initialAmount:1e5,tokenConfiguration:"existingToken"},ECe=({handleNext:e,handleBack:t,setupData:n})=>{const f=ACe(),r=n.token,[a,i]=n0.useState(r),[o,s]=n0.useState(!1),{provider:l}=hi(),c=wCe(l),{tokenAddress:d,tokenName:p,tokenSymbol:x,tokenConfiguration:C,initialAmount:O}=a,L=()=>({tokenAddress:d,tokenName:p,tokenSymbol:x,tokenConfiguration:C,initialAmount:O}),D=()=>[d].includes("")?f.input:![d].includes(void 0)&&!o?f.inputError:f.input,V=m0=>{i({...a,tokenConfiguration:m0.target.value})},Y=(m0,A0)=>{i({...a,[A0]:m0.target.value})};n0.useEffect(()=>{[d].includes(void 0)||(async()=>aF(d)&&await c(d)?s(!0):s(!1))()},[d,c]);const i0=C==="existingToken"?!!(!o||[d].includes("")):C==="ERC721"||C==="ERC20"?!![p,x].includes(""):!0;return r0(wf,{borderStyle:"single",className:f.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:4,className:f.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Setup Token for Voting"})}),r0(fe,{item:!0,children:r0(ze,{children:"The following token will enable members to vote on proposals with this governor contract. The token must be ERC20Votes compatible."})})]})}),r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Token Configuration"})}),ve(fe,{item:!0,children:[r0(ze,{variant:"body2",children:"Do you have an existing token in your safe that you'd like to use as the token for voting in this contract?"}),ve(Ce0,{"aria-label":"Token Configuration",name:"Token Configuration",value:C,onChange:V,children:[r0(nT,{value:"existingToken",control:r0(s7,{classes:{root:f.radio,checked:f.checked}}),label:"Existing Token"}),r0(nT,{value:"ERC20",control:r0(s7,{classes:{root:f.radio,checked:f.checked}}),label:"Deploy a new ERC20 for voting."}),r0(nT,{value:"ERC721",control:r0(s7,{classes:{root:f.radio,checked:f.checked}}),label:"Deploy a new ERC721 for voting."})]})]}),C==="existingToken"&&ve(fe,{item:!0,children:[r0(Cr,{label:"Token Address",value:d,placeholder:"0xDf33060F476511F806C72719394da1Ad64",borderStyle:"double",className:D(),onChange:m0=>Y(m0,"tokenAddress")}),![d].includes(void 0)&&!o&&r0(rD,{className:f.errorColor,children:"Please provide a valid address"})]}),(C==="ERC20"||C==="ERC721")&&r0(n0.Fragment,{children:r0(fe,{item:!0,style:{width:"-webkit-fill-available"},children:ve(fe,{container:!0,spacing:2,justifyContent:"space-between",children:[r0(fe,{item:!0,xs:9,children:r0(Cr,{label:"Token Name",value:p,placeholder:"MyToken",borderStyle:"double",className:f.input,onChange:m0=>Y(m0,"tokenName"),tooltipMsg:"The same as collection name in OpenSea, e.g. Nouns"})}),r0(fe,{item:!0,xs:3,children:r0(Cr,{label:"Token Symbol",value:x,placeholder:"TKN",borderStyle:"double",className:f.input,onChange:m0=>Y(m0,"tokenSymbol"),tooltipMsg:"e.g. LOOT"})})]})})}),r0(fe,{item:!0,style:{paddingBottom:0},children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:()=>t(L()),children:"Cancel"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",disabled:i0,onClick:()=>e(L()),children:"Next"})})]})})]})})},TCe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},icon:{fill:"white",cursor:"pointer"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},label:{fontFamily:"Roboto Mono, monospace",fontSize:12,fontWeight:"bold"},loading:{width:"15px !important",height:"15px !important"},value:{fontFamily:"Roboto Mono, monospace",fontWeight:"bold",color:"white"},underline:{textDecoration:"underline"}})),MCe=[{label:"Token",number:1,section:0},{label:"Governor",number:2,section:1}],CCe=({handleBack:e,handleNext:t,goToStep:n,setupData:f,loading:r})=>{const a=TCe(),i=f==null?void 0:f.token,o=f==null?void 0:f.governor,{safe:s}=uo.useSafeAppsSDK();return r0(wf,{borderStyle:"single",className:a.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:3,className:a.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:a.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Review"})}),r0(fe,{item:!0,children:r0(ze,{children:"Please take a final look at your OZ Governor Module details."})})]})}),r0(fe,{item:!0,children:r0(zo,{})}),MCe.map(l=>ve(Pt.Fragment,{children:[r0(fe,{item:!0,children:r0(Q90,{label:l.label,number:l.number,disabled:r||l.label==="Governor",onClick:()=>n(l.section)})}),l.label==="Token"&&i&&ve(Er,{children:[i.tokenAddress&&ve(fe,{item:!0,children:[r0(ze,{children:"Voting Token:"}),r0(d1,{target:"_blank",href:`${Zz[s.chainId]}/token/${i.tokenAddress}`,className:a.value,children:i.tokenAddress})]}),i.tokenName&&ve(fe,{item:!0,children:[r0(ze,{children:"Token Name:"}),r0(ze,{className:a.value,children:i.tokenName})]}),i.tokenSymbol&&ve(fe,{item:!0,children:[r0(ze,{children:"Token Symbol:"}),r0(ze,{className:a.value,children:i.tokenSymbol})]})]}),l.label==="Governor"&&o&&ve(Er,{children:[ve(fe,{item:!0,children:[r0(ze,{children:"Name:"}),r0(ze,{className:a.value,children:o.daoName})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Voting Delay:"}),ve(ze,{className:a.value,children:[o.votingDelayInBlocks," blocks"]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Voting Period:"}),ve(ze,{className:a.value,children:[o.votingPeriodInBlocks," blocks"]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Proposal Threshold:"}),ve(ze,{className:a.value,children:[o.proposalThreshold,"%"]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Quorum (%):"}),ve(ze,{className:a.value,children:[o.quorumPercent,"%"]})]})]}),r0(fe,{item:!0,children:r0(zo,{})})]},l.label)),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:e,disabled:r,children:"Back"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",startIcon:r?r0(fi.Loader,{className:a.loading,size:"sm",color:"background"}):r0(pW,{}),onClick:()=>{t(f)},children:"Deploy and Enable Module"})})]})})]})})},SCe="0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761",OCe=async(e,t,n,f,r,a,i,o)=>{if(t==null)throw new Error("No safe address provided");if(n==null)throw new Error("No token address provided");if(f==null)throw new Error("No name provided");if(r==null)throw new Error("No voting delay provided");if(a==null)throw new Error("No voting period provided");if(i==null)throw new Error("No proposal threshold provided");if(o==null)throw new Error("No quorum percent provided");if(o>100||o<0)throw new Error("Quorum percent must be between 0 and 100");const s={values:[t,t,SCe,n,f,r.toString(),a.toString(),i.toString(),o.toString(),"0"],types:["address","address","address","address","string","uint256","uint256","uint256","uint256","uint64"]},l=Date.now().toString(),c=(await e.getNetwork()).chainId,{transaction:d,expectedModuleAddress:p}=await js(_e.OZ_GOVERNOR,s,e,Number(c),l);return{txs:[{...d,value:d.value.toString()}],meta:{expectedAddress:p}}},kCe=async(e,t,n,f,r)=>{if(t==null)throw new Error("No safe address provided");if(n==null)throw new Error("No token name provided");if(f==null)throw new Error("No token symbol provided");if(r!=="ERC20"&&r!=="ERC721")throw new Error("Invalid token kind");const a={values:[t,n,f],types:["address","string","string"]},i=Date.now().toString(),o=(await e.getNetwork()).chainId,{transaction:s,expectedModuleAddress:l}=await js(r==="ERC20"?_e.ERC20_VOTES:_e.ERC721_VOTES,a,e,Number(o),i);return{txs:[{...s,value:s.value.toString()}],meta:{expectedAddress:l}}},NCe=async(e,t,n,f,r,a,i,o,s,l)=>{if(s==null&&l==null)throw new Error("No token address or create token args provided");if(s!=null&&l!=null)throw new Error("Both token address and create token args provided");const c=[];if(l!=null){const{txs:C,meta:O}=await kCe(e,n,l.name,l.symbol,l.kind);if(c.push(...C),(O==null?void 0:O.expectedAddress)==null)throw new Error("No expected address returned from token deployment");s=O.expectedAddress}if(s==null)throw new Error("No token address provided. Should not be possible. Either the token address should be provided or a new token should be deployed.");const{txs:d,meta:p}=await OCe(e,n,s,f,r,a,i,o);if(c.push(...d),(p==null?void 0:p.expectedAddress)==null)throw new Error("The expected value is missing");const x=Fs(n,p.expectedAddress);return c.push(x),t.txs.send({txs:c}).catch(C=>{throw console.error(C),new Error("Error when proposing transactions to the Safe")})},PCe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},textSubdued:{color:"rgba(255 255 255 / 70%)"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}}})),ICe={daoName:"",votingDelayInBlocks:0,votingPeriodInBlocks:50400,proposalThreshold:0,quorumPercent:4},RCe=({handleNext:e,handleBack:t,setupData:n})=>{const f=PCe(),r=n.governor,[a,i]=n0.useState(r),o=(O,L)=>{i({...a,[L]:O.target.value})},s=()=>a,{daoName:l,votingDelayInBlocks:c,votingPeriodInBlocks:d,proposalThreshold:p,quorumPercent:x}=a,C=()=>!(![l].includes("")&&x>=0&&x<=100);return r0(wf,{borderStyle:"single",className:f.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:4,className:f.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Setup OZ Governor Contract"})}),r0(fe,{item:!0,children:r0(ze,{children:"Configure your governor contract. It can always be changed later, so don't worry too much about getting it perfect the first time."})})]})}),r0(fe,{item:!0,children:r0(Cr,{label:"DAO Name:",value:l,placeholder:"My Governor",borderStyle:"double",className:f.input,onChange:O=>o(O,"daoName")})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Voting Delay Configurations"})}),r0(fe,{item:!0,children:r0(ze,{variant:"body2",className:f.textSubdued,children:"Configure a delay modifier to determine the duration required before voting (Cooldown), and the amount of time that the proposal will be valid (Expiration)."})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:6,alignItems:"center",children:[r0(fe,{item:!0,xs:6,children:r0(Cr,{label:"Voting Delay (in blocks)",value:c,type:"number",placeholder:"0",borderStyle:"double",className:f.input,onChange:O=>{i({...a,votingDelayInBlocks:parseInt(O.target.value)})},tooltipMsg:"The time between proposal submission and when voting starts."})}),r0(fe,{item:!0,xs:6,children:r0(Cr,{label:"Voting Period (in blocks)",value:d,type:"number",placeholder:"50400",borderStyle:"double",className:f.input,onChange:O=>{i({...a,votingPeriodInBlocks:parseInt(O.target.value)})},tooltipMsg:"The number of blocks between when a proposal's voting period starts and ends."})})]})}),r0(fe,{item:!0,children:r0(fe,{container:!0,spacing:1,className:f.container,children:r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Voting Thresholds"})})})}),r0(fe,{item:!0,children:r0(Cr,{label:"Proposal Threshold",color:"secondary",borderStyle:"double",className:f.input,type:"number",value:p,tooltipMsg:"How many tokens must someone own before they can submit a proposal to the DAO?",onChange:O=>o(O,"proposalThreshold")})}),r0(fe,{item:!0,children:r0($r0,{label:"Quorum (%):",defaultValue:x,hasInput:!0,onChangeSlider:O=>{typeof O=="number"&&x!==O&&O>=0&&i({...a,quorumPercent:O})}})}),r0(fe,{item:!0,style:{paddingBottom:0},children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:()=>t(s()),children:"Back"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",disabled:C(),onClick:()=>e(s()),children:"Next"})})]})})]})})},BCe=["token","governor","review"],DCe=en(e=>({root:{height:"100%",display:"flex",flexDirection:"column",padding:e.spacing(1.5),overflowY:"auto"},container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},paperTitle:{margin:0},step:{"& text":{fontFamily:"Roboto Mono"},"& .step-label":{textTransform:"capitalize",display:"inline",fontFamily:"Roboto Mono","&.clickable":{cursor:"pointer","&:hover":{textDecoration:"underline"}}}},stepperRoot:{backgroundColor:"transparent",border:"none",padding:e.spacing(0),"& .MuiStepIcon-active":{color:e.palette.secondary.main,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%"},"& .MuiStepIcon-completed":{background:e.palette.text.primary,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%",color:e.palette.secondary.main},"& .Mui-disabled .MuiStepIcon-root":{color:e.palette.primary.main,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%"}}})),LCe=()=>{const e=DCe(),{sdk:t,safe:n,provider:f}=hi(),r=A1(),[a,i]=n0.useState(0),[o,s]=n0.useState(!1),[l,c]=n0.useState({token:!1,governor:!1,review:!1}),[d,p]=n0.useState({token:xCe,governor:ICe,review:{}}),x=(L,D)=>{l[D]&&i(L)},C=(L,D,V)=>Y=>{i(L),c({...l,[D]:V}),p({...d,[D]:Y})},O=async()=>{if(s(!0),d==null)throw s(!1),new Error("No setup data");const{tokenAddress:L,tokenSymbol:D,tokenConfiguration:V,tokenName:Y}=d.token,{daoName:i0,votingDelayInBlocks:m0,votingPeriodInBlocks:A0,proposalThreshold:T0,quorumPercent:I0}=d.governor;try{let z0;(V==="ERC20"||V==="ERC721")&&(z0={name:Y,symbol:D,kind:V}),(await NCe(f,t,n.safeAddress,i0,m0,A0,T0,I0,L,z0)).safeTxHash&&(r(hc(n)),r(qC(!0)))}catch(z0){s(!1),console.error(z0)}};return r0("div",{className:e.root,children:ve(fe,{container:!0,spacing:2,className:e.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,children:[r0(fe,{item:!0,children:r0(sg,{icon:"ozGov",size:60})}),r0(fe,{item:!0,style:{display:"flex",alignItems:"center"},children:r0(ze,{variant:"h5",children:"Governor Module"})})]})}),r0(fe,{item:!0,children:ve(ze,{gutterBottom:!0,children:["Enables an Open Zeppelin Governor contract as a module."," ",r0(Jo,{underline:"always",href:"https://blog.openzeppelin.com/governor-smart-contract/",target:"_blank",color:"inherit",children:"Read more here."})]})}),r0(fe,{item:!0,children:r0(zo,{})}),r0(fe,{item:!0,children:ve(wf,{borderStyle:"single",className:e.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[ve(fe,{container:!0,justifyContent:"space-between",alignItems:"center",style:{marginBottom:15},children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",gutterBottom:!0,className:e.paperTitle,children:"Add Governor Module"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"outlined",onClick:()=>r(bV(!1)),children:"Cancel"})})]}),r0(MD,{activeStep:a,className:e.stepperRoot,orientation:"vertical",children:BCe.map((L,D)=>ve(ED,{className:e.step,children:[ve(TD,{onClick:()=>x(D,L),children:[r0(ze,{variant:"h6",className:Wf(D<=a&&"clickable","step-label"),children:L})," "]}),ve(Be0,{children:[L==="token"&&r0(ECe,{handleNext:C(D+1,L,!0),handleBack:()=>r(bV(!1)),setupData:d}),L==="governor"&&r0(RCe,{handleNext:C(D+1,L,!0),handleBack:C(a-1,L,!1),setupData:d}),L==="review"&&r0(CCe,{handleNext:O,handleBack:C(D-1,L,!0),setupData:d,goToStep:i,loading:o})]})]},L))})]})})]})})},jCe=()=>{const e=lr(VC),t=lr(Vg),n=lr(a=>a.modules.loadingModules),f=lr(a=>a.modules.realityModuleScreen),r=lr(a=>a.modules.OzGovernorModuleScreen);return e?r0(Hee,{module:e}):t?r0(aMe,{}):f?r0(gCe,{}):r?r0(LCe,{}):n?null:r0(eMe,{})},FCe=en(e=>({root:{marginBottom:e.spacing(2)},container:{"&.MuiPaper-root":{display:"flex",flexDirection:"row",alignItems:"center","&::before":fd(-5,Jt.tan[300])}},header:{"&.MuiPaper-root":{padding:e.spacing(.5,2,.5,.5),"&::before":fd(-5,Jt.tan[300])}},txBuilder:{"&.MuiPaper-root":{padding:e.spacing(.5,.5,.5,2),cursor:"pointer",transition:"0.2s ease all","&::before":fd(-5,Jt.tan[300]),"&:hover":{background:"rgba(217, 212, 173, 0.15)"}}},img:{display:"block",width:36,height:36},title:{marginLeft:e.spacing(1)},bagIcon:{marginLeft:e.spacing(2),stroke:"white"},badge:{color:e.palette.common.white,display:"flex",position:"relative",transform:"none",textAlign:"center",background:"none",fontSize:16},badgeRoot:{display:"flex",justifyContent:"center",alignItems:"center",height:36,width:36,borderRadius:60,border:`1px solid ${Jt.tan[300]}`,padding:e.spacing(.5)},txBuilderTitle:{marginRight:e.spacing(3)},circleIconContainer:{padding:e.spacing(.5)},banner:{"&.MuiPaper-root":{flexGrow:1,position:"relative",borderWidth:1,borderColor:Jt.tan[300],backgroundColor:Jt.tan[100],margin:e.spacing(0,2),"&::before":fd(-5,Jt.tan[300])}}})),zCe=()=>{const e=FCe(),t=A1(),n=lr(BV),f=()=>t(Q60());return ve(x1,{className:e.root,children:[ve(wf,{elevation:0,borderStyle:"double",rounded:"left",variant:"elevation",className:Wf(e.container,e.header),placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[r0(sg,{icon:"zodiac"}),r0(ze,{variant:"h5",className:e.title,children:"Zodiac"})]}),r0(wf,{elevation:0,className:e.banner,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0}),ve(wf,{borderStyle:"double",onClick:f,elevation:0,rounded:"right",className:Wf(e.container,e.txBuilder),placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[r0(ze,{className:e.txBuilderTitle,children:"Bundle Transactions"}),r0(wf,{rounded:"full",variant:"outlined",className:e.circleIconContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0($B,{showZero:!0,badgeContent:n.length,color:n.length?"error":"primary",classes:{badge:e.badge,root:e.badgeRoot}})})]})]})};function R1(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var X90=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),vW=function(){return Math.random().toString(36).substring(7).split("").join(".")},_90={INIT:"@@redux/INIT"+vW(),REPLACE:"@@redux/REPLACE"+vW(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+vW()}};function VCe(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function $90(e,t,n){var f;if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(R1(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(R1(1));return n($90)(e,t)}if(typeof e!="function")throw new Error(R1(2));var r=e,a=t,i=[],o=i,s=!1;function l(){o===i&&(o=i.slice())}function c(){if(s)throw new Error(R1(3));return a}function d(O){if(typeof O!="function")throw new Error(R1(4));if(s)throw new Error(R1(5));var L=!0;return l(),o.push(O),function(){if(L){if(s)throw new Error(R1(6));L=!1,l();var D=o.indexOf(O);o.splice(D,1),i=null}}}function p(O){if(!VCe(O))throw new Error(R1(7));if(typeof O.type>"u")throw new Error(R1(8));if(s)throw new Error(R1(9));try{s=!0,a=r(a,O)}finally{s=!1}for(var L=i=o,D=0;D=0;f--){var r=t[f](e);if(r)return r}return function(a,i){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+i.wrappedComponentName+".")}}function wSe(e,t){return e===t}function ASe(e){var t={},n=t.connectHOC,f=n===void 0?tSe:n,r=t.mapStateToPropsFactories,a=r===void 0?lSe:r,i=t.mapDispatchToPropsFactories,o=i===void 0?iSe:i,s=t.mergePropsFactories,l=s===void 0?bSe:s,c=t.selectorFactory,d=c===void 0?gSe:c;return function(p,x,C,O){O===void 0&&(O={});var L=O,D=L.pure,V=D===void 0?!0:D,Y=L.areStatesEqual,i0=Y===void 0?wSe:Y,m0=L.areOwnPropsEqual,A0=m0===void 0?wW:m0,T0=L.areStatePropsEqual,I0=T0===void 0?wW:T0,z0=L.areMergedPropsEqual,oe=z0===void 0?wW:z0,ae=Du(L,vSe),ye=xW(p,a,"mapStateToProps"),P=xW(x,o,"mapDispatchToProps"),F=xW(C,l,"mergeProps");return f(d,pe({methodName:"connect",getDisplayName:function(Q){return"Connect("+Q+")"},shouldHandleStateChanges:!!p,initMapStateToProps:ye,initMapDispatchToProps:P,initMergeProps:F,pure:V,areStatesEqual:i0,areOwnPropsEqual:A0,areStatePropsEqual:I0,areMergedPropsEqual:oe},ae))}}const dm0=ASe();GCe(Qi.unstable_batchedUpdates);function xSe(e,t){if(e.length!==t.length)return!1;for(var n=0;n");return f.callbacks},f.setCallbacks=function(o){f.callbacks=o},f}var n=t.prototype;return n.componentDidMount=function(){this.unbind=Js(window,[{eventName:"error",fn:this.onWindowError}])},n.componentDidCatch=function(f){if(f instanceof JO){this.setState({});return}throw f},n.componentWillUnmount=function(){this.unbind()},n.render=function(){return this.props.children(this.setCallbacks)},t}(Pt.Component),RSe=` + `,x={id:Sr(t),orderBy:a,orderDirection:i,first:o,whereFilter:d},C=await l.request(p,x);return C.domain?C.domain.subdomains.map(O=>q30({...O,parent:{name:t}})):[]},TTe=e=>({getDecodedName:t=>oTe(e,t),getNameHistory:t=>sTe(e,t),getNamesForAddress:t=>bTe(e,t),getSubgraphRecords:t=>vTe(e,t),getSubgraphRegistrant:t=>ATe(e,t),getSubnames:t=>ETe(e,t)}),W30=e=>Pn({abi:Pde,functionName:"clearRecords",args:[e]}),Q30=(e,{name:t,resolverAddress:n})=>({to:n,data:W30(Sr(t))});async function Y30(e,{name:t,resolverAddress:n,...f}){const r={...Q30(e,{name:t,resolverAddress:n}),...f};return Ja(e,r)}Y30.makeFunctionData=Q30;const K30=({namehash:e,contentType:t,encodedData:n})=>Pn({abi:kde,functionName:"setABI",args:[e,BigInt(t),n]}),J30=({namehash:e,coin:t,value:n})=>{const f=Mq(t),r=f.coinType;let a=n?f.decode(n):"0x";return r===60&&a==="0x"&&(a=f.decode("0x0000000000000000000000000000000000000000")),typeof a!="string"&&(a=yi(a)),Pn({abi:Ode,functionName:"setAddr",args:[e,BigInt(r),a]})},Z30=({namehash:e,contentHash:t})=>{let n="0x";return t&&(n=Owe(t)),Pn({abi:Nde,functionName:"setContenthash",args:[e,n]})},X30=({namehash:e,key:t,value:n})=>Pn({abi:Sde,functionName:"setText",args:[e,t,n??""]}),_30=({namehash:e,clearRecords:t,contentHash:n,texts:f,coins:r,abi:a})=>{const i=[];if(t&&i.push(W30(e)),n!==void 0){const o=Z30({namehash:e,contentHash:n});o&&i.push(o)}if(a!==void 0){const o=Array.isArray(a)?a:[a];for(const s of o){const l=K30({namehash:e,...s});l&&i.push(l)}}if(f&&f.length>0){const o=f.map(s=>X30({namehash:e,...s}));o&&i.push(...o)}if(r&&r.length>0){const o=r.map(s=>J30({namehash:e,...s}));o&&i.push(...o)}return i},$30=({name:e,owner:t,duration:n,resolverAddress:f=_r,records:{coins:r=[],...a}={texts:[],coins:[]},reverseRecord:i,fuses:o,secret:s})=>{const l=U6(e.split(".")[0]),c=Sr(e),d=o?N9({restriction:"child",input:o}):0;i&&!r.find(x=>typeof x.coin=="string"&&x.coin.toLowerCase()==="eth"||(typeof x.coin=="string"?parseInt(x.coin)===60:x.coin===60))&&r.push({coin:60,value:t});const p=a?_30({namehash:c,coins:r,...a}):[];if(p.length>0&&f===_r)throw new jde({data:{name:e,owner:t,duration:n,resolverAddress:f,records:a,reverseRecord:i,fuses:o}});return[l,t,BigInt(n),s,f,p,!!i,d]},MTe=e=>{const[t,...n]=$30(e);return[e.name.split(".")[0],...n]},CTe=e=>Cc(Xg([{name:"name",type:"bytes32"},{name:"owner",type:"address"},{name:"duration",type:"uint256"},{name:"secret",type:"bytes32"},{name:"resolver",type:"address"},{name:"data",type:"bytes[]"},{name:"reverseRecord",type:"bool"},{name:"ownerControlledFuses",type:"uint16"}],e)),STe=e=>CTe($30(e)),OTe=2n**64n-1n,kTe=(e,t=0n)=>{if(!e)return t;if(typeof e=="bigint")return e;if(typeof e=="string"||typeof e=="number")return BigInt(e);if(e instanceof Date)return BigInt(Math.floor(e.getTime()/1e3));throw new TypeError("Expiry must be a bigint, string, number or Date")},iw=e=>{const t=Ac(e);if(t.byteLength>255)throw new Lde({label:e,byteLength:t.byteLength})},NTe=e=>e&&BigInt(e)&k9.PARENT_CANNOT_CONTROL?OTe:0n,e90=(e,t)=>{const n=t.name.split("."),f=sl(t.name);if(f!=="eth-2ld")throw new Bc({nameType:f,supportedNameTypes:["eth-2ld"],details:"Only 2ld-eth name registration is supported"});return iw(n[0]),{to:Rf({client:e,contract:"ensEthRegistrarController"}),data:Pn({abi:aAe,functionName:"commit",args:[STe(t)]})}};async function t90(e,{name:t,owner:n,duration:f,secret:r,resolverAddress:a,records:i,reverseRecord:o,fuses:s,...l}){const c={...e90(e,{name:t,owner:n,duration:f,secret:r,resolverAddress:a,records:i,reverseRecord:o,fuses:s}),...l};return Ja(e,c)}t90.makeFunctionData=e90;const H9=e=>{const t=e.split("."),n=t.shift(),f=Sr(t.join("."));return{label:n,labelhash:U6(n),parentNode:f}},n90=(e,{name:t,contract:n,owner:f,resolverAddress:r=Rf({client:e,contract:"ensPublicResolver"}),expiry:a,fuses:i})=>{const o=sl(t);if(o==="tld"||o==="root")throw new Bc({nameType:o,supportedNameTypes:["eth-2ld","eth-subname","other-2ld","other-subname"]});const{label:s,labelhash:l,parentNode:c}=H9(t);switch(n){case"registry":return{to:Rf({client:e,contract:"ensRegistry"}),data:Pn({abi:zh0,functionName:"setSubnodeRecord",args:[c,l,f,r,BigInt(0)]})};case"nameWrapper":{iw(s);const d=i?N9({input:i}):0,p=a?kTe(a):NTe(d);return{to:Rf({client:e,contract:"ensNameWrapper"}),data:Pn({abi:Uh0,functionName:"setSubnodeRecord",args:[c,s,f,r,BigInt(0),d,p]})}}default:throw new xO({contractType:n,supportedContractTypes:["registry","nameWrapper"]})}};class PTe extends ia{constructor({parentName:t}){super(`Create subname error: ${t} as burned CANNOT_CREATE_SUBDOMAIN fuse`),Object.defineProperty(this,"parentName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CreateSubnamePermissionDeniedError"}),this.parentName=t}}class ITe extends ia{constructor({parentName:t}){super(`Create subname error: Cannot burn PARENT_CANNOT_CONTROL when ${t} has not burned CANNOT_UNWRAP fuse`),Object.defineProperty(this,"parentName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CreateSubnameParentNotLockedError"}),this.parentName=t}}const RTe=async(e,{name:t,fuses:n,contract:f})=>{var l,c,d,p;if(f!=="nameWrapper")return;const r=t.split(".").slice(1).join(".");if(r==="eth")return;const a=await _h0(e,{name:r});if((c=(l=a==null?void 0:a.fuses)==null?void 0:l.child)!=null&&c.CANNOT_CREATE_SUBDOMAIN)throw new PTe({parentName:r});const i=n?N9({input:n}):0,o=n&&BigInt(i)&k9.PARENT_CANNOT_CONTROL,s=(p=(d=a==null?void 0:a.fuses)==null?void 0:d.child)==null?void 0:p.CANNOT_UNWRAP;if(o&&!s)throw new ITe({parentName:r})};async function f90(e,{name:t,contract:n,owner:f,resolverAddress:r,expiry:a,fuses:i,...o}){await RTe(e,{name:t,fuses:i,contract:n});const s={...n90(e,{name:t,contract:n,owner:f,resolverAddress:r,expiry:a,fuses:i}),...o};return Ja(e,s)}f90.makeFunctionData=n90;const r90=(e,{name:t,contract:n,asOwner:f})=>{const r=sl(t);if(r!=="eth-subname"&&r!=="other-subname")throw new Bc({nameType:r,supportedNameTypes:["eth-subname","other-subname"],details:"Cannot delete a name that is not a subname"});switch(n){case"registry":{const a=Rf({client:e,contract:"ensRegistry"});if(f)return{to:a,data:Pn({abi:Fwe,functionName:"setRecord",args:[Sr(t),_r,_r,BigInt(0)]})};const{labelhash:i,parentNode:o}=H9(t);return{to:a,data:Pn({abi:zh0,functionName:"setSubnodeRecord",args:[o,i,_r,_r,BigInt(0)]})}}case"nameWrapper":{const a=Rf({client:e,contract:"ensNameWrapper"});if(f)return{to:a,data:Pn({abi:Uwe,functionName:"setRecord",args:[Sr(t),_r,_r,BigInt(0)]})};const{label:i,parentNode:o}=H9(t);return{to:a,data:Pn({abi:Uh0,functionName:"setSubnodeRecord",args:[o,i,_r,_r,BigInt(0),0,BigInt(0)]})}}default:throw new xO({contractType:n,supportedContractTypes:["registry","nameWrapper"]})}};async function a90(e,{name:t,contract:n,asOwner:f,...r}){const a={...r90(e,{name:t,contract:n,asOwner:f}),...r};return Ja(e,a)}a90.makeFunctionData=r90;const i90=(e,{value:t,...n})=>{const f=sl(n.name);if(f!=="eth-2ld")throw new Bc({nameType:f,supportedNameTypes:["eth-2ld"],details:"Only 2ld-eth name registration is supported"});const r=n.name.split(".");return iw(r[0]),{to:Rf({client:e,contract:"ensEthRegistrarController"}),data:Pn({abi:iAe,functionName:"register",args:MTe(n)}),value:t}};async function o90(e,{name:t,owner:n,duration:f,secret:r,resolverAddress:a,records:i,reverseRecord:o,fuses:s,value:l,...c}){const d={...i90(e,{name:t,owner:n,duration:f,secret:r,resolverAddress:a,records:i,reverseRecord:o,fuses:s,value:l}),...c};return Ja(e,d)}o90.makeFunctionData=i90;const s90=(e,{nameOrNames:t,duration:n,value:f})=>{const r=(Array.isArray(t)?t:[t]).map(a=>{const i=a.split("."),o=sl(a);if(o!=="eth-2ld")throw new Bc({nameType:o,supportedNameTypes:["eth-2ld"],details:"Only 2ld-eth renewals are currently supported"});return i[0]});return r.length===1?{to:Rf({client:e,contract:"ensEthRegistrarController"}),data:Pn({abi:oAe,functionName:"renew",args:[r[0],BigInt(n)]}),value:f}:{to:Rf({client:e,contract:"ensBulkRenewal"}),data:Pn({abi:rAe,functionName:"renewAll",args:[r,BigInt(n)]}),value:f}};async function l90(e,{nameOrNames:t,duration:n,value:f,...r}){const a={...s90(e,{nameOrNames:t,duration:n,value:f}),...r};return Ja(e,a)}l90.makeFunctionData=s90;const c90=(e,{name:t,encodedAbi:n,resolverAddress:f})=>({to:f,data:K30({namehash:Sr(t),...n})});async function u90(e,{name:t,encodedAbi:n,resolverAddress:f,...r}){const a={...c90(e,{name:t,encodedAbi:n,resolverAddress:f}),...r};return Ja(e,a)}u90.makeFunctionData=c90;const d90=(e,{name:t,coin:n,value:f,resolverAddress:r})=>({to:r,data:J30({namehash:Sr(t),coin:n,value:f})});async function p90(e,{name:t,coin:n,value:f,resolverAddress:r,...a}){const i={...d90(e,{name:t,coin:n,value:f,resolverAddress:r}),...a};return Ja(e,i)}p90.makeFunctionData=d90;const b90=(e,{name:t,fuses:n,expiry:f})=>{const r=N9({input:n}),a=t.split("."),i=U6(a.shift()),o=Sr(a.join("."));return{to:Rf({client:e,contract:"ensNameWrapper"}),data:Pn({abi:Vwe,functionName:"setChildFuses",args:[o,i,r,BigInt(f??0)]})}};async function h90(e,{name:t,fuses:n,expiry:f,...r}){const a={...b90(e,{name:t,fuses:n,expiry:f}),...r};return Ja(e,a)}h90.makeFunctionData=b90;const m90=(e,{name:t,contentHash:n,resolverAddress:f})=>({to:f,data:Z30({namehash:Sr(t),contentHash:n})});async function y90(e,{name:t,contentHash:n,resolverAddress:f,...r}){const a={...m90(e,{name:t,contentHash:n,resolverAddress:f}),...r};return Ja(e,a)}y90.makeFunctionData=m90;const g90=(e,{name:t,fuses:n})=>{const f=N9({restriction:"child",input:n});return{to:Rf({client:e,contract:"ensNameWrapper"}),data:Pn({abi:zwe,functionName:"setFuses",args:[Sr(t),f]})}};async function v90(e,{name:t,fuses:n,...f}){const r={...g90(e,{name:t,fuses:n}),...f};return Ja(e,r)}v90.makeFunctionData=g90;const BTe=[{inputs:[{name:"addr",type:"address"},{name:"owner",type:"address"},{name:"resolver",type:"address"},{name:"name",type:"string"}],name:"setNameForAddr",outputs:[{name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"}],DTe=[{inputs:[{name:"name",type:"string"}],name:"setName",outputs:[{name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"}],w90=(e,{name:t,address:n,resolverAddress:f=Rf({client:e,contract:"ensPublicResolver"})})=>{const r=Rf({client:e,contract:"ensReverseRegistrar"});return n?{to:r,data:Pn({abi:BTe,functionName:"setNameForAddr",args:[n,e.account.address,f||Rf({client:e,contract:"ensPublicResolver"}),t]})}:{to:r,data:Pn({abi:DTe,functionName:"setName",args:[t]})}};async function A90(e,{name:t,address:n,resolverAddress:f,...r}){const a={...w90({...e,account:fs(r.account||e.account)},{name:t,address:n,resolverAddress:f}),...r};return Ja(e,a)}A90.makeFunctionData=w90;const x90=(e,{name:t,resolverAddress:n,...f})=>{const r=_30({namehash:Sr(t),...f});if(r.length===0)throw new oue;return r.length===1?{to:n,data:r[0]}:{to:n,data:Pn({abi:Ide,functionName:"multicall",args:[r]})}};async function E90(e,{name:t,resolverAddress:n,clearRecords:f,contentHash:r,texts:a,coins:i,abi:o,...s}){const l={...x90(e,{name:t,resolverAddress:n,clearRecords:f,contentHash:r,texts:a,coins:i,abi:o}),...s};return Ja(e,l)}E90.makeFunctionData=x90;const T90=(e,{name:t,contract:n,resolverAddress:f})=>{if(n!=="registry"&&n!=="nameWrapper")throw new Error(`Unknown contract: ${n}`);const r=Rf({client:e,contract:n==="nameWrapper"?"ensNameWrapper":"ensRegistry"}),a=[Sr(t),f],i="setResolver";return n==="nameWrapper"?{to:r,data:Pn({abi:Kwe,functionName:i,args:a})}:{to:r,data:Pn({abi:Vh0,functionName:i,args:a})}};async function M90(e,{name:t,contract:n,resolverAddress:f,...r}){const a={...T90(e,{name:t,contract:n,resolverAddress:f}),...r};return Ja(e,a)}M90.makeFunctionData=T90;const C90=(e,{name:t,key:n,value:f,resolverAddress:r})=>({to:r,data:X30({namehash:Sr(t),key:n,value:f})});async function S90(e,{name:t,key:n,value:f,resolverAddress:r,...a}){const i={...C90(e,{name:t,key:n,value:f,resolverAddress:r}),...a};return Ja(e,i)}S90.makeFunctionData=C90;const O90=(e,{name:t,newOwnerAddress:n,contract:f,reclaim:r,asParent:a})=>{if(r&&f!=="registrar")throw new AO({parameter:"reclaim",allowedParameters:["name","newOwnerAddress","contract"],details:"Can't reclaim a name from any contract other than the registrar"});switch(f){case"registry":{const i=Rf({client:e,contract:"ensRegistry"});if(a){const{labelhash:o,parentNode:s}=H9(t);return{to:i,data:Pn({abi:jwe,functionName:"setSubnodeOwner",args:[s,o,n]})}}return{to:i,data:Pn({abi:Lwe,functionName:"setOwner",args:[Sr(t),n]})}}case"registrar":{if(a)throw new AO({parameter:"asParent",allowedParameters:["name","newOwnerAddress","contract","reclaim"],details:"Can't transfer a name as the parent owner on the registrar"});const i=sl(t);if(i!=="eth-2ld")throw new Bc({nameType:i,supportedNameTypes:["eth-2ld"],details:"Only eth-2ld names can be transferred on the registrar contract"});const o=t.split("."),s=BigInt(U6(o[0]));return{to:Rf({client:e,contract:"ensBaseRegistrarImplementation"}),data:Pn(r?{abi:Gve,functionName:"reclaim",args:[s,n]}:{abi:qve,functionName:"safeTransferFrom",args:[e.account.address,n,s]})}}case"nameWrapper":{const i=Rf({client:e,contract:"ensNameWrapper"});if(a){const{label:o,parentNode:s}=H9(t);return{to:i,data:Pn({abi:Hwe,functionName:"setSubnodeOwner",args:[s,o,n,0,BigInt(0)]})}}return{to:i,data:Pn({abi:Qwe,functionName:"safeTransferFrom",args:[e.account.address,n,BigInt(Sr(t)),BigInt(1),"0x"]})}}default:throw new xO({contractType:f,supportedContractTypes:["registry","registrar","nameWrapper"]})}};async function k90(e,{name:t,newOwnerAddress:n,contract:f,reclaim:r,asParent:a,...i}){const o={...O90({...e,account:fs(i.account||e.account)},{name:t,newOwnerAddress:n,contract:f,reclaim:r,asParent:a}),...i};return Ja(e,o)}k90.makeFunctionData=O90;const N90=(e,{name:t,newOwnerAddress:n,newRegistrantAddress:f})=>{const{labelhash:r,parentNode:a}=H9(t),i=Rf({client:e,contract:"ensNameWrapper"});if(sl(t)==="eth-2ld"){if(!f)throw new Yve({parameter:"newRegistrantAddress",details:"Must provide newRegistrantAddress for eth-2ld names"});return{to:i,data:Pn({abi:Wwe,functionName:"unwrapETH2LD",args:[r,f,n]})}}if(f)throw new AO({parameter:"newRegistrantAddress",allowedParameters:["name","newOwnerAddress"],details:"newRegistrantAddress can only be specified for eth-2ld names"});return{to:i,data:Pn({abi:qwe,functionName:"unwrap",args:[a,r,n]})}};async function P90(e,{name:t,newOwnerAddress:n,newRegistrantAddress:f,...r}){const a={...N90(e,{name:t,newOwnerAddress:n,newRegistrantAddress:f}),...r};return Ja(e,a)}P90.makeFunctionData=N90;const I90=(e,{name:t,newOwnerAddress:n,fuses:f,resolverAddress:r=Rf({client:e,contract:"ensPublicResolver"})})=>{const a=t.split("."),i=Rq(a),o=Rf({client:e,contract:"ensNameWrapper"});if(i){iw(a[0]);const s=f?N9({restriction:"child",input:f}):0,l=BigInt(U6(a[0])),c=Xg([{name:"label",type:"string"},{name:"wrappedOwner",type:"address"},{name:"ownerControlledFuses",type:"uint16"},{name:"resolverAddress",type:"address"}],[a[0],n,s,r]);return{to:Rf({client:e,contract:"ensBaseRegistrarImplementation"}),data:Pn({abi:Wve,functionName:"safeTransferFrom",args:[e.account.address,o,l,c]})}}if(f)throw new AO({parameter:"fuses",allowedParameters:["name","wrappedOwner","resolverAddress"],details:"Fuses cannot be initially set when wrapping non eth-2ld names"});return a.forEach(s=>iw(s)),{to:o,data:Pn({abi:Gwe,functionName:"wrap",args:[e8(Rv(t)),n,r]})}};async function R90(e,{name:t,newOwnerAddress:n,fuses:f,resolverAddress:r,...a}){const i={...I90({...e,account:fs(a.account||e.account)},{name:t,newOwnerAddress:n,fuses:f,resolverAddress:r}),...a};return Ja(e,i)}R90.makeFunctionData=I90;const LTe=e=>({clearRecords:t=>Y30(e,t),commitName:t=>t90(e,t),createSubname:t=>f90(e,t),deleteSubname:t=>a90(e,t),registerName:t=>o90(e,t),renewNames:t=>l90(e,t),setAbiRecord:t=>u90(e,t),setAddressRecord:t=>p90(e,t),setChildFuses:t=>h90(e,t),setContentHashRecord:t=>y90(e,t),setFuses:t=>v90(e,t),setPrimaryName:t=>A90(e,t),setRecords:t=>E90(e,t),setResolver:t=>M90(e,t),setTextRecord:t=>S90(e,t),transferName:t=>k90(e,t),unwrapName:t=>P90(e,t),wrapName:t=>R90(e,t)});class jTe extends ia{constructor({chainId:t,supportedChains:n,details:f}){super(`Unsupported chain: ${t}`,{metaMessages:[`- Supported chains: ${n.join(", ")}`],details:f}),Object.defineProperty(this,"chainId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportedChains",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedChainError"}),this.chainId=t,this.supportedChains=n}}class FTe extends ia{constructor(){super("No chain provided"),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NoChainError"})}}const B90=[1,5,17e3,11155111],zTe={1:{ensBaseRegistrarImplementation:{address:"0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"},ensBulkRenewal:{address:"0xa12159e5131b1eEf6B4857EEE3e1954744b5033A"},ensDnsRegistrar:{address:"0xB32cB5677a7C971689228EC835800432B339bA2B"},ensDnssecImpl:{address:"0x0fc3152971714E5ed7723FAFa650F86A4BaF30C5"},ensEthRegistrarController:{address:"0x253553366Da8546fC250F225fe3d25d0C782303b"},ensNameWrapper:{address:"0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401"},ensPublicResolver:{address:"0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63"},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensReverseRegistrar:{address:"0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67"}},5:{ensBaseRegistrarImplementation:{address:"0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"},ensBulkRenewal:{address:"0x6d9F26FfBcF1c6f0bAe9F2C1f7fBe8eE6B1d8d4d"},ensDnsRegistrar:{address:"0x8edc487D26F6c8Fa76e032066A3D4F87E273515d"},ensDnssecImpl:{address:"0xF427c4AdED8B6dfde604865c1a7E953B160C26f0"},ensEthRegistrarController:{address:"0xCc5e7dB10E65EED1BBD105359e7268aa660f6734"},ensNameWrapper:{address:"0x114D4603199df73e7D157787f8778E21fCd13066"},ensPublicResolver:{address:"0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750"},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensReverseRegistrar:{address:"0x6d9F26FfBcF1c6f0bAe9F2C1f7fBe8eE6B1d8d4d"},ensUniversalResolver:{address:"0x898A1182F3C2BBBF0b16b4DfEf63E9c3e9eB4821"}},17e3:{ensBaseRegistrarImplementation:{address:"0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"},ensBulkRenewal:{address:"0xbc4cfB363F948E64Cd73Da6438F64CB37E2e33d1"},ensDnsRegistrar:{address:"0x458d278AEd4cE82BAeC384170f39198b01B8351c"},ensDnssecImpl:{address:"0x283af0b28c62c092c9727f1ee09c02ca627eb7f5"},ensEthRegistrarController:{address:"0x179Be112b24Ad4cFC392eF8924DfA08C20Ad8583"},ensNameWrapper:{address:"0xab50971078225D365994dc1Edcb9b7FD72Bb4862"},ensPublicResolver:{address:"0x9010A27463717360cAD99CEA8bD39b8705CCA238"},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensReverseRegistrar:{address:"0x132AC0B116a73add4225029D1951A9A707Ef673f"},ensUniversalResolver:{address:"0xa6ac935d4971e3cd133b950ae053becd16fe7f3b"}},11155111:{ensBaseRegistrarImplementation:{address:"0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"},ensBulkRenewal:{address:"0x4EF77b90762Eddb33C8Eba5B5a19558DaE53D7a1"},ensDnsRegistrar:{address:"0x5a07C75Ae469Bf3ee2657B588e8E6ABAC6741b4f"},ensDnssecImpl:{address:"0xe62E4b6cE018Ad6e916fcC24545e20a33b9d8653"},ensEthRegistrarController:{address:"0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72"},ensNameWrapper:{address:"0x0635513f179D50A207757E05759CbD106d7dFcE8"},ensPublicResolver:{address:"0x8FADE66B79cC9f707aB26799354482EB93a5B7dD"},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensReverseRegistrar:{address:"0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6"},ensUniversalResolver:{address:"0xc8af999e38273d658be1b921b88a9ddf005769cc"}}},VTe={1:{ens:{url:"https://api.thegraph.com/subgraphs/name/ensdomains/ens"}},5:{ens:{url:"https://api.thegraph.com/subgraphs/name/ensdomains/ensgoerli"}},17e3:{ens:{url:"https://api.studio.thegraph.com/query/49574/ensholesky/version/latest"}},11155111:{ens:{url:"https://api.studio.thegraph.com/query/49574/enssepolia/version/latest"}}},D90=e=>{if(!e)throw new FTe;if(!B90.includes(e.id))throw new jTe({chainId:e.id,supportedChains:B90});return{...e,contracts:{...e.contracts,...zTe[e.id]},subgraphs:{...VTe[e.id]}}},UTe=({batch:e,chain:t,key:n="ensPublic",name:f="ENS Public Client",transport:r,pollingInterval:a})=>B20({batch:e,chain:D90(t),key:n,name:f,pollingInterval:a,transport:r,type:"ensPublicClient"}).extend(jAe).extend(TTe),HTe=({account:e,chain:t,key:n="ensWallet",name:f="ENS Wallet Client",transport:r,pollingInterval:a})=>Ade({account:e,chain:D90(t),key:n,name:f,pollingInterval:a,transport:r}).extend(LTe),L90=V20({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),j90=V20({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.sepolia.org"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",blockCreated:5317080}},testnet:!0}),F90="production",z90=()=>{const[e,t]=n0.useState(void 0),[n,f]=n0.useState(!0),[r,a]=n0.useState(!1);return n0.useEffect(()=>{(async()=>{try{const i=UTe({chain:F90==="development"?j90:L90,transport:L20()}),o=HTe({chain:F90==="development"?j90:L90,transport:L20()});t(i)}catch{a(!0)}finally{f(!1)}})()},[]),{ensClient:e,loading:n,error:r}};var cW={},GTe=W5,qTe=mc;Object.defineProperty(cW,"__esModule",{value:!0});var ow=cW.default=void 0,WTe=qTe(n0),QTe=GTe(yc()),YTe=(0,QTe.default)(WTe.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}),"Done");ow=cW.default=YTe;const uW=86400,V90=en(e=>({doneIcon:{marginRight:4,fill:"#A8E07E",width:"16px"},errorIcon:{fill:"rgba(244, 67, 54, 1)",width:"20px"},warningIcon:{fill:"rgba(230, 230, 54, 1)",width:"20px"},fields:{marginBottom:e.spacing(1)},loadMessage:{textAlign:"center"},loadingContainer:{marginRight:4,padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:14,width:14,border:`1px solid ${Jt.tan[300]}`},spinner:{width:"8px !important",height:"8px !important",color:`${Jt.tan[300]} !important`},loading:{width:"15px !important",height:"15px !important",marginRight:8},addSpinner:{color:"white !important",fill:"white !important",opacity:"100% !important"},detailsContainer:{width:"95%"},messageContainer:{width:"85%",fill:"rgba(244, 67, 54, 1)"},errorMessageDetails:{fontSize:12,textDecoration:"underline",cursor:"pointer",color:"rgba(244, 67, 54, 1)"},warningMessageDetails:{fontSize:12,textDecoration:"underline",cursor:"pointer",color:"rgba(230, 230, 54, 1)"},textSubdued:{color:"rgba(255 255 255 / 70%)"},errorMessage:{fontSize:12,color:"rgba(244, 67, 54, 1)",fontWeight:"bolder"},warningMessage:{fontSize:12,color:"rgba(230, 230, 54, 1)"},linkStyle:{color:"white"},flexRow:{display:"flex",flexDirection:"row"},textFieldSmall:{"& .MuiFormLabel-root":{fontSize:12}},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},inputError:{"& .MuiInputBase-root":{borderColor:"rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.1)","&::before":{borderColor:"rgba(244, 67, 54, 0.3)"}}},errorContainer:{margin:8,display:"flex",alignItems:"center"}})),KTe=dn({switchBase:{"&.Mui-checked":{color:"white"}},colorSecondary:{"&.Mui-checked + .MuiSwitch-track":{backgroundColor:Jt.tan[500]}},track:{backgroundColor:"black"}})(De0),sw=({status:e,message:t,link:n})=>{const f=V90();return e&&ve(fe,{container:!0,spacing:1,alignItems:"center",children:[ve(fe,{item:!0,xs:1,children:[e==="error"&&r0(gc,{className:f.errorIcon}),e==="warning"&&r0(wG,{className:f.warningIcon})]}),r0(fe,{item:!0,className:f.detailsContainer,xs:11,children:ve(fe,{container:!0,justifyContent:"space-between",alignItems:"center",children:[r0(fe,{item:!0,className:f.messageContainer,children:r0(ze,{className:e==="error"?f.errorMessage:f.warningMessage,children:t})}),n?r0(fe,{item:!0,children:r0(d1,{className:e==="error"?f.errorMessageDetails:f.warningMessageDetails,href:n,target:"_blank",children:"Details"})}):r0(fe,{})]})})]})},JTe=({open:e,onClose:t,onSubmit:n})=>{const f=V90(),{sdk:r,safe:a,provider:i}=hi(),{ensClient:o}=z90(),s=n0.useMemo(()=>new D3(1,"0de1a96486754f8b98f284d093905198"),[]),l=n0.useMemo(()=>new D3(5,"0de1a96486754f8b98f284d093905198"),[]),c=G3[a.chainId].nativeAsset,[d,p]=n0.useState({snapshotEns:"",timeout:(uW*2).toString(),cooldown:(uW*2).toString(),expiration:(uW*7).toString(),bond:"0.1"}),[x,C]=n0.useState(!1),[O,L]=n0.useState(!1),[D,V]=n0.useState(!1),[Y,i0]=n0.useState(""),[m0,A0]=n0.useState(!1),[T0,I0]=n0.useState(!1),z0=!!d.snapshotEns&&d.snapshotEns.includes(".eth")&&!x&&O&&D,[oe,ae]=n0.useState({snapshotEns:z0,bond:!!d.bond}),[ye,P]=n0.useState(!1),[F,Q]=n0.useState(""),[H,u0]=n0.useState(""),[h0,g0]=n0.useState(!1),[o0,N]=n0.useState(""),[t0,S0]=n0.useState([]),[s0,W]=n0.useState(""),[D0,Y0]=n0.useState(""),[Z0,le]=n0.useState(""),[ue,xe]=n0.useState("form"),je=Object.values(oe).every(y=>y),Ge=/^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/.test(o0)&&!t0.includes(o0),et=je&&(!ye||F!==void 0&&H!==void 0&&t0.length>0),[St,wt]=n0.useState(!1),zt=n0.useCallback(async()=>{var y,Z;if(o&&(y=await Cq(o,{name:d.snapshotEns}))!=null&&y.value){const z=await gG(d.snapshotEns,a.chainId),v=await Goe(d.snapshotEns,"daorequirements",i);if(i0(v[0]),V(z!==void 0),z!==void 0){I0(!!((Z=z.plugins)!=null&&Z.safeSnap));const k=await Iu0(i,o,d.snapshotEns,a.safeAddress);A0(k),console.log({isController:k,snapshotSpace:z}),console.log({snapshotSpace:z})}}},[d.snapshotEns,a.chainId,a.safeAddress,s,l]),pn=gc0(()=>{V(!1),i0(""),A0(!1),I0(!1),L(!1),d.snapshotEns&&d.snapshotEns.includes(".eth")&&(C(!0),(async()=>(await zt(),C(!1),L(!0)))())},300);n0.useEffect(()=>{pn()},[d.snapshotEns]);const{loading:k0,execute:d0,error:J}=A20(),X=gc0(async()=>{g0(!1),await d0(F,H),g0(!0)},300);n0.useEffect(()=>{F&&H&&X()},[F,H]),n0.useEffect(()=>{if(a.chainId){const y=a.chainId===1?"1":a.chainId===100?"1500":a.chainId===137?"1000":"1";p(Z=>({...Z,bond:y}))}},[a.chainId]),n0.useEffect(()=>{ae({snapshotEns:z0,bond:!!d.bond})},[d,x,z0]);const A=(y,Z,z)=>{p({...d,[y]:Z})},c0=async()=>{var y;wt(!0);try{const Z=pg(d.bond,c.decimals),z={...d,oracle:jg(a.chainId),arbitrator:s60(a.chainId),executor:a.safeAddress,bond:Z.toString()},v={templateType:"default",language:"english",category:"DAO proposal",templateQuestion:$S(z.snapshotEns)},k=await vc0(i,a.safeAddress,m20,a.chainId,z,v);let M=[...k.txs];const _=(y=k.meta)==null?void 0:y.daoModuleExpectedAddress;if(m0&&a.chainId===1){if(_==null)throw new Error("The calculated reality module address is 'null'. This should be handled in the 'statusCallback' function.");const q=await i.getSigner(),{txs:K}=await y20(q,z.snapshotEns,_,a.chainId);M.push(K[0])}if(ye){const q={apiKey:F,secretKey:H,discordKey:s0,email:t0,slackKey:"",telegram:{botToken:D0,chatId:Z0}};await h20(a.chainId,_,z.oracle,q)}await r.txs.send({txs:M}),n&&n(),t&&t()}catch(Z){console.log("Error deploying module: ",Z)}wt(!1)},m=y=>{const Z=y.target.value||"0";let z=Z.startsWith("0")&&Z.length>1?Z.substr(1):Z;z=z.startsWith(".")?"0"+z:z;try{pg(z,c.decimals),A("bond",z)}catch(v){console.warn("invalid bond",Z,v)}},f0=()=>x?"":d.snapshotEns.includes(".eth")&&!x&&!D?f.inputError:d.snapshotEns.includes(".eth")&&!x&&D?f.input:"";return r0(L6,{open:e,onClose:t,title:"Kleros Snapshot Module",description:"Execute transactions for successful Snapshot proposals using Reality.eth, secured by Kleros.",icon:"reality",tags:["Stackable","From Kleros"],hideButton:!0,readMoreLink:"https://kleros.gitbook.io/docs/integrations/types-of-integrations/1.-dispute-resolution-integration-plan/channel-partners/kleros-reality-module",children:ue==="form"?ve(Er,{children:[r0(ze,{gutterBottom:!0,children:"Parameters"}),ve(fe,{container:!0,spacing:2,className:f.fields,children:[ve(fe,{item:!0,xs:12,children:[r0(Cr,{value:d.snapshotEns,onChange:y=>A("snapshotEns",y.target.value),label:"Enter the Snapshot ENS name.",placeholder:"ex: gnosis.eth",className:`${f.textFieldSmall} ${f0()}`,rightIcon:ve(Er,{children:[x&&r0(ua,{className:f.loadingContainer,children:r0(fi.Loader,{size:"sm",className:f.spinner})}),d.snapshotEns.includes(".eth")&&!x&&!D&&r0(gc,{className:f.errorIcon}),d.snapshotEns.includes(".eth")&&!x&&D&&r0(ow,{className:f.doneIcon})]})}),!x&&O&&!z0&&r0(sw,{message:"This Snapshot space does not exist.",status:"error"})]}),r0(fe,{item:!0,xs:6,children:r0(Zo,{label:"Timeout",defaultValue:d.timeout,defaultUnit:"days",onChange:y=>A("timeout",y)})}),r0(fe,{item:!0,xs:6,children:r0(Zo,{label:"Cooldown",defaultValue:d.cooldown,defaultUnit:"days",onChange:y=>A("cooldown",y)})}),r0(fe,{item:!0,xs:6,children:r0(Zo,{label:"Expiration",defaultValue:d.expiration,defaultUnit:"days",onChange:y=>A("expiration",y)})}),r0(fe,{item:!0,xs:6,children:r0(Cr,{label:"Bond",prefix:c.symbol,color:"secondary",value:d.bond,onChange:m})})]}),ve(fe,{container:!0,spacing:2,children:[r0(fe,{item:!0,xs:6,children:r0(ze,{variant:"body1",children:"Configure Monitoring"})}),ve(fe,{xs:6,item:!0,style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[r0("div",{}),r0(KTe,{value:ye,onClick:()=>{P(!ye)}})]})]}),ye&&ve(fe,{container:!0,direction:"column",spacing:2,className:f.fields,children:[r0(fe,{item:!0,xs:12,children:ve(ze,{variant:"body2",children:["Setting up an effective monitoring strategy is critical for the security of your safe. First, you need to"," ",r0(d1,{className:f.linkStyle,underline:"always",href:"https://defender.openzeppelin.com/#/auth/sign-in",target:"_blank",children:"create an Open Zeppelin account"}),"."]})}),r0(fe,{item:!0,xs:12,children:r0(Cr,{value:F,onChange:y=>{Q(y.target.value)},label:"API Key",placeholder:"3pwZzZZZzzZZZzzZZzZZZAAaaAAaaZZzz",rightIcon:k0?r0(ua,{className:f.loadingContainer,children:r0(fi.Loader,{size:"sm",className:f.spinner})}):h0&&!J&&r0(ua,{className:f.loadingContainer,children:r0(w20,{className:f.spinner})})})}),r0(fe,{item:!0,xs:12,children:r0(Cr,{value:H,onChange:y=>{u0(y.target.value)},label:"API Secret",placeholder:"2LUwZwwuUuuUUzzZZdDddooodudDDdaaDDdaAAAddDDadDzZZzdDDdcCCdDDaaAA",rightIcon:k0?r0(ua,{className:f.loadingContainer,children:r0(fi.Loader,{size:"sm",className:f.spinner})}):h0&&!J&&r0(ua,{className:f.loadingContainer,children:r0(w20,{className:f.spinner})})})}),h0&&J&&r0(fe,{item:!0,xs:12,children:r0(sw,{message:"These credentials are wrong.",status:"error"})}),ve(fe,{item:!0,xs:12,children:[ve(fe,{item:!0,style:{display:"flex"},children:[r0(ze,{children:"Email"}),r0(ze,{style:{fontStyle:"italic",opacity:"0.7"},children:"\xA0(required)"})]}),r0(ze,{variant:"body2",children:"Enter as many email addresses as you need"}),r0(Cr,{placeholder:"john@doe.com",value:o0,onChange:y=>{N(y.target.value)},onKeyDown:y=>{y.key==="Enter"&&Ge&&(S0([...t0,o0]),N(""))},rightIcon:r0(Er,{children:Ge?r0(ua,{className:f.loadingContainer,children:ve(ap,{size:"small",onClick:()=>{S0([...t0,o0]),N("")},children:[" ",r0(fi.Icon,{size:"sm",type:"add",color:"primary"})]})}):null})}),t0.length>0?t0.map(y=>ve(fe,{container:!0,children:[r0(fe,{item:!0,xs:1,children:r0(ap,{size:"small",onClick:()=>S0(t0.filter(Z=>Z!==y)),children:r0(fi.Icon,{size:"sm",type:"delete",color:"warning"})})}),r0(fe,{item:!0,xs:11,children:r0(ze,{children:y})})]},y)):r0(ze,{style:{fontStyle:"italic",opacity:"0.7"},children:Ge?"Press Enter or click + to add this email":"(No emails entered, at least one is required)"})]}),ve(fe,{item:!0,xs:12,children:[ve(fe,{item:!0,style:{display:"flex"},children:[r0(ze,{children:"Discord Integration"}),r0(ze,{style:{fontStyle:"italic",opacity:"0.7"},children:"\xA0(optional)"})]}),ve(fe,{container:!0,style:{display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[r0(ze,{variant:"body2",children:"Include the Discord channel's url key"}),r0(d1,{className:f.linkStyle,href:"https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks",target:"_blank",children:"Learn more"})]}),r0(Cr,{value:s0,onChange:y=>{W(y.target.value)},placeholder:"https://discord.com/api/webhooks/.../"})]}),ve(fe,{item:!0,xs:12,children:[ve(fe,{item:!0,style:{display:"flex"},children:[r0(ze,{children:"Telegram Integration"}),r0(ze,{style:{fontStyle:"italic",opacity:"0.7"},children:"\xA0(optional)"})]}),ve(fe,{container:!0,style:{display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[r0(ze,{variant:"body2",children:"Include the Telegram bot token and Chat ID"}),r0(d1,{className:f.linkStyle,href:"https://core.telegram.org/bots#6-botfather",target:"_blank",children:"Learn more"})]}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,direction:"row",alignItems:"center",justifyContent:"space-between",children:[r0(fe,{item:!0,children:r0(Cr,{placeholder:"123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11",value:D0,onChange:y=>{Y0(y.target.value)}})}),r0(fe,{item:!0,children:r0(Cr,{placeholder:"1234567890",value:Z0,onChange:y=>{le(y.target.value)}})})]})})]})]}),r0(E1,{fullWidth:!0,startIcon:r0($p,{}),onClick:()=>{xe("confirm")},disabled:!et,style:{marginTop:"16px"},children:et||!ye?"Add Module":k0?"Validating OpenZeppelin Credentials...":!h0||J?"Missing OpenZeppelin API":"Missing Email"})]}):ve(Er,{children:[r0(ze,{children:"It's almost ready! Just a reminder:"}),O&&(z0?m0&&a.chainId===1?T0?r0("div",{children:"SafeSnap plugin is already installed, and will be overwritten."}):r0("div",{children:"The SafeSnap plugin will be automatically installed."}):r0("div",{style:{marginTop:"4px"},children:r0(sw,{message:"Install SafeSnap after creating the module.",link:"https://kleros.gitbook.io/docs/integrations/types-of-integrations/1.-dispute-resolution-integration-plan/channel-partners/kleros-reality-module#safesnap",status:"warning"})}):r0(sw,{message:"This Snapshot space does not exist.",status:"error"})),O&&Y===""&&r0(sw,{message:"Missing DAO requirements ENS record.",link:"https://kleros.gitbook.io/docs/integrations/types-of-integrations/1.-dispute-resolution-integration-plan/channel-partners/kleros-reality-module#missing-daorequirements",status:"warning"}),ve(fe,{container:!0,spacing:2,style:{display:"flex",flexDirection:"row",marginTop:"16px"},children:[r0(fe,{item:!0,xs:6,children:r0(E1,{fullWidth:!0,disabled:St,startIcon:r0($p,{style:{rotate:"270deg"}}),onClick:()=>xe("form"),children:"Return"})}),r0(fe,{item:!0,xs:6,children:r0(E1,{fullWidth:!0,disabled:St,startIcon:St?r0(fi.Loader,{size:"xs",className:f.addSpinner}):r0($p,{}),onClick:()=>{c0()},children:"Add Module"})}),St&&ye&&r0(fe,{xs:12,style:{marginLeft:"8px"},children:r0("div",{children:"This can take around a minute, please wait..."})})]})]})})},ZTe=en(e=>({addButton:{marginTop:e.spacing(2)},addTransactionButton:{marginTop:e.spacing(1)},addIcon:{stroke:e.palette.common.white,width:20,height:20},inputParam:{marginTop:e.spacing(2)},errorMessage:{marginTop:e.spacing(1),color:"red"}})),XTe=({onSubmit:e,open:t,onClose:n})=>{const{sdk:f,safe:r,provider:a}=hi(),i=ZTe(),[o,s]=n0.useState({owner:!1,avatar:!1,target:!1,domainId:!0,sender:!0}),[l,c]=n0.useState({owner:r.safeAddress,avatar:r.safeAddress,target:r.safeAddress,domainId:0,sender:""}),d=(x,C,O)=>{s({...o,[x]:!O}),c({...l,[x]:C})},p=async()=>{try{const x={...l},C=await hX0(a,r.safeAddress,r.chainId,x);await f.txs.send({txs:C}),e&&e(),n&&n()}catch(x){console.error("Error deploying module: ",x)}};return ve(L6,{hideButton:!0,open:t,onClose:n,title:"Connext Module",description:"This module allows for execution of transactions initiated by a designated address on the other chain via Connext.",tags:["From Connext"],icon:"connext",readMoreLink:"https://github.com/gnosis/zodiac-module-connext/",children:[r0(ze,{gutterBottom:!0,children:"Parameters"}),r0(Ba,{placeholder:"Origin Sender Address",label:"Origin sender address",param:_n.from("address"),onChange:(x,C)=>d("sender",x,C)}),r0(Ba,{placeholder:"Connext origin domain ID",label:"Connext origin domain ID",className:i.inputParam,param:_n.from("uint256"),onChange:(x,C)=>d("domainId",x,C)}),r0(ze,{className:i.errorMessage,children:eV(r.chainId)?null:"Not supported network for the Module"}),r0(E1,{fullWidth:!0,disableElevation:!0,className:i.addButton,variant:"contained",disabled:o.domainId||o.sender||!eV(r.chainId),startIcon:r0($p,{}),onClick:p,children:"Add Module"})]})},_Te=({selected:e,onClose:t,onSubmit:n})=>ve(Er,{children:[r0(tte,{open:e===Cn.TELLOR,onClose:t,onSubmit:()=>n&&n(Cn.TELLOR)}),r0(fte,{open:e===Cn.OPTIMISTIC_GOVERNOR,onClose:t,onSubmit:()=>n&&n(Cn.OPTIMISTIC_GOVERNOR)}),r0(ate,{open:e===Cn.DELAY,onClose:t,onSubmit:()=>n&&n(Cn.DELAY)}),r0(lte,{open:e===Cn.BRIDGE,onClose:t,onSubmit:()=>n&&n(Cn.BRIDGE)}),r0(ute,{open:e===Cn.EXIT,onClose:t,onSubmit:()=>n&&n(Cn.EXIT)}),r0(hte,{open:e===Cn.ROLES_V1,onClose:t,onSubmit:()=>n&&n(Cn.ROLES_V1)}),r0(nre,{open:e===Cn.ROLES_V2,onClose:t,onSubmit:()=>n&&n(Cn.ROLES_V2)}),r0(sre,{open:e===Cn.REALITY_ETH,onClose:t,onSubmit:()=>n&&n(Cn.REALITY_ETH)}),r0(JTe,{open:e===Cn.KLEROS_REALITY,onClose:t,onSubmit:()=>n&&n(Cn.KLEROS_REALITY)}),r0(XTe,{open:e===Cn.CONNEXT,onClose:t,onSubmit:()=>n&&n(Cn.CONNEXT)}),r0(ote,{open:e===Cn.UNKNOWN,onClose:t,onSubmit:()=>n&&n(Cn.UNKNOWN)})]}),$Te=en(e=>({root:{padding:e.spacing(1.5)},gridContainer:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:e.spacing(2)},paper:{padding:e.spacing(2.5,2)},title:{marginBottom:e.spacing(2)},introBox:{gridColumn:"1/3","@media (max-width:930px)":{gridColumn:"1/2"}},firstModule:{gridColumn:1},link:{color:e.palette.text.primary}})),eMe=()=>{const e=$Te(),t=A1(),{safe:n}=uo.useSafeAppsSDK(),f=lr(l=>K3(l).length>0),[r,a]=n0.useState(),i=()=>{t(hc(n)),t(qC(!0))},o=pz[n.chainId],s=f?"Add another mod":"Start by adding a mod";return ve("div",{className:e.root,children:[ve("div",{className:e.gridContainer,children:[r0("div",{className:e.introBox,children:ve(wf,{variant:"outlined",className:e.paper,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[r0(ze,{variant:"h5",className:e.title,children:s}),ve(ze,{variant:"body2",children:["Built according to an open standard, the Zodiac collection of tools are mods that support, expand, and transform how organizations operate. Learn more about Zodiac in"," ",r0("a",{href:"https://gnosisguild.mirror.xyz/OuhG5s2X5uSVBx1EK4tKPhnUc91Wh9YM0fwSnC8UNcg",target:"_blank",rel:"noopener noreferrer",className:e.link,children:"this article"})," ","and about Gnosis Safe modules more generally in"," ",r0("a",{href:"https://help.gnosis-safe.io/en/articles/4934378-what-is-a-module",target:"_blank",rel:"noopener noreferrer",className:e.link,children:"this article"}),"."]})]})}),r0(ns,{title:"Bridge Module",description:"Enables an address on one chain to control an avatar on another chain using an Arbitrary Message Bridge (AMB)",icon:"bridge",onClick:()=>a(Cn.BRIDGE),className:e.firstModule,available:!!o[_e.BRIDGE]}),r0(ns,{title:"Delay Modifier",description:"Enables a time delay between when a module initiates a transaction and when it can be executed",icon:"delay",onClick:()=>a(Cn.DELAY),available:!!o[_e.DELAY]}),r0(ns,{title:"Exit Module",description:"Enables participants to redeem a designated token for a proportional share of this account\u2019digital assets",icon:"exit",onClick:()=>a(Cn.EXIT),available:!!o[_e.EXIT_ERC20]}),r0(ns,{title:"Roles Modifier",description:"Allows avatars to enforce granular, role-based, permissions for attached modules",icon:"roles",onClick:()=>a(Cn.ROLES_V2),available:!!o[_e.ROLES_V2]}),r0(ns,{title:"Reality Module Wizard",description:"Use a wizard to enable on-chain execution based on the outcome of events reported by the Reality.eth oracle",icon:"reality",onClick:()=>t(WC(!0)),available:[rn.MAINNET,rn.SEPOLIA].includes(n.chainId)}),r0(ns,{title:"Reality Module",description:"Enables on-chain execution based on the outcome of events reported by the Reality.eth oracle",icon:"reality",onClick:()=>a(Cn.REALITY_ETH),available:[rn.MAINNET,rn.SEPOLIA].includes(n.chainId)}),r0(ns,{title:"Kleros Snapshot Module",description:"Execute transactions for successful Snapshot proposals using Reality.eth, secured by Kleros.",icon:"reality",onClick:()=>a(Cn.KLEROS_REALITY),available:hc0.includes(n.chainId)}),r0(ns,{title:"Tellor Module",description:"Enables on-chain execution of successful Snapshot proposals reported by the Tellor oracle",icon:"tellor",onClick:()=>a(Cn.TELLOR),available:!!o[_e.TELLOR]}),r0(ns,{title:"UMA oSnap Module",description:"Enables on-chain execution of successful Snapshot proposals utilizing UMA's optimistic oracle.",icon:"optimisticGov",onClick:()=>a(Cn.OPTIMISTIC_GOVERNOR),available:!0}),r0(ns,{title:"Governor Module",description:"Enables an Open Zeppelin Governor contract as a module.",icon:"ozGov",onClick:()=>t(bV(!0)),available:!!o[_e.OZ_GOVERNOR]}),r0(ns,{title:"Connext Module",description:"Enables an address on one chain to control an avatar on another chain using Connext as the messaging layer.",icon:"connext",onClick:()=>a(Cn.CONNEXT),available:!!o[_e.CONNEXT]}),r0(ns,{title:"Roles Modifier v1",description:"Legacy version of the Roles Modifier",icon:"roles",deprecated:!0,onClick:()=>a(Cn.ROLES_V1),available:!!o[_e.ROLES_V1]}),r0(ns,{title:"Custom Module",description:"Enable a custom contract as a module",icon:"custom",onClick:()=>a(Cn.UNKNOWN),available:!0})]}),r0(_Te,{selected:r,onClose:()=>a(void 0),onSubmit:i})]})},tMe=en(e=>({content:{padding:e.spacing(2.5),marginTop:e.spacing(3)}})),nMe=({address:e,abi:t})=>{const n=tMe();return ve(Er,{children:[r0(al0,{value:"read",disabled:!0}),r0(wf,{borderStyle:"double",className:n.content,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0(Z50,{preview:!0,address:e,abi:t})})]})},fMe=en(e=>({root:{padding:e.spacing(3)},paper:{padding:e.spacing(2.5),maxWidth:500},title:{marginBottom:e.spacing(2)},header:{display:"grid",gridTemplateColumns:"50px auto",gridGap:e.spacing(2),alignItems:"center",marginBottom:e.spacing(3)},addressText:{margin:e.spacing(0,2,0,3),fontWeight:"bold"},icon:{marginLeft:"16px"},buttons:{marginTop:e.spacing(3),opacity:.5}}));function rMe(){const e=lr(Vg);if(!e)return null;const t=oV(e.module);return!t||!t.abi?null:r0(nMe,{address:e.address,abi:t.abi})}const aMe=()=>{const e=fMe(),t=lr(pV)===1;return ve("div",{className:e.root,children:[ve("div",{className:e.header,children:[r0(md,{variant:"circle",width:50,height:50}),r0(md,{variant:"rect",width:380,height:20})]}),t?r0(rMe,{}):ve(wf,{borderStyle:"double",className:e.paper,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[r0(ze,{variant:"h5",className:e.title,children:"Waiting on module approval"}),r0(ze,{children:"Once this module transaction has been approved by the other signers, you will be able to read and write to it."})]})]})},iMe=en(e=>({container:{display:"flex",flexDirection:"column"},textSubdued:{color:"rgba(255 255 255 / 70%)"},input:{"& .MuiInputBase-root":{padding:"9px 8px",borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}}})),oMe=({data:e,setData:t})=>{const n=iMe(),{safe:f}=uo.useSafeAppsSDK(),r=f.chainId===1?q90:W90,[a,i]=n0.useState("");n0.useEffect(()=>{if(e&&r.length&&a===""){const c=r.filter(d=>d.label.includes(e.instanceAddress));i(c[0].value)}},[e,r,a]);const o=c=>d=>t({...e,[c]:d}),s=c=>e[c],l=c=>{if(c==="custom"){o("instanceType")(c);return}const d=c.substr(c.indexOf("-")+1),p=c.substr(0,c.indexOf("-"));i(c),o("instanceAddress")(d),o("instanceType")(p)};return ve(fe,{container:!0,spacing:2,className:n.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Oracle Instance"})}),r0(fe,{item:!0,children:r0(ze,{variant:"body2",className:n.textSubdued,children:"The oracle instance sets the appropriate bond token. It's recommended to use the default (ETH) oracle instance unless you have a specific reason to use something like a native token which can potentially be more prone to price manipulation."})})]})}),r0(fe,{item:!0,children:r0(_S,{value:a,options:r,disableUnderline:!0,label:"Select oracle:",onChange:({target:c})=>{l(c.value)}})}),s("instanceType")==="custom"&&r0(fe,{item:!0,children:ve(fe,{container:!0,justifyContent:"space-between",alignItems:"center",spacing:1,children:[r0(fe,{item:!0,sm:10,children:r0(Cr,{label:"Contract Address",value:s("instanceAddress"),borderStyle:"double",className:n.input,onChange:c=>o("instanceAddress")(c.target.value)})}),r0(fe,{item:!0,sm:2,children:r0(ze,{style:{marginTop:15},children:"WEENUS"})})]})})]})},sMe=172800,U90=86400,lMe=172800,cMe=172800,uMe=172800,H90=0,dMe=604800,pMe=432e3,G90=86400,bMe="We highly recommend that your timeout delay exceeds 48 hours.",hMe="Your timeout delay must exceed 24 hours.",mMe="We highly recommend that your cooldown delay exceeds 48 hours.",yMe="Your cooldown delay must exceed 0",gMe="We highly recommend that your expiration delay exceeds cooldown + 5 days.",vMe="Your expiration delay must exceeds cooldown + 1 days.",jc=(e,t,n)=>{const f=parseInt(t),r=parseInt(n);switch(e){case"timeout":if(f{const n=parseInt(t);switch(e){case"timeout":if(n>=U90&&n=H90&&n=G90&&n({errorIcon:{fill:"rgba(244, 67, 54, 1)"},warningIcon:{fill:Jt.tan[800]},message:{fontSize:12,color:"rgba(244, 67, 54, 1)"},warningMessage:{fontSize:12,color:Jt.tan[800]}})),lw=({type:e,message:t})=>{const n=wMe();return ve(fe,{container:!0,spacing:1,alignItems:"center",children:[e==="error"&&ve(fe,{item:!0,children:[r0(gc,{className:n.errorIcon})," "]}),e==="warning"&&r0(fe,{item:!0,children:r0(KV,{className:n.warningIcon})}),r0(fe,{item:!0,children:r0(ze,{className:e==="error"?n.message:n.warningMessage,children:t})})]})},q9=({type:e,delayValue:t,dependsDelayValue:n})=>{const f=jc("timeout",parseInt(t)),r=jc("cooldown",parseInt(t)),a=jc("expiration",parseInt(t),n),i=G9("timeout",parseInt(t)),o=G9("cooldown",parseInt(t)),s=G9("expiration",parseInt(t)),[l,c]=n0.useState(void 0),[d,p]=n0.useState(void 0),[x,C]=n0.useState(void 0);return n0.useEffect(()=>{if(!f)return c({type:"error",message:hMe});if(!i)return c({type:"warning",message:bMe});c(void 0)},[f,i]),n0.useEffect(()=>{if(!r)return p({type:"error",message:yMe});if(!o)return p({type:"warning",message:mMe});p(void 0)},[r,o]),n0.useEffect(()=>{if(!a)return C({type:"error",message:vMe});if(!s)return C({type:"warning",message:gMe});C(void 0)},[a,s]),ve(n0.Fragment,{children:[e==="timeout"&&l&&r0(fe,{item:!0,children:r0(lw,{type:l.type,message:l.message})}),e==="cooldown"&&d&&r0(fe,{item:!0,children:r0(lw,{type:d.type,message:d.message})}),e==="expiration"&&x&&r0(fe,{item:!0,children:r0(lw,{type:x.type,message:x.message})})]})},AMe=en(()=>({container:{display:"flex",flexDirection:"column"},textSubdued:{color:"rgba(255 255 255 / 70%)"}})),xMe=({data:e,setData:t})=>{const n=AMe(),f=c=>e[c],r=f("timeout"),a=f("cooldown"),i=f("expiration"),o=jc("timeout",r),s=jc("cooldown",a),l=jc("expiration",i,a);return ve(fe,{container:!0,spacing:2,className:n.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:n.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Delay Configuration"})}),r0(fe,{item:!0,children:r0(ze,{variant:"body2",className:n.textSubdued,children:"These Parameters are very important for your DAO's security and should be considered carefully. Allowing enough time in these configurations will enable the safe to have a final chance to veto or circumvent any potential malicious proposals that have snuck through."})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:6,alignItems:"center",justifyContent:"space-between",children:[r0(fe,{item:!0,xs:4,children:r0(Zo,{variant:o?"secondary":"error",alertType:o?void 0:"error",label:"Timeout",tooltipMsg:"Duration that answers can be submitted to the oracle (resets when a new answer is submitted)",valueUnit:f("timeoutUnit"),value:r,onChange:(c,d)=>{t({...e,timeout:c,timeoutUnit:d})}})}),r0(fe,{item:!0,xs:4,children:r0(Zo,{variant:s?"secondary":"error",alertType:s?void 0:"error",label:"Cooldown",tooltipMsg:"Duration required before the transaction can be executed (after the timeout has expired).",valueUnit:f("cooldownUnit"),value:a,onChange:(c,d)=>{t({...e,cooldown:c,cooldownUnit:d})}})}),r0(fe,{item:!0,xs:4,children:r0(Zo,{variant:l?"secondary":"error",alertType:l?void 0:"error",label:"Expiration",tooltipMsg:"Duration that a transaction is valid in seconds (or 0 if valid forever) after the cooldown (note this applies to all proposals on this module).",valueUnit:f("expirationUnit"),value:i??0,onChange:(c,d)=>{t({...e,expiration:c,expirationUnit:d})}})})]})}),r0(q9,{type:"timeout",delayValue:parseInt(r)}),r0(q9,{type:"cooldown",delayValue:parseInt(a)}),r0(q9,{type:"expiration",delayValue:parseInt(i),dependsDelayValue:parseInt(a)})]})},EMe=en(e=>({container:{display:"flex",flexDirection:"column"},textSubdued:{color:"rgba(255 255 255 / 70%)"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},error:{"& .MuiInputBase-root":{borderColor:"rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.1)","&::before":{borderColor:"rgba(244, 67, 54, 0.3)"}}}})),GO=.1,TMe=({data:e,setData:t})=>{const n=EMe(),f=a=>i=>t({...e,[a]:i}),r=(a=>e[a])("bond");return ve(fe,{container:!0,spacing:2,className:n.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:n.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Bond"})}),r0(fe,{item:!0,children:ve(ze,{variant:"body2",className:n.textSubdued,children:["Minimum bond required for an answer to be accepted. New answers must be submitted with double the previous bond. For more on why a bond is required in an escalation-game-based oracle, read more in the"," ",r0(d1,{underline:"always",href:"http://reality.eth.link/app/docs/html/whitepaper.html",target:"_blank",color:"inherit",children:"Reality.eth whitepaper."})]})})]})}),r0(fe,{item:!0,children:r0(Cr,{label:"Bond",color:"secondary",borderStyle:"double",className:rf("bond")(a.target.value)})}),r({container:{display:"flex",flexDirection:"column"},textSubdued:{color:"rgba(255 255 255 / 70%)"}})),CMe=({data:e,setData:t})=>{const n=MMe(),f=a=>i=>t({...e,[a]:i}),r=a=>e[a];return ve(fe,{container:!0,spacing:2,className:n.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Arbitration"})}),r0(fe,{item:!0,children:ve(ze,{variant:"body2",className:n.textSubdued,children:["An arbitrator is responsible for providing a final answer to a question when there is a dispute, in exchange for a fee. In most cases, the bond escalation-game eliminates the need for this. However, if you feel it's necessary to include a backup arbitration strategy incase of a dispute, you can select one from below. Read more in the"," ",r0(d1,{underline:"always",href:"https://reality.eth.link/app/docs/html/arbitrators.html",target:"_blank",color:"inherit",children:"Reality.eth arbitrators documentation"}),"."]})})]})}),r0(fe,{item:!0,children:r0(_S,{value:r("arbitratorOption"),options:[{label:"No arbitration (highest bond wins)",value:W3.NO_ARBITRATOR},{label:"Kleros",value:W3.KLEROS}],disableUnderline:!0,label:"Arbitrator:",onChange:({target:a})=>f("arbitratorOption")(a.value)})})]})},SMe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},icon:{fill:"white",width:"20px"},divider:{marginTop:8,marginBottom:8},warningModal:{maxWidth:650},errorPaperContainer:{width:"100%",padding:e.spacing(1),background:"rgba(0, 0, 0, 0.2)",border:0,borderRadius:4,display:"inline-block","& .MuiTypography-root":{fontFamily:"Roboto Mono"}}})),q90=[{label:"ETH-0x5b7dD1E86623548AF054A4985F7fc8Ccbb554E2c",value:"ETH-0x5b7dD1E86623548AF054A4985F7fc8Ccbb554E2c"},{label:"GNO-0x33aa365a53a4c9ba777fb5f450901a8eef73f0a9",value:"GNO-0x33aa365a53a4c9ba777fb5f450901a8eef73f0a9"}],W90=[{label:"ETH-0x6F80C5cBCF9FbC2dA2F0675E56A5900BB70Df72f",value:"ETH-0x6F80C5cBCF9FbC2dA2F0675E56A5900BB70Df72f"}],OMe=({handleBack:e,handleNext:t,setupData:n})=>{const f=SMe(),{safe:r}=uo.useSafeAppsSDK(),a=r.chainId===1?q90:W90,[i,o]=n0.useState(!1);if((n==null?void 0:n.proposal.ensName)==null)throw new Error("ENS name is not set");const[s,l]=n0.useState({templateType:"default",language:"english",category:"DAO proposal",templateQuestion:$S(n==null?void 0:n.proposal.ensName)}),[c,d]=n0.useState({instanceAddress:a[0].value.substr(a[0].value.indexOf("-")+1),instanceType:a[0].value.substr(0,a[0].value.indexOf("-"))}),[p,x]=n0.useState({timeout:sMe,timeoutUnit:"days",cooldown:cMe,cooldownUnit:"days",expiration:dMe,expirationUnit:"days"}),[C,O]=n0.useState({bond:.1}),{timeout:L,cooldown:D,expiration:V}=p,{bond:Y}=C,i0=jc("timeout",L),m0=jc("cooldown",D),A0=jc("expiration",V,D),T0=G9("timeout",L),I0=G9("cooldown",D),z0=G9("expiration",V),[oe,ae]=n0.useState({arbitratorOption:W3.NO_ARBITRATOR}),ye=()=>({templateData:s,instanceData:c,delayData:p,bondData:C,arbitratorData:oe}),P=()=>{if([T0,I0,z0].includes(!1)||Y{if(n&&n.oracle){const{bondData:F,delayData:Q,instanceData:H,templateData:u0,arbitratorData:h0}=n.oracle;O(F),x(Q),d(H),l(u0),ae(h0)}},[n]),(n==null?void 0:n.proposal.ensName)==null)throw new Error("The ENS name is not available, it needs to already be in the setupData, before initiating this step.");return ve(wf,{borderStyle:"single",className:f.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[ve(fe,{container:!0,spacing:4,className:f.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Set up the Oracle"})}),r0(fe,{item:!0,children:ve(ze,{children:["Now, it's time to set up the oracle for your reality module. The oracle ensures the results of proposals are brought accurately on-chain. The Reality.eth oracle uses a mechanism known as the"," ",r0(Jo,{underline:"always",href:"https://reality.eth.limo/app/docs/html/whitepaper.html",target:"_blank",color:"inherit",children:"escalation game"})," ","to generate correct answers that can be used as inputs for smart contracts. The following parameters are very important for your DAO's security and should be considered carefully."]})})]})}),r0(fe,{item:!0,children:r0(zo,{})}),r0(fe,{item:!0,children:r0(Xce,{data:s,setData:l,ensName:n==null?void 0:n.proposal.ensName})}),r0(fe,{item:!0,children:r0(oMe,{data:c,setData:d})}),r0(fe,{item:!0,children:r0(xMe,{data:p,setData:x})}),r0(fe,{item:!0,children:r0(TMe,{data:C,setData:O})}),r0(fe,{item:!0,children:r0(CMe,{data:oe,setData:ae})}),r0(fe,{item:!0,style:{paddingBottom:0},children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:()=>e(ye()),children:"Back"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",disabled:[i0,m0,A0].includes(!1),onClick:P,children:"Next"})})]})})]}),r0(_r0,{className:f.warningModal,open:i,isOpen:i,onClose:()=>o(!i),children:ve(fe,{container:!0,spacing:1,direction:"column",children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,alignItems:"center",children:[r0(fe,{item:!0,children:r0(gc,{className:f.icon})}),r0(fe,{item:!0,children:r0(ze,{variant:"h4",children:"Security Risk Detected"})})]})}),r0(fe,{item:!0,children:r0(ze,{children:"The following security risks have been detected. We highly recommend that you resolve them before moving forward, as these can leave to loss of funds."})}),r0(fe,{item:!0,children:ve(wf,{borderStyle:"single",className:f.errorPaperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[r0(q9,{type:"timeout",delayValue:L}),r0(q9,{type:"cooldown",delayValue:D}),r0(q9,{type:"expiration",delayValue:V,dependsDelayValue:D}),Yt(ye()),children:"Proceed"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",onClick:()=>o(!1),children:"Resolve (Recommended)"})})]})})]})})]})},kMe=en(e=>({icon:{fill:"white",width:"20px"},paperContainer:{padding:e.spacing(2),background:"rgba(244, 67, 54, 0.1)",border:"1px solid rgba(244, 67, 54, 0.3)","&, &:before, &:after":{border:"1px solid rgba(244, 67, 54, 0.3)"}},addressPaperContainer:{width:"100%",padding:e.spacing(1),background:"rgba(0, 0, 0, 0.2)",border:0,borderRadius:4,display:"inline-block","& .MuiTypography-root":{fontFamily:"Roboto Mono"}}})),NMe=({title:e,type:t,address:n})=>{const f=kMe();return ve(fe,{container:!0,spacing:1,direction:"column",children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,alignItems:"center",children:[r0(fe,{item:!0,children:r0(gc,{className:f.icon})}),r0(fe,{item:!0,children:r0(ze,{variant:"h4",children:e})})]})}),r0(fe,{item:!0,children:ve(ze,{children:[t==="controller"&&"The safe you are currently using with Zodiac is not the controller of the ENS you've entered. Try one of the following: ",t==="owner"&&"The ENS that you've entered is not owned by a safe. This gives unilateral control to the individual with this address: ",t==="safesnap"&&"The Snapshot space has already installed the Safesnap plugin.",t==="snapshot"&&e.includes("Invalid")&&"The current snapshot settings file is invalid. Check the browser console for validation details. The schema for validating the settings file can be found",t==="snapshot"&&e.includes("Invalid")&&ve(Er,{children:[" ",r0(Jo,{underline:"always",href:"https://github.com/snapshot-labs/snapshot.js/blob/master/src/schemas/space.json",target:"_blank",color:"inherit",children:"here."})]}),t==="snapshot"&&!e.includes("Invalid")&&"The ENS you've entered is not setup with a Snapshot space. To setup a snapshot space with this ENS, follow the guide",t==="snapshot"&&!e.includes("Invalid")&&ve(Er,{children:[" ",r0(Jo,{underline:"always",href:"https://docs.snapshot.org/spaces/create",target:"_blank",color:"inherit",children:"here."})]})]})}),n&&r0(fe,{item:!0,children:r0(wf,{borderStyle:"double",className:f.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0(wf,{borderStyle:"single",className:f.addressPaperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0(ze,{variant:"body2",children:n})})})}),["controller","owner"].includes(t)&&r0(fe,{item:!0,children:ve(ze,{children:[t==="controller"&&"- Check that your ENS is typed correctly.",t==="owner"&&"We highly recommend transferring the ENS to a multisig safe before continuing."]})}),t==="controller"&&r0(fe,{item:!0,children:ve(ze,{children:["- Update your ENS controller settings via the"," ",r0(Jo,{underline:"always",href:"https://docs.ens.domains/contract-api-reference/.eth-permanent-registrar/controller",target:"_blank",color:"inherit",children:"ENS."})]})})]})},PMe=en(e=>({message:{fontSize:12,color:"rgba(244, 67, 54, 1)"},messageDetails:{fontSize:12,textDecoration:"underline",cursor:"pointer"},errorIcon:{fill:"rgba(244, 67, 54, 1)",width:"20px"},detailsContainer:{width:"95%"},messageContainer:{width:"85%"}})),qO=({status:e,message:t,type:n,address:f})=>{const r=PMe(),[a,i]=n0.useState(!1),o=(()=>{switch(n){case"controller":return"Safe not controller of ENS";case"owner":return"Security Risk Detected";case"snapshot":return t!=null&&t.includes("invalid")?"Invalid Snapshot settings file":"Snapshot space not found";case"safesnap":return"Safesnap plugin is already installed";default:return""}})();return e&&ve(fe,{container:!0,spacing:1,alignItems:"center",children:[ve(fe,{item:!0,children:[e==="error"&&r0(gc,{className:r.errorIcon}),e==="warning"&&r0(wG,{className:r.errorIcon})]}),r0(fe,{item:!0,className:r.detailsContainer,children:ve(fe,{container:!0,justifyContent:"space-between",alignItems:"center",children:[r0(fe,{item:!0,className:r.messageContainer,children:r0(ze,{className:r.message,children:t})}),r0(fe,{item:!0,children:r0(ze,{className:r.messageDetails,onClick:()=>i(!a),children:"Details"})})]})}),r0(_r0,{open:a,isOpen:a,onClose:()=>i(!a),children:r0(NMe,{title:o,type:n,address:f})})]})},WO=(e,t,n,f,r,a,i)=>{if(!t){if(e==="snapshot"&&!r||e==="snapshot"&&!a||e==="controller"&&!n||e==="safesnap"&&i)return"error";if(e==="owner"&&!f)return"warning"}return null},QO=(e,t,n,f,r,a)=>e==="snapshot"&&!f?"The ENS name should have a Snapshot space created.":e==="snapshot"&&!r?"Your snapshot settings file is invalid.":e==="controller"&&!t?"The safe must be the controller of the ENS name.":e==="owner"&&!n?"The safe is not the owner of the ENS name. We highly recommend transferring the ENS to this safe or enter a different ENS before continuing.":e==="safesnap"&&a?"The plugin is already installed on the Snapshot space.":null;function IMe(e,t=500){const[n,f]=n0.useState(e),[r,a]=n0.useState(e);return n0.useEffect(()=>{f(e)},[e]),n0.useEffect(()=>{const i=setTimeout(()=>{a(n)},t);return()=>{clearTimeout(i)}},[n,t]),[n,r,f]}const RMe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},doneIcon:{marginRight:4,fill:"#A8E07E",width:"16px"},errorIcon:{marginRight:4,fill:"rgba(244, 67, 54, 1)",width:"16px"},loadingContainer:{marginRight:4,padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:14,width:14,border:`1px solid ${Jt.tan[300]}`},spinner:{width:"8px !important",height:"8px !important",color:`${Jt.tan[300]} !important`},loading:{width:"15px !important",height:"15px !important",marginRight:8},radio:{marginLeft:-2,padding:2,"& ~ .MuiFormControlLabel-label":{fontSize:12,marginLeft:4},"&$checked":{color:Jt.tan[1e3]}},checked:{},textSubdued:{color:"rgba(255 255 255 / 70%)"},textFieldSmall:{"& .MuiFormLabel-root":{fontSize:12}},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},inputError:{"& .MuiInputBase-root":{borderColor:"rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.1)","&::before":{borderColor:"rgba(244, 67, 54, 0.3)"}}},errorContainer:{margin:8,display:"flex",alignItems:"center"}})),BMe=({handleNext:e,handleBack:t,setupData:n})=>{const{ensClient:f}=z90(),{safe:r,provider:a}=hi(),i=RMe(),[o,s,l]=IMe(""),[c,d]=n0.useState(""),[p,x]=n0.useState(!1),[C,O]=n0.useState(!1),[L,D]=n0.useState(!1),[V,Y]=n0.useState(!1),[i0,m0]=n0.useState(!1),[A0,T0]=n0.useState(!1),[I0,z0]=n0.useState(!1);n0.useEffect(()=>{a&&n&&n.proposal&&l(n.proposal.ensName)},[]),n0.useEffect(()=>{(async()=>s&&f&&(await f.getSubgraphRecords({name:s})?(z0(!0),T0(!0),(async()=>await oe())()):(z0(!1),D(!1),x(!1))))()},[s,f]);const oe=async()=>{var F;if(!f)return;const P=(F=await Cq(f,{name:s}))==null?void 0:F.value;if(P){const Q=await gG(o,r.chainId);console.log(Q);const H=await Hoe(f,o,r.safeAddress),u0=await Iu0(a,f,o,r.safeAddress),h0=Q==null?void 0:Q.plugins;h0&&O(!!h0.safeSnap),Y(!!Q),x(H),D(u0),d(P),T0(!1);return}else{d(""),T0(!1),x(!1),D(!1),Y(!1),m0(!1),O(!1);return}},ae=()=>({ensName:o}),ye=P=>{P===""?(D(!1),x(!1),Y(!1),m0(!1),l("")):l(P)};return r0(wf,{borderStyle:"single",className:i.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:4,className:i.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:i.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Configure Proposal Space"})}),r0(fe,{item:!0,children:r0(ze,{children:"Add your preferred proposal type below to get started. If you're unsure, we recommend starting with Snapshot."})}),r0(fe,{item:!0,children:ve(ze,{children:["Don't have a snapshot space setup yet?"," ",r0(Jo,{underline:"always",href:f0e(r,"https://snapshot.org/#/setup?step=1"),target:"_blank",color:"inherit",children:"Get started here."})]})})]})}),r0(fe,{item:!0,children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:i.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Proposal Configuration"})}),r0(fe,{item:!0,children:r0(ze,{variant:"body2",className:i.textSubdued,children:"Enter your snapshot space ENS domain below to get started. The Safe must be the controller of this ENS domain."})}),ve(fe,{item:!0,children:[r0(Cr,{value:o,onChange:({target:P})=>ye(P.value),label:"Enter the Snapshot ENS name.",placeholder:"ex: gnosis.eth",borderStyle:"double",className:`${i.textFieldSmall} ${o.includes(".eth")&&!A0&&(!V||!L||!p)?i.inputError:i.input}`,rightIcon:ve(Er,{children:[A0&&r0(ua,{className:i.loadingContainer,children:r0(fi.Loader,{size:"sm",className:i.spinner})}),o.includes(".eth")&&!A0&&(!V||!L||!p)&&r0(gc,{className:i.errorIcon}),o.includes(".eth")&&!A0&&V&&L&&p&&r0(ow,{className:i.doneIcon})]})}),r0("br",{}),r0("br",{}),I0&&ve(Er,{children:[r0(qO,{type:"snapshot",status:WO("snapshot",A0,!1,!1,V,i0,!1),message:QO("snapshot",!1,!1,V,i0,!1)}),r0(qO,{type:"safesnap",status:WO("safesnap",A0,!1,!1,!1,!1,C),message:QO("safesnap",!1,!1,!1,!1,C)}),r0(qO,{type:"controller",status:WO("controller",A0,L,!1,!1,!1,!1),message:QO("controller",L,!1,!1,!1,!1)}),r0(qO,{type:"owner",status:WO("owner",A0,!1,p,!1,!1,!1),message:QO("owner",!1,p,!1,!1,!1),address:c})]})]})]})}),r0(fe,{item:!0,style:{paddingBottom:0},children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:()=>t(ae()),children:"Cancel"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",disabled:!L||C,onClick:()=>e(ae()),children:"Next"})})]})})]})})},DMe=en(()=>({circle:{padding:6,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:25,width:25,border:`1px solid ${Jt.tan[300]}`,background:Jt.blue[500]},label:{display:"inline",fontFamily:"Roboto Mono",cursor:"pointer","&:hover":{textDecoration:"underline"}}})),Q90=({label:e,number:t,disabled:n,onClick:f})=>{const r=DMe();return ve(fe,{container:!0,spacing:1,alignItems:"center",onClick:()=>{!n&&f()},children:[r0(fe,{item:!0,children:r0(ua,{className:r.circle,children:r0(ze,{children:t})})}),r0(fe,{item:!0,children:r0(ze,{className:r.label,children:e})})]})};var dW={},LMe=W5,jMe=mc;Object.defineProperty(dW,"__esModule",{value:!0});var pW=dW.default=void 0,FMe=jMe(n0),zMe=LMe(yc()),VMe=(0,zMe.default)(FMe.createElement("path",{d:"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward");pW=dW.default=VMe;var bW={},UMe=W5,HMe=mc;Object.defineProperty(bW,"__esModule",{value:!0});var Y90=bW.default=void 0,GMe=HMe(n0),qMe=UMe(yc()),WMe=(0,qMe.default)(GMe.createElement("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Y90=bW.default=WMe;var hW={},QMe=W5,YMe=mc;Object.defineProperty(hW,"__esModule",{value:!0});var K90=hW.default=void 0,KMe=YMe(n0),JMe=QMe(yc()),ZMe=(0,JMe.default)(KMe.createElement("path",{d:"M19 13H5v-2h14v2z"}),"Remove");K90=hW.default=ZMe;var mW={},XMe=W5,_Me=mc;Object.defineProperty(mW,"__esModule",{value:!0});var yW=mW.default=void 0,$Me=_Me(n0),eCe=XMe(yc()),tCe=(0,eCe.default)($Me.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear");yW=mW.default=tCe;const nCe=en(e=>({message:{fontSize:"0.9rem"},messageError:{fontSize:"0.9rem",color:"rgba(244, 67, 54, 1)"},circle:{padding:6,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,background:Jt.tan[1e3]},loadingContainer:{padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,border:`1px solid ${Jt.tan[300]}`},errorContainer:{padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,border:"1px solid rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.3)"},errorIcon:{width:"12px",height:"12px",color:"#F44336"},loading:{width:"12px !important",height:"12px !important",color:`${Jt.tan[300]} !important`},doneIcon:{fill:"black",width:"16px"}})),fCe=({statusLog:e})=>{const t=nCe();return r0(fe,{container:!0,spacing:1,alignItems:"center",children:e.map((n,f)=>r0(fe,{item:!0,xs:12,children:ve(fe,{container:!0,spacing:1,alignItems:"center",children:[ve(fe,{item:!0,children:[e.length>f+1&&!n.error&&r0(ua,{className:t.circle,children:r0(ow,{className:t.doneIcon})}),e.length===f+1&&!n.error&&r0(ua,{className:t.loadingContainer,children:r0(fi.Loader,{size:"sm",className:t.loading})}),e.length===f+1&&n.error&&r0(ua,{className:t.errorContainer,children:r0(yW,{className:t.errorIcon})})]}),r0(fe,{item:!0,children:r0(ze,{className:n.error?t.messageError:t.message,children:n.msg})})]},f)},`status-${f}`))})},rCe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},paperTemplateContainer:{marginTop:4,padding:e.spacing(2),background:"rgba(0, 0, 0, 0.2)"},textSubdued:{color:"rgba(255 255 255 / 70%)"},icon:{fill:"white",cursor:"pointer"},collapse:{textDecoration:"underline",cursor:"pointer"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},textarea:{"& .MuiInputBase-root":{padding:e.spacing(2),background:"rgba(0, 0, 0, 0.2)",borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},link:{fontFamily:"Roboto Mono",fontSize:12,textDecoration:"underline",fontWeight:"bold"},label:{fontFamily:"Roboto Mono",fontSize:12,fontWeight:"bold"},loading:{width:"15px !important",height:"15px !important"}})),aCe=[{label:"Proposal",number:1,section:0},{label:"Oracle",number:2,section:1},{label:"Monitoring",number:3,section:2}],iCe=({handleBack:e,handleNext:t,goToStep:n,delayModules:f,setupData:r,loading:a,statusLog:i})=>{const o=rCe(),{safe:s}=uo.useSafeAppsSDK(),[l,c]=n0.useState(),[d,p]=n0.useState(!1),[x,C]=n0.useState(void 0),[O,L]=n0.useState(f.length===1?f[0].address:""),D=r&&r.monitoring;return n0.useEffect(()=>{r&&r.proposal&&c(jce(s.chainId,r.proposal.ensName)),r&&r.oracle&&C(r.oracle)},[r]),r0(wf,{borderStyle:"single",className:o.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:4,className:o.container,children:[!d&&ve(Er,{children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:o.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Review"})}),r0(fe,{item:!0,children:r0(ze,{children:"Here is an overview of your reality module configuration. Please review carefully. Once you've confirmed that the details are correct, you can submit the transaction which will add the reality module to this safe, and automatically integrate the SafeSnap plugin with the snapshot space you've include."})})]})}),r0(fe,{item:!0,children:r0(zo,{})}),aCe.map(V=>ve(Pt.Fragment,{children:[r0(fe,{item:!0,children:r0(Q90,{label:V.label,number:V.number,disabled:a,onClick:()=>n(V.section)})}),V.label==="Proposal"&&ve(fe,{item:!0,children:[r0(ze,{children:"Snapshot Space:"}),r0(d1,{color:"inherit",href:l,target:"_blank",className:o.link,children:l})]}),V.label==="Oracle"&&x&&r&&r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,direction:"column",children:[ve(fe,{item:!0,children:[r0(ze,{children:"Template question preview:"}),r0(wf,{className:o.paperTemplateContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0(ze,{children:r.oracle.templateData.templateQuestion})})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Oracle Address:"}),r0(d1,{color:"inherit",href:`${Zz[s.chainId]}/search?f=0&q=${x.instanceData.instanceAddress}`,target:"_blank",className:o.link,children:x.instanceData.instanceAddress})]}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,justifyContent:"space-between",alignItems:"center",children:[ve(fe,{item:!0,children:[r0(ze,{children:"Timeout:"}),ve(ze,{className:o.label,children:[(BigInt(x.delayData.timeout)/BigInt(_p[x.delayData.timeoutUnit])).toString()," ",x.delayData.timeoutUnit]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Cooldown:"}),ve(ze,{className:o.label,children:[(BigInt(x.delayData.cooldown)/BigInt(_p[x.delayData.cooldownUnit])).toString()," ",x.delayData.cooldownUnit]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Expiration:"}),ve(ze,{className:o.label,children:[(BigInt(x.delayData.expiration)/BigInt(_p[x.delayData.expirationUnit])).toString()," ",x.delayData.expirationUnit]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Bond:"}),ve(ze,{className:o.label,children:[x.bondData.bond," ETH"]})]})]})}),ve(fe,{item:!0,children:[r0(ze,{children:"Arbitrator:"}),ve(ze,{className:o.label,children:[x.arbitratorData.arbitratorOption===0&&"No arbitration (highest bond wins)",x.arbitratorData.arbitratorOption===1&&"Kleros"]})]})]})}),V.label==="Monitoring"&&D&&r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,direction:"column",children:[ve(fe,{item:!0,children:[r0(ze,{children:"API key/secret:"}),r0(ze,{className:o.label,children:"Valid"})]}),D.email.length>0&&ve(fe,{item:!0,children:[r0(ze,{children:"Emails:"}),D.email.map((Y,i0)=>ve(ze,{className:o.label,children:["- ",Y]},i0))]}),D.discordKey!==""&&ve(fe,{item:!0,children:[r0(ze,{children:"Discord:"}),r0(ze,{className:o.label,children:D.discordKey})]}),D.telegram.botToken!==""&&ve(fe,{item:!0,children:[r0(ze,{children:"Telegram:"}),ve(ze,{className:o.label,children:["Bot token: ",D.telegram.botToken]}),ve(ze,{className:o.label,children:["Chat ID: ",D.telegram.chatId]})]}),D.slackKey!==""&&ve(fe,{item:!0,children:[r0(ze,{children:"Slack:"}),r0(ze,{className:o.label,children:D.slackKey})]})]})}),r0(fe,{item:!0,children:r0(zo,{})})]},V.label)),f.length>=1&&r0(fe,{item:!0,children:r0(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:ve(fe,{item:!0,children:[r0(ze,{variant:"h6",gutterBottom:!0,children:"Deploy Options"}),r0(eS,{description:oCe,modules:f,value:O,onChange:V=>L(V),type:Cn.DELAY})]})})})]}),i.length>0&&r0(fe,{item:!0,onClick:()=>p(!d),children:ve(fe,{container:!0,spacing:1,children:[r0(fe,{item:!0,children:d?r0(Y90,{className:o.icon}):r0(K90,{className:o.icon})}),r0(fe,{item:!0,className:o.collapse,children:r0(ze,{children:d?"Show More":"Show Less"})})]})}),i.length>0&&r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:o.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Setting up Module"})}),r0(fe,{item:!0,children:r0(fCe,{statusLog:i})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:e,disabled:a,children:"Back"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",startIcon:a?r0(fi.Loader,{className:o.loading,size:"sm",color:"background"}):r0(pW,{}),disabled:a,onClick:()=>{p(!0),t(r)},children:"Submit"})})]})})]})})},oCe=ve(ze,{variant:"body2",children:["This will add a time delay to any transactions created by this module."," ",r0("b",{children:"Note that this delay is cumulative with the cooldown set above"})," (e.g. if both are set to 24 hours, the cumulative delay before the transaction can be executed will be 48 hours)."]}),sCe=en(()=>({paperContainer:{background:"rgba(0, 0, 0, 0.2)"},message:{fontSize:12,color:"rgba(244, 67, 54, 1)"}})),lCe={control:(e,t)=>({...e,background:"none",border:"none",fontFamily:"Roboto Mono !important",color:"yellow !important",boxShadow:(t.isFocused,null),"&:hover":{border:"none"}}),option:e=>({...e,color:"white",backgroundColor:"#101010",cursor:"pointer"}),menu:e=>({...e,borderRadius:0,backgroundColor:"#101010",marginTop:0}),menuList:e=>({...e,padding:0}),multiValue:e=>({...e,color:"white !important",background:Jt.tan[300],maxWidth:"calc(28% - 4px)","&:hover":{background:Jt.tan[300]},"& > div":{color:"white !important"},"& > div[role=button]:hover":{cursor:"pointer",color:"blue",background:Jt.tan[500]}})},cCe=e=>{const t=sCe();return ve(fe,{container:!0,spacing:1,direction:"column",children:[r0(fe,{item:!0,children:r0(wf,{className:t.paperContainer,borderStyle:"double",placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0(uc0,{...e,isMulti:!0,styles:lCe,options:e.options,theme:n=>({...n,colors:{...n.colors,font:"#101010",primary25:"#101010",primary:"#101010",neutral80:"white"}})})})}),e.invalidText&&r0(fe,{item:!0,children:r0(ze,{className:t.message,children:e.invalidText})})]})},J90=e=>{const t=n0.useRef();return n0.useEffect(()=>{t.current=e},[e]),t.current},uCe=en(e=>({message:{fontSize:"0.9rem"},messageError:{fontSize:"0.8rem",color:"rgba(244, 67, 54, 1)"},circle:{padding:6,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,background:Jt.tan[1e3]},loadingContainer:{padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,border:`1px solid ${Jt.tan[300]}`},errorContainer:{padding:2,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",height:20,width:20,border:"1px solid rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.3)"},errorIcon:{width:"12px",height:"12px",color:"#F44336"},loading:{width:"12px !important",height:"12px !important",color:`${Jt.tan[300]} !important`},doneIcon:{fill:"black",width:"16px"}})),dCe=({status:e,message:t})=>{const n=uCe();return e&&ve(fe,{container:!0,spacing:1,alignItems:"center",children:[ve(fe,{item:!0,children:[e==="success"&&r0(ua,{className:n.circle,children:r0(ow,{className:n.doneIcon})}),e==="loading"&&r0(ua,{className:n.loadingContainer,children:r0(fi.Loader,{size:"sm",className:n.loading})}),e==="error"&&r0(ua,{className:n.errorContainer,children:r0(yW,{className:n.errorIcon})})]}),r0(fe,{item:!0,children:r0(ze,{className:e==="error"?n.messageError:n.message,children:t})})]})},pCe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},textSubdued:{color:"rgba(255 255 255 / 70%)"},inputContainer:{width:"50%"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},inputError:{"& .MuiInputBase-root":{borderColor:"rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.1)","&::before":{borderColor:"rgba(244, 67, 54, 0.3)"}}},textarea:{"& .MuiInputBase-root":{padding:e.spacing(2),background:"rgba(0, 0, 0, 0.2)",borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},spinner:{width:"8px !important",height:"8px !important",color:`${Jt.tan[300]} !important`}})),bCe={apiKey:"",secretKey:"",email:[],discordKey:"",telegram:{botToken:"",chatId:""},slackKey:""},hCe=({handleBack:e,handleNext:t,setupData:n})=>{const f=pCe(),{loading:r,execute:a,error:i}=A20(),o=n==null?void 0:n.monitoring,[s,l]=n0.useState(o??bCe),[c,d]=n0.useState([]),[p,x]=n0.useState(!1),[C,O]=n0.useState(!1),{apiKey:L,secretKey:D,email:V,discordKey:Y,slackKey:i0,telegram:m0}=s,A0=J90(L),T0=J90(D);n0.useEffect(()=>{if(o&&o.email.length){const F=[];o.email.forEach(Q=>F.push({label:Q,value:Q})),d(F)}},[o]),n0.useEffect(()=>{!r&&![L,D].includes("")&&!C&&(O(!0),(async()=>await a(L,D))())},[L,D,r,C,a]),n0.useEffect(()=>{(A0!==L||T0!==D)&&C&&O(!1)},[L,D,A0,T0,C]);const I0=(F,Q)=>{if(F.preventDefault(),["chatId","botToken"].includes(Q)){const H={...s.telegram,[Q]:F.target.value};l({...s,telegram:H});return}l({...s,[Q]:F.target.value})},z0=F=>/\S+@\S+\.\S+/.test(F),oe=F=>{var H;const Q=(H=F[F.length-1])==null?void 0:H.value;z0(Q)||Q==null?(x(!1),d(F),l({...s,email:F.map(u0=>u0.value)})):x(!0)},ae=()=>r?"Validating API credentials...":i?"The API credentials that you have provided are not valid. Please verify that you have the correct information.":!i&&typeof i=="boolean"?"API credentials are valid.":null,ye=()=>r?"loading":i?"error":!i&&typeof i=="boolean"?"success":null,P=()=>{const{botToken:F,chatId:Q}=m0;return!!(r||i||F===""&&Q!==""||F!==""&&Q===""||F===""&&Q===""&&Y===""&&i0===""&&V.length===0)};return r0(wf,{borderStyle:"single",className:f.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:4,className:f.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Configure Monitoring"})}),r0(fe,{item:!0,children:ve(ze,{children:["Setting up an effective monitoring strategy is critical for the security of your safe. In order to set up the monitoring for this module, you'll need to first"," ",r0(Jo,{underline:"always",href:"https://defender.openzeppelin.com/#/auth/sign-in",target:"_blank",color:"inherit",children:"create an Open Zeppelin account."})]})})]})}),r0(fe,{item:!0,children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"API Configuration"})}),r0(fe,{item:!0,children:ve(ze,{children:["Include the API Key and Secret Key from your Open Zeppelin account below. Follow the Open Zeppelin guide ","",r0(Jo,{underline:"always",href:"https://docs.openzeppelin.com/defender/v2/manage.html#relayer-api-keys",target:"_blank",color:"inherit",children:"here."})]})}),r0(fe,{item:!0,children:r0(Cr,{label:"API Key",placeholder:"0f9u8yuiahkjdh8qhiflahfjajdhafa",borderStyle:"double",value:s.apiKey,onChange:F=>I0(F,"apiKey"),className:i?f.inputError:f.input})}),r0(fe,{item:!0,children:r0(Cr,{label:"API Secret",placeholder:"hkjdh8qhiflahfjajdhafa0f9u8yuiahkjdh8qhiflahfjajdhafa",value:s.secretKey,onChange:F=>I0(F,"secretKey"),borderStyle:"double",className:i?f.inputError:f.input})}),r0(fe,{item:!0,children:r0(dCe,{status:ye(),message:ae()})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Email"})}),r0(fe,{item:!0,children:r0(ze,{children:"Add as many emails as you'd like."})}),r0(fe,{item:!0,children:r0(cCe,{invalidText:p?"Please provide a valid email":void 0,onChange:F=>oe(F),value:c})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Discord"})}),r0(fe,{item:!0,children:ve(ze,{children:["To add a Discord integration, include the Discord channel's url including key below. Find out more"," ",r0(Jo,{underline:"always",href:"https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks",target:"_blank",color:"inherit",children:"here."})]})}),r0(fe,{item:!0,children:r0(Cr,{label:"Discord Key",placeholder:"key",borderStyle:"double",className:f.input,value:s.discordKey,onChange:F=>I0(F,"discordKey")})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Telegram"})}),r0(fe,{item:!0,children:ve(ze,{children:["To add a Telegram integration, include the telegram bot token and chat ID below. Find out more"," ",r0(Jo,{underline:"always",href:"https://core.telegram.org/bots#6-botfather",target:"_blank",color:"inherit",children:"here."})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,direction:"row",alignItems:"center",justifyContent:"space-between",children:[r0(fe,{item:!0,className:f.inputContainer,children:r0(Cr,{label:"Bot token",placeholder:"abc",borderStyle:"double",className:f.input,value:s.telegram.botToken,onChange:F=>I0(F,"botToken")})}),r0(fe,{item:!0,className:f.inputContainer,children:r0(Cr,{label:"Chat ID",placeholder:"123",borderStyle:"double",className:f.input,value:s.telegram.chatId,onChange:F=>I0(F,"chatId")})})]})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Slack"})}),r0(fe,{item:!0,children:ve(ze,{children:["To add a Slack integration, include the Slack channel's url including key below. Find out more"," ",r0(Jo,{underline:"always",href:"https://docs.openzeppelin.com/defender/sentinel#notifications",target:"_blank",color:"inherit",children:"here."})]})}),r0(fe,{item:!0,children:r0(Cr,{label:"Slack Channel URL",placeholder:"https://slack.com/url/key",borderStyle:"double",className:f.input,value:s.slackKey,onChange:F=>I0(F,"slackKey")})})]})}),r0(fe,{item:!0,style:{paddingBottom:0},children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:()=>e(s),children:"Back"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",type:"submit",disabled:P(),onClick:()=>t(s),children:"Next"})})]})})]})})},mCe=["proposal","oracle","monitoring","review"],yCe=en(e=>({root:{height:"100%",display:"flex",flexDirection:"column",padding:e.spacing(1.5),overflowY:"auto"},container:{display:"flex",flexDirection:"column"},tag:{background:e.palette.secondary.main},paperContainer:{padding:e.spacing(2)},paperTitle:{margin:0},step:{"& text":{fontFamily:"Roboto Mono"},"& .step-label":{textTransform:"capitalize",display:"inline",fontFamily:"Roboto Mono","&.clickable":{cursor:"pointer","&:hover":{textDecoration:"underline"}}}},stepperRoot:{backgroundColor:"transparent",border:"none",padding:e.spacing(0),"& .MuiStepIcon-active":{color:e.palette.secondary.main,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%"},"& .MuiStepIcon-completed":{background:e.palette.text.primary,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%",color:e.palette.secondary.main},"& .Mui-disabled .MuiStepIcon-root":{color:e.palette.primary.main,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%"}}})),gCe=()=>{const e=yCe(),{sdk:t,safe:n,provider:f}=hi(),r=lr(UC),a=A1(),i=lr(K3),[o,s]=n0.useState(i.length),[l,c]=n0.useState([]),[d,p]=n0.useState(0),[x,C]=n0.useState({proposal:!1,oracle:!1,monitoring:!1,review:!1}),[O,L]=n0.useState(!1),[D,V]=n0.useState(),Y=(A0,T0)=>{x[T0]&&p(A0)},i0=(A0,T0,I0)=>z0=>{p(A0),C({...x,[T0]:I0}),V({...D,[T0]:z0})},m0=async A0=>{const T0=[];if(L(!0),D==null)throw L(!1),new Error("No setup data");const I0=A0!==""||A0==null?n.safeAddress:A0,z0=(oe,ae)=>{if(ae!=null)throw ae.name==="OpenError"?T0.push({error:!0,msg:ae.toString()+"This error can be caused by add/track blockers. Please disable any blockers (for instance, the Brave Shield) and try again."}):T0.push({error:!0,msg:ae.toString()}),ae;T0.push({error:!1,msg:oe}),c(T0)};try{await Gce(f,t,n,I0,D,z0)}catch(oe){L(!1),console.error(oe)}a(hc(n)),a(qC(!0))};return n0.useEffect(()=>{O&&i.length>o&&(s(i.length),L(!1),a(WC(!1)))},[a,O,o,i]),r0("div",{className:e.root,children:ve(fe,{container:!0,spacing:2,className:e.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,children:[r0(fe,{item:!0,children:r0(sg,{icon:"reality",size:60})}),ve(fe,{item:!0,children:[r0(ze,{variant:"h5",children:"Reality Module"}),r0(ol0,{className:e.tag,tags:["Stackable","From Gnosis Guild"]})]})]})}),r0(fe,{item:!0,children:ve(ze,{gutterBottom:!0,children:["Allows Reality.eth questions to execute a transaction when resolved."," ",r0(Jo,{underline:"always",href:"https://www.zodiac.wiki/documentation/reality-module",target:"_blank",color:"inherit",children:"Read more here."})]})}),r0(fe,{item:!0,children:r0(zo,{})}),r0(fe,{item:!0,children:ve(wf,{borderStyle:"single",className:e.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[ve(fe,{container:!0,justifyContent:"space-between",alignItems:"center",style:{marginBottom:15},children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",gutterBottom:!0,className:e.paperTitle,children:"Add Reality Module"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"outlined",onClick:()=>a(WC(!1)),children:"Cancel"})})]}),r0(MD,{activeStep:d,className:e.stepperRoot,orientation:"vertical",children:mCe.map((A0,T0)=>ve(ED,{className:e.step,children:[ve(TD,{onClick:()=>Y(T0,A0),children:[r0(ze,{variant:"h6",className:Wf(T0<=d&&"clickable","step-label"),children:A0})," "]}),ve(Be0,{children:[A0==="proposal"&&r0(BMe,{handleNext:i0(T0+1,A0,!0),handleBack:()=>a(WC(!1)),setupData:D}),A0==="oracle"&&r0(OMe,{handleNext:i0(T0+1,A0,!0),handleBack:i0(d-1,A0,!1),setupData:D}),A0==="monitoring"&&r0(hCe,{handleNext:i0(T0+1,A0,!0),handleBack:i0(d-1,A0,!1),setupData:D}),A0==="review"&&r0(iCe,{handleNext:m0,handleBack:i0(d-1,A0,!1),goToStep:p,setupData:D,delayModules:r,loading:O,statusLog:l})]})]},A0))})]})})]})})},vCe=["function getVotes(address account) external view returns (uint256)","function getPastVotes(address account, uint256 blockNumber) external view returns (uint256)","function getPastTotalSupply(uint256 blockNumber) external view returns (uint256)","function delegates(address account) external view returns (address)","function delegate(address delegatee) external","function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external"],gW="0xD028d504316FEc029CFa36bdc3A8f053F6E5a6e4",Z90=1234,wCe=e=>async t=>{const n=new pf(t,vCe,e);try{await Promise.all([n.getVotes(gW),n.getPastVotes(gW,Z90),n.getPastTotalSupply(Z90),n.delegates.staticCall(gW)]),n.delegateBySig.name}catch(f){return console.log(f),!1}return!0},ACe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},radio:{marginLeft:-2,padding:2,"& ~ .MuiFormControlLabel-label":{fontSize:12,marginLeft:4},"&$checked":{color:Jt.tan[1e3]}},checked:{},errorColor:{color:"rgba(244, 67, 54, 1)"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},inputError:{"& .MuiInputBase-root":{borderColor:"rgba(244, 67, 54, 0.3)",background:"rgba(244, 67, 54, 0.1)","&::before":{borderColor:"rgba(244, 67, 54, 0.3)"}}}})),xCe={tokenAddress:void 0,tokenName:"",tokenSymbol:"",initialAmount:1e5,tokenConfiguration:"existingToken"},ECe=({handleNext:e,handleBack:t,setupData:n})=>{const f=ACe(),r=n.token,[a,i]=n0.useState(r),[o,s]=n0.useState(!1),{provider:l}=hi(),c=wCe(l),{tokenAddress:d,tokenName:p,tokenSymbol:x,tokenConfiguration:C,initialAmount:O}=a,L=()=>({tokenAddress:d,tokenName:p,tokenSymbol:x,tokenConfiguration:C,initialAmount:O}),D=()=>[d].includes("")?f.input:![d].includes(void 0)&&!o?f.inputError:f.input,V=m0=>{i({...a,tokenConfiguration:m0.target.value})},Y=(m0,A0)=>{i({...a,[A0]:m0.target.value})};n0.useEffect(()=>{[d].includes(void 0)||(async()=>aF(d)&&await c(d)?s(!0):s(!1))()},[d,c]);const i0=C==="existingToken"?!!(!o||[d].includes("")):C==="ERC721"||C==="ERC20"?!![p,x].includes(""):!0;return r0(wf,{borderStyle:"single",className:f.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:4,className:f.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Setup Token for Voting"})}),r0(fe,{item:!0,children:r0(ze,{children:"The following token will enable members to vote on proposals with this governor contract. The token must be ERC20Votes compatible."})})]})}),r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Token Configuration"})}),ve(fe,{item:!0,children:[r0(ze,{variant:"body2",children:"Do you have an existing token in your safe that you'd like to use as the token for voting in this contract?"}),ve(Ce0,{"aria-label":"Token Configuration",name:"Token Configuration",value:C,onChange:V,children:[r0(nT,{value:"existingToken",control:r0(s7,{classes:{root:f.radio,checked:f.checked}}),label:"Existing Token"}),r0(nT,{value:"ERC20",control:r0(s7,{classes:{root:f.radio,checked:f.checked}}),label:"Deploy a new ERC20 for voting."}),r0(nT,{value:"ERC721",control:r0(s7,{classes:{root:f.radio,checked:f.checked}}),label:"Deploy a new ERC721 for voting."})]})]}),C==="existingToken"&&ve(fe,{item:!0,children:[r0(Cr,{label:"Token Address",value:d,placeholder:"0xDf33060F476511F806C72719394da1Ad64",borderStyle:"double",className:D(),onChange:m0=>Y(m0,"tokenAddress")}),![d].includes(void 0)&&!o&&r0(rD,{className:f.errorColor,children:"Please provide a valid address"})]}),(C==="ERC20"||C==="ERC721")&&r0(n0.Fragment,{children:r0(fe,{item:!0,style:{width:"-webkit-fill-available"},children:ve(fe,{container:!0,spacing:2,justifyContent:"space-between",children:[r0(fe,{item:!0,xs:9,children:r0(Cr,{label:"Token Name",value:p,placeholder:"MyToken",borderStyle:"double",className:f.input,onChange:m0=>Y(m0,"tokenName"),tooltipMsg:"The same as collection name in OpenSea, e.g. Nouns"})}),r0(fe,{item:!0,xs:3,children:r0(Cr,{label:"Token Symbol",value:x,placeholder:"TKN",borderStyle:"double",className:f.input,onChange:m0=>Y(m0,"tokenSymbol"),tooltipMsg:"e.g. LOOT"})})]})})}),r0(fe,{item:!0,style:{paddingBottom:0},children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:()=>t(L()),children:"Cancel"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",disabled:i0,onClick:()=>e(L()),children:"Next"})})]})})]})})},TCe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},icon:{fill:"white",cursor:"pointer"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}},label:{fontFamily:"Roboto Mono, monospace",fontSize:12,fontWeight:"bold"},loading:{width:"15px !important",height:"15px !important"},value:{fontFamily:"Roboto Mono, monospace",fontWeight:"bold",color:"white"},underline:{textDecoration:"underline"}})),MCe=[{label:"Token",number:1,section:0},{label:"Governor",number:2,section:1}],CCe=({handleBack:e,handleNext:t,goToStep:n,setupData:f,loading:r})=>{const a=TCe(),i=f==null?void 0:f.token,o=f==null?void 0:f.governor,{safe:s}=uo.useSafeAppsSDK();return r0(wf,{borderStyle:"single",className:a.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:3,className:a.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:a.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Review"})}),r0(fe,{item:!0,children:r0(ze,{children:"Please take a final look at your OZ Governor Module details."})})]})}),r0(fe,{item:!0,children:r0(zo,{})}),MCe.map(l=>ve(Pt.Fragment,{children:[r0(fe,{item:!0,children:r0(Q90,{label:l.label,number:l.number,disabled:r||l.label==="Governor",onClick:()=>n(l.section)})}),l.label==="Token"&&i&&ve(Er,{children:[i.tokenAddress&&ve(fe,{item:!0,children:[r0(ze,{children:"Voting Token:"}),r0(d1,{target:"_blank",href:`${Zz[s.chainId]}/token/${i.tokenAddress}`,className:a.value,children:i.tokenAddress})]}),i.tokenName&&ve(fe,{item:!0,children:[r0(ze,{children:"Token Name:"}),r0(ze,{className:a.value,children:i.tokenName})]}),i.tokenSymbol&&ve(fe,{item:!0,children:[r0(ze,{children:"Token Symbol:"}),r0(ze,{className:a.value,children:i.tokenSymbol})]})]}),l.label==="Governor"&&o&&ve(Er,{children:[ve(fe,{item:!0,children:[r0(ze,{children:"Name:"}),r0(ze,{className:a.value,children:o.daoName})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Voting Delay:"}),ve(ze,{className:a.value,children:[o.votingDelayInBlocks," blocks"]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Voting Period:"}),ve(ze,{className:a.value,children:[o.votingPeriodInBlocks," blocks"]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Proposal Threshold:"}),ve(ze,{className:a.value,children:[o.proposalThreshold,"%"]})]}),ve(fe,{item:!0,children:[r0(ze,{children:"Quorum (%):"}),ve(ze,{className:a.value,children:[o.quorumPercent,"%"]})]})]}),r0(fe,{item:!0,children:r0(zo,{})})]},l.label)),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:e,disabled:r,children:"Back"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",startIcon:r?r0(fi.Loader,{className:a.loading,size:"sm",color:"background"}):r0(pW,{}),onClick:()=>{t(f)},children:"Deploy and Enable Module"})})]})})]})})},SCe="0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761",OCe=async(e,t,n,f,r,a,i,o)=>{if(t==null)throw new Error("No safe address provided");if(n==null)throw new Error("No token address provided");if(f==null)throw new Error("No name provided");if(r==null)throw new Error("No voting delay provided");if(a==null)throw new Error("No voting period provided");if(i==null)throw new Error("No proposal threshold provided");if(o==null)throw new Error("No quorum percent provided");if(o>100||o<0)throw new Error("Quorum percent must be between 0 and 100");const s={values:[t,t,SCe,n,f,r.toString(),a.toString(),i.toString(),o.toString(),"0"],types:["address","address","address","address","string","uint256","uint256","uint256","uint256","uint64"]},l=Date.now().toString(),c=(await e.getNetwork()).chainId,{transaction:d,expectedModuleAddress:p}=await js(_e.OZ_GOVERNOR,s,e,Number(c),l);return{txs:[{...d,value:d.value.toString()}],meta:{expectedAddress:p}}},kCe=async(e,t,n,f,r)=>{if(t==null)throw new Error("No safe address provided");if(n==null)throw new Error("No token name provided");if(f==null)throw new Error("No token symbol provided");if(r!=="ERC20"&&r!=="ERC721")throw new Error("Invalid token kind");const a={values:[t,n,f],types:["address","string","string"]},i=Date.now().toString(),o=(await e.getNetwork()).chainId,{transaction:s,expectedModuleAddress:l}=await js(r==="ERC20"?_e.ERC20_VOTES:_e.ERC721_VOTES,a,e,Number(o),i);return{txs:[{...s,value:s.value.toString()}],meta:{expectedAddress:l}}},NCe=async(e,t,n,f,r,a,i,o,s,l)=>{if(s==null&&l==null)throw new Error("No token address or create token args provided");if(s!=null&&l!=null)throw new Error("Both token address and create token args provided");const c=[];if(l!=null){const{txs:C,meta:O}=await kCe(e,n,l.name,l.symbol,l.kind);if(c.push(...C),(O==null?void 0:O.expectedAddress)==null)throw new Error("No expected address returned from token deployment");s=O.expectedAddress}if(s==null)throw new Error("No token address provided. Should not be possible. Either the token address should be provided or a new token should be deployed.");const{txs:d,meta:p}=await OCe(e,n,s,f,r,a,i,o);if(c.push(...d),(p==null?void 0:p.expectedAddress)==null)throw new Error("The expected value is missing");const x=Fs(n,p.expectedAddress);return c.push(x),t.txs.send({txs:c}).catch(C=>{throw console.error(C),new Error("Error when proposing transactions to the Safe")})},PCe=en(e=>({container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},textSubdued:{color:"rgba(255 255 255 / 70%)"},input:{"& .MuiInputBase-root":{borderColor:Jt.tan[300],"&::before":{borderColor:Jt.tan[300]}}}})),ICe={daoName:"",votingDelayInBlocks:0,votingPeriodInBlocks:50400,proposalThreshold:0,quorumPercent:4},RCe=({handleNext:e,handleBack:t,setupData:n})=>{const f=PCe(),r=n.governor,[a,i]=n0.useState(r),o=(O,L)=>{i({...a,[L]:O.target.value})},s=()=>a,{daoName:l,votingDelayInBlocks:c,votingPeriodInBlocks:d,proposalThreshold:p,quorumPercent:x}=a,C=()=>!(![l].includes("")&&x>=0&&x<=100);return r0(wf,{borderStyle:"single",className:f.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:ve(fe,{container:!0,spacing:4,className:f.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h3",children:"Setup OZ Governor Contract"})}),r0(fe,{item:!0,children:r0(ze,{children:"Configure your governor contract. It can always be changed later, so don't worry too much about getting it perfect the first time."})})]})}),r0(fe,{item:!0,children:r0(Cr,{label:"DAO Name:",value:l,placeholder:"My Governor",borderStyle:"double",className:f.input,onChange:O=>o(O,"daoName")})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:1,className:f.container,children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Voting Delay Configurations"})}),r0(fe,{item:!0,children:r0(ze,{variant:"body2",className:f.textSubdued,children:"Configure a delay modifier to determine the duration required before voting (Cooldown), and the amount of time that the proposal will be valid (Expiration)."})})]})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:6,alignItems:"center",children:[r0(fe,{item:!0,xs:6,children:r0(Cr,{label:"Voting Delay (in blocks)",value:c,type:"number",placeholder:"0",borderStyle:"double",className:f.input,onChange:O=>{i({...a,votingDelayInBlocks:parseInt(O.target.value)})},tooltipMsg:"The time between proposal submission and when voting starts."})}),r0(fe,{item:!0,xs:6,children:r0(Cr,{label:"Voting Period (in blocks)",value:d,type:"number",placeholder:"50400",borderStyle:"double",className:f.input,onChange:O=>{i({...a,votingPeriodInBlocks:parseInt(O.target.value)})},tooltipMsg:"The number of blocks between when a proposal's voting period starts and ends."})})]})}),r0(fe,{item:!0,children:r0(fe,{container:!0,spacing:1,className:f.container,children:r0(fe,{item:!0,children:r0(ze,{variant:"h4",color:"textSecondary",children:"Voting Thresholds"})})})}),r0(fe,{item:!0,children:r0(Cr,{label:"Proposal Threshold",color:"secondary",borderStyle:"double",className:f.input,type:"number",value:p,tooltipMsg:"How many tokens must someone own before they can submit a proposal to the DAO?",onChange:O=>o(O,"proposalThreshold")})}),r0(fe,{item:!0,children:r0($r0,{label:"Quorum (%):",defaultValue:x,hasInput:!0,onChangeSlider:O=>{typeof O=="number"&&x!==O&&O>=0&&i({...a,quorumPercent:O})}})}),r0(fe,{item:!0,style:{paddingBottom:0},children:r0(zo,{})}),r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:3,justifyContent:"center",alignItems:"center",children:[r0(fe,{item:!0,children:r0(Va,{size:"medium",variant:"text",onClick:()=>t(s()),children:"Back"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"contained",disabled:C(),onClick:()=>e(s()),children:"Next"})})]})})]})})},BCe=["token","governor","review"],DCe=en(e=>({root:{height:"100%",display:"flex",flexDirection:"column",padding:e.spacing(1.5),overflowY:"auto"},container:{display:"flex",flexDirection:"column"},paperContainer:{padding:e.spacing(2)},paperTitle:{margin:0},step:{"& text":{fontFamily:"Roboto Mono"},"& .step-label":{textTransform:"capitalize",display:"inline",fontFamily:"Roboto Mono","&.clickable":{cursor:"pointer","&:hover":{textDecoration:"underline"}}}},stepperRoot:{backgroundColor:"transparent",border:"none",padding:e.spacing(0),"& .MuiStepIcon-active":{color:e.palette.secondary.main,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%"},"& .MuiStepIcon-completed":{background:e.palette.text.primary,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%",color:e.palette.secondary.main},"& .Mui-disabled .MuiStepIcon-root":{color:e.palette.primary.main,border:`1px solid ${Jt.tan[300]}`,borderRadius:"100%"}}})),LCe=()=>{const e=DCe(),{sdk:t,safe:n,provider:f}=hi(),r=A1(),[a,i]=n0.useState(0),[o,s]=n0.useState(!1),[l,c]=n0.useState({token:!1,governor:!1,review:!1}),[d,p]=n0.useState({token:xCe,governor:ICe,review:{}}),x=(L,D)=>{l[D]&&i(L)},C=(L,D,V)=>Y=>{i(L),c({...l,[D]:V}),p({...d,[D]:Y})},O=async()=>{if(s(!0),d==null)throw s(!1),new Error("No setup data");const{tokenAddress:L,tokenSymbol:D,tokenConfiguration:V,tokenName:Y}=d.token,{daoName:i0,votingDelayInBlocks:m0,votingPeriodInBlocks:A0,proposalThreshold:T0,quorumPercent:I0}=d.governor;try{let z0;(V==="ERC20"||V==="ERC721")&&(z0={name:Y,symbol:D,kind:V}),(await NCe(f,t,n.safeAddress,i0,m0,A0,T0,I0,L,z0)).safeTxHash&&(r(hc(n)),r(qC(!0)))}catch(z0){s(!1),console.error(z0)}};return r0("div",{className:e.root,children:ve(fe,{container:!0,spacing:2,className:e.container,children:[r0(fe,{item:!0,children:ve(fe,{container:!0,spacing:2,children:[r0(fe,{item:!0,children:r0(sg,{icon:"ozGov",size:60})}),r0(fe,{item:!0,style:{display:"flex",alignItems:"center"},children:r0(ze,{variant:"h5",children:"Governor Module"})})]})}),r0(fe,{item:!0,children:ve(ze,{gutterBottom:!0,children:["Enables an Open Zeppelin Governor contract as a module."," ",r0(Jo,{underline:"always",href:"https://blog.openzeppelin.com/governor-smart-contract/",target:"_blank",color:"inherit",children:"Read more here."})]})}),r0(fe,{item:!0,children:r0(zo,{})}),r0(fe,{item:!0,children:ve(wf,{borderStyle:"single",className:e.paperContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[ve(fe,{container:!0,justifyContent:"space-between",alignItems:"center",style:{marginBottom:15},children:[r0(fe,{item:!0,children:r0(ze,{variant:"h4",gutterBottom:!0,className:e.paperTitle,children:"Add Governor Module"})}),r0(fe,{item:!0,children:r0(Va,{color:"secondary",size:"medium",variant:"outlined",onClick:()=>r(bV(!1)),children:"Cancel"})})]}),r0(MD,{activeStep:a,className:e.stepperRoot,orientation:"vertical",children:BCe.map((L,D)=>ve(ED,{className:e.step,children:[ve(TD,{onClick:()=>x(D,L),children:[r0(ze,{variant:"h6",className:Wf(D<=a&&"clickable","step-label"),children:L})," "]}),ve(Be0,{children:[L==="token"&&r0(ECe,{handleNext:C(D+1,L,!0),handleBack:()=>r(bV(!1)),setupData:d}),L==="governor"&&r0(RCe,{handleNext:C(D+1,L,!0),handleBack:C(a-1,L,!1),setupData:d}),L==="review"&&r0(CCe,{handleNext:O,handleBack:C(D-1,L,!0),setupData:d,goToStep:i,loading:o})]})]},L))})]})})]})})},jCe=()=>{const e=lr(VC),t=lr(Vg),n=lr(a=>a.modules.loadingModules),f=lr(a=>a.modules.realityModuleScreen),r=lr(a=>a.modules.OzGovernorModuleScreen);return e?r0(Hee,{module:e}):t?r0(aMe,{}):f?r0(gCe,{}):r?r0(LCe,{}):n?null:r0(eMe,{})},FCe=en(e=>({root:{marginBottom:e.spacing(2)},container:{"&.MuiPaper-root":{display:"flex",flexDirection:"row",alignItems:"center","&::before":fd(-5,Jt.tan[300])}},header:{"&.MuiPaper-root":{padding:e.spacing(.5,2,.5,.5),"&::before":fd(-5,Jt.tan[300])}},txBuilder:{"&.MuiPaper-root":{padding:e.spacing(.5,.5,.5,2),cursor:"pointer",transition:"0.2s ease all","&::before":fd(-5,Jt.tan[300]),"&:hover":{background:"rgba(217, 212, 173, 0.15)"}}},img:{display:"block",width:36,height:36},title:{marginLeft:e.spacing(1)},bagIcon:{marginLeft:e.spacing(2),stroke:"white"},badge:{color:e.palette.common.white,display:"flex",position:"relative",transform:"none",textAlign:"center",background:"none",fontSize:16},badgeRoot:{display:"flex",justifyContent:"center",alignItems:"center",height:36,width:36,borderRadius:60,border:`1px solid ${Jt.tan[300]}`,padding:e.spacing(.5)},txBuilderTitle:{marginRight:e.spacing(3)},circleIconContainer:{padding:e.spacing(.5)},banner:{"&.MuiPaper-root":{flexGrow:1,position:"relative",borderWidth:1,borderColor:Jt.tan[300],backgroundColor:Jt.tan[100],margin:e.spacing(0,2),"&::before":fd(-5,Jt.tan[300])}}})),zCe=()=>{const e=FCe(),t=A1(),n=lr(BV),f=()=>t(Q60());return ve(x1,{className:e.root,children:[ve(wf,{elevation:0,borderStyle:"double",rounded:"left",variant:"elevation",className:Wf(e.container,e.header),placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[r0(sg,{icon:"zodiac"}),r0(ze,{variant:"h5",className:e.title,children:"Zodiac"})]}),r0(wf,{elevation:0,className:e.banner,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0}),ve(wf,{borderStyle:"double",onClick:f,elevation:0,rounded:"right",className:Wf(e.container,e.txBuilder),placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:[r0(ze,{className:e.txBuilderTitle,children:"Bundle Transactions"}),r0(wf,{rounded:"full",variant:"outlined",className:e.circleIconContainer,placeholder:void 0,onPointerEnterCapture:void 0,onPointerLeaveCapture:void 0,children:r0($B,{showZero:!0,badgeContent:n.length,color:n.length?"error":"primary",classes:{badge:e.badge,root:e.badgeRoot}})})]})]})};function R1(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var X90=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),vW=function(){return Math.random().toString(36).substring(7).split("").join(".")},_90={INIT:"@@redux/INIT"+vW(),REPLACE:"@@redux/REPLACE"+vW(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+vW()}};function VCe(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function $90(e,t,n){var f;if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(R1(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(R1(1));return n($90)(e,t)}if(typeof e!="function")throw new Error(R1(2));var r=e,a=t,i=[],o=i,s=!1;function l(){o===i&&(o=i.slice())}function c(){if(s)throw new Error(R1(3));return a}function d(O){if(typeof O!="function")throw new Error(R1(4));if(s)throw new Error(R1(5));var L=!0;return l(),o.push(O),function(){if(L){if(s)throw new Error(R1(6));L=!1,l();var D=o.indexOf(O);o.splice(D,1),i=null}}}function p(O){if(!VCe(O))throw new Error(R1(7));if(typeof O.type>"u")throw new Error(R1(8));if(s)throw new Error(R1(9));try{s=!0,a=r(a,O)}finally{s=!1}for(var L=i=o,D=0;D=0;f--){var r=t[f](e);if(r)return r}return function(a,i){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+i.wrappedComponentName+".")}}function wSe(e,t){return e===t}function ASe(e){var t={},n=t.connectHOC,f=n===void 0?tSe:n,r=t.mapStateToPropsFactories,a=r===void 0?lSe:r,i=t.mapDispatchToPropsFactories,o=i===void 0?iSe:i,s=t.mergePropsFactories,l=s===void 0?bSe:s,c=t.selectorFactory,d=c===void 0?gSe:c;return function(p,x,C,O){O===void 0&&(O={});var L=O,D=L.pure,V=D===void 0?!0:D,Y=L.areStatesEqual,i0=Y===void 0?wSe:Y,m0=L.areOwnPropsEqual,A0=m0===void 0?wW:m0,T0=L.areStatePropsEqual,I0=T0===void 0?wW:T0,z0=L.areMergedPropsEqual,oe=z0===void 0?wW:z0,ae=Du(L,vSe),ye=xW(p,a,"mapStateToProps"),P=xW(x,o,"mapDispatchToProps"),F=xW(C,l,"mergeProps");return f(d,pe({methodName:"connect",getDisplayName:function(Q){return"Connect("+Q+")"},shouldHandleStateChanges:!!p,initMapStateToProps:ye,initMapDispatchToProps:P,initMergeProps:F,pure:V,areStatesEqual:i0,areOwnPropsEqual:A0,areStatePropsEqual:I0,areMergedPropsEqual:oe},ae))}}const dm0=ASe();GCe(Qi.unstable_batchedUpdates);function xSe(e,t){if(e.length!==t.length)return!1;for(var n=0;n");return f.callbacks},f.setCallbacks=function(o){f.callbacks=o},f}var n=t.prototype;return n.componentDidMount=function(){this.unbind=Js(window,[{eventName:"error",fn:this.onWindowError}])},n.componentDidCatch=function(f){if(f instanceof JO){this.setState({});return}throw f},n.componentWillUnmount=function(){this.unbind()},n.render=function(){return this.props.children(this.setCallbacks)},t}(Pt.Component),RSe=` Press space bar to start a drag. When dragging you can use the arrow keys to move the item around and escape to cancel. Some screen readers may require you to be in focus mode or to use your pass through key diff --git a/assets/pako_inflate.min-CwX3nVh0.js b/assets/pako_inflate.min-BGiCGMdN.js similarity index 99% rename from assets/pako_inflate.min-CwX3nVh0.js rename to assets/pako_inflate.min-BGiCGMdN.js index f03d4a3..957f359 100644 --- a/assets/pako_inflate.min-CwX3nVh0.js +++ b/assets/pako_inflate.min-BGiCGMdN.js @@ -1 +1 @@ -import{c as ee}from"./index-CaiI26nW.js";function ne(P,K){for(var D=0;DI[N]})}}}return Object.freeze(Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}))}var ct={exports:{}};/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */(function(P,K){(function(D,I){I(K)})(ee,function(D){var I=(e,n,t,o)=>{let s=65535&e|0,r=e>>>16&65535|0,c=0;for(;t!==0;){c=t>2e3?2e3:t,t-=c;do s=s+n[o++]|0,r=r+s|0;while(--c);s%=65521,r%=65521}return s|r<<16|0};const N=new Uint32Array((()=>{let e,n=[];for(var t=0;t<256;t++){e=t;for(var o=0;o<8;o++)e=1&e?3988292384^e>>>1:e>>>1;n[t]=e}return n})());var O=(e,n,t,o)=>{const s=N,r=o+t;e^=-1;for(let c=o;c>>8^s[255&(e^n[c])];return-1^e};const Y=16209;var Ut=function(e,n){let t,o,s,r,c,l,p,i,a,R,w,d,Z,v,u,x,_,f,g,E,h,y,m,b;const k=e.state;t=e.next_in,m=e.input,o=t+(e.avail_in-5),s=e.next_out,b=e.output,r=s-(n-e.avail_out),c=s+(e.avail_out-257),l=k.dmax,p=k.wsize,i=k.whave,a=k.wnext,R=k.window,w=k.hold,d=k.bits,Z=k.lencode,v=k.distcode,u=(1<>>24,w>>>=f,d-=f,f=_>>>16&255,f===0)b[s++]=65535&_;else{if(!(16&f)){if(!(64&f)){_=Z[(65535&_)+(w&(1<>>=f,d-=f),d<15&&(w+=m[t++]<>>24,w>>>=f,d-=f,f=_>>>16&255,!(16&f)){if(!(64&f)){_=v[(65535&_)+(w&(1<l){e.msg="invalid distance too far back",k.mode=Y;break t}if(w>>>=f,d-=f,f=s-r,E>f){if(f=E-f,f>i&&k.sane){e.msg="invalid distance too far back",k.mode=Y;break t}if(h=0,y=R,a===0){if(h+=p-f,f2;)b[s++]=y[h++],b[s++]=y[h++],b[s++]=y[h++],g-=3;g&&(b[s++]=y[h++],g>1&&(b[s++]=y[h++]))}else{h=s-E;do b[s++]=b[h++],b[s++]=b[h++],b[s++]=b[h++],g-=3;while(g>2);g&&(b[s++]=b[h++],g>1&&(b[s++]=b[h++]))}break}}break}}while(t>3,t-=g,d-=g<<3,w&=(1<{const p=l.bits;let i,a,R,w,d,Z,v=0,u=0,x=0,_=0,f=0,g=0,E=0,h=0,y=0,m=0,b=null;const k=new Uint16Array(16),S=new Uint16Array(16);let H,V,$,tt=null;for(v=0;v<=G;v++)k[v]=0;for(u=0;u=1&&k[_]===0;_--);if(f>_&&(f=_),_===0)return s[r++]=20971520,s[r++]=20971520,l.bits=1,0;for(x=1;x<_&&k[x]===0;x++);for(f0&&(e===0||_!==1))return-1;for(S[1]=0,v=1;v852||e===2&&y>592)return 1;for(;;){H=v-E,c[u]+1=Z?(V=tt[c[u]-Z],$=b[c[u]-Z]):(V=96,$=0),i=1<>E)+a]=H<<24|V<<16|$|0;while(a!==0);for(i=1<>=1;if(i!==0?(m&=i-1,m+=i):m=0,u++,--k[v]==0){if(v===_)break;v=n[t+c[u]]}if(v>f&&(m&w)!==R){for(E===0&&(E=f),d+=x,g=v-E,h=1<852||e===2&&y>592)return 1;R=m&w,s[R]=f<<24|g<<16|d-r|0}}return m!==0&&(s[d+m]=v-E<<24|64<<16|0),l.bits=f,0},et={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{Z_FINISH:ht,Z_BLOCK:Ct,Z_TREES:X,Z_OK:C,Z_STREAM_END:zt,Z_NEED_DICT:Ft,Z_STREAM_ERROR:U,Z_DATA_ERROR:ut,Z_MEM_ERROR:wt,Z_BUF_ERROR:Mt,Z_DEFLATED:bt}=et,W=16180,q=16190,T=16191,nt=16192,it=16194,J=16199,Q=16200,at=16206,A=16209,mt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Lt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const z=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.mode16211?1:0},_t=e=>{if(z(e))return U;const n=e.state;return e.total_in=e.total_out=n.total=0,e.msg="",n.wrap&&(e.adler=1&n.wrap),n.mode=W,n.last=0,n.havedict=0,n.flags=-1,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Int32Array(852),n.distcode=n.distdyn=new Int32Array(592),n.sane=1,n.back=-1,C},kt=e=>{if(z(e))return U;const n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,_t(e)},gt=(e,n)=>{let t;if(z(e))return U;const o=e.state;return n<0?(t=0,n=-n):(t=5+(n>>4),n<48&&(n&=15)),n&&(n<8||n>15)?U:(o.window!==null&&o.wbits!==n&&(o.window=null),o.wrap=t,o.wbits=n,kt(e))},pt=(e,n)=>{if(!e)return U;const t=new Lt;e.state=t,t.strm=e,t.window=null,t.mode=W;const o=gt(e,n);return o!==C&&(e.state=null),o};let rt,ot,vt=!0;const jt=e=>{if(vt){rt=new Int32Array(512),ot=new Int32Array(32);let n=0;for(;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(F(1,e.lens,0,288,rt,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;F(2,e.lens,0,32,ot,0,e.work,{bits:5}),vt=!1}e.lencode=rt,e.lenbits=9,e.distcode=ot,e.distbits=5},yt=(e,n,t,o)=>{let s;const r=e.state;return r.window===null&&(r.wsize=1<=r.wsize?(r.window.set(n.subarray(t-r.wsize,t),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>o&&(s=o),r.window.set(n.subarray(t-o,t-o+s),r.wnext),(o-=s)?(r.window.set(n.subarray(t-o,t),0),r.wnext=o,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavept(e,15),inflateInit2:pt,inflate:(e,n)=>{let t,o,s,r,c,l,p,i,a,R,w,d,Z,v,u,x,_,f,g,E,h,y,m=0;const b=new Uint8Array(4);let k,S;const H=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(z(e)||!e.output||!e.input&&e.avail_in!==0)return U;t=e.state,t.mode===T&&(t.mode=nt),c=e.next_out,s=e.output,p=e.avail_out,r=e.next_in,o=e.input,l=e.avail_in,i=t.hold,a=t.bits,R=l,w=p,y=C;t:for(;;)switch(t.mode){case W:if(t.wrap===0){t.mode=nt;break}for(;a<16;){if(l===0)break t;l--,i+=o[r++]<>>8&255,t.check=O(t.check,b,2,0),i=0,a=0,t.mode=16181;break}if(t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&i)<<8)+(i>>8))%31){e.msg="incorrect header check",t.mode=A;break}if((15&i)!==bt){e.msg="unknown compression method",t.mode=A;break}if(i>>>=4,a-=4,h=8+(15&i),t.wbits===0&&(t.wbits=h),h>15||h>t.wbits){e.msg="invalid window size",t.mode=A;break}t.dmax=1<>8&1),512&t.flags&&4&t.wrap&&(b[0]=255&i,b[1]=i>>>8&255,t.check=O(t.check,b,2,0)),i=0,a=0,t.mode=16182;case 16182:for(;a<32;){if(l===0)break t;l--,i+=o[r++]<>>8&255,b[2]=i>>>16&255,b[3]=i>>>24&255,t.check=O(t.check,b,4,0)),i=0,a=0,t.mode=16183;case 16183:for(;a<16;){if(l===0)break t;l--,i+=o[r++]<>8),512&t.flags&&4&t.wrap&&(b[0]=255&i,b[1]=i>>>8&255,t.check=O(t.check,b,2,0)),i=0,a=0,t.mode=16184;case 16184:if(1024&t.flags){for(;a<16;){if(l===0)break t;l--,i+=o[r++]<>>8&255,t.check=O(t.check,b,2,0)),i=0,a=0}else t.head&&(t.head.extra=null);t.mode=16185;case 16185:if(1024&t.flags&&(d=t.length,d>l&&(d=l),d&&(t.head&&(h=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(o.subarray(r,r+d),h)),512&t.flags&&4&t.wrap&&(t.check=O(t.check,o,d,r)),l-=d,r+=d,t.length-=d),t.length))break t;t.length=0,t.mode=16186;case 16186:if(2048&t.flags){if(l===0)break t;d=0;do h=o[r+d++],t.head&&h&&t.length<65536&&(t.head.name+=String.fromCharCode(h));while(h&&d>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=T;break;case 16189:for(;a<32;){if(l===0)break t;l--,i+=o[r++]<>>=7&a,a-=7&a,t.mode=at;break}for(;a<3;){if(l===0)break t;l--,i+=o[r++]<>>=1,a-=1,3&i){case 0:t.mode=16193;break;case 1:if(jt(t),t.mode=J,n===X){i>>>=2,a-=2;break t}break;case 2:t.mode=16196;break;case 3:e.msg="invalid block type",t.mode=A}i>>>=2,a-=2;break;case 16193:for(i>>>=7&a,a-=7&a;a<32;){if(l===0)break t;l--,i+=o[r++]<>>16^65535)){e.msg="invalid stored block lengths",t.mode=A;break}if(t.length=65535&i,i=0,a=0,t.mode=it,n===X)break t;case it:t.mode=16195;case 16195:if(d=t.length,d){if(d>l&&(d=l),d>p&&(d=p),d===0)break t;s.set(o.subarray(r,r+d),c),l-=d,r+=d,p-=d,c+=d,t.length-=d;break}t.mode=T;break;case 16196:for(;a<14;){if(l===0)break t;l--,i+=o[r++]<>>=5,a-=5,t.ndist=1+(31&i),i>>>=5,a-=5,t.ncode=4+(15&i),i>>>=4,a-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=A;break}t.have=0,t.mode=16197;case 16197:for(;t.have>>=3,a-=3}for(;t.have<19;)t.lens[H[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,k={bits:t.lenbits},y=F(0,t.lens,0,19,t.lencode,0,t.work,k),t.lenbits=k.bits,y){e.msg="invalid code lengths set",t.mode=A;break}t.have=0,t.mode=16198;case 16198:for(;t.have>>24,x=m>>>16&255,_=65535&m,!(u<=a);){if(l===0)break t;l--,i+=o[r++]<>>=u,a-=u,t.lens[t.have++]=_;else{if(_===16){for(S=u+2;a>>=u,a-=u,t.have===0){e.msg="invalid bit length repeat",t.mode=A;break}h=t.lens[t.have-1],d=3+(3&i),i>>>=2,a-=2}else if(_===17){for(S=u+3;a>>=u,a-=u,h=0,d=3+(7&i),i>>>=3,a-=3}else{for(S=u+7;a>>=u,a-=u,h=0,d=11+(127&i),i>>>=7,a-=7}if(t.have+d>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=A;break}for(;d--;)t.lens[t.have++]=h}}if(t.mode===A)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=A;break}if(t.lenbits=9,k={bits:t.lenbits},y=F(1,t.lens,0,t.nlen,t.lencode,0,t.work,k),t.lenbits=k.bits,y){e.msg="invalid literal/lengths set",t.mode=A;break}if(t.distbits=6,t.distcode=t.distdyn,k={bits:t.distbits},y=F(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,k),t.distbits=k.bits,y){e.msg="invalid distances set",t.mode=A;break}if(t.mode=J,n===X)break t;case J:t.mode=Q;case Q:if(l>=6&&p>=258){e.next_out=c,e.avail_out=p,e.next_in=r,e.avail_in=l,t.hold=i,t.bits=a,Ut(e,w),c=e.next_out,s=e.output,p=e.avail_out,r=e.next_in,o=e.input,l=e.avail_in,i=t.hold,a=t.bits,t.mode===T&&(t.back=-1);break}for(t.back=0;m=t.lencode[i&(1<>>24,x=m>>>16&255,_=65535&m,!(u<=a);){if(l===0)break t;l--,i+=o[r++]<>f)],u=m>>>24,x=m>>>16&255,_=65535&m,!(f+u<=a);){if(l===0)break t;l--,i+=o[r++]<>>=f,a-=f,t.back+=f}if(i>>>=u,a-=u,t.back+=u,t.length=_,x===0){t.mode=16205;break}if(32&x){t.back=-1,t.mode=T;break}if(64&x){e.msg="invalid literal/length code",t.mode=A;break}t.extra=15&x,t.mode=16201;case 16201:if(t.extra){for(S=t.extra;a>>=t.extra,a-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=16202;case 16202:for(;m=t.distcode[i&(1<>>24,x=m>>>16&255,_=65535&m,!(u<=a);){if(l===0)break t;l--,i+=o[r++]<>f)],u=m>>>24,x=m>>>16&255,_=65535&m,!(f+u<=a);){if(l===0)break t;l--,i+=o[r++]<>>=f,a-=f,t.back+=f}if(i>>>=u,a-=u,t.back+=u,64&x){e.msg="invalid distance code",t.mode=A;break}t.offset=_,t.extra=15&x,t.mode=16203;case 16203:if(t.extra){for(S=t.extra;a>>=t.extra,a-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=A;break}t.mode=16204;case 16204:if(p===0)break t;if(d=w-p,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=A;break}d>t.wnext?(d-=t.wnext,Z=t.wsize-d):Z=t.wnext-d,d>t.length&&(d=t.length),v=t.window}else v=s,Z=c-t.offset,d=t.length;d>p&&(d=p),p-=d,t.length-=d;do s[c++]=v[Z++];while(--d);t.length===0&&(t.mode=Q);break;case 16205:if(p===0)break t;s[c++]=t.length,p--,t.mode=Q;break;case at:if(t.wrap){for(;a<32;){if(l===0)break t;l--,i|=o[r++]<{if(z(e))return U;let n=e.state;return n.window&&(n.window=null),e.state=null,C},inflateGetHeader:(e,n)=>{if(z(e))return U;const t=e.state;return 2&t.wrap?(t.head=n,n.done=!1,C):U},inflateSetDictionary:(e,n)=>{const t=n.length;let o,s,r;return z(e)?U:(o=e.state,o.wrap!==0&&o.mode!==q?U:o.mode===q&&(s=1,s=I(s,n,t,0),s!==o.check)?ut:(r=yt(e,n,t,t),r?(o.mode=16210,wt):(o.havedict=1,C)))},inflateInfo:"pako inflate (from Nodeca project)"};const Ht=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var Pt=function(e){const n=Array.prototype.slice.call(arguments,1);for(;n.length;){const t=n.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const o in t)Ht(t,o)&&(e[o]=t[o])}}return e},Kt=e=>{let n=0;for(let o=0,s=e.length;o=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;M[254]=M[254]=1;var Yt=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let n,t,o,s,r,c=e.length,l=0;for(s=0;s>>6,n[r++]=128|63&t):t<65536?(n[r++]=224|t>>>12,n[r++]=128|t>>>6&63,n[r++]=128|63&t):(n[r++]=240|t>>>18,n[r++]=128|t>>>12&63,n[r++]=128|t>>>6&63,n[r++]=128|63&t);return n},Gt=(e,n)=>{const t=n||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,n));let o,s;const r=new Array(2*t);for(s=0,o=0;o4)r[s++]=65533,o+=l-1;else{for(c&=l===2?31:l===3?15:7;l>1&&o1?r[s++]=65533:c<65536?r[s++]=c:(c-=65536,r[s++]=55296|c>>10&1023,r[s++]=56320|1023&c)}}return((c,l)=>{if(l<65534&&c.subarray&&xt)return String.fromCharCode.apply(null,c.length===l?c:c.subarray(0,l));let p="";for(let i=0;i{(n=n||e.length)>e.length&&(n=e.length);let t=n-1;for(;t>=0&&(192&e[t])==128;)t--;return t<0||t===0?n:t+M[e[t]]>n?t:n},st={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Wt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},qt=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Et=Object.prototype.toString,{Z_NO_FLUSH:Jt,Z_FINISH:Qt,Z_OK:L,Z_STREAM_END:lt,Z_NEED_DICT:dt,Z_STREAM_ERROR:Vt,Z_DATA_ERROR:At,Z_MEM_ERROR:$t}=et;function j(e){this.options=Pt({chunkSize:65536,windowBits:15,to:""},e||{});const n=this.options;n.raw&&n.windowBits>=0&&n.windowBits<16&&(n.windowBits=-n.windowBits,n.windowBits===0&&(n.windowBits=-15)),!(n.windowBits>=0&&n.windowBits<16)||e&&e.windowBits||(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&!(15&n.windowBits)&&(n.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Wt,this.strm.avail_out=0;let t=B.inflateInit2(this.strm,n.windowBits);if(t!==L)throw new Error(st[t]);if(this.header=new qt,B.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=Yt(n.dictionary):Et.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=B.inflateSetDictionary(this.strm,n.dictionary),t!==L)))throw new Error(st[t])}function ft(e,n){const t=new j(n);if(t.push(e),t.err)throw t.msg||st[t.err];return t.result}j.prototype.push=function(e,n){const t=this.strm,o=this.options.chunkSize,s=this.options.dictionary;let r,c,l;if(this.ended)return!1;for(c=n===~~n?n:n===!0?Qt:Jt,Et.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(o),t.next_out=0,t.avail_out=o),r=B.inflate(t,c),r===dt&&s&&(r=B.inflateSetDictionary(t,s),r===L?r=B.inflate(t,c):r===At&&(r=dt));t.avail_in>0&&r===lt&&t.state.wrap>0&&e[t.next_in]!==0;)B.inflateReset(t),r=B.inflate(t,c);switch(r){case Vt:case At:case dt:case $t:return this.onEnd(r),this.ended=!0,!1}if(l=t.avail_out,t.next_out&&(t.avail_out===0||r===lt))if(this.options.to==="string"){let p=Xt(t.output,t.next_out),i=t.next_out-p,a=Gt(t.output,p);t.next_out=i,t.avail_out=o-i,i&&t.output.set(t.output.subarray(p,p+i),0),this.onData(a)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(r!==L||l!==0){if(r===lt)return r=B.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},j.prototype.onData=function(e){this.chunks.push(e)},j.prototype.onEnd=function(e){e===L&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Kt(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Rt=j,Zt=ft,St=function(e,n){return(n=n||{}).raw=!0,ft(e,n)},Ot=ft,Dt=et,te={Inflate:Rt,inflate:Zt,inflateRaw:St,ungzip:Ot,constants:Dt};D.Inflate=Rt,D.constants=Dt,D.default=te,D.inflate=Zt,D.inflateRaw=St,D.ungzip=Ot,Object.defineProperty(D,"__esModule",{value:!0})})})(ct,ct.exports);var ie=ct.exports;const ae=ne({__proto__:null},[ie]);export{ae as p}; +import{c as ee}from"./index-BcZzR9qG.js";function ne(P,K){for(var D=0;DI[N]})}}}return Object.freeze(Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}))}var ct={exports:{}};/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */(function(P,K){(function(D,I){I(K)})(ee,function(D){var I=(e,n,t,o)=>{let s=65535&e|0,r=e>>>16&65535|0,c=0;for(;t!==0;){c=t>2e3?2e3:t,t-=c;do s=s+n[o++]|0,r=r+s|0;while(--c);s%=65521,r%=65521}return s|r<<16|0};const N=new Uint32Array((()=>{let e,n=[];for(var t=0;t<256;t++){e=t;for(var o=0;o<8;o++)e=1&e?3988292384^e>>>1:e>>>1;n[t]=e}return n})());var O=(e,n,t,o)=>{const s=N,r=o+t;e^=-1;for(let c=o;c>>8^s[255&(e^n[c])];return-1^e};const Y=16209;var Ut=function(e,n){let t,o,s,r,c,l,p,i,a,R,w,d,Z,v,u,x,_,f,g,E,h,y,m,b;const k=e.state;t=e.next_in,m=e.input,o=t+(e.avail_in-5),s=e.next_out,b=e.output,r=s-(n-e.avail_out),c=s+(e.avail_out-257),l=k.dmax,p=k.wsize,i=k.whave,a=k.wnext,R=k.window,w=k.hold,d=k.bits,Z=k.lencode,v=k.distcode,u=(1<>>24,w>>>=f,d-=f,f=_>>>16&255,f===0)b[s++]=65535&_;else{if(!(16&f)){if(!(64&f)){_=Z[(65535&_)+(w&(1<>>=f,d-=f),d<15&&(w+=m[t++]<>>24,w>>>=f,d-=f,f=_>>>16&255,!(16&f)){if(!(64&f)){_=v[(65535&_)+(w&(1<l){e.msg="invalid distance too far back",k.mode=Y;break t}if(w>>>=f,d-=f,f=s-r,E>f){if(f=E-f,f>i&&k.sane){e.msg="invalid distance too far back",k.mode=Y;break t}if(h=0,y=R,a===0){if(h+=p-f,f2;)b[s++]=y[h++],b[s++]=y[h++],b[s++]=y[h++],g-=3;g&&(b[s++]=y[h++],g>1&&(b[s++]=y[h++]))}else{h=s-E;do b[s++]=b[h++],b[s++]=b[h++],b[s++]=b[h++],g-=3;while(g>2);g&&(b[s++]=b[h++],g>1&&(b[s++]=b[h++]))}break}}break}}while(t>3,t-=g,d-=g<<3,w&=(1<{const p=l.bits;let i,a,R,w,d,Z,v=0,u=0,x=0,_=0,f=0,g=0,E=0,h=0,y=0,m=0,b=null;const k=new Uint16Array(16),S=new Uint16Array(16);let H,V,$,tt=null;for(v=0;v<=G;v++)k[v]=0;for(u=0;u=1&&k[_]===0;_--);if(f>_&&(f=_),_===0)return s[r++]=20971520,s[r++]=20971520,l.bits=1,0;for(x=1;x<_&&k[x]===0;x++);for(f0&&(e===0||_!==1))return-1;for(S[1]=0,v=1;v852||e===2&&y>592)return 1;for(;;){H=v-E,c[u]+1=Z?(V=tt[c[u]-Z],$=b[c[u]-Z]):(V=96,$=0),i=1<>E)+a]=H<<24|V<<16|$|0;while(a!==0);for(i=1<>=1;if(i!==0?(m&=i-1,m+=i):m=0,u++,--k[v]==0){if(v===_)break;v=n[t+c[u]]}if(v>f&&(m&w)!==R){for(E===0&&(E=f),d+=x,g=v-E,h=1<852||e===2&&y>592)return 1;R=m&w,s[R]=f<<24|g<<16|d-r|0}}return m!==0&&(s[d+m]=v-E<<24|64<<16|0),l.bits=f,0},et={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{Z_FINISH:ht,Z_BLOCK:Ct,Z_TREES:X,Z_OK:C,Z_STREAM_END:zt,Z_NEED_DICT:Ft,Z_STREAM_ERROR:U,Z_DATA_ERROR:ut,Z_MEM_ERROR:wt,Z_BUF_ERROR:Mt,Z_DEFLATED:bt}=et,W=16180,q=16190,T=16191,nt=16192,it=16194,J=16199,Q=16200,at=16206,A=16209,mt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Lt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const z=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.mode16211?1:0},_t=e=>{if(z(e))return U;const n=e.state;return e.total_in=e.total_out=n.total=0,e.msg="",n.wrap&&(e.adler=1&n.wrap),n.mode=W,n.last=0,n.havedict=0,n.flags=-1,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Int32Array(852),n.distcode=n.distdyn=new Int32Array(592),n.sane=1,n.back=-1,C},kt=e=>{if(z(e))return U;const n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,_t(e)},gt=(e,n)=>{let t;if(z(e))return U;const o=e.state;return n<0?(t=0,n=-n):(t=5+(n>>4),n<48&&(n&=15)),n&&(n<8||n>15)?U:(o.window!==null&&o.wbits!==n&&(o.window=null),o.wrap=t,o.wbits=n,kt(e))},pt=(e,n)=>{if(!e)return U;const t=new Lt;e.state=t,t.strm=e,t.window=null,t.mode=W;const o=gt(e,n);return o!==C&&(e.state=null),o};let rt,ot,vt=!0;const jt=e=>{if(vt){rt=new Int32Array(512),ot=new Int32Array(32);let n=0;for(;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(F(1,e.lens,0,288,rt,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;F(2,e.lens,0,32,ot,0,e.work,{bits:5}),vt=!1}e.lencode=rt,e.lenbits=9,e.distcode=ot,e.distbits=5},yt=(e,n,t,o)=>{let s;const r=e.state;return r.window===null&&(r.wsize=1<=r.wsize?(r.window.set(n.subarray(t-r.wsize,t),0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>o&&(s=o),r.window.set(n.subarray(t-o,t-o+s),r.wnext),(o-=s)?(r.window.set(n.subarray(t-o,t),0),r.wnext=o,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whavept(e,15),inflateInit2:pt,inflate:(e,n)=>{let t,o,s,r,c,l,p,i,a,R,w,d,Z,v,u,x,_,f,g,E,h,y,m=0;const b=new Uint8Array(4);let k,S;const H=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(z(e)||!e.output||!e.input&&e.avail_in!==0)return U;t=e.state,t.mode===T&&(t.mode=nt),c=e.next_out,s=e.output,p=e.avail_out,r=e.next_in,o=e.input,l=e.avail_in,i=t.hold,a=t.bits,R=l,w=p,y=C;t:for(;;)switch(t.mode){case W:if(t.wrap===0){t.mode=nt;break}for(;a<16;){if(l===0)break t;l--,i+=o[r++]<>>8&255,t.check=O(t.check,b,2,0),i=0,a=0,t.mode=16181;break}if(t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&i)<<8)+(i>>8))%31){e.msg="incorrect header check",t.mode=A;break}if((15&i)!==bt){e.msg="unknown compression method",t.mode=A;break}if(i>>>=4,a-=4,h=8+(15&i),t.wbits===0&&(t.wbits=h),h>15||h>t.wbits){e.msg="invalid window size",t.mode=A;break}t.dmax=1<>8&1),512&t.flags&&4&t.wrap&&(b[0]=255&i,b[1]=i>>>8&255,t.check=O(t.check,b,2,0)),i=0,a=0,t.mode=16182;case 16182:for(;a<32;){if(l===0)break t;l--,i+=o[r++]<>>8&255,b[2]=i>>>16&255,b[3]=i>>>24&255,t.check=O(t.check,b,4,0)),i=0,a=0,t.mode=16183;case 16183:for(;a<16;){if(l===0)break t;l--,i+=o[r++]<>8),512&t.flags&&4&t.wrap&&(b[0]=255&i,b[1]=i>>>8&255,t.check=O(t.check,b,2,0)),i=0,a=0,t.mode=16184;case 16184:if(1024&t.flags){for(;a<16;){if(l===0)break t;l--,i+=o[r++]<>>8&255,t.check=O(t.check,b,2,0)),i=0,a=0}else t.head&&(t.head.extra=null);t.mode=16185;case 16185:if(1024&t.flags&&(d=t.length,d>l&&(d=l),d&&(t.head&&(h=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(o.subarray(r,r+d),h)),512&t.flags&&4&t.wrap&&(t.check=O(t.check,o,d,r)),l-=d,r+=d,t.length-=d),t.length))break t;t.length=0,t.mode=16186;case 16186:if(2048&t.flags){if(l===0)break t;d=0;do h=o[r+d++],t.head&&h&&t.length<65536&&(t.head.name+=String.fromCharCode(h));while(h&&d>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=T;break;case 16189:for(;a<32;){if(l===0)break t;l--,i+=o[r++]<>>=7&a,a-=7&a,t.mode=at;break}for(;a<3;){if(l===0)break t;l--,i+=o[r++]<>>=1,a-=1,3&i){case 0:t.mode=16193;break;case 1:if(jt(t),t.mode=J,n===X){i>>>=2,a-=2;break t}break;case 2:t.mode=16196;break;case 3:e.msg="invalid block type",t.mode=A}i>>>=2,a-=2;break;case 16193:for(i>>>=7&a,a-=7&a;a<32;){if(l===0)break t;l--,i+=o[r++]<>>16^65535)){e.msg="invalid stored block lengths",t.mode=A;break}if(t.length=65535&i,i=0,a=0,t.mode=it,n===X)break t;case it:t.mode=16195;case 16195:if(d=t.length,d){if(d>l&&(d=l),d>p&&(d=p),d===0)break t;s.set(o.subarray(r,r+d),c),l-=d,r+=d,p-=d,c+=d,t.length-=d;break}t.mode=T;break;case 16196:for(;a<14;){if(l===0)break t;l--,i+=o[r++]<>>=5,a-=5,t.ndist=1+(31&i),i>>>=5,a-=5,t.ncode=4+(15&i),i>>>=4,a-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=A;break}t.have=0,t.mode=16197;case 16197:for(;t.have>>=3,a-=3}for(;t.have<19;)t.lens[H[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,k={bits:t.lenbits},y=F(0,t.lens,0,19,t.lencode,0,t.work,k),t.lenbits=k.bits,y){e.msg="invalid code lengths set",t.mode=A;break}t.have=0,t.mode=16198;case 16198:for(;t.have>>24,x=m>>>16&255,_=65535&m,!(u<=a);){if(l===0)break t;l--,i+=o[r++]<>>=u,a-=u,t.lens[t.have++]=_;else{if(_===16){for(S=u+2;a>>=u,a-=u,t.have===0){e.msg="invalid bit length repeat",t.mode=A;break}h=t.lens[t.have-1],d=3+(3&i),i>>>=2,a-=2}else if(_===17){for(S=u+3;a>>=u,a-=u,h=0,d=3+(7&i),i>>>=3,a-=3}else{for(S=u+7;a>>=u,a-=u,h=0,d=11+(127&i),i>>>=7,a-=7}if(t.have+d>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=A;break}for(;d--;)t.lens[t.have++]=h}}if(t.mode===A)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=A;break}if(t.lenbits=9,k={bits:t.lenbits},y=F(1,t.lens,0,t.nlen,t.lencode,0,t.work,k),t.lenbits=k.bits,y){e.msg="invalid literal/lengths set",t.mode=A;break}if(t.distbits=6,t.distcode=t.distdyn,k={bits:t.distbits},y=F(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,k),t.distbits=k.bits,y){e.msg="invalid distances set",t.mode=A;break}if(t.mode=J,n===X)break t;case J:t.mode=Q;case Q:if(l>=6&&p>=258){e.next_out=c,e.avail_out=p,e.next_in=r,e.avail_in=l,t.hold=i,t.bits=a,Ut(e,w),c=e.next_out,s=e.output,p=e.avail_out,r=e.next_in,o=e.input,l=e.avail_in,i=t.hold,a=t.bits,t.mode===T&&(t.back=-1);break}for(t.back=0;m=t.lencode[i&(1<>>24,x=m>>>16&255,_=65535&m,!(u<=a);){if(l===0)break t;l--,i+=o[r++]<>f)],u=m>>>24,x=m>>>16&255,_=65535&m,!(f+u<=a);){if(l===0)break t;l--,i+=o[r++]<>>=f,a-=f,t.back+=f}if(i>>>=u,a-=u,t.back+=u,t.length=_,x===0){t.mode=16205;break}if(32&x){t.back=-1,t.mode=T;break}if(64&x){e.msg="invalid literal/length code",t.mode=A;break}t.extra=15&x,t.mode=16201;case 16201:if(t.extra){for(S=t.extra;a>>=t.extra,a-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=16202;case 16202:for(;m=t.distcode[i&(1<>>24,x=m>>>16&255,_=65535&m,!(u<=a);){if(l===0)break t;l--,i+=o[r++]<>f)],u=m>>>24,x=m>>>16&255,_=65535&m,!(f+u<=a);){if(l===0)break t;l--,i+=o[r++]<>>=f,a-=f,t.back+=f}if(i>>>=u,a-=u,t.back+=u,64&x){e.msg="invalid distance code",t.mode=A;break}t.offset=_,t.extra=15&x,t.mode=16203;case 16203:if(t.extra){for(S=t.extra;a>>=t.extra,a-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=A;break}t.mode=16204;case 16204:if(p===0)break t;if(d=w-p,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=A;break}d>t.wnext?(d-=t.wnext,Z=t.wsize-d):Z=t.wnext-d,d>t.length&&(d=t.length),v=t.window}else v=s,Z=c-t.offset,d=t.length;d>p&&(d=p),p-=d,t.length-=d;do s[c++]=v[Z++];while(--d);t.length===0&&(t.mode=Q);break;case 16205:if(p===0)break t;s[c++]=t.length,p--,t.mode=Q;break;case at:if(t.wrap){for(;a<32;){if(l===0)break t;l--,i|=o[r++]<{if(z(e))return U;let n=e.state;return n.window&&(n.window=null),e.state=null,C},inflateGetHeader:(e,n)=>{if(z(e))return U;const t=e.state;return 2&t.wrap?(t.head=n,n.done=!1,C):U},inflateSetDictionary:(e,n)=>{const t=n.length;let o,s,r;return z(e)?U:(o=e.state,o.wrap!==0&&o.mode!==q?U:o.mode===q&&(s=1,s=I(s,n,t,0),s!==o.check)?ut:(r=yt(e,n,t,t),r?(o.mode=16210,wt):(o.havedict=1,C)))},inflateInfo:"pako inflate (from Nodeca project)"};const Ht=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var Pt=function(e){const n=Array.prototype.slice.call(arguments,1);for(;n.length;){const t=n.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const o in t)Ht(t,o)&&(e[o]=t[o])}}return e},Kt=e=>{let n=0;for(let o=0,s=e.length;o=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;M[254]=M[254]=1;var Yt=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let n,t,o,s,r,c=e.length,l=0;for(s=0;s>>6,n[r++]=128|63&t):t<65536?(n[r++]=224|t>>>12,n[r++]=128|t>>>6&63,n[r++]=128|63&t):(n[r++]=240|t>>>18,n[r++]=128|t>>>12&63,n[r++]=128|t>>>6&63,n[r++]=128|63&t);return n},Gt=(e,n)=>{const t=n||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,n));let o,s;const r=new Array(2*t);for(s=0,o=0;o4)r[s++]=65533,o+=l-1;else{for(c&=l===2?31:l===3?15:7;l>1&&o1?r[s++]=65533:c<65536?r[s++]=c:(c-=65536,r[s++]=55296|c>>10&1023,r[s++]=56320|1023&c)}}return((c,l)=>{if(l<65534&&c.subarray&&xt)return String.fromCharCode.apply(null,c.length===l?c:c.subarray(0,l));let p="";for(let i=0;i{(n=n||e.length)>e.length&&(n=e.length);let t=n-1;for(;t>=0&&(192&e[t])==128;)t--;return t<0||t===0?n:t+M[e[t]]>n?t:n},st={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Wt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},qt=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Et=Object.prototype.toString,{Z_NO_FLUSH:Jt,Z_FINISH:Qt,Z_OK:L,Z_STREAM_END:lt,Z_NEED_DICT:dt,Z_STREAM_ERROR:Vt,Z_DATA_ERROR:At,Z_MEM_ERROR:$t}=et;function j(e){this.options=Pt({chunkSize:65536,windowBits:15,to:""},e||{});const n=this.options;n.raw&&n.windowBits>=0&&n.windowBits<16&&(n.windowBits=-n.windowBits,n.windowBits===0&&(n.windowBits=-15)),!(n.windowBits>=0&&n.windowBits<16)||e&&e.windowBits||(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&!(15&n.windowBits)&&(n.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Wt,this.strm.avail_out=0;let t=B.inflateInit2(this.strm,n.windowBits);if(t!==L)throw new Error(st[t]);if(this.header=new qt,B.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=Yt(n.dictionary):Et.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=B.inflateSetDictionary(this.strm,n.dictionary),t!==L)))throw new Error(st[t])}function ft(e,n){const t=new j(n);if(t.push(e),t.err)throw t.msg||st[t.err];return t.result}j.prototype.push=function(e,n){const t=this.strm,o=this.options.chunkSize,s=this.options.dictionary;let r,c,l;if(this.ended)return!1;for(c=n===~~n?n:n===!0?Qt:Jt,Et.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(o),t.next_out=0,t.avail_out=o),r=B.inflate(t,c),r===dt&&s&&(r=B.inflateSetDictionary(t,s),r===L?r=B.inflate(t,c):r===At&&(r=dt));t.avail_in>0&&r===lt&&t.state.wrap>0&&e[t.next_in]!==0;)B.inflateReset(t),r=B.inflate(t,c);switch(r){case Vt:case At:case dt:case $t:return this.onEnd(r),this.ended=!0,!1}if(l=t.avail_out,t.next_out&&(t.avail_out===0||r===lt))if(this.options.to==="string"){let p=Xt(t.output,t.next_out),i=t.next_out-p,a=Gt(t.output,p);t.next_out=i,t.avail_out=o-i,i&&t.output.set(t.output.subarray(p,p+i),0),this.onData(a)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(r!==L||l!==0){if(r===lt)return r=B.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},j.prototype.onData=function(e){this.chunks.push(e)},j.prototype.onEnd=function(e){e===L&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Kt(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Rt=j,Zt=ft,St=function(e,n){return(n=n||{}).raw=!0,ft(e,n)},Ot=ft,Dt=et,te={Inflate:Rt,inflate:Zt,inflateRaw:St,ungzip:Ot,constants:Dt};D.Inflate=Rt,D.constants=Dt,D.default=te,D.inflate=Zt,D.inflateRaw=St,D.ungzip=Ot,Object.defineProperty(D,"__esModule",{value:!0})})})(ct,ct.exports);var ie=ct.exports;const ae=ne({__proto__:null},[ie]);export{ae as p}; diff --git a/index.html b/index.html index 9d03177..c420bf1 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ Zodiac - Safe App - +