droplinked-web3-kit 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
data.chainLinkRoundId: ${n.chainLinkRoundId}
|
|
15
15
|
data.memo: ${n.memo}
|
|
16
16
|
data.totalPrice: ${Number(n.totalPrice)}
|
|
17
|
-
`),ae===Chains.SKALE)return await skalePayment(n,le,ye,Ee,me,xe,ie);he?await handleCustomTokenApproval(n,xe,ye,me,ie):n.tbdValues=n.tbdValues.map(Ue=>parseInt(Ue.toString(),10));try{await Ee.callStatic.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{value:he?BigNumber.from(0):n.totalPrice})}catch(Ue){throw new Error("Transaction will fail: "+Ue.message)}let Se;try{Se=await getGasPrice(fe)}catch(Ue){throw new Error("Failed to get gas price: "+Ue.message)}let Me;try{Me=await Ee.estimateGas.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{value:he?BigNumber.from(0):n.totalPrice})}catch(Ue){throw new Error(`Gas estimation failed: ${Ue.message}. Please check the transaction parameters.`)}const Be=Me.mul(105).div(100),$e=he?BigNumber.from(0):BigNumber.from(n.totalPrice);let Ce;try{Ce=await fe.getBalance(me)}catch(Ue){throw new Error("Failed to get user balance: "+Ue.message)}const ke=$e.add(Be.mul(Se));if(Ce.lt(ke))throw new InsufficientBalanceException;ie.changeStep("Sending Payment Transaction");const Pe=await Ee.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{gasLimit:Be,value:he?BigNumber.from(0):n.totalPrice});return ie.changeStep("Awaiting transaction"),await Pe.wait(),ie.changeStep("Payment Successful"),{transactionHash:Pe.hash,cryptoAmount:n.totalPrice}}catch(Se){handleError(Se)}},skalePayment=async function(c,t,n,ie,fe,ae,le){try{const he=t===Network.TESTNET?SkaleUsdcAddressForTestnet:SkaleUsdcAddressForMainnet;return c.tokenAddress=he,await handleCustomTokenApproval(c,ae,n,fe,le),{transactionHash:(await ie.droplinkedPurchase(c.tbdValues,c.tbdReceivers,he,"0",c.memo)).hash,cryptoAmount:c.totalPrice}}catch(he){handleError(he)}};function handleError(c){var t;throw c instanceof Error?((t=c.code)==null?void 0:t.toString())==="ACTION_REJECTED"||c.message.includes("User denied")||c.message.includes("User cancelled transaction")?new UserDeniedException("Metamask*"):c.message.includes("insufficient funds")||c.message.includes("gas * price + value")||c.code==="INSUFFICIENT_FUNDS"?new InsufficientBalanceException:c:new Error("An unknown error occurred")}async function payment({chain:c,orderID:t,paymentToken:n,axiosInstance:ie,shopId:fe,network:ae,provider:le,stepizer:he}){const ye=new Web3Provider(le,"any");if(await ensureWalletOnChainFromConfig(ye,getChainByName(c),ae),!fe)throw new InvalidParametersException(c,"shopId not found");const me=await startPayment(t,n,c,fe,ie),xe=await getCartData(t,n,c,ie),Ee=xe.paymentData,Be=await droplinkedPayment({chain:c,network:ae,provider:ye},{modalInterface:he},Ee);if(await updateHash("payment",me,Be.transactionHash,ie),!await web3Callback(Be.transactionHash,c,Network[ae],`${getBaseUrl(ae)}/web3/payment/callback/${me}/${Be.transactionHash}`))throw new Web3CallbackFailedException(Actions.Payment);return{...Be,orderID:xe.orderID,transactionId:me}}const DROPLINKED_MANAGER="0x2F86E1B1A69D259b9609b40E3cbEBEa29946f979";async function doClaimNFT(c,t,n){const{modalInterface:ie}=n,fe=t.provider.getSigner();ie.changeStep("Claiming NFTs");const ae=new Contract(n.shopContractAddress,shopABI,fe);try{console.log(DROPLINKED_MANAGER,c.signature.signature,{cart:c.signature.purchaseData.map(ye=>({amount:ye.amount,productId:ye.productId,nullifier:ye.nullifier})),shop:n.shopContractAddress});const le=c.signature.purchaseData.map(ye=>({amount:ye.amount,productId:BigNumber.from(ye.productId),nullifier:BigNumber.from(ye.nullifier)}));ie.changeStep("Sending Transaction");const he=await ae.claimPurchase(DROPLINKED_MANAGER,c.signature.signature,{cart:le,shop:n.shopContractAddress});return ie.changeStep("Waiting for confirmation"),await he.wait(),ie.changeStep("NFT Claimed!"),{transactionHash:he.hash}}catch(le){if(console.error(le),le.code&&le.code.toString()==="ACTION_REJECTED")throw n.modalInterface.error("Transaction Rejected","Transaction Rejected by the user"),new UserDeniedException("Transaction Rejected");try{const he=ae.interface.parseError(le.data);throw he.name==="OwnableUnauthorizedAccount"&&n.modalInterface.error(he.name,he.name),n.modalInterface.error(le,le),le}catch(he){throw ie.error("Unexpected error occurred",`An unexpected error occurred: ${he}`),he}}}async function claimNFT({provider:c,axiosInstance:t,stepizer:n,orderId:ie,skuId:fe,network:ae}){const le=new Web3Provider(c,"any"),{shopContractAddress:he,signature:ye,networkName:me}=await getPurchaseSignature(ie,fe,t);return await ensureWalletOnChainFromConfig(le,getChainByName(me),ae),await doClaimNFT({signature:ye},{provider:le},{axiosInstance:t,modalInterface:n,nftContract:"",shopContractAddress:he})}class EVMBaseWallet extends Web3Wallet{constructor(t,n){super(t.wallet,t.group,n),this.provider=null,this.cfg=t}async initializeProvider(){this.provider=await getEvmProviderByWalletName(this.cfg.wallet),console.log(`Initialized ${this.name} EVM Provider.`)}async login({chain:t,network:n}){if(!this.provider)throw new ProviderException(this.name);console.log(`Login on ${t} ${n}`);const ie=await this.provider.request({method:"eth_requestAccounts"});if(!Array.isArray(ie)||ie.length===0)throw new ProviderException("Trust Wallet");return{address:ie[0]}}async isWalletConnected(){if(!this.provider)return!1;try{const t=await this.provider.request({method:"eth_accounts"});return Array.isArray(t)&&t.length>0}catch{return!1}}async getConnectedAccounts(){if(!this.provider)return[];const t=await this.provider.request({method:"eth_accounts"});return Array.isArray(t)?t:[]}async recordProduct({productId:t,chain:n,axiosInstance:ie,shopId:fe,network:ae}){if(console.log(`Recording for ${t} on ${n}`),!this.provider)throw this.stepizer.error("Provider Error","Provider not initialized"),new ProviderException(this.name);return recordProduct({axiosInstance:ie,chain:n,network:ae,productId:t,provider:this.provider,shopId:fe,stepizer:this.stepizer})}async auth({chain:t,network:n,axiosInstance:ie}){if(console.log(`Authentication process ${t}`),!this.provider)throw this.stepizer.error("Provider Error","Provider not initialized"),new ProviderException(this.name);const fe=this.provider,ae=this.stepizer,le=new Web3Provider(this.provider,"any");try{if(ae.changeStep("Connecting to wallet..."),!await this.isWalletConnected())try{return await fe.request({method:"eth_requestAccounts"})}catch(Me){throw console.error(Me),new UserDeniedException(this.name)}const he=(await this.login({chain:t,network:n})).address;ae.changeStep("Signing message...");const ye=await getNonce(he,ie),me=new Date().toLocaleString(),xe=`Welcome to Droplinked! Please sign this message to verify your ownership over your wallet and log in. - Nonce: ${ye} - Date: ${me}`,Se=await le.getSigner().signMessage(xe);return ae.changeStep("Authentication successful!"),{address:he,signature:Se,nonce:ye,date:me}}catch(he){throw console.error(he),he instanceof UserDeniedException?(ae.error("User denied the request",""),he):(ae.error("An error occurred while connecting to the wallet",""),he)}}async claimNFT({orderId:t,skuId:n,axiosInstance:ie,network:fe}){if(console.log(`ClaimNFT process for order: ${t} - sku: ${n}`),!this.provider)throw this.stepizer.error("Provider Error","Provider not initialized"),new ProviderException(this.name);return claimNFT({axiosInstance:ie,network:fe,orderId:t,provider:this.provider,skuId:n,stepizer:this.stepizer})}async payment({chain:t,network:n,orderID:ie,paymentToken:fe,shopId:ae,axiosInstance:le}){if(!this.supportsToken(t,fe))throw new TokenNotSupportedException(this.name,fe);if(this.stepizer.changeStep("Starting payment process"),!this.provider)throw this.stepizer.error("Provider Error","Provider not initialized"),new ProviderException(this.name);return await payment({axiosInstance:le,chain:t,network:n,orderID:ie,paymentToken:fe,provider:this.provider,shopId:ae,stepizer:this.stepizer})}async isWalletInstalled(){let t=!1;const n=this.name;function ie(fe){var le,he;const ae=fe.detail;((he=(le=ae==null?void 0:ae.info)==null?void 0:le.name)==null?void 0:he.toLowerCase())===n.toLowerCase()&&(t=!0)}return window.addEventListener("eip6963:announceProvider",ie),window.dispatchEvent(new Event("eip6963:requestProvider")),await new Promise(fe=>setTimeout(fe,700)),window.removeEventListener("eip6963:announceProvider",ie),t}getInstallationLink(){return this.cfg.installationLink}}var Wallets=(c=>(c.Metamask="Metamask",c.Phantom="Phantom",c.TrustWallet="Trust Wallet",c.UnstoppableDomains="Unstoppable Domains",c.XION="Xion",c))(Wallets||{});class MetamaskEVMWallet extends EVMBaseWallet{constructor(t){super({group:Groups.EVM,installationLink:{website:"https://metamask.io/download",chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",firefox:"https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/"},wallet:Wallets.Metamask},t)}supportsToken(t,n){return console.log(`Checking support for ${n} on ${t}`),!!this.supportsChain(t)}supportsChain(t){return isChainInGroup(t,Groups.EVM)}}var __classPrivateFieldGet=function(c,t,n,ie){if(n==="a"&&!ie)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?c!==t||!ie:!t.has(c))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?ie:n==="a"?ie.call(c):ie?ie.value:t.get(c)},__classPrivateFieldSet=function(c,t,n,ie,fe){if(ie==="m")throw new TypeError("Private method is not writable");if(ie==="a"&&!fe)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?c!==t||!fe:!t.has(c))throw new TypeError("Cannot write private member to an object whose class did not declare it");return ie==="a"?fe.call(c,n):fe?fe.value=n:t.set(c,n),n},_AppReadyEvent_detail;let wallets;const registeredWalletsSet=new Set;function addRegisteredWallet(c){cachedWalletsArray=void 0,registeredWalletsSet.add(c)}function removeRegisteredWallet(c){cachedWalletsArray=void 0,registeredWalletsSet.delete(c)}const listeners={};function getWallets(){if(wallets||(wallets=Object.freeze({register,get:get$1,on}),typeof window>"u"))return wallets;const c=Object.freeze({register});try{window.addEventListener("wallet-standard:register-wallet",({detail:t})=>t(c))}catch(t){console.error(`wallet-standard:register-wallet event listener could not be added
|
|
17
|
+
`),ae===Chains.SKALE)return await skalePayment(n,le,ye,Ee,me,xe,ie);he?await handleCustomTokenApproval(n,xe,ye,me,ie):n.tbdValues=n.tbdValues.map(Ue=>parseInt(Ue.toString(),10));try{await Ee.callStatic.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{value:he?BigNumber.from(0):n.totalPrice})}catch(Ue){throw new Error("Transaction will fail: "+Ue.message)}let Se;try{Se=await getGasPrice(fe)}catch(Ue){throw new Error("Failed to get gas price: "+Ue.message)}let Me;try{Me=await Ee.estimateGas.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{value:he?BigNumber.from(0):n.totalPrice})}catch(Ue){throw new Error(`Gas estimation failed: ${Ue.message}. Please check the transaction parameters.`)}const Be=Me.mul(105).div(100),$e=he?BigNumber.from(0):BigNumber.from(n.totalPrice);let Ce;try{Ce=await fe.getBalance(me)}catch(Ue){throw new Error("Failed to get user balance: "+Ue.message)}const ke=$e.add(Be.mul(Se));if(Ce.lt(ke))throw new InsufficientBalanceException;ie.changeStep("Sending Payment Transaction");const Pe=await Ee.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{gasLimit:Be,value:he?BigNumber.from(0):n.totalPrice});return ie.changeStep("Awaiting transaction"),await Pe.wait(),ie.success("Payment Successful"),{transactionHash:Pe.hash,cryptoAmount:n.totalPrice}}catch(Se){handleError(Se)}},skalePayment=async function(c,t,n,ie,fe,ae,le){try{const he=t===Network.TESTNET?SkaleUsdcAddressForTestnet:SkaleUsdcAddressForMainnet;return c.tokenAddress=he,await handleCustomTokenApproval(c,ae,n,fe,le),{transactionHash:(await ie.droplinkedPurchase(c.tbdValues,c.tbdReceivers,he,"0",c.memo)).hash,cryptoAmount:c.totalPrice}}catch(he){handleError(he)}};function handleError(c){var t;throw c instanceof Error?((t=c.code)==null?void 0:t.toString())==="ACTION_REJECTED"||c.message.includes("User denied")||c.message.includes("User cancelled transaction")?new UserDeniedException("Metamask*"):c.message.includes("insufficient funds")||c.message.includes("gas * price + value")||c.code==="INSUFFICIENT_FUNDS"?new InsufficientBalanceException:c:new Error("An unknown error occurred")}async function payment({chain:c,orderID:t,paymentToken:n,axiosInstance:ie,shopId:fe,network:ae,provider:le,stepizer:he}){const ye=new Web3Provider(le,"any");if(await ensureWalletOnChainFromConfig(ye,getChainByName(c),ae),!fe)throw new InvalidParametersException(c,"shopId not found");const me=await startPayment(t,n,c,fe,ie),xe=await getCartData(t,n,c,ie),Ee=xe.paymentData,Be=await droplinkedPayment({chain:c,network:ae,provider:ye},{modalInterface:he},Ee);if(await updateHash("payment",me,Be.transactionHash,ie),!await web3Callback(Be.transactionHash,c,Network[ae],`${getBaseUrl(ae)}/web3/payment/callback/${me}/${Be.transactionHash}`))throw new Web3CallbackFailedException(Actions.Payment);return{...Be,orderID:xe.orderID,transactionId:me}}const DROPLINKED_MANAGER="0x2F86E1B1A69D259b9609b40E3cbEBEa29946f979";async function doClaimNFT(c,t,n){const{modalInterface:ie}=n,fe=t.provider.getSigner();ie.changeStep("Claiming NFTs");const ae=new Contract(n.shopContractAddress,shopABI,fe);try{console.log(DROPLINKED_MANAGER,c.signature.signature,{cart:c.signature.purchaseData.map(ye=>({amount:ye.amount,productId:ye.productId,nullifier:ye.nullifier})),shop:n.shopContractAddress});const le=c.signature.purchaseData.map(ye=>({amount:ye.amount,productId:BigNumber.from(ye.productId),nullifier:BigNumber.from(ye.nullifier)}));ie.changeStep("Sending Transaction");const he=await ae.claimPurchase(DROPLINKED_MANAGER,c.signature.signature,{cart:le,shop:n.shopContractAddress});return ie.changeStep("Waiting for confirmation"),await he.wait(),ie.changeStep("NFT Claimed!"),{transactionHash:he.hash}}catch(le){if(console.error(le),le.code&&le.code.toString()==="ACTION_REJECTED")throw n.modalInterface.error("Transaction Rejected","Transaction Rejected by the user"),new UserDeniedException("Transaction Rejected");try{const he=ae.interface.parseError(le.data);throw he.name==="OwnableUnauthorizedAccount"&&n.modalInterface.error(he.name,he.name),n.modalInterface.error(le,le),le}catch(he){throw ie.error("Unexpected error occurred",`An unexpected error occurred: ${he}`),he}}}async function claimNFT({provider:c,axiosInstance:t,stepizer:n,orderId:ie,skuId:fe,network:ae}){const le=new Web3Provider(c,"any"),{shopContractAddress:he,signature:ye,networkName:me}=await getPurchaseSignature(ie,fe,t);return await ensureWalletOnChainFromConfig(le,getChainByName(me),ae),await doClaimNFT({signature:ye},{provider:le},{axiosInstance:t,modalInterface:n,nftContract:"",shopContractAddress:he})}class EVMBaseWallet extends Web3Wallet{constructor(t,n){super(t.wallet,t.group,n),this.provider=null,this.cfg=t}async initializeProvider(){this.provider=await getEvmProviderByWalletName(this.cfg.wallet),console.log(`Initialized ${this.name} EVM Provider.`)}async login({chain:t,network:n}){if(!this.provider)throw this.stepizer.error("Provider Error","Provider not initialized"),new ProviderException(this.name);try{this.stepizer.changeStep("Connecting to wallet..."),console.log(`Login on ${t} ${n}`);const ie=await this.provider.request({method:"eth_requestAccounts"});if(!Array.isArray(ie)||ie.length===0)throw new ProviderException("Evm Wallet");return this.stepizer.success("Wallet connected"),{address:ie[0]}}catch(ie){throw console.error(ie),ie instanceof UserDeniedException?(this.stepizer.error("User denied the request",""),ie):(this.stepizer.error("An error occurred while connecting to the wallet",""),ie)}}async isWalletConnected(){if(!this.provider)return!1;try{const t=await this.provider.request({method:"eth_accounts"});return Array.isArray(t)&&t.length>0}catch{return!1}}async getConnectedAccounts(){if(!this.provider)return[];const t=await this.provider.request({method:"eth_accounts"});return Array.isArray(t)?t:[]}async recordProduct({productId:t,chain:n,axiosInstance:ie,shopId:fe,network:ae}){if(console.log(`Recording for ${t} on ${n}`),!this.provider)throw this.stepizer.error("Provider Error","Provider not initialized"),new ProviderException(this.name);return recordProduct({axiosInstance:ie,chain:n,network:ae,productId:t,provider:this.provider,shopId:fe,stepizer:this.stepizer})}async auth({chain:t,network:n,axiosInstance:ie}){if(console.log(`Authentication process ${t}`),!this.provider)throw this.stepizer.error("Provider Error","Provider not initialized"),new ProviderException(this.name);const fe=this.provider,ae=this.stepizer,le=new Web3Provider(this.provider,"any");try{if(ae.changeStep("Connecting to wallet..."),!await this.isWalletConnected())try{return await fe.request({method:"eth_requestAccounts"})}catch(Me){throw console.error(Me),new UserDeniedException(this.name)}const he=(await this.login({chain:t,network:n})).address;ae.changeStep("Signing message...");const ye=await getNonce(he,ie),me=new Date().toLocaleString(),xe=`Welcome to Droplinked! Please sign this message to verify your ownership over your wallet and log in. - Nonce: ${ye} - Date: ${me}`,Se=await le.getSigner().signMessage(xe);return ae.success("Authentication successful!"),{address:he,signature:Se,nonce:ye,date:me}}catch(he){throw console.error(he),he instanceof UserDeniedException?(ae.error("User denied the request",""),he):(ae.error("An error occurred while connecting to the wallet",""),he)}}async claimNFT({orderId:t,skuId:n,axiosInstance:ie,network:fe}){if(console.log(`ClaimNFT process for order: ${t} - sku: ${n}`),!this.provider)throw this.stepizer.error("Provider Error","Provider not initialized"),new ProviderException(this.name);return claimNFT({axiosInstance:ie,network:fe,orderId:t,provider:this.provider,skuId:n,stepizer:this.stepizer})}async payment({chain:t,network:n,orderID:ie,paymentToken:fe,shopId:ae,axiosInstance:le}){if(!this.supportsToken(t,fe))throw new TokenNotSupportedException(this.name,fe);if(this.stepizer.changeStep("Starting payment process"),!this.provider)throw this.stepizer.error("Provider Error","Provider not initialized"),new ProviderException(this.name);return await payment({axiosInstance:le,chain:t,network:n,orderID:ie,paymentToken:fe,provider:this.provider,shopId:ae,stepizer:this.stepizer})}async isWalletInstalled(){let t=!1;const n=this.name;function ie(fe){var le,he;const ae=fe.detail;((he=(le=ae==null?void 0:ae.info)==null?void 0:le.name)==null?void 0:he.toLowerCase())===n.toLowerCase()&&(t=!0)}return window.addEventListener("eip6963:announceProvider",ie),window.dispatchEvent(new Event("eip6963:requestProvider")),await new Promise(fe=>setTimeout(fe,700)),window.removeEventListener("eip6963:announceProvider",ie),t}getInstallationLink(){return this.cfg.installationLink}}var Wallets=(c=>(c.Metamask="Metamask",c.Phantom="Phantom",c.TrustWallet="Trust Wallet",c.UnstoppableDomains="Unstoppable Domains",c.XION="Xion",c))(Wallets||{});class MetamaskEVMWallet extends EVMBaseWallet{constructor(t){super({group:Groups.EVM,installationLink:{website:"https://metamask.io/download",chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",firefox:"https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/"},wallet:Wallets.Metamask},t)}supportsToken(t,n){return console.log(`Checking support for ${n} on ${t}`),!!this.supportsChain(t)}supportsChain(t){return isChainInGroup(t,Groups.EVM)}}var __classPrivateFieldGet=function(c,t,n,ie){if(n==="a"&&!ie)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?c!==t||!ie:!t.has(c))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?ie:n==="a"?ie.call(c):ie?ie.value:t.get(c)},__classPrivateFieldSet=function(c,t,n,ie,fe){if(ie==="m")throw new TypeError("Private method is not writable");if(ie==="a"&&!fe)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?c!==t||!fe:!t.has(c))throw new TypeError("Cannot write private member to an object whose class did not declare it");return ie==="a"?fe.call(c,n):fe?fe.value=n:t.set(c,n),n},_AppReadyEvent_detail;let wallets;const registeredWalletsSet=new Set;function addRegisteredWallet(c){cachedWalletsArray=void 0,registeredWalletsSet.add(c)}function removeRegisteredWallet(c){cachedWalletsArray=void 0,registeredWalletsSet.delete(c)}const listeners={};function getWallets(){if(wallets||(wallets=Object.freeze({register,get:get$1,on}),typeof window>"u"))return wallets;const c=Object.freeze({register});try{window.addEventListener("wallet-standard:register-wallet",({detail:t})=>t(c))}catch(t){console.error(`wallet-standard:register-wallet event listener could not be added
|
|
18
18
|
`,t)}try{window.dispatchEvent(new AppReadyEvent(c))}catch(t){console.error(`wallet-standard:app-ready event could not be dispatched
|
|
19
19
|
`,t)}return wallets}function register(...c){var t;return c=c.filter(n=>!registeredWalletsSet.has(n)),c.length?(c.forEach(n=>addRegisteredWallet(n)),(t=listeners.register)==null||t.forEach(n=>guard(()=>n(...c))),function(){var ie;c.forEach(fe=>removeRegisteredWallet(fe)),(ie=listeners.unregister)==null||ie.forEach(fe=>guard(()=>fe(...c)))}):()=>{}}let cachedWalletsArray;function get$1(){return cachedWalletsArray||(cachedWalletsArray=[...registeredWalletsSet]),cachedWalletsArray}function on(c,t){var n;return(n=listeners[c])!=null&&n.push(t)||(listeners[c]=[t]),function(){var fe;listeners[c]=(fe=listeners[c])==null?void 0:fe.filter(ae=>t!==ae)}}function guard(c){try{c()}catch(t){console.error(t)}}class AppReadyEvent extends Event{get detail(){return __classPrivateFieldGet(this,_AppReadyEvent_detail,"f")}get type(){return"wallet-standard:app-ready"}constructor(t){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),_AppReadyEvent_detail.set(this,void 0),__classPrivateFieldSet(this,_AppReadyEvent_detail,t,"f")}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}_AppReadyEvent_detail=new WeakMap;const crypto$2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes(c){return c instanceof Uint8Array||ArrayBuffer.isView(c)&&c.constructor.name==="Uint8Array"}function anumber(c){if(!Number.isSafeInteger(c)||c<0)throw new Error("positive integer expected, got "+c)}function abytes(c,...t){if(!isBytes(c))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(c.length))throw new Error("Uint8Array expected of length "+t+", got length="+c.length)}function ahash(c){if(typeof c!="function"||typeof c.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");anumber(c.outputLen),anumber(c.blockLen)}function aexists(c,t=!0){if(c.destroyed)throw new Error("Hash instance has been destroyed");if(t&&c.finished)throw new Error("Hash#digest() has already been called")}function aoutput(c,t){abytes(c);const n=t.outputLen;if(c.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function clean(...c){for(let t=0;t<c.length;t++)c[t].fill(0)}function createView(c){return new DataView(c.buffer,c.byteOffset,c.byteLength)}function rotr(c,t){return c<<32-t|c>>>t}const hasHexBuiltin=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",hexes=Array.from({length:256},(c,t)=>t.toString(16).padStart(2,"0"));function bytesToHex(c){if(abytes(c),hasHexBuiltin)return c.toHex();let t="";for(let n=0;n<c.length;n++)t+=hexes[c[n]];return t}const asciis={_0:48,_9:57,A:65,F:70,a:97,f:102};function asciiToBase16(c){if(c>=asciis._0&&c<=asciis._9)return c-asciis._0;if(c>=asciis.A&&c<=asciis.F)return c-(asciis.A-10);if(c>=asciis.a&&c<=asciis.f)return c-(asciis.a-10)}function hexToBytes(c){if(typeof c!="string")throw new Error("hex string expected, got "+typeof c);if(hasHexBuiltin)return Uint8Array.fromHex(c);const t=c.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const ie=new Uint8Array(n);for(let fe=0,ae=0;fe<n;fe++,ae+=2){const le=asciiToBase16(c.charCodeAt(ae)),he=asciiToBase16(c.charCodeAt(ae+1));if(le===void 0||he===void 0){const ye=c[ae]+c[ae+1];throw new Error('hex string expected, got non-hex character "'+ye+'" at index '+ae)}ie[fe]=le*16+he}return ie}function utf8ToBytes(c){if(typeof c!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(c))}function toBytes(c){return typeof c=="string"&&(c=utf8ToBytes(c)),abytes(c),c}function concatBytes(...c){let t=0;for(let ie=0;ie<c.length;ie++){const fe=c[ie];abytes(fe),t+=fe.length}const n=new Uint8Array(t);for(let ie=0,fe=0;ie<c.length;ie++){const ae=c[ie];n.set(ae,fe),fe+=ae.length}return n}class Hash{}function createHasher(c){const t=ie=>c().update(toBytes(ie)).digest(),n=c();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>c(),t}function randomBytes(c=32){if(crypto$2&&typeof crypto$2.getRandomValues=="function")return crypto$2.getRandomValues(new Uint8Array(c));if(crypto$2&&typeof crypto$2.randomBytes=="function")return Uint8Array.from(crypto$2.randomBytes(c));throw new Error("crypto.getRandomValues must be defined")}function setBigUint64(c,t,n,ie){if(typeof c.setBigUint64=="function")return c.setBigUint64(t,n,ie);const fe=BigInt(32),ae=BigInt(4294967295),le=Number(n>>fe&ae),he=Number(n&ae),ye=ie?4:0,me=ie?0:4;c.setUint32(t+ye,le,ie),c.setUint32(t+me,he,ie)}function Chi(c,t,n){return c&t^~c&n}function Maj(c,t,n){return c&t^c&n^t&n}class HashMD extends Hash{constructor(t,n,ie,fe){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=ie,this.isLE=fe,this.buffer=new Uint8Array(t),this.view=createView(this.buffer)}update(t){aexists(this),t=toBytes(t),abytes(t);const{view:n,buffer:ie,blockLen:fe}=this,ae=t.length;for(let le=0;le<ae;){const he=Math.min(fe-this.pos,ae-le);if(he===fe){const ye=createView(t);for(;fe<=ae-le;le+=fe)this.process(ye,le);continue}ie.set(t.subarray(le,le+he),this.pos),this.pos+=he,le+=he,this.pos===fe&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){aexists(this),aoutput(t,this),this.finished=!0;const{buffer:n,view:ie,blockLen:fe,isLE:ae}=this;let{pos:le}=this;n[le++]=128,clean(this.buffer.subarray(le)),this.padOffset>fe-le&&(this.process(ie,0),le=0);for(let Ee=le;Ee<fe;Ee++)n[Ee]=0;setBigUint64(ie,fe-8,BigInt(this.length*8),ae),this.process(ie,0);const he=createView(t),ye=this.outputLen;if(ye%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const me=ye/4,xe=this.get();if(me>xe.length)throw new Error("_sha2: outputLen bigger than state");for(let Ee=0;Ee<me;Ee++)he.setUint32(4*Ee,xe[Ee],ae)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const ie=t.slice(0,n);return this.destroy(),ie}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:ie,length:fe,finished:ae,destroyed:le,pos:he}=this;return t.destroyed=le,t.finished=ae,t.length=fe,t.pos=he,fe%n&&t.buffer.set(ie),t}clone(){return this._cloneInto()}}const SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(c,t=!1){return t?{h:Number(c&U32_MASK64),l:Number(c>>_32n&U32_MASK64)}:{h:Number(c>>_32n&U32_MASK64)|0,l:Number(c&U32_MASK64)|0}}function split(c,t=!1){const n=c.length;let ie=new Uint32Array(n),fe=new Uint32Array(n);for(let ae=0;ae<n;ae++){const{h:le,l:he}=fromBig(c[ae],t);[ie[ae],fe[ae]]=[le,he]}return[ie,fe]}const shrSH=(c,t,n)=>c>>>n,shrSL=(c,t,n)=>c<<32-n|t>>>n,rotrSH=(c,t,n)=>c>>>n|t<<32-n,rotrSL=(c,t,n)=>c<<32-n|t>>>n,rotrBH=(c,t,n)=>c<<64-n|t>>>n-32,rotrBL=(c,t,n)=>c>>>n-32|t<<64-n;function add(c,t,n,ie){const fe=(t>>>0)+(ie>>>0);return{h:c+n+(fe/2**32|0)|0,l:fe|0}}const add3L=(c,t,n)=>(c>>>0)+(t>>>0)+(n>>>0),add3H=(c,t,n,ie)=>t+n+ie+(c/2**32|0)|0,add4L=(c,t,n,ie)=>(c>>>0)+(t>>>0)+(n>>>0)+(ie>>>0),add4H=(c,t,n,ie,fe)=>t+n+ie+fe+(c/2**32|0)|0,add5L=(c,t,n,ie,fe)=>(c>>>0)+(t>>>0)+(n>>>0)+(ie>>>0)+(fe>>>0),add5H=(c,t,n,ie,fe,ae)=>t+n+ie+fe+ae+(c/2**32|0)|0,SHA256_K=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),SHA256_W=new Uint32Array(64);class SHA256 extends HashMD{constructor(t=32){super(64,t,8,!1),this.A=SHA256_IV[0]|0,this.B=SHA256_IV[1]|0,this.C=SHA256_IV[2]|0,this.D=SHA256_IV[3]|0,this.E=SHA256_IV[4]|0,this.F=SHA256_IV[5]|0,this.G=SHA256_IV[6]|0,this.H=SHA256_IV[7]|0}get(){const{A:t,B:n,C:ie,D:fe,E:ae,F:le,G:he,H:ye}=this;return[t,n,ie,fe,ae,le,he,ye]}set(t,n,ie,fe,ae,le,he,ye){this.A=t|0,this.B=n|0,this.C=ie|0,this.D=fe|0,this.E=ae|0,this.F=le|0,this.G=he|0,this.H=ye|0}process(t,n){for(let Ee=0;Ee<16;Ee++,n+=4)SHA256_W[Ee]=t.getUint32(n,!1);for(let Ee=16;Ee<64;Ee++){const Se=SHA256_W[Ee-15],Me=SHA256_W[Ee-2],Be=rotr(Se,7)^rotr(Se,18)^Se>>>3,$e=rotr(Me,17)^rotr(Me,19)^Me>>>10;SHA256_W[Ee]=$e+SHA256_W[Ee-7]+Be+SHA256_W[Ee-16]|0}let{A:ie,B:fe,C:ae,D:le,E:he,F:ye,G:me,H:xe}=this;for(let Ee=0;Ee<64;Ee++){const Se=rotr(he,6)^rotr(he,11)^rotr(he,25),Me=xe+Se+Chi(he,ye,me)+SHA256_K[Ee]+SHA256_W[Ee]|0,$e=(rotr(ie,2)^rotr(ie,13)^rotr(ie,22))+Maj(ie,fe,ae)|0;xe=me,me=ye,ye=he,he=le+Me|0,le=ae,ae=fe,fe=ie,ie=Me+$e|0}ie=ie+this.A|0,fe=fe+this.B|0,ae=ae+this.C|0,le=le+this.D|0,he=he+this.E|0,ye=ye+this.F|0,me=me+this.G|0,xe=xe+this.H|0,this.set(ie,fe,ae,le,he,ye,me,xe)}roundClean(){clean(SHA256_W)}destroy(){this.set(0,0,0,0,0,0,0,0),clean(this.buffer)}}const K512=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(c=>BigInt(c))),SHA512_Kh=K512[0],SHA512_Kl=K512[1],SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends HashMD{constructor(t=64){super(128,t,16,!1),this.Ah=SHA512_IV[0]|0,this.Al=SHA512_IV[1]|0,this.Bh=SHA512_IV[2]|0,this.Bl=SHA512_IV[3]|0,this.Ch=SHA512_IV[4]|0,this.Cl=SHA512_IV[5]|0,this.Dh=SHA512_IV[6]|0,this.Dl=SHA512_IV[7]|0,this.Eh=SHA512_IV[8]|0,this.El=SHA512_IV[9]|0,this.Fh=SHA512_IV[10]|0,this.Fl=SHA512_IV[11]|0,this.Gh=SHA512_IV[12]|0,this.Gl=SHA512_IV[13]|0,this.Hh=SHA512_IV[14]|0,this.Hl=SHA512_IV[15]|0}get(){const{Ah:t,Al:n,Bh:ie,Bl:fe,Ch:ae,Cl:le,Dh:he,Dl:ye,Eh:me,El:xe,Fh:Ee,Fl:Se,Gh:Me,Gl:Be,Hh:$e,Hl:Ce}=this;return[t,n,ie,fe,ae,le,he,ye,me,xe,Ee,Se,Me,Be,$e,Ce]}set(t,n,ie,fe,ae,le,he,ye,me,xe,Ee,Se,Me,Be,$e,Ce){this.Ah=t|0,this.Al=n|0,this.Bh=ie|0,this.Bl=fe|0,this.Ch=ae|0,this.Cl=le|0,this.Dh=he|0,this.Dl=ye|0,this.Eh=me|0,this.El=xe|0,this.Fh=Ee|0,this.Fl=Se|0,this.Gh=Me|0,this.Gl=Be|0,this.Hh=$e|0,this.Hl=Ce|0}process(t,n){for(let Ue=0;Ue<16;Ue++,n+=4)SHA512_W_H[Ue]=t.getUint32(n),SHA512_W_L[Ue]=t.getUint32(n+=4);for(let Ue=16;Ue<80;Ue++){const qe=SHA512_W_H[Ue-15]|0,He=SHA512_W_L[Ue-15]|0,Ve=rotrSH(qe,He,1)^rotrSH(qe,He,8)^shrSH(qe,He,7),Ye=rotrSL(qe,He,1)^rotrSL(qe,He,8)^shrSL(qe,He,7),Qe=SHA512_W_H[Ue-2]|0,Ke=SHA512_W_L[Ue-2]|0,Pt=rotrSH(Qe,Ke,19)^rotrBH(Qe,Ke,61)^shrSH(Qe,Ke,6),_e=rotrSL(Qe,Ke,19)^rotrBL(Qe,Ke,61)^shrSL(Qe,Ke,6),se=add4L(Ye,_e,SHA512_W_L[Ue-7],SHA512_W_L[Ue-16]),ce=add4H(se,Ve,Pt,SHA512_W_H[Ue-7],SHA512_W_H[Ue-16]);SHA512_W_H[Ue]=ce|0,SHA512_W_L[Ue]=se|0}let{Ah:ie,Al:fe,Bh:ae,Bl:le,Ch:he,Cl:ye,Dh:me,Dl:xe,Eh:Ee,El:Se,Fh:Me,Fl:Be,Gh:$e,Gl:Ce,Hh:ke,Hl:Pe}=this;for(let Ue=0;Ue<80;Ue++){const qe=rotrSH(Ee,Se,14)^rotrSH(Ee,Se,18)^rotrBH(Ee,Se,41),He=rotrSL(Ee,Se,14)^rotrSL(Ee,Se,18)^rotrBL(Ee,Se,41),Ve=Ee&Me^~Ee&$e,Ye=Se&Be^~Se&Ce,Qe=add5L(Pe,He,Ye,SHA512_Kl[Ue],SHA512_W_L[Ue]),Ke=add5H(Qe,ke,qe,Ve,SHA512_Kh[Ue],SHA512_W_H[Ue]),Pt=Qe|0,_e=rotrSH(ie,fe,28)^rotrBH(ie,fe,34)^rotrBH(ie,fe,39),se=rotrSL(ie,fe,28)^rotrBL(ie,fe,34)^rotrBL(ie,fe,39),ce=ie&ae^ie&he^ae&he,de=fe&le^fe&ye^le&ye;ke=$e|0,Pe=Ce|0,$e=Me|0,Ce=Be|0,Me=Ee|0,Be=Se|0,{h:Ee,l:Se}=add(me|0,xe|0,Ke|0,Pt|0),me=he|0,xe=ye|0,he=ae|0,ye=le|0,ae=ie|0,le=fe|0;const pe=add3L(Pt,se,de);ie=add3H(pe,Ke,_e,ce),fe=pe|0}({h:ie,l:fe}=add(this.Ah|0,this.Al|0,ie|0,fe|0)),{h:ae,l:le}=add(this.Bh|0,this.Bl|0,ae|0,le|0),{h:he,l:ye}=add(this.Ch|0,this.Cl|0,he|0,ye|0),{h:me,l:xe}=add(this.Dh|0,this.Dl|0,me|0,xe|0),{h:Ee,l:Se}=add(this.Eh|0,this.El|0,Ee|0,Se|0),{h:Me,l:Be}=add(this.Fh|0,this.Fl|0,Me|0,Be|0),{h:$e,l:Ce}=add(this.Gh|0,this.Gl|0,$e|0,Ce|0),{h:ke,l:Pe}=add(this.Hh|0,this.Hl|0,ke|0,Pe|0),this.set(ie,fe,ae,le,he,ye,me,xe,Ee,Se,Me,Be,$e,Ce,ke,Pe)}roundClean(){clean(SHA512_W_H,SHA512_W_L)}destroy(){clean(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha256$5=createHasher(()=>new SHA256),sha512$3=createHasher(()=>new SHA512);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$5=BigInt(1);function _abool2(c,t=""){if(typeof c!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof c)}return c}function _abytes2(c,t,n=""){const ie=isBytes(c),fe=c==null?void 0:c.length,ae=t!==void 0;if(!ie||ae&&fe!==t){const le=n&&`"${n}" `,he=ae?` of length ${t}`:"",ye=ie?`length=${fe}`:`type=${typeof c}`;throw new Error(le+"expected Uint8Array"+he+", got "+ye)}return c}function numberToHexUnpadded(c){const t=c.toString(16);return t.length&1?"0"+t:t}function hexToNumber(c){if(typeof c!="string")throw new Error("hex string expected, got "+typeof c);return c===""?_0n$4:BigInt("0x"+c)}function bytesToNumberBE(c){return hexToNumber(bytesToHex(c))}function bytesToNumberLE(c){return abytes(c),hexToNumber(bytesToHex(Uint8Array.from(c).reverse()))}function numberToBytesBE(c,t){return hexToBytes(c.toString(16).padStart(t*2,"0"))}function numberToBytesLE(c,t){return numberToBytesBE(c,t).reverse()}function ensureBytes(c,t,n){let ie;if(typeof t=="string")try{ie=hexToBytes(t)}catch(ae){throw new Error(c+" must be hex string or Uint8Array, cause: "+ae)}else if(isBytes(t))ie=Uint8Array.from(t);else throw new Error(c+" must be hex string or Uint8Array");const fe=ie.length;if(typeof n=="number"&&fe!==n)throw new Error(c+" of length "+n+" expected, got "+fe);return ie}function copyBytes(c){return Uint8Array.from(c)}const isPosBig=c=>typeof c=="bigint"&&_0n$4<=c;function inRange$1(c,t,n){return isPosBig(c)&&isPosBig(t)&&isPosBig(n)&&t<=c&&c<n}function aInRange(c,t,n,ie){if(!inRange$1(t,n,ie))throw new Error("expected valid "+c+": "+n+" <= n < "+ie+", got "+t)}function bitLen(c){let t;for(t=0;c>_0n$4;c>>=_1n$5,t+=1);return t}const bitMask=c=>(_1n$5<<BigInt(c))-_1n$5;function createHmacDrbg(c,t,n){if(typeof c!="number"||c<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");const ie=Me=>new Uint8Array(Me),fe=Me=>Uint8Array.of(Me);let ae=ie(c),le=ie(c),he=0;const ye=()=>{ae.fill(1),le.fill(0),he=0},me=(...Me)=>n(le,ae,...Me),xe=(Me=ie(0))=>{le=me(fe(0),Me),ae=me(),Me.length!==0&&(le=me(fe(1),Me),ae=me())},Ee=()=>{if(he++>=1e3)throw new Error("drbg: tried 1000 values");let Me=0;const Be=[];for(;Me<t;){ae=me();const $e=ae.slice();Be.push($e),Me+=ae.length}return concatBytes(...Be)};return(Me,Be)=>{ye(),xe(Me);let $e;for(;!($e=Be(Ee()));)xe();return ye(),$e}}function _validateObject(c,t,n={}){if(!c||typeof c!="object")throw new Error("expected valid options object");function ie(fe,ae,le){const he=c[fe];if(le&&he===void 0)return;const ye=typeof he;if(ye!==ae||he===null)throw new Error(`param "${fe}" is invalid: expected ${ae}, got ${ye}`)}Object.entries(t).forEach(([fe,ae])=>ie(fe,ae,!1)),Object.entries(n).forEach(([fe,ae])=>ie(fe,ae,!0))}function memoized(c){const t=new WeakMap;return(n,...ie)=>{const fe=t.get(n);if(fe!==void 0)return fe;const ae=c(n,...ie);return t.set(n,ae),ae}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$3=BigInt(0),_1n$4=BigInt(1),_2n$4=BigInt(2),_3n$1=BigInt(3),_4n$1=BigInt(4),_5n$1=BigInt(5),_7n=BigInt(7),_8n$2=BigInt(8),_9n=BigInt(9),_16n=BigInt(16);function mod(c,t){const n=c%t;return n>=_0n$3?n:t+n}function pow2(c,t,n){let ie=c;for(;t-- >_0n$3;)ie*=ie,ie%=n;return ie}function invert(c,t){if(c===_0n$3)throw new Error("invert: expected non-zero number");if(t<=_0n$3)throw new Error("invert: expected positive modulus, got "+t);let n=mod(c,t),ie=t,fe=_0n$3,ae=_1n$4;for(;n!==_0n$3;){const he=ie/n,ye=ie%n,me=fe-ae*he;ie=n,n=ye,fe=ae,ae=me}if(ie!==_1n$4)throw new Error("invert: does not exist");return mod(fe,t)}function assertIsSquare(c,t,n){if(!c.eql(c.sqr(t),n))throw new Error("Cannot find square root")}function sqrt3mod4(c,t){const n=(c.ORDER+_1n$4)/_4n$1,ie=c.pow(t,n);return assertIsSquare(c,ie,t),ie}function sqrt5mod8(c,t){const n=(c.ORDER-_5n$1)/_8n$2,ie=c.mul(t,_2n$4),fe=c.pow(ie,n),ae=c.mul(t,fe),le=c.mul(c.mul(ae,_2n$4),fe),he=c.mul(ae,c.sub(le,c.ONE));return assertIsSquare(c,he,t),he}function sqrt9mod16(c){const t=Field(c),n=tonelliShanks(c),ie=n(t,t.neg(t.ONE)),fe=n(t,ie),ae=n(t,t.neg(ie)),le=(c+_7n)/_16n;return(he,ye)=>{let me=he.pow(ye,le),xe=he.mul(me,ie);const Ee=he.mul(me,fe),Se=he.mul(me,ae),Me=he.eql(he.sqr(xe),ye),Be=he.eql(he.sqr(Ee),ye);me=he.cmov(me,xe,Me),xe=he.cmov(Se,Ee,Be);const $e=he.eql(he.sqr(xe),ye),Ce=he.cmov(me,xe,$e);return assertIsSquare(he,Ce,ye),Ce}}function tonelliShanks(c){if(c<_3n$1)throw new Error("sqrt is not defined for small field");let t=c-_1n$4,n=0;for(;t%_2n$4===_0n$3;)t/=_2n$4,n++;let ie=_2n$4;const fe=Field(c);for(;FpLegendre(fe,ie)===1;)if(ie++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return sqrt3mod4;let ae=fe.pow(ie,t);const le=(t+_1n$4)/_2n$4;return function(ye,me){if(ye.is0(me))return me;if(FpLegendre(ye,me)!==1)throw new Error("Cannot find square root");let xe=n,Ee=ye.mul(ye.ONE,ae),Se=ye.pow(me,t),Me=ye.pow(me,le);for(;!ye.eql(Se,ye.ONE);){if(ye.is0(Se))return ye.ZERO;let Be=1,$e=ye.sqr(Se);for(;!ye.eql($e,ye.ONE);)if(Be++,$e=ye.sqr($e),Be===xe)throw new Error("Cannot find square root");const Ce=_1n$4<<BigInt(xe-Be-1),ke=ye.pow(Ee,Ce);xe=Be,Ee=ye.sqr(ke),Se=ye.mul(Se,Ee),Me=ye.mul(Me,ke)}return Me}}function FpSqrt(c){return c%_4n$1===_3n$1?sqrt3mod4:c%_8n$2===_5n$1?sqrt5mod8:c%_16n===_9n?sqrt9mod16(c):tonelliShanks(c)}const isNegativeLE=(c,t)=>(mod(c,t)&_1n$4)===_1n$4,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(c){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=FIELD_FIELDS.reduce((ie,fe)=>(ie[fe]="function",ie),t);return _validateObject(c,n),c}function FpPow(c,t,n){if(n<_0n$3)throw new Error("invalid exponent, negatives unsupported");if(n===_0n$3)return c.ONE;if(n===_1n$4)return t;let ie=c.ONE,fe=t;for(;n>_0n$3;)n&_1n$4&&(ie=c.mul(ie,fe)),fe=c.sqr(fe),n>>=_1n$4;return ie}function FpInvertBatch(c,t,n=!1){const ie=new Array(t.length).fill(n?c.ZERO:void 0),fe=t.reduce((le,he,ye)=>c.is0(he)?le:(ie[ye]=le,c.mul(le,he)),c.ONE),ae=c.inv(fe);return t.reduceRight((le,he,ye)=>c.is0(he)?le:(ie[ye]=c.mul(le,ie[ye]),c.mul(le,he)),ae),ie}function FpLegendre(c,t){const n=(c.ORDER-_1n$4)/_2n$4,ie=c.pow(t,n),fe=c.eql(ie,c.ONE),ae=c.eql(ie,c.ZERO),le=c.eql(ie,c.neg(c.ONE));if(!fe&&!ae&&!le)throw new Error("invalid Legendre symbol result");return fe?1:ae?0:-1}function nLength(c,t){t!==void 0&&anumber(t);const n=t!==void 0?t:c.toString(2).length,ie=Math.ceil(n/8);return{nBitLength:n,nByteLength:ie}}function Field(c,t,n=!1,ie={}){if(c<=_0n$3)throw new Error("invalid field: expected ORDER > 0, got "+c);let fe,ae,le=!1,he;if(typeof t=="object"&&t!=null){if(ie.sqrt||n)throw new Error("cannot specify opts in two arguments");const Se=t;Se.BITS&&(fe=Se.BITS),Se.sqrt&&(ae=Se.sqrt),typeof Se.isLE=="boolean"&&(n=Se.isLE),typeof Se.modFromBytes=="boolean"&&(le=Se.modFromBytes),he=Se.allowedLengths}else typeof t=="number"&&(fe=t),ie.sqrt&&(ae=ie.sqrt);const{nBitLength:ye,nByteLength:me}=nLength(c,fe);if(me>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let xe;const Ee=Object.freeze({ORDER:c,isLE:n,BITS:ye,BYTES:me,MASK:bitMask(ye),ZERO:_0n$3,ONE:_1n$4,allowedLengths:he,create:Se=>mod(Se,c),isValid:Se=>{if(typeof Se!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof Se);return _0n$3<=Se&&Se<c},is0:Se=>Se===_0n$3,isValidNot0:Se=>!Ee.is0(Se)&&Ee.isValid(Se),isOdd:Se=>(Se&_1n$4)===_1n$4,neg:Se=>mod(-Se,c),eql:(Se,Me)=>Se===Me,sqr:Se=>mod(Se*Se,c),add:(Se,Me)=>mod(Se+Me,c),sub:(Se,Me)=>mod(Se-Me,c),mul:(Se,Me)=>mod(Se*Me,c),pow:(Se,Me)=>FpPow(Ee,Se,Me),div:(Se,Me)=>mod(Se*invert(Me,c),c),sqrN:Se=>Se*Se,addN:(Se,Me)=>Se+Me,subN:(Se,Me)=>Se-Me,mulN:(Se,Me)=>Se*Me,inv:Se=>invert(Se,c),sqrt:ae||(Se=>(xe||(xe=FpSqrt(c)),xe(Ee,Se))),toBytes:Se=>n?numberToBytesLE(Se,me):numberToBytesBE(Se,me),fromBytes:(Se,Me=!0)=>{if(he){if(!he.includes(Se.length)||Se.length>me)throw new Error("Field.fromBytes: expected "+he+" bytes, got "+Se.length);const $e=new Uint8Array(me);$e.set(Se,n?0:$e.length-Se.length),Se=$e}if(Se.length!==me)throw new Error("Field.fromBytes: expected "+me+" bytes, got "+Se.length);let Be=n?bytesToNumberLE(Se):bytesToNumberBE(Se);if(le&&(Be=mod(Be,c)),!Me&&!Ee.isValid(Be))throw new Error("invalid field element: outside of range 0..ORDER");return Be},invertBatch:Se=>FpInvertBatch(Ee,Se),cmov:(Se,Me,Be)=>Be?Me:Se});return Object.freeze(Ee)}function getFieldBytesLength(c){if(typeof c!="bigint")throw new Error("field order must be bigint");const t=c.toString(2).length;return Math.ceil(t/8)}function getMinHashLength(c){const t=getFieldBytesLength(c);return t+Math.ceil(t/2)}function mapHashToField(c,t,n=!1){const ie=c.length,fe=getFieldBytesLength(t),ae=getMinHashLength(t);if(ie<16||ie<ae||ie>1024)throw new Error("expected "+ae+"-1024 bytes of input, got "+ie);const le=n?bytesToNumberLE(c):bytesToNumberBE(c),he=mod(le,t-_1n$4)+_1n$4;return n?numberToBytesLE(he,fe):numberToBytesBE(he,fe)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$2=BigInt(0),_1n$3=BigInt(1);function negateCt(c,t){const n=t.negate();return c?n:t}function normalizeZ(c,t){const n=FpInvertBatch(c.Fp,t.map(ie=>ie.Z));return t.map((ie,fe)=>c.fromAffine(ie.toAffine(n[fe])))}function validateW(c,t){if(!Number.isSafeInteger(c)||c<=0||c>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+c)}function calcWOpts(c,t){validateW(c,t);const n=Math.ceil(t/c)+1,ie=2**(c-1),fe=2**c,ae=bitMask(c),le=BigInt(c);return{windows:n,windowSize:ie,mask:ae,maxNumber:fe,shiftBy:le}}function calcOffsets(c,t,n){const{windowSize:ie,mask:fe,maxNumber:ae,shiftBy:le}=n;let he=Number(c&fe),ye=c>>le;he>ie&&(he-=ae,ye+=_1n$3);const me=t*ie,xe=me+Math.abs(he)-1,Ee=he===0,Se=he<0,Me=t%2!==0;return{nextN:ye,offset:xe,isZero:Ee,isNeg:Se,isNegF:Me,offsetF:me}}function validateMSMPoints(c,t){if(!Array.isArray(c))throw new Error("array expected");c.forEach((n,ie)=>{if(!(n instanceof t))throw new Error("invalid point at index "+ie)})}function validateMSMScalars(c,t){if(!Array.isArray(c))throw new Error("array of scalars expected");c.forEach((n,ie)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+ie)})}const pointPrecomputes=new WeakMap,pointWindowSizes=new WeakMap;function getW(c){return pointWindowSizes.get(c)||1}function assert0(c){if(c!==_0n$2)throw new Error("invalid wNAF")}class wNAF{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,ie=this.ZERO){let fe=t;for(;n>_0n$2;)n&_1n$3&&(ie=ie.add(fe)),fe=fe.double(),n>>=_1n$3;return ie}precomputeWindow(t,n){const{windows:ie,windowSize:fe}=calcWOpts(n,this.bits),ae=[];let le=t,he=le;for(let ye=0;ye<ie;ye++){he=le,ae.push(he);for(let me=1;me<fe;me++)he=he.add(le),ae.push(he);le=he.double()}return ae}wNAF(t,n,ie){if(!this.Fn.isValid(ie))throw new Error("invalid scalar");let fe=this.ZERO,ae=this.BASE;const le=calcWOpts(t,this.bits);for(let he=0;he<le.windows;he++){const{nextN:ye,offset:me,isZero:xe,isNeg:Ee,isNegF:Se,offsetF:Me}=calcOffsets(ie,he,le);ie=ye,xe?ae=ae.add(negateCt(Se,n[Me])):fe=fe.add(negateCt(Ee,n[me]))}return assert0(ie),{p:fe,f:ae}}wNAFUnsafe(t,n,ie,fe=this.ZERO){const ae=calcWOpts(t,this.bits);for(let le=0;le<ae.windows&&ie!==_0n$2;le++){const{nextN:he,offset:ye,isZero:me,isNeg:xe}=calcOffsets(ie,le,ae);if(ie=he,!me){const Ee=n[ye];fe=fe.add(xe?Ee.negate():Ee)}}return assert0(ie),fe}getPrecomputes(t,n,ie){let fe=pointPrecomputes.get(n);return fe||(fe=this.precomputeWindow(n,t),t!==1&&(typeof ie=="function"&&(fe=ie(fe)),pointPrecomputes.set(n,fe))),fe}cached(t,n,ie){const fe=getW(t);return this.wNAF(fe,this.getPrecomputes(fe,t,ie),n)}unsafe(t,n,ie,fe){const ae=getW(t);return ae===1?this._unsafeLadder(t,n,fe):this.wNAFUnsafe(ae,this.getPrecomputes(ae,t,ie),n,fe)}createCache(t,n){validateW(n,this.bits),pointWindowSizes.set(t,n),pointPrecomputes.delete(t)}hasCache(t){return getW(t)!==1}}function mulEndoUnsafe(c,t,n,ie){let fe=t,ae=c.ZERO,le=c.ZERO;for(;n>_0n$2||ie>_0n$2;)n&_1n$3&&(ae=ae.add(fe)),ie&_1n$3&&(le=le.add(fe)),fe=fe.double(),n>>=_1n$3,ie>>=_1n$3;return{p1:ae,p2:le}}function pippenger(c,t,n,ie){validateMSMPoints(n,c),validateMSMScalars(ie,t);const fe=n.length,ae=ie.length;if(fe!==ae)throw new Error("arrays of points and scalars must have equal length");const le=c.ZERO,he=bitLen(BigInt(fe));let ye=1;he>12?ye=he-3:he>4?ye=he-2:he>0&&(ye=2);const me=bitMask(ye),xe=new Array(Number(me)+1).fill(le),Ee=Math.floor((t.BITS-1)/ye)*ye;let Se=le;for(let Me=Ee;Me>=0;Me-=ye){xe.fill(le);for(let $e=0;$e<ae;$e++){const Ce=ie[$e],ke=Number(Ce>>BigInt(Me)&me);xe[ke]=xe[ke].add(n[$e])}let Be=le;for(let $e=xe.length-1,Ce=le;$e>0;$e--)Ce=Ce.add(xe[$e]),Be=Be.add(Ce);if(Se=Se.add(Be),Me!==0)for(let $e=0;$e<ye;$e++)Se=Se.double()}return Se}function createField(c,t,n){if(t){if(t.ORDER!==c)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return validateField(t),t}else return Field(c,{isLE:n})}function _createCurveFields(c,t,n={},ie){if(ie===void 0&&(ie=c==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${c} CURVE object`);for(const ye of["p","n","h"]){const me=t[ye];if(!(typeof me=="bigint"&&me>_0n$2))throw new Error(`CURVE.${ye} must be positive bigint`)}const fe=createField(t.p,n.Fp,ie),ae=createField(t.n,n.Fn,ie),he=["Gx","Gy","a",c==="weierstrass"?"b":"d"];for(const ye of he)if(!fe.isValid(t[ye]))throw new Error(`CURVE.${ye} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:fe,Fn:ae}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$1=BigInt(0),_1n$2=BigInt(1),_2n$3=BigInt(2),_8n$1=BigInt(8);function isEdValidXY(c,t,n,ie){const fe=c.sqr(n),ae=c.sqr(ie),le=c.add(c.mul(t.a,fe),ae),he=c.add(c.ONE,c.mul(t.d,c.mul(fe,ae)));return c.eql(le,he)}function edwards$1(c,t={}){const n=_createCurveFields("edwards",c,t,t.FpFnLE),{Fp:ie,Fn:fe}=n;let ae=n.CURVE;const{h:le}=ae;_validateObject(t,{},{uvRatio:"function"});const he=_2n$3<<BigInt(fe.BYTES*8)-_1n$2,ye=Ce=>ie.create(Ce),me=t.uvRatio||((Ce,ke)=>{try{return{isValid:!0,value:ie.sqrt(ie.div(Ce,ke))}}catch{return{isValid:!1,value:_0n$1}}});if(!isEdValidXY(ie,ae,ae.Gx,ae.Gy))throw new Error("bad curve params: generator point");function xe(Ce,ke,Pe=!1){const Ue=Pe?_1n$2:_0n$1;return aInRange("coordinate "+Ce,ke,Ue,he),ke}function Ee(Ce){if(!(Ce instanceof Be))throw new Error("ExtendedPoint expected")}const Se=memoized((Ce,ke)=>{const{X:Pe,Y:Ue,Z:qe}=Ce,He=Ce.is0();ke==null&&(ke=He?_8n$1:ie.inv(qe));const Ve=ye(Pe*ke),Ye=ye(Ue*ke),Qe=ie.mul(qe,ke);if(He)return{x:_0n$1,y:_1n$2};if(Qe!==_1n$2)throw new Error("invZ was invalid");return{x:Ve,y:Ye}}),Me=memoized(Ce=>{const{a:ke,d:Pe}=ae;if(Ce.is0())throw new Error("bad point: ZERO");const{X:Ue,Y:qe,Z:He,T:Ve}=Ce,Ye=ye(Ue*Ue),Qe=ye(qe*qe),Ke=ye(He*He),Pt=ye(Ke*Ke),_e=ye(Ye*ke),se=ye(Ke*ye(_e+Qe)),ce=ye(Pt+ye(Pe*ye(Ye*Qe)));if(se!==ce)throw new Error("bad point: equation left != right (1)");const de=ye(Ue*qe),pe=ye(He*Ve);if(de!==pe)throw new Error("bad point: equation left != right (2)");return!0});class Be{constructor(ke,Pe,Ue,qe){this.X=xe("x",ke),this.Y=xe("y",Pe),this.Z=xe("z",Ue,!0),this.T=xe("t",qe),Object.freeze(this)}static CURVE(){return ae}static fromAffine(ke){if(ke instanceof Be)throw new Error("extended point not allowed");const{x:Pe,y:Ue}=ke||{};return xe("x",Pe),xe("y",Ue),new Be(Pe,Ue,_1n$2,ye(Pe*Ue))}static fromBytes(ke,Pe=!1){const Ue=ie.BYTES,{a:qe,d:He}=ae;ke=copyBytes(_abytes2(ke,Ue,"point")),_abool2(Pe,"zip215");const Ve=copyBytes(ke),Ye=ke[Ue-1];Ve[Ue-1]=Ye&-129;const Qe=bytesToNumberLE(Ve),Ke=Pe?he:ie.ORDER;aInRange("point.y",Qe,_0n$1,Ke);const Pt=ye(Qe*Qe),_e=ye(Pt-_1n$2),se=ye(He*Pt-qe);let{isValid:ce,value:de}=me(_e,se);if(!ce)throw new Error("bad point: invalid y coordinate");const pe=(de&_1n$2)===_1n$2,ve=(Ye&128)!==0;if(!Pe&&de===_0n$1&&ve)throw new Error("bad point: x=0 and x_0=1");return ve!==pe&&(de=ye(-de)),Be.fromAffine({x:de,y:Qe})}static fromHex(ke,Pe=!1){return Be.fromBytes(ensureBytes("point",ke),Pe)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(ke=8,Pe=!0){return $e.createCache(this,ke),Pe||this.multiply(_2n$3),this}assertValidity(){Me(this)}equals(ke){Ee(ke);const{X:Pe,Y:Ue,Z:qe}=this,{X:He,Y:Ve,Z:Ye}=ke,Qe=ye(Pe*Ye),Ke=ye(He*qe),Pt=ye(Ue*Ye),_e=ye(Ve*qe);return Qe===Ke&&Pt===_e}is0(){return this.equals(Be.ZERO)}negate(){return new Be(ye(-this.X),this.Y,this.Z,ye(-this.T))}double(){const{a:ke}=ae,{X:Pe,Y:Ue,Z:qe}=this,He=ye(Pe*Pe),Ve=ye(Ue*Ue),Ye=ye(_2n$3*ye(qe*qe)),Qe=ye(ke*He),Ke=Pe+Ue,Pt=ye(ye(Ke*Ke)-He-Ve),_e=Qe+Ve,se=_e-Ye,ce=Qe-Ve,de=ye(Pt*se),pe=ye(_e*ce),ve=ye(Pt*ce),we=ye(se*_e);return new Be(de,pe,we,ve)}add(ke){Ee(ke);const{a:Pe,d:Ue}=ae,{X:qe,Y:He,Z:Ve,T:Ye}=this,{X:Qe,Y:Ke,Z:Pt,T:_e}=ke,se=ye(qe*Qe),ce=ye(He*Ke),de=ye(Ye*Ue*_e),pe=ye(Ve*Pt),ve=ye((qe+He)*(Qe+Ke)-se-ce),we=pe-de,Ae=pe+de,ge=ye(ce-Pe*se),ue=ye(ve*we),be=ye(Ae*ge),Re=ye(ve*ge),Ne=ye(we*Ae);return new Be(ue,be,Ne,Re)}subtract(ke){return this.add(ke.negate())}multiply(ke){if(!fe.isValidNot0(ke))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:Pe,f:Ue}=$e.cached(this,ke,qe=>normalizeZ(Be,qe));return normalizeZ(Be,[Pe,Ue])[0]}multiplyUnsafe(ke,Pe=Be.ZERO){if(!fe.isValid(ke))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return ke===_0n$1?Be.ZERO:this.is0()||ke===_1n$2?this:$e.unsafe(this,ke,Ue=>normalizeZ(Be,Ue),Pe)}isSmallOrder(){return this.multiplyUnsafe(le).is0()}isTorsionFree(){return $e.unsafe(this,ae.n).is0()}toAffine(ke){return Se(this,ke)}clearCofactor(){return le===_1n$2?this:this.multiplyUnsafe(le)}toBytes(){const{x:ke,y:Pe}=this.toAffine(),Ue=ie.toBytes(Pe);return Ue[Ue.length-1]|=ke&_1n$2?128:0,Ue}toHex(){return bytesToHex(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(ke){return normalizeZ(Be,ke)}static msm(ke,Pe){return pippenger(Be,fe,ke,Pe)}_setWindowSize(ke){this.precompute(ke)}toRawBytes(){return this.toBytes()}}Be.BASE=new Be(ae.Gx,ae.Gy,_1n$2,ye(ae.Gx*ae.Gy)),Be.ZERO=new Be(_0n$1,_1n$2,_1n$2,_0n$1),Be.Fp=ie,Be.Fn=fe;const $e=new wNAF(Be,fe.BITS);return Be.BASE.precompute(8),Be}function eddsa$1(c,t,n={}){if(typeof t!="function")throw new Error('"hash" function param is required');_validateObject(n,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:ie}=n,{BASE:fe,Fp:ae,Fn:le}=c,he=n.randomBytes||randomBytes,ye=n.adjustScalarBytes||(Ke=>Ke),me=n.domain||((Ke,Pt,_e)=>{if(_abool2(_e,"phflag"),Pt.length||_e)throw new Error("Contexts/pre-hash are not supported");return Ke});function xe(Ke){return le.create(bytesToNumberLE(Ke))}function Ee(Ke){const Pt=Ue.secretKey;Ke=ensureBytes("private key",Ke,Pt);const _e=ensureBytes("hashed private key",t(Ke),2*Pt),se=ye(_e.slice(0,Pt)),ce=_e.slice(Pt,2*Pt),de=xe(se);return{head:se,prefix:ce,scalar:de}}function Se(Ke){const{head:Pt,prefix:_e,scalar:se}=Ee(Ke),ce=fe.multiply(se),de=ce.toBytes();return{head:Pt,prefix:_e,scalar:se,point:ce,pointBytes:de}}function Me(Ke){return Se(Ke).pointBytes}function Be(Ke=Uint8Array.of(),...Pt){const _e=concatBytes(...Pt);return xe(t(me(_e,ensureBytes("context",Ke),!!ie)))}function $e(Ke,Pt,_e={}){Ke=ensureBytes("message",Ke),ie&&(Ke=ie(Ke));const{prefix:se,scalar:ce,pointBytes:de}=Se(Pt),pe=Be(_e.context,se,Ke),ve=fe.multiply(pe).toBytes(),we=Be(_e.context,ve,de,Ke),Ae=le.create(pe+we*ce);if(!le.isValid(Ae))throw new Error("sign failed: invalid s");const ge=concatBytes(ve,le.toBytes(Ae));return _abytes2(ge,Ue.signature,"result")}const Ce={zip215:!0};function ke(Ke,Pt,_e,se=Ce){const{context:ce,zip215:de}=se,pe=Ue.signature;Ke=ensureBytes("signature",Ke,pe),Pt=ensureBytes("message",Pt),_e=ensureBytes("publicKey",_e,Ue.publicKey),de!==void 0&&_abool2(de,"zip215"),ie&&(Pt=ie(Pt));const ve=pe/2,we=Ke.subarray(0,ve),Ae=bytesToNumberLE(Ke.subarray(ve,pe));let ge,ue,be;try{ge=c.fromBytes(_e,de),ue=c.fromBytes(we,de),be=fe.multiplyUnsafe(Ae)}catch{return!1}if(!de&&ge.isSmallOrder())return!1;const Re=Be(ce,ue.toBytes(),ge.toBytes(),Pt);return ue.add(ge.multiplyUnsafe(Re)).subtract(be).clearCofactor().is0()}const Pe=ae.BYTES,Ue={secretKey:Pe,publicKey:Pe,signature:2*Pe,seed:Pe};function qe(Ke=he(Ue.seed)){return _abytes2(Ke,Ue.seed,"seed")}function He(Ke){const Pt=Qe.randomSecretKey(Ke);return{secretKey:Pt,publicKey:Me(Pt)}}function Ve(Ke){return isBytes(Ke)&&Ke.length===le.BYTES}function Ye(Ke,Pt){try{return!!c.fromBytes(Ke,Pt)}catch{return!1}}const Qe={getExtendedPublicKey:Se,randomSecretKey:qe,isValidSecretKey:Ve,isValidPublicKey:Ye,toMontgomery(Ke){const{y:Pt}=c.fromBytes(Ke),_e=Ue.publicKey,se=_e===32;if(!se&&_e!==57)throw new Error("only defined for 25519 and 448");const ce=se?ae.div(_1n$2+Pt,_1n$2-Pt):ae.div(Pt-_1n$2,Pt+_1n$2);return ae.toBytes(ce)},toMontgomerySecret(Ke){const Pt=Ue.secretKey;_abytes2(Ke,Pt);const _e=t(Ke.subarray(0,Pt));return ye(_e).subarray(0,Pt)},randomPrivateKey:qe,precompute(Ke=8,Pt=c.BASE){return Pt.precompute(Ke,!1)}};return Object.freeze({keygen:He,getPublicKey:Me,sign:$e,verify:ke,utils:Qe,Point:c,lengths:Ue})}function _eddsa_legacy_opts_to_new(c){const t={a:c.a,d:c.d,p:c.Fp.ORDER,n:c.n,h:c.h,Gx:c.Gx,Gy:c.Gy},n=c.Fp,ie=Field(t.n,c.nBitLength,!0),fe={Fp:n,Fn:ie,uvRatio:c.uvRatio},ae={randomBytes:c.randomBytes,adjustScalarBytes:c.adjustScalarBytes,domain:c.domain,prehash:c.prehash,mapToCurve:c.mapToCurve};return{CURVE:t,curveOpts:fe,hash:c.hash,eddsaOpts:ae}}function _eddsa_new_output_to_legacy(c,t){const n=t.Point;return Object.assign({},t,{ExtendedPoint:n,CURVE:c,nBitLength:n.Fn.BITS,nByteLength:n.Fn.BYTES})}function twistedEdwards(c){const{CURVE:t,curveOpts:n,hash:ie,eddsaOpts:fe}=_eddsa_legacy_opts_to_new(c),ae=edwards$1(t,n),le=eddsa$1(ae,ie,fe);return _eddsa_new_output_to_legacy(c,le)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _1n$1=BigInt(1),_2n$2=BigInt(2);BigInt(3);const _5n=BigInt(5),_8n=BigInt(8),ed25519_CURVE_p=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),ed25519_CURVE={p:ed25519_CURVE_p,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:_8n,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function ed25519_pow_2_252_3(c){const t=BigInt(10),n=BigInt(20),ie=BigInt(40),fe=BigInt(80),ae=ed25519_CURVE_p,he=c*c%ae*c%ae,ye=pow2(he,_2n$2,ae)*he%ae,me=pow2(ye,_1n$1,ae)*c%ae,xe=pow2(me,_5n,ae)*me%ae,Ee=pow2(xe,t,ae)*xe%ae,Se=pow2(Ee,n,ae)*Ee%ae,Me=pow2(Se,ie,ae)*Se%ae,Be=pow2(Me,fe,ae)*Me%ae,$e=pow2(Be,fe,ae)*Me%ae,Ce=pow2($e,t,ae)*xe%ae;return{pow_p_5_8:pow2(Ce,_2n$2,ae)*c%ae,b2:he}}function adjustScalarBytes(c){return c[0]&=248,c[31]&=127,c[31]|=64,c}const ED25519_SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function uvRatio(c,t){const n=ed25519_CURVE_p,ie=mod(t*t*t,n),fe=mod(ie*ie*t,n),ae=ed25519_pow_2_252_3(c*fe).pow_p_5_8;let le=mod(c*ie*ae,n);const he=mod(t*le*le,n),ye=le,me=mod(le*ED25519_SQRT_M1,n),xe=he===c,Ee=he===mod(-c,n),Se=he===mod(-c*ED25519_SQRT_M1,n);return xe&&(le=ye),(Ee||Se)&&(le=me),isNegativeLE(le,n)&&(le=mod(-le,n)),{isValid:xe||Ee,value:le}}const Fp=Field(ed25519_CURVE.p,{isLE:!0}),ed25519Defaults={...ed25519_CURVE,Fp,hash:sha512$3,adjustScalarBytes,uvRatio},ed25519=twistedEdwards(ed25519Defaults);var safeBuffer$2={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(c,t){var n=require$$0$4,ie=n.Buffer;function fe(le,he){for(var ye in le)he[ye]=le[ye]}ie.from&&ie.alloc&&ie.allocUnsafe&&ie.allocUnsafeSlow?c.exports=n:(fe(n,t),t.Buffer=ae);function ae(le,he,ye){return ie(le,he,ye)}ae.prototype=Object.create(ie.prototype),fe(ie,ae),ae.from=function(le,he,ye){if(typeof le=="number")throw new TypeError("Argument must not be a number");return ie(le,he,ye)},ae.alloc=function(le,he,ye){if(typeof le!="number")throw new TypeError("Argument must be a number");var me=ie(le);return he!==void 0?typeof ye=="string"?me.fill(he,ye):me.fill(he):me.fill(0),me},ae.allocUnsafe=function(le){if(typeof le!="number")throw new TypeError("Argument must be a number");return ie(le)},ae.allocUnsafeSlow=function(le){if(typeof le!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(le)}})(safeBuffer$2,safeBuffer$2.exports);var safeBufferExports=safeBuffer$2.exports,_Buffer=safeBufferExports.Buffer;function base$4(c){if(c.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var ie=0;ie<c.length;ie++){var fe=c.charAt(ie),ae=fe.charCodeAt(0);if(t[ae]!==255)throw new TypeError(fe+" is ambiguous");t[ae]=ie}var le=c.length,he=c.charAt(0),ye=Math.log(le)/Math.log(256),me=Math.log(256)/Math.log(le);function xe(Me){if((Array.isArray(Me)||Me instanceof Uint8Array)&&(Me=_Buffer.from(Me)),!_Buffer.isBuffer(Me))throw new TypeError("Expected Buffer");if(Me.length===0)return"";for(var Be=0,$e=0,Ce=0,ke=Me.length;Ce!==ke&&Me[Ce]===0;)Ce++,Be++;for(var Pe=(ke-Ce)*me+1>>>0,Ue=new Uint8Array(Pe);Ce!==ke;){for(var qe=Me[Ce],He=0,Ve=Pe-1;(qe!==0||He<$e)&&Ve!==-1;Ve--,He++)qe+=256*Ue[Ve]>>>0,Ue[Ve]=qe%le>>>0,qe=qe/le>>>0;if(qe!==0)throw new Error("Non-zero carry");$e=He,Ce++}for(var Ye=Pe-$e;Ye!==Pe&&Ue[Ye]===0;)Ye++;for(var Qe=he.repeat(Be);Ye<Pe;++Ye)Qe+=c.charAt(Ue[Ye]);return Qe}function Ee(Me){if(typeof Me!="string")throw new TypeError("Expected String");if(Me.length===0)return _Buffer.alloc(0);for(var Be=0,$e=0,Ce=0;Me[Be]===he;)$e++,Be++;for(var ke=(Me.length-Be)*ye+1>>>0,Pe=new Uint8Array(ke);Be<Me.length;){var Ue=Me.charCodeAt(Be);if(Ue>255)return;var qe=t[Ue];if(qe===255)return;for(var He=0,Ve=ke-1;(qe!==0||He<Ce)&&Ve!==-1;Ve--,He++)qe+=le*Pe[Ve]>>>0,Pe[Ve]=qe%256>>>0,qe=qe/256>>>0;if(qe!==0)throw new Error("Non-zero carry");Ce=He,Be++}for(var Ye=ke-Ce;Ye!==ke&&Pe[Ye]===0;)Ye++;var Qe=_Buffer.allocUnsafe($e+(ke-Ye));Qe.fill(0,0,$e);for(var Ke=$e;Ye!==ke;)Qe[Ke++]=Pe[Ye++];return Qe}function Se(Me){var Be=Ee(Me);if(Be)return Be;throw new Error("Non-base"+le+" character")}return{encode:xe,decodeUnsafe:Ee,decode:Se}}var src$7=base$4;const e$1=getDefaultExportFromCjs$2(src$7);var basex=src$7,ALPHABET$1="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58=basex(ALPHABET$1);const o$1=getDefaultExportFromCjs$2(bs58),sha256$4=sha256$5;var lib={};function inRange(c,t,n){return t<=c&&c<=n}function ToDictionary(c){if(c===void 0)return{};if(c===Object(c))return c;throw TypeError("Could not convert argument to dictionary")}function stringToCodePoints(c){for(var t=String(c),n=t.length,ie=0,fe=[];ie<n;){var ae=t.charCodeAt(ie);if(ae<55296||ae>57343)fe.push(ae);else if(56320<=ae&&ae<=57343)fe.push(65533);else if(55296<=ae&&ae<=56319)if(ie===n-1)fe.push(65533);else{var le=c.charCodeAt(ie+1);if(56320<=le&&le<=57343){var he=ae&1023,ye=le&1023;fe.push(65536+(he<<10)+ye),ie+=1}else fe.push(65533)}ie+=1}return fe}function codePointsToString(c){for(var t="",n=0;n<c.length;++n){var ie=c[n];ie<=65535?t+=String.fromCharCode(ie):(ie-=65536,t+=String.fromCharCode((ie>>10)+55296,(ie&1023)+56320))}return t}var end_of_stream=-1;function Stream(c){this.tokens=[].slice.call(c)}Stream.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():end_of_stream},prepend:function(c){if(Array.isArray(c))for(var t=c;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(c)},push:function(c){if(Array.isArray(c))for(var t=c;t.length;)this.tokens.push(t.shift());else this.tokens.push(c)}};var finished=-1;function decoderError(c,t){if(c)throw TypeError("Decoder error");return t||65533}var DEFAULT_ENCODING="utf-8";function TextDecoder$1(c,t){if(!(this instanceof TextDecoder$1))return new TextDecoder$1(c,t);if(c=c!==void 0?String(c).toLowerCase():DEFAULT_ENCODING,c!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");t=ToDictionary(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}TextDecoder$1.prototype={decode:function(t,n){var ie;typeof t=="object"&&t instanceof ArrayBuffer?ie=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?ie=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):ie=new Uint8Array(0),n=ToDictionary(n),this._streaming||(this._decoder=new UTF8Decoder({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!n.stream;for(var fe=new Stream(ie),ae=[],le;!fe.endOfStream()&&(le=this._decoder.handler(fe,fe.read()),le!==finished);)le!==null&&(Array.isArray(le)?ae.push.apply(ae,le):ae.push(le));if(!this._streaming){do{if(le=this._decoder.handler(fe,fe.read()),le===finished)break;le!==null&&(Array.isArray(le)?ae.push.apply(ae,le):ae.push(le))}while(!fe.endOfStream());this._decoder=null}return ae.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(ae[0]===65279?(this._BOMseen=!0,ae.shift()):this._BOMseen=!0),codePointsToString(ae)}};function TextEncoder$1(c,t){if(!(this instanceof TextEncoder$1))return new TextEncoder$1(c,t);if(c=c!==void 0?String(c).toLowerCase():DEFAULT_ENCODING,c!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");t=ToDictionary(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}TextEncoder$1.prototype={encode:function(t,n){t=t?String(t):"",n=ToDictionary(n),this._streaming||(this._encoder=new UTF8Encoder(this._options)),this._streaming=!!n.stream;for(var ie=[],fe=new Stream(stringToCodePoints(t)),ae;!fe.endOfStream()&&(ae=this._encoder.handler(fe,fe.read()),ae!==finished);)Array.isArray(ae)?ie.push.apply(ie,ae):ie.push(ae);if(!this._streaming){for(;ae=this._encoder.handler(fe,fe.read()),ae!==finished;)Array.isArray(ae)?ie.push.apply(ie,ae):ie.push(ae);this._encoder=null}return new Uint8Array(ie)}};function UTF8Decoder(c){var t=c.fatal,n=0,ie=0,fe=0,ae=128,le=191;this.handler=function(he,ye){if(ye===end_of_stream&&fe!==0)return fe=0,decoderError(t);if(ye===end_of_stream)return finished;if(fe===0){if(inRange(ye,0,127))return ye;if(inRange(ye,194,223))fe=1,n=ye-192;else if(inRange(ye,224,239))ye===224&&(ae=160),ye===237&&(le=159),fe=2,n=ye-224;else if(inRange(ye,240,244))ye===240&&(ae=144),ye===244&&(le=143),fe=3,n=ye-240;else return decoderError(t);return n=n<<6*fe,null}if(!inRange(ye,ae,le))return n=fe=ie=0,ae=128,le=191,he.prepend(ye),decoderError(t);if(ae=128,le=191,ie+=1,n+=ye-128<<6*(fe-ie),ie!==fe)return null;var me=n;return n=fe=ie=0,me}}function UTF8Encoder(c){c.fatal,this.handler=function(t,n){if(n===end_of_stream)return finished;if(inRange(n,0,127))return n;var ie,fe;inRange(n,128,2047)?(ie=1,fe=192):inRange(n,2048,65535)?(ie=2,fe=224):inRange(n,65536,1114111)&&(ie=3,fe=240);for(var ae=[(n>>6*ie)+fe];ie>0;){var le=n>>6*(ie-1);ae.push(128|le&63),ie-=1}return ae}}const encoding$1=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:TextDecoder$1,TextEncoder:TextEncoder$1},Symbol.toStringTag,{value:"Module"})),require$$2$2=getAugmentedNamespace(encoding$1);var __createBinding$9=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n),Object.defineProperty(c,ie,{enumerable:!0,get:function(){return t[n]}})}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$9=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__decorate=commonjsGlobal&&commonjsGlobal.__decorate||function(c,t,n,ie){var fe=arguments.length,ae=fe<3?t:ie===null?ie=Object.getOwnPropertyDescriptor(t,n):ie,le;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ae=Reflect.decorate(c,t,n,ie);else for(var he=c.length-1;he>=0;he--)(le=c[he])&&(ae=(fe<3?le(ae):fe>3?le(t,n,ae):le(t,n))||ae);return fe>3&&ae&&Object.defineProperty(t,n,ae),ae},__importStar$9=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.hasOwnProperty.call(c,n)&&__createBinding$9(t,c,n);return __setModuleDefault$9(t,c),t},__importDefault$9=commonjsGlobal&&commonjsGlobal.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(lib,"__esModule",{value:!0});var deserializeUnchecked_1=lib.deserializeUnchecked=deserialize_1=lib.deserialize=serialize_1=lib.serialize=lib.BinaryReader=lib.BinaryWriter=lib.BorshError=lib.baseDecode=lib.baseEncode=void 0;const bn_js_1$1=__importDefault$9(bnExports$3),bs58_1=__importDefault$9(bs58),encoding=__importStar$9(require$$2$2),ResolvedTextDecoder=typeof TextDecoder!="function"?encoding.TextDecoder:TextDecoder,textDecoder=new ResolvedTextDecoder("utf-8",{fatal:!0});function baseEncode(c){return typeof c=="string"&&(c=Buffer$7.from(c,"utf8")),bs58_1.default.encode(Buffer$7.from(c))}lib.baseEncode=baseEncode;function baseDecode(c){return Buffer$7.from(bs58_1.default.decode(c))}lib.baseDecode=baseDecode;const INITIAL_LENGTH=1024;class BorshError extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}lib.BorshError=BorshError;class BinaryWriter{constructor(){this.buf=Buffer$7.alloc(INITIAL_LENGTH),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer$7.concat([this.buf,Buffer$7.alloc(INITIAL_LENGTH)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Buffer$7.concat([Buffer$7.from(this.buf.subarray(0,this.length)),t,Buffer$7.alloc(INITIAL_LENGTH)]),this.length+=t.length}writeString(t){this.maybeResize();const n=Buffer$7.from(t,"utf8");this.writeU32(n.length),this.writeBuffer(n)}writeFixedArray(t){this.writeBuffer(Buffer$7.from(t))}writeArray(t,n){this.maybeResize(),this.writeU32(t.length);for(const ie of t)this.maybeResize(),n(ie)}toArray(){return this.buf.subarray(0,this.length)}}lib.BinaryWriter=BinaryWriter;function handlingRangeError(c,t,n){const ie=n.value;n.value=function(...fe){try{return ie.apply(this,fe)}catch(ae){if(ae instanceof RangeError){const le=ae.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(le)>=0)throw new BorshError("Reached the end of buffer when deserializing")}throw ae}}}class BinaryReader{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new bn_js_1$1.default(t,"le")}readU128(){const t=this.readBuffer(16);return new bn_js_1$1.default(t,"le")}readU256(){const t=this.readBuffer(32);return new bn_js_1$1.default(t,"le")}readU512(){const t=this.readBuffer(64);return new bn_js_1$1.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new BorshError(`Expected buffer length ${t} isn't within bounds`);const n=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,n}readString(){const t=this.readU32(),n=this.readBuffer(t);try{return textDecoder.decode(n)}catch(ie){throw new BorshError(`Error decoding UTF-8 string: ${ie}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const n=this.readU32(),ie=Array();for(let fe=0;fe<n;++fe)ie.push(t());return ie}}__decorate([handlingRangeError],BinaryReader.prototype,"readU8",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU16",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU32",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU64",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU128",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU256",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU512",null);__decorate([handlingRangeError],BinaryReader.prototype,"readString",null);__decorate([handlingRangeError],BinaryReader.prototype,"readFixedArray",null);__decorate([handlingRangeError],BinaryReader.prototype,"readArray",null);lib.BinaryReader=BinaryReader;function capitalizeFirstLetter(c){return c.charAt(0).toUpperCase()+c.slice(1)}function serializeField(c,t,n,ie,fe){try{if(typeof ie=="string")fe[`write${capitalizeFirstLetter(ie)}`](n);else if(ie instanceof Array)if(typeof ie[0]=="number"){if(n.length!==ie[0])throw new BorshError(`Expecting byte array of length ${ie[0]}, but got ${n.length} bytes`);fe.writeFixedArray(n)}else if(ie.length===2&&typeof ie[1]=="number"){if(n.length!==ie[1])throw new BorshError(`Expecting byte array of length ${ie[1]}, but got ${n.length} bytes`);for(let ae=0;ae<ie[1];ae++)serializeField(c,null,n[ae],ie[0],fe)}else fe.writeArray(n,ae=>{serializeField(c,t,ae,ie[0],fe)});else if(ie.kind!==void 0)switch(ie.kind){case"option":{n==null?fe.writeU8(0):(fe.writeU8(1),serializeField(c,t,n,ie.type,fe));break}case"map":{fe.writeU32(n.size),n.forEach((ae,le)=>{serializeField(c,t,le,ie.key,fe),serializeField(c,t,ae,ie.value,fe)});break}default:throw new BorshError(`FieldType ${ie} unrecognized`)}else serializeStruct(c,n,fe)}catch(ae){throw ae instanceof BorshError&&ae.addToFieldPath(t),ae}}function serializeStruct(c,t,n){if(typeof t.borshSerialize=="function"){t.borshSerialize(n);return}const ie=c.get(t.constructor);if(!ie)throw new BorshError(`Class ${t.constructor.name} is missing in schema`);if(ie.kind==="struct")ie.fields.map(([fe,ae])=>{serializeField(c,fe,t[fe],ae,n)});else if(ie.kind==="enum"){const fe=t[ie.field];for(let ae=0;ae<ie.values.length;++ae){const[le,he]=ie.values[ae];if(le===fe){n.writeU8(ae),serializeField(c,le,t[le],he,n);break}}}else throw new BorshError(`Unexpected schema kind: ${ie.kind} for ${t.constructor.name}`)}function serialize(c,t,n=BinaryWriter){const ie=new n;return serializeStruct(c,t,ie),ie.toArray()}var serialize_1=lib.serialize=serialize;function deserializeField(c,t,n,ie){try{if(typeof n=="string")return ie[`read${capitalizeFirstLetter(n)}`]();if(n instanceof Array){if(typeof n[0]=="number")return ie.readFixedArray(n[0]);if(typeof n[1]=="number"){const fe=[];for(let ae=0;ae<n[1];ae++)fe.push(deserializeField(c,null,n[0],ie));return fe}else return ie.readArray(()=>deserializeField(c,t,n[0],ie))}if(n.kind==="option")return ie.readU8()?deserializeField(c,t,n.type,ie):void 0;if(n.kind==="map"){let fe=new Map;const ae=ie.readU32();for(let le=0;le<ae;le++){const he=deserializeField(c,t,n.key,ie),ye=deserializeField(c,t,n.value,ie);fe.set(he,ye)}return fe}return deserializeStruct(c,n,ie)}catch(fe){throw fe instanceof BorshError&&fe.addToFieldPath(t),fe}}function deserializeStruct(c,t,n){if(typeof t.borshDeserialize=="function")return t.borshDeserialize(n);const ie=c.get(t);if(!ie)throw new BorshError(`Class ${t.name} is missing in schema`);if(ie.kind==="struct"){const fe={};for(const[ae,le]of c.get(t).fields)fe[ae]=deserializeField(c,ae,le,n);return new t(fe)}if(ie.kind==="enum"){const fe=n.readU8();if(fe>=ie.values.length)throw new BorshError(`Enum index: ${fe} is out of range`);const[ae,le]=ie.values[fe],he=deserializeField(c,ae,le,n);return new t({[ae]:he})}throw new BorshError(`Unexpected schema kind: ${ie.kind} for ${t.constructor.name}`)}function deserialize(c,t,n,ie=BinaryReader){const fe=new ie(n),ae=deserializeStruct(c,t,fe);if(fe.offset<n.length)throw new BorshError(`Unexpected ${n.length-fe.offset} bytes after deserialized data`);return ae}var deserialize_1=lib.deserialize=deserialize;function deserializeUnchecked(c,t,n,ie=BinaryReader){const fe=new ie(n);return deserializeStruct(c,t,fe)}deserializeUnchecked_1=lib.deserializeUnchecked=deserializeUnchecked;var Layout$1={};Object.defineProperty(Layout$1,"__esModule",{value:!0});Layout$1.s16=Layout$1.s8=Layout$1.nu64be=Layout$1.u48be=Layout$1.u40be=Layout$1.u32be=Layout$1.u24be=Layout$1.u16be=nu64=Layout$1.nu64=Layout$1.u48=Layout$1.u40=u32=Layout$1.u32=Layout$1.u24=u16=Layout$1.u16=u8=Layout$1.u8=offset=Layout$1.offset=Layout$1.greedy=Layout$1.Constant=Layout$1.UTF8=Layout$1.CString=Layout$1.Blob=Layout$1.Boolean=Layout$1.BitField=Layout$1.BitStructure=Layout$1.VariantLayout=Layout$1.Union=Layout$1.UnionLayoutDiscriminator=Layout$1.UnionDiscriminator=Layout$1.Structure=Layout$1.Sequence=Layout$1.DoubleBE=Layout$1.Double=Layout$1.FloatBE=Layout$1.Float=Layout$1.NearInt64BE=Layout$1.NearInt64=Layout$1.NearUInt64BE=Layout$1.NearUInt64=Layout$1.IntBE=Layout$1.Int=Layout$1.UIntBE=Layout$1.UInt=Layout$1.OffsetLayout=Layout$1.GreedyCount=Layout$1.ExternalLayout=Layout$1.bindConstructorLayout=Layout$1.nameWithProperty=Layout$1.Layout=Layout$1.uint8ArrayToBuffer=Layout$1.checkUint8Array=void 0;Layout$1.constant=Layout$1.utf8=Layout$1.cstr=blob=Layout$1.blob=Layout$1.unionLayoutDiscriminator=Layout$1.union=seq=Layout$1.seq=Layout$1.bits=struct=Layout$1.struct=Layout$1.f64be=Layout$1.f64=Layout$1.f32be=Layout$1.f32=Layout$1.ns64be=Layout$1.s48be=Layout$1.s40be=Layout$1.s32be=Layout$1.s24be=Layout$1.s16be=ns64=Layout$1.ns64=Layout$1.s48=Layout$1.s40=Layout$1.s32=Layout$1.s24=void 0;const buffer_1=require$$0$4;function checkUint8Array(c){if(!(c instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}Layout$1.checkUint8Array=checkUint8Array;function uint8ArrayToBuffer(c){return checkUint8Array(c),buffer_1.Buffer.from(c.buffer,c.byteOffset,c.length)}Layout$1.uint8ArrayToBuffer=uint8ArrayToBuffer;class Layout{constructor(t,n){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=n}makeDestinationObject(){return{}}getSpan(t,n){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const n=Object.create(this.constructor.prototype);return Object.assign(n,this),n.property=t,n}fromArray(t){}}Layout$1.Layout=Layout;function nameWithProperty(c,t){return t.property?c+"["+t.property+"]":c}Layout$1.nameWithProperty=nameWithProperty;function bindConstructorLayout(c,t){if(typeof c!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(c,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Layout))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");c.layout_=t,t.boundConstructor_=c,t.makeDestinationObject=()=>new c,Object.defineProperty(c.prototype,"encode",{value(n,ie){return t.encode(this,n,ie)},writable:!0}),Object.defineProperty(c,"decode",{value(n,ie){return t.decode(n,ie)},writable:!0})}Layout$1.bindConstructorLayout=bindConstructorLayout;class ExternalLayout extends Layout{isCount(){throw new Error("ExternalLayout is abstract")}}Layout$1.ExternalLayout=ExternalLayout;class GreedyCount extends ExternalLayout{constructor(t=1,n){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,n),this.elementSpan=t}isCount(){return!0}decode(t,n=0){checkUint8Array(t);const ie=t.length-n;return Math.floor(ie/this.elementSpan)}encode(t,n,ie){return 0}}Layout$1.GreedyCount=GreedyCount;class OffsetLayout extends ExternalLayout{constructor(t,n=0,ie){if(!(t instanceof Layout))throw new TypeError("layout must be a Layout");if(!Number.isInteger(n))throw new TypeError("offset must be integer or undefined");super(t.span,ie||t.property),this.layout=t,this.offset=n}isCount(){return this.layout instanceof UInt||this.layout instanceof UIntBE}decode(t,n=0){return this.layout.decode(t,n+this.offset)}encode(t,n,ie=0){return this.layout.encode(t,n,ie+this.offset)}}Layout$1.OffsetLayout=OffsetLayout;class UInt extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readUIntLE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeUIntLE(t,ie,this.span),this.span}}Layout$1.UInt=UInt;class UIntBE extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readUIntBE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeUIntBE(t,ie,this.span),this.span}}Layout$1.UIntBE=UIntBE;class Int extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readIntLE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeIntLE(t,ie,this.span),this.span}}Layout$1.Int=Int;class IntBE extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readIntBE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeIntBE(t,ie,this.span),this.span}}Layout$1.IntBE=IntBE;const V2E32=Math.pow(2,32);function divmodInt64(c){const t=Math.floor(c/V2E32),n=c-t*V2E32;return{hi32:t,lo32:n}}function roundedInt64(c,t){return c*V2E32+t}class NearUInt64 extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readUInt32LE(n),ae=ie.readUInt32LE(n+4);return roundedInt64(ae,fe)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeUInt32LE(fe.lo32,ie),ae.writeUInt32LE(fe.hi32,ie+4),8}}Layout$1.NearUInt64=NearUInt64;class NearUInt64BE extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readUInt32BE(n),ae=ie.readUInt32BE(n+4);return roundedInt64(fe,ae)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeUInt32BE(fe.hi32,ie),ae.writeUInt32BE(fe.lo32,ie+4),8}}Layout$1.NearUInt64BE=NearUInt64BE;class NearInt64 extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readUInt32LE(n),ae=ie.readInt32LE(n+4);return roundedInt64(ae,fe)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeUInt32LE(fe.lo32,ie),ae.writeInt32LE(fe.hi32,ie+4),8}}Layout$1.NearInt64=NearInt64;class NearInt64BE extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readInt32BE(n),ae=ie.readUInt32BE(n+4);return roundedInt64(fe,ae)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeInt32BE(fe.hi32,ie),ae.writeUInt32BE(fe.lo32,ie+4),8}}Layout$1.NearInt64BE=NearInt64BE;class Float extends Layout{constructor(t){super(4,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readFloatLE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeFloatLE(t,ie),4}}Layout$1.Float=Float;class FloatBE extends Layout{constructor(t){super(4,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readFloatBE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeFloatBE(t,ie),4}}Layout$1.FloatBE=FloatBE;class Double extends Layout{constructor(t){super(8,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readDoubleLE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeDoubleLE(t,ie),8}}Layout$1.Double=Double;class DoubleBE extends Layout{constructor(t){super(8,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readDoubleBE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeDoubleBE(t,ie),8}}Layout$1.DoubleBE=DoubleBE;class Sequence extends Layout{constructor(t,n,ie){if(!(t instanceof Layout))throw new TypeError("elementLayout must be a Layout");if(!(n instanceof ExternalLayout&&n.isCount()||Number.isInteger(n)&&0<=n))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let fe=-1;!(n instanceof ExternalLayout)&&0<t.span&&(fe=n*t.span),super(fe,ie),this.elementLayout=t,this.count=n}getSpan(t,n=0){if(0<=this.span)return this.span;let ie=0,fe=this.count;if(fe instanceof ExternalLayout&&(fe=fe.decode(t,n)),0<this.elementLayout.span)ie=fe*this.elementLayout.span;else{let ae=0;for(;ae<fe;)ie+=this.elementLayout.getSpan(t,n+ie),++ae}return ie}decode(t,n=0){const ie=[];let fe=0,ae=this.count;for(ae instanceof ExternalLayout&&(ae=ae.decode(t,n));fe<ae;)ie.push(this.elementLayout.decode(t,n)),n+=this.elementLayout.getSpan(t,n),fe+=1;return ie}encode(t,n,ie=0){const fe=this.elementLayout,ae=t.reduce((le,he)=>le+fe.encode(he,n,ie+le),0);return this.count instanceof ExternalLayout&&this.count.encode(t.length,n,ie),ae}}Layout$1.Sequence=Sequence;class Structure extends Layout{constructor(t,n,ie){if(!(Array.isArray(t)&&t.reduce((ae,le)=>ae&&le instanceof Layout,!0)))throw new TypeError("fields must be array of Layout instances");typeof n=="boolean"&&ie===void 0&&(ie=n,n=void 0);for(const ae of t)if(0>ae.span&&ae.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let fe=-1;try{fe=t.reduce((ae,le)=>ae+le.getSpan(),0)}catch{}super(fe,n),this.fields=t,this.decodePrefixes=!!ie}getSpan(t,n=0){if(0<=this.span)return this.span;let ie=0;try{ie=this.fields.reduce((fe,ae)=>{const le=ae.getSpan(t,n);return n+=le,fe+le},0)}catch{throw new RangeError("indeterminate span")}return ie}decode(t,n=0){checkUint8Array(t);const ie=this.makeDestinationObject();for(const fe of this.fields)if(fe.property!==void 0&&(ie[fe.property]=fe.decode(t,n)),n+=fe.getSpan(t,n),this.decodePrefixes&&t.length===n)break;return ie}encode(t,n,ie=0){const fe=ie;let ae=0,le=0;for(const he of this.fields){let ye=he.span;if(le=0<ye?ye:0,he.property!==void 0){const me=t[he.property];me!==void 0&&(le=he.encode(me,n,ie),0>ye&&(ye=he.getSpan(n,ie)))}ae=ie,ie+=ye}return ae+le-fe}fromArray(t){const n=this.makeDestinationObject();for(const ie of this.fields)ie.property!==void 0&&0<t.length&&(n[ie.property]=t.shift());return n}layoutFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const n of this.fields)if(n.property===t)return n}offsetOf(t){if(typeof t!="string")throw new TypeError("property must be string");let n=0;for(const ie of this.fields){if(ie.property===t)return n;0>ie.span?n=-1:0<=n&&(n+=ie.span)}}}Layout$1.Structure=Structure;class UnionDiscriminator{constructor(t){this.property=t}decode(t,n){throw new Error("UnionDiscriminator is abstract")}encode(t,n,ie){throw new Error("UnionDiscriminator is abstract")}}Layout$1.UnionDiscriminator=UnionDiscriminator;class UnionLayoutDiscriminator extends UnionDiscriminator{constructor(t,n){if(!(t instanceof ExternalLayout&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(n||t.property||"variant"),this.layout=t}decode(t,n){return this.layout.decode(t,n)}encode(t,n,ie){return this.layout.encode(t,n,ie)}}Layout$1.UnionLayoutDiscriminator=UnionLayoutDiscriminator;class Union extends Layout{constructor(t,n,ie){let fe;if(t instanceof UInt||t instanceof UIntBE)fe=new UnionLayoutDiscriminator(new OffsetLayout(t));else if(t instanceof ExternalLayout&&t.isCount())fe=new UnionLayoutDiscriminator(t);else if(t instanceof UnionDiscriminator)fe=t;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(n===void 0&&(n=null),!(n===null||n instanceof Layout))throw new TypeError("defaultLayout must be null or a Layout");if(n!==null){if(0>n.span)throw new Error("defaultLayout must have constant span");n.property===void 0&&(n=n.replicate("content"))}let ae=-1;n&&(ae=n.span,0<=ae&&(t instanceof UInt||t instanceof UIntBE)&&(ae+=fe.layout.span)),super(ae,ie),this.discriminator=fe,this.usesPrefixDiscriminator=t instanceof UInt||t instanceof UIntBE,this.defaultLayout=n,this.registry={};let le=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(he){return le(he)},this.configGetSourceVariant=function(he){le=he.bind(this)}}getSpan(t,n=0){if(0<=this.span)return this.span;const ie=this.getVariant(t,n);if(!ie)throw new Error("unable to determine span for unrecognized variant");return ie.getSpan(t,n)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const n=this.registry[t[this.discriminator.property]];if(n&&(!n.layout||n.property&&Object.prototype.hasOwnProperty.call(t,n.property)))return n}else for(const n in this.registry){const ie=this.registry[n];if(ie.property&&Object.prototype.hasOwnProperty.call(t,ie.property))return ie}throw new Error("unable to infer src variant")}decode(t,n=0){let ie;const fe=this.discriminator,ae=fe.decode(t,n),le=this.registry[ae];if(le===void 0){const he=this.defaultLayout;let ye=0;this.usesPrefixDiscriminator&&(ye=fe.layout.span),ie=this.makeDestinationObject(),ie[fe.property]=ae,ie[he.property]=he.decode(t,n+ye)}else ie=le.decode(t,n);return ie}encode(t,n,ie=0){const fe=this.getSourceVariant(t);if(fe===void 0){const ae=this.discriminator,le=this.defaultLayout;let he=0;return this.usesPrefixDiscriminator&&(he=ae.layout.span),ae.encode(t[ae.property],n,ie),he+le.encode(t[le.property],n,ie+he)}return fe.encode(t,n,ie)}addVariant(t,n,ie){const fe=new VariantLayout(this,t,n,ie);return this.registry[t]=fe,fe}getVariant(t,n=0){let ie;return t instanceof Uint8Array?ie=this.discriminator.decode(t,n):ie=t,this.registry[ie]}}Layout$1.Union=Union;class VariantLayout extends Layout{constructor(t,n,ie,fe){if(!(t instanceof Union))throw new TypeError("union must be a Union");if(!Number.isInteger(n)||0>n)throw new TypeError("variant must be a (non-negative) integer");if(typeof ie=="string"&&fe===void 0&&(fe=ie,ie=null),ie){if(!(ie instanceof Layout))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=ie.span&&ie.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof fe!="string")throw new TypeError("variant must have a String property")}let ae=t.span;0>t.span&&(ae=ie?ie.span:0,0<=ae&&t.usesPrefixDiscriminator&&(ae+=t.discriminator.layout.span)),super(ae,fe),this.union=t,this.variant=n,this.layout=ie||null}getSpan(t,n=0){if(0<=this.span)return this.span;let ie=0;this.union.usesPrefixDiscriminator&&(ie=this.union.discriminator.layout.span);let fe=0;return this.layout&&(fe=this.layout.getSpan(t,n+ie)),ie+fe}decode(t,n=0){const ie=this.makeDestinationObject();if(this!==this.union.getVariant(t,n))throw new Error("variant mismatch");let fe=0;return this.union.usesPrefixDiscriminator&&(fe=this.union.discriminator.layout.span),this.layout?ie[this.property]=this.layout.decode(t,n+fe):this.property?ie[this.property]=!0:this.union.usesPrefixDiscriminator&&(ie[this.union.discriminator.property]=this.variant),ie}encode(t,n,ie=0){let fe=0;if(this.union.usesPrefixDiscriminator&&(fe=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,n,ie);let ae=fe;if(this.layout&&(this.layout.encode(t[this.property],n,ie+fe),ae+=this.layout.getSpan(n,ie+fe),0<=this.union.span&&ae>this.union.span))throw new Error("encoded variant overruns containing union");return ae}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}Layout$1.VariantLayout=VariantLayout;function fixBitwiseResult(c){return 0>c&&(c+=4294967296),c}class BitStructure extends Layout{constructor(t,n,ie){if(!(t instanceof UInt||t instanceof UIntBE))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof n=="string"&&ie===void 0&&(ie=n,n=!1),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,ie),this.word=t,this.msb=!!n,this.fields=[];let fe=0;this._packedSetValue=function(ae){return fe=fixBitwiseResult(ae),this},this._packedGetValue=function(){return fe}}decode(t,n=0){const ie=this.makeDestinationObject(),fe=this.word.decode(t,n);this._packedSetValue(fe);for(const ae of this.fields)ae.property!==void 0&&(ie[ae.property]=ae.decode(t));return ie}encode(t,n,ie=0){const fe=this.word.decode(n,ie);this._packedSetValue(fe);for(const ae of this.fields)if(ae.property!==void 0){const le=t[ae.property];le!==void 0&&ae.encode(le)}return this.word.encode(this._packedGetValue(),n,ie)}addField(t,n){const ie=new BitField(this,t,n);return this.fields.push(ie),ie}addBoolean(t){const n=new Boolean$1(this,t);return this.fields.push(n),n}fieldFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const n of this.fields)if(n.property===t)return n}}Layout$1.BitStructure=BitStructure;class BitField{constructor(t,n,ie){if(!(t instanceof BitStructure))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(n)||0>=n)throw new TypeError("bits must be positive integer");const fe=8*t.span,ae=t.fields.reduce((le,he)=>le+he.bits,0);if(n+ae>fe)throw new Error("bits too long for span remainder ("+(fe-ae)+" of "+fe+" remain)");this.container=t,this.bits=n,this.valueMask=(1<<n)-1,n===32&&(this.valueMask=4294967295),this.start=ae,this.container.msb&&(this.start=fe-ae-n),this.wordMask=fixBitwiseResult(this.valueMask<<this.start),this.property=ie}decode(t,n){const ie=this.container._packedGetValue();return fixBitwiseResult(ie&this.wordMask)>>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==fixBitwiseResult(t&this.valueMask))throw new TypeError(nameWithProperty("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const n=this.container._packedGetValue(),ie=fixBitwiseResult(t<<this.start);this.container._packedSetValue(fixBitwiseResult(n&~this.wordMask)|ie)}}Layout$1.BitField=BitField;let Boolean$1=class extends BitField{constructor(t,n){super(t,1,n)}decode(t,n){return!!super.decode(t,n)}encode(t){typeof t=="boolean"&&(t=+t),super.encode(t)}};Layout$1.Boolean=Boolean$1;let Blob$1=class extends Layout{constructor(t,n){if(!(t instanceof ExternalLayout&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let ie=-1;t instanceof ExternalLayout||(ie=t),super(ie,n),this.length=t}getSpan(t,n){let ie=this.span;return 0>ie&&(ie=this.length.decode(t,n)),ie}decode(t,n=0){let ie=this.span;return 0>ie&&(ie=this.length.decode(t,n)),uint8ArrayToBuffer(t).slice(n,n+ie)}encode(t,n,ie){let fe=this.length;if(this.length instanceof ExternalLayout&&(fe=t.length),!(t instanceof Uint8Array&&fe===t.length))throw new TypeError(nameWithProperty("Blob.encode",this)+" requires (length "+fe+") Uint8Array as src");if(ie+fe>n.length)throw new RangeError("encoding overruns Uint8Array");const ae=uint8ArrayToBuffer(t);return uint8ArrayToBuffer(n).write(ae.toString("hex"),ie,fe,"hex"),this.length instanceof ExternalLayout&&this.length.encode(fe,n,ie),fe}};Layout$1.Blob=Blob$1;class CString extends Layout{constructor(t){super(-1,t)}getSpan(t,n=0){checkUint8Array(t);let ie=n;for(;ie<t.length&&t[ie]!==0;)ie+=1;return 1+ie-n}decode(t,n=0){const ie=this.getSpan(t,n);return uint8ArrayToBuffer(t).slice(n,n+ie-1).toString("utf-8")}encode(t,n,ie=0){typeof t!="string"&&(t=String(t));const fe=buffer_1.Buffer.from(t,"utf8"),ae=fe.length;if(ie+ae>n.length)throw new RangeError("encoding overruns Buffer");const le=uint8ArrayToBuffer(n);return fe.copy(le,ie),le[ie+ae]=0,ae+1}}Layout$1.CString=CString;class UTF8 extends Layout{constructor(t,n){if(typeof t=="string"&&n===void 0&&(n=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,n),this.maxSpan=t}getSpan(t,n=0){return checkUint8Array(t),t.length-n}decode(t,n=0){const ie=this.getSpan(t,n);if(0<=this.maxSpan&&this.maxSpan<ie)throw new RangeError("text length exceeds maxSpan");return uint8ArrayToBuffer(t).slice(n,n+ie).toString("utf-8")}encode(t,n,ie=0){typeof t!="string"&&(t=String(t));const fe=buffer_1.Buffer.from(t,"utf8"),ae=fe.length;if(0<=this.maxSpan&&this.maxSpan<ae)throw new RangeError("text length exceeds maxSpan");if(ie+ae>n.length)throw new RangeError("encoding overruns Buffer");return fe.copy(uint8ArrayToBuffer(n),ie),ae}}Layout$1.UTF8=UTF8;class Constant extends Layout{constructor(t,n){super(0,n),this.value=t}decode(t,n){return this.value}encode(t,n,ie){return 0}}Layout$1.Constant=Constant;Layout$1.greedy=(c,t)=>new GreedyCount(c,t);var offset=Layout$1.offset=(c,t,n)=>new OffsetLayout(c,t,n),u8=Layout$1.u8=c=>new UInt(1,c),u16=Layout$1.u16=c=>new UInt(2,c);Layout$1.u24=c=>new UInt(3,c);var u32=Layout$1.u32=c=>new UInt(4,c);Layout$1.u40=c=>new UInt(5,c);Layout$1.u48=c=>new UInt(6,c);var nu64=Layout$1.nu64=c=>new NearUInt64(c);Layout$1.u16be=c=>new UIntBE(2,c);Layout$1.u24be=c=>new UIntBE(3,c);Layout$1.u32be=c=>new UIntBE(4,c);Layout$1.u40be=c=>new UIntBE(5,c);Layout$1.u48be=c=>new UIntBE(6,c);Layout$1.nu64be=c=>new NearUInt64BE(c);Layout$1.s8=c=>new Int(1,c);Layout$1.s16=c=>new Int(2,c);Layout$1.s24=c=>new Int(3,c);Layout$1.s32=c=>new Int(4,c);Layout$1.s40=c=>new Int(5,c);Layout$1.s48=c=>new Int(6,c);var ns64=Layout$1.ns64=c=>new NearInt64(c);Layout$1.s16be=c=>new IntBE(2,c);Layout$1.s24be=c=>new IntBE(3,c);Layout$1.s32be=c=>new IntBE(4,c);Layout$1.s40be=c=>new IntBE(5,c);Layout$1.s48be=c=>new IntBE(6,c);Layout$1.ns64be=c=>new NearInt64BE(c);Layout$1.f32=c=>new Float(c);Layout$1.f32be=c=>new FloatBE(c);Layout$1.f64=c=>new Double(c);Layout$1.f64be=c=>new DoubleBE(c);var struct=Layout$1.struct=(c,t,n)=>new Structure(c,t,n);Layout$1.bits=(c,t,n)=>new BitStructure(c,t,n);var seq=Layout$1.seq=(c,t,n)=>new Sequence(c,t,n);Layout$1.union=(c,t,n)=>new Union(c,t,n);Layout$1.unionLayoutDiscriminator=(c,t)=>new UnionLayoutDiscriminator(c,t);var blob=Layout$1.blob=(c,t)=>new Blob$1(c,t);Layout$1.cstr=c=>new CString(c);Layout$1.utf8=(c,t)=>new UTF8(c,t);Layout$1.constant=(c,t)=>new Constant(c,t);var browser$d={};Object.defineProperty(browser$d,"__esModule",{value:!0});function toBigIntLE(c){{const t=Buffer$7.from(c);t.reverse();const n=t.toString("hex");return n.length===0?BigInt(0):BigInt(`0x${n}`)}}var toBigIntLE_1=browser$d.toBigIntLE=toBigIntLE;function toBigIntBE(c){{const t=c.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}}browser$d.toBigIntBE=toBigIntBE;function toBufferLE(c,t){{const n=c.toString(16),ie=Buffer$7.from(n.padStart(t*2,"0").slice(0,t*2),"hex");return ie.reverse(),ie}}var toBufferLE_1=browser$d.toBufferLE=toBufferLE;function toBufferBE(c,t){{const n=c.toString(16);return Buffer$7.from(n.padStart(t*2,"0").slice(0,t*2),"hex")}}browser$d.toBufferBE=toBufferBE;class StructError extends TypeError{constructor(t,n){let ie;const{message:fe,explanation:ae,...le}=t,{path:he}=t,ye=he.length===0?fe:`At path: ${he.join(".")} -- ${fe}`;super(ae??ye),ae!=null&&(this.cause=ye),Object.assign(this,le),this.name=this.constructor.name,this.failures=()=>ie??(ie=[t,...n()])}}function isIterable(c){return isObject$1(c)&&typeof c[Symbol.iterator]=="function"}function isObject$1(c){return typeof c=="object"&&c!=null}function isNonArrayObject(c){return isObject$1(c)&&!Array.isArray(c)}function print$2(c){return typeof c=="symbol"?c.toString():typeof c=="string"?JSON.stringify(c):`${c}`}function shiftIterator(c){const{done:t,value:n}=c.next();return t?void 0:n}function toFailure(c,t,n,ie){if(c===!0)return;c===!1?c={}:typeof c=="string"&&(c={message:c});const{path:fe,branch:ae}=t,{type:le}=n,{refinement:he,message:ye=`Expected a value of type \`${le}\`${he?` with refinement \`${he}\``:""}, but received: \`${print$2(ie)}\``}=c;return{value:ie,type:le,refinement:he,key:fe[fe.length-1],path:fe,branch:ae,...c,message:ye}}function*toFailures(c,t,n,ie){isIterable(c)||(c=[c]);for(const fe of c){const ae=toFailure(fe,t,n,ie);ae&&(yield ae)}}function*run(c,t,n={}){const{path:ie=[],branch:fe=[c],coerce:ae=!1,mask:le=!1}=n,he={path:ie,branch:fe,mask:le};ae&&(c=t.coercer(c,he));let ye="valid";for(const me of t.validator(c,he))me.explanation=n.message,ye="not_valid",yield[me,void 0];for(let[me,xe,Ee]of t.entries(c,he)){const Se=run(xe,Ee,{path:me===void 0?ie:[...ie,me],branch:me===void 0?fe:[...fe,xe],coerce:ae,mask:le,message:n.message});for(const Me of Se)Me[0]?(ye=Me[0].refinement!=null?"not_refined":"not_valid",yield[Me[0],void 0]):ae&&(xe=Me[1],me===void 0?c=xe:c instanceof Map?c.set(me,xe):c instanceof Set?c.add(xe):isObject$1(c)&&(xe!==void 0||me in c)&&(c[me]=xe))}if(ye!=="not_valid")for(const me of t.refiner(c,he))me.explanation=n.message,ye="not_refined",yield[me,void 0];ye==="valid"&&(yield[void 0,c])}let Struct$1=class{constructor(t){const{type:n,schema:ie,validator:fe,refiner:ae,coercer:le=ye=>ye,entries:he=function*(){}}=t;this.type=n,this.schema=ie,this.entries=he,this.coercer=le,fe?this.validator=(ye,me)=>{const xe=fe(ye,me);return toFailures(xe,me,this,ye)}:this.validator=()=>[],ae?this.refiner=(ye,me)=>{const xe=ae(ye,me);return toFailures(xe,me,this,ye)}:this.refiner=()=>[]}assert(t,n){return assert$a(t,this,n)}create(t,n){return create(t,this,n)}is(t){return is(t,this)}mask(t,n){return mask(t,this,n)}validate(t,n={}){return validate$1(t,this,n)}};function assert$a(c,t,n){const ie=validate$1(c,t,{message:n});if(ie[0])throw ie[0]}function create(c,t,n){const ie=validate$1(c,t,{coerce:!0,message:n});if(ie[0])throw ie[0];return ie[1]}function mask(c,t,n){const ie=validate$1(c,t,{coerce:!0,mask:!0,message:n});if(ie[0])throw ie[0];return ie[1]}function is(c,t){return!validate$1(c,t)[0]}function validate$1(c,t,n={}){const ie=run(c,t,n),fe=shiftIterator(ie);return fe[0]?[new StructError(fe[0],function*(){for(const le of ie)le[0]&&(yield le[0])}),void 0]:[void 0,fe[1]]}function define(c,t){return new Struct$1({type:c,schema:null,validator:t})}function any(){return define("any",()=>!0)}function array(c){return new Struct$1({type:"array",schema:c,*entries(t){if(c&&Array.isArray(t))for(const[n,ie]of t.entries())yield[n,ie,c]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${print$2(t)}`}})}function boolean(){return define("boolean",c=>typeof c=="boolean")}function instance(c){return define("instance",t=>t instanceof c||`Expected a \`${c.name}\` instance, but received: ${print$2(t)}`)}function literal(c){const t=print$2(c),n=typeof c;return new Struct$1({type:"literal",schema:n==="string"||n==="number"||n==="boolean"?c:null,validator(ie){return ie===c||`Expected the literal \`${t}\`, but received: ${print$2(ie)}`}})}function never(){return define("never",()=>!1)}function nullable(c){return new Struct$1({...c,validator:(t,n)=>t===null||c.validator(t,n),refiner:(t,n)=>t===null||c.refiner(t,n)})}function number(){return define("number",c=>typeof c=="number"&&!isNaN(c)||`Expected a number, but received: ${print$2(c)}`)}function optional(c){return new Struct$1({...c,validator:(t,n)=>t===void 0||c.validator(t,n),refiner:(t,n)=>t===void 0||c.refiner(t,n)})}function record(c,t){return new Struct$1({type:"record",schema:null,*entries(n){if(isObject$1(n))for(const ie in n){const fe=n[ie];yield[ie,ie,c],yield[ie,fe,t]}},validator(n){return isNonArrayObject(n)||`Expected an object, but received: ${print$2(n)}`},coercer(n){return isNonArrayObject(n)?{...n}:n}})}function string(){return define("string",c=>typeof c=="string"||`Expected a string, but received: ${print$2(c)}`)}function tuple(c){const t=never();return new Struct$1({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const ie=Math.max(c.length,n.length);for(let fe=0;fe<ie;fe++)yield[fe,n[fe],c[fe]||t]}},validator(n){return Array.isArray(n)||`Expected an array, but received: ${print$2(n)}`},coercer(n){return Array.isArray(n)?n.slice():n}})}function type$1(c){const t=Object.keys(c);return new Struct$1({type:"type",schema:c,*entries(n){if(isObject$1(n))for(const ie of t)yield[ie,n[ie],c[ie]]},validator(n){return isNonArrayObject(n)||`Expected an object, but received: ${print$2(n)}`},coercer(n){return isNonArrayObject(n)?{...n}:n}})}function union(c){const t=c.map(n=>n.type).join(" | ");return new Struct$1({type:"union",schema:null,coercer(n,ie){for(const fe of c){const[ae,le]=fe.validate(n,{coerce:!0,mask:ie.mask});if(!ae)return le}return n},validator(n,ie){const fe=[];for(const ae of c){const[...le]=run(n,ae,ie),[he]=le;if(he[0])for(const[ye]of le)ye&&fe.push(ye);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${print$2(n)}`,...fe]}})}function unknown(){return define("unknown",()=>!0)}function coerce(c,t,n){return new Struct$1({...c,coercer:(ie,fe)=>is(ie,t)?c.coercer(n(ie,fe),fe):c.coercer(ie,fe)})}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const REGEX$1=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate(c){return typeof c=="string"&®EX$1.test(c)}var byteToHex=[];for(var i$2=0;i$2<256;++i$2)byteToHex.push((i$2+256).toString(16).substr(1));function stringify(c){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(byteToHex[c[t+0]]+byteToHex[c[t+1]]+byteToHex[c[t+2]]+byteToHex[c[t+3]]+"-"+byteToHex[c[t+4]]+byteToHex[c[t+5]]+"-"+byteToHex[c[t+6]]+byteToHex[c[t+7]]+"-"+byteToHex[c[t+8]]+byteToHex[c[t+9]]+"-"+byteToHex[c[t+10]]+byteToHex[c[t+11]]+byteToHex[c[t+12]]+byteToHex[c[t+13]]+byteToHex[c[t+14]]+byteToHex[c[t+15]]).toLowerCase();if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}var _nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1(c,t,n){var ie=t&&n||0,fe=t||new Array(16);c=c||{};var ae=c.node||_nodeId,le=c.clockseq!==void 0?c.clockseq:_clockseq;if(ae==null||le==null){var he=c.random||(c.rng||rng)();ae==null&&(ae=_nodeId=[he[0]|1,he[1],he[2],he[3],he[4],he[5]]),le==null&&(le=_clockseq=(he[6]<<8|he[7])&16383)}var ye=c.msecs!==void 0?c.msecs:Date.now(),me=c.nsecs!==void 0?c.nsecs:_lastNSecs+1,xe=ye-_lastMSecs+(me-_lastNSecs)/1e4;if(xe<0&&c.clockseq===void 0&&(le=le+1&16383),(xe<0||ye>_lastMSecs)&&c.nsecs===void 0&&(me=0),me>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=ye,_lastNSecs=me,_clockseq=le,ye+=122192928e5;var Ee=((ye&268435455)*1e4+me)%4294967296;fe[ie++]=Ee>>>24&255,fe[ie++]=Ee>>>16&255,fe[ie++]=Ee>>>8&255,fe[ie++]=Ee&255;var Se=ye/4294967296*1e4&268435455;fe[ie++]=Se>>>8&255,fe[ie++]=Se&255,fe[ie++]=Se>>>24&15|16,fe[ie++]=Se>>>16&255,fe[ie++]=le>>>8|128,fe[ie++]=le&255;for(var Me=0;Me<6;++Me)fe[ie+Me]=ae[Me];return t||stringify(fe)}function parse$1(c){if(!validate(c))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(c.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=t&255,n[4]=(t=parseInt(c.slice(9,13),16))>>>8,n[5]=t&255,n[6]=(t=parseInt(c.slice(14,18),16))>>>8,n[7]=t&255,n[8]=(t=parseInt(c.slice(19,23),16))>>>8,n[9]=t&255,n[10]=(t=parseInt(c.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=t&255,n}function stringToBytes(c){c=unescape(encodeURIComponent(c));for(var t=[],n=0;n<c.length;++n)t.push(c.charCodeAt(n));return t}var DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",URL$1="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function v35(c,t,n){function ie(fe,ae,le,he){if(typeof fe=="string"&&(fe=stringToBytes(fe)),typeof ae=="string"&&(ae=parse$1(ae)),ae.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var ye=new Uint8Array(16+fe.length);if(ye.set(ae),ye.set(fe,ae.length),ye=n(ye),ye[6]=ye[6]&15|t,ye[8]=ye[8]&63|128,le){he=he||0;for(var me=0;me<16;++me)le[he+me]=ye[me];return le}return stringify(ye)}try{ie.name=c}catch{}return ie.DNS=DNS,ie.URL=URL$1,ie}function md5$3(c){if(typeof c=="string"){var t=unescape(encodeURIComponent(c));c=new Uint8Array(t.length);for(var n=0;n<t.length;++n)c[n]=t.charCodeAt(n)}return md5ToHexEncodedArray(wordsToMd5(bytesToWords(c),c.length*8))}function md5ToHexEncodedArray(c){for(var t=[],n=c.length*32,ie="0123456789abcdef",fe=0;fe<n;fe+=8){var ae=c[fe>>5]>>>fe%32&255,le=parseInt(ie.charAt(ae>>>4&15)+ie.charAt(ae&15),16);t.push(le)}return t}function getOutputLength(c){return(c+64>>>9<<4)+14+1}function wordsToMd5(c,t){c[t>>5]|=128<<t%32,c[getOutputLength(t)-1]=t;for(var n=1732584193,ie=-271733879,fe=-1732584194,ae=271733878,le=0;le<c.length;le+=16){var he=n,ye=ie,me=fe,xe=ae;n=md5ff(n,ie,fe,ae,c[le],7,-680876936),ae=md5ff(ae,n,ie,fe,c[le+1],12,-389564586),fe=md5ff(fe,ae,n,ie,c[le+2],17,606105819),ie=md5ff(ie,fe,ae,n,c[le+3],22,-1044525330),n=md5ff(n,ie,fe,ae,c[le+4],7,-176418897),ae=md5ff(ae,n,ie,fe,c[le+5],12,1200080426),fe=md5ff(fe,ae,n,ie,c[le+6],17,-1473231341),ie=md5ff(ie,fe,ae,n,c[le+7],22,-45705983),n=md5ff(n,ie,fe,ae,c[le+8],7,1770035416),ae=md5ff(ae,n,ie,fe,c[le+9],12,-1958414417),fe=md5ff(fe,ae,n,ie,c[le+10],17,-42063),ie=md5ff(ie,fe,ae,n,c[le+11],22,-1990404162),n=md5ff(n,ie,fe,ae,c[le+12],7,1804603682),ae=md5ff(ae,n,ie,fe,c[le+13],12,-40341101),fe=md5ff(fe,ae,n,ie,c[le+14],17,-1502002290),ie=md5ff(ie,fe,ae,n,c[le+15],22,1236535329),n=md5gg(n,ie,fe,ae,c[le+1],5,-165796510),ae=md5gg(ae,n,ie,fe,c[le+6],9,-1069501632),fe=md5gg(fe,ae,n,ie,c[le+11],14,643717713),ie=md5gg(ie,fe,ae,n,c[le],20,-373897302),n=md5gg(n,ie,fe,ae,c[le+5],5,-701558691),ae=md5gg(ae,n,ie,fe,c[le+10],9,38016083),fe=md5gg(fe,ae,n,ie,c[le+15],14,-660478335),ie=md5gg(ie,fe,ae,n,c[le+4],20,-405537848),n=md5gg(n,ie,fe,ae,c[le+9],5,568446438),ae=md5gg(ae,n,ie,fe,c[le+14],9,-1019803690),fe=md5gg(fe,ae,n,ie,c[le+3],14,-187363961),ie=md5gg(ie,fe,ae,n,c[le+8],20,1163531501),n=md5gg(n,ie,fe,ae,c[le+13],5,-1444681467),ae=md5gg(ae,n,ie,fe,c[le+2],9,-51403784),fe=md5gg(fe,ae,n,ie,c[le+7],14,1735328473),ie=md5gg(ie,fe,ae,n,c[le+12],20,-1926607734),n=md5hh(n,ie,fe,ae,c[le+5],4,-378558),ae=md5hh(ae,n,ie,fe,c[le+8],11,-2022574463),fe=md5hh(fe,ae,n,ie,c[le+11],16,1839030562),ie=md5hh(ie,fe,ae,n,c[le+14],23,-35309556),n=md5hh(n,ie,fe,ae,c[le+1],4,-1530992060),ae=md5hh(ae,n,ie,fe,c[le+4],11,1272893353),fe=md5hh(fe,ae,n,ie,c[le+7],16,-155497632),ie=md5hh(ie,fe,ae,n,c[le+10],23,-1094730640),n=md5hh(n,ie,fe,ae,c[le+13],4,681279174),ae=md5hh(ae,n,ie,fe,c[le],11,-358537222),fe=md5hh(fe,ae,n,ie,c[le+3],16,-722521979),ie=md5hh(ie,fe,ae,n,c[le+6],23,76029189),n=md5hh(n,ie,fe,ae,c[le+9],4,-640364487),ae=md5hh(ae,n,ie,fe,c[le+12],11,-421815835),fe=md5hh(fe,ae,n,ie,c[le+15],16,530742520),ie=md5hh(ie,fe,ae,n,c[le+2],23,-995338651),n=md5ii(n,ie,fe,ae,c[le],6,-198630844),ae=md5ii(ae,n,ie,fe,c[le+7],10,1126891415),fe=md5ii(fe,ae,n,ie,c[le+14],15,-1416354905),ie=md5ii(ie,fe,ae,n,c[le+5],21,-57434055),n=md5ii(n,ie,fe,ae,c[le+12],6,1700485571),ae=md5ii(ae,n,ie,fe,c[le+3],10,-1894986606),fe=md5ii(fe,ae,n,ie,c[le+10],15,-1051523),ie=md5ii(ie,fe,ae,n,c[le+1],21,-2054922799),n=md5ii(n,ie,fe,ae,c[le+8],6,1873313359),ae=md5ii(ae,n,ie,fe,c[le+15],10,-30611744),fe=md5ii(fe,ae,n,ie,c[le+6],15,-1560198380),ie=md5ii(ie,fe,ae,n,c[le+13],21,1309151649),n=md5ii(n,ie,fe,ae,c[le+4],6,-145523070),ae=md5ii(ae,n,ie,fe,c[le+11],10,-1120210379),fe=md5ii(fe,ae,n,ie,c[le+2],15,718787259),ie=md5ii(ie,fe,ae,n,c[le+9],21,-343485551),n=safeAdd(n,he),ie=safeAdd(ie,ye),fe=safeAdd(fe,me),ae=safeAdd(ae,xe)}return[n,ie,fe,ae]}function bytesToWords(c){if(c.length===0)return[];for(var t=c.length*8,n=new Uint32Array(getOutputLength(t)),ie=0;ie<t;ie+=8)n[ie>>5]|=(c[ie/8]&255)<<ie%32;return n}function safeAdd(c,t){var n=(c&65535)+(t&65535),ie=(c>>16)+(t>>16)+(n>>16);return ie<<16|n&65535}function bitRotateLeft(c,t){return c<<t|c>>>32-t}function md5cmn(c,t,n,ie,fe,ae){return safeAdd(bitRotateLeft(safeAdd(safeAdd(t,c),safeAdd(ie,ae)),fe),n)}function md5ff(c,t,n,ie,fe,ae,le){return md5cmn(t&n|~t&ie,c,t,fe,ae,le)}function md5gg(c,t,n,ie,fe,ae,le){return md5cmn(t&ie|n&~ie,c,t,fe,ae,le)}function md5hh(c,t,n,ie,fe,ae,le){return md5cmn(t^n^ie,c,t,fe,ae,le)}function md5ii(c,t,n,ie,fe,ae,le){return md5cmn(n^(t|~ie),c,t,fe,ae,le)}var v3=v35("v3",48,md5$3);function v4(c,t,n){c=c||{};var ie=c.random||(c.rng||rng)();if(ie[6]=ie[6]&15|64,ie[8]=ie[8]&63|128,t){n=n||0;for(var fe=0;fe<16;++fe)t[n+fe]=ie[fe];return t}return stringify(ie)}function f$1(c,t,n,ie){switch(c){case 0:return t&n^~t&ie;case 1:return t^n^ie;case 2:return t&n^t&ie^n&ie;case 3:return t^n^ie}}function ROTL(c,t){return c<<t|c>>>32-t}function sha1$3(c){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof c=="string"){var ie=unescape(encodeURIComponent(c));c=[];for(var fe=0;fe<ie.length;++fe)c.push(ie.charCodeAt(fe))}else Array.isArray(c)||(c=Array.prototype.slice.call(c));c.push(128);for(var ae=c.length/4+2,le=Math.ceil(ae/16),he=new Array(le),ye=0;ye<le;++ye){for(var me=new Uint32Array(16),xe=0;xe<16;++xe)me[xe]=c[ye*64+xe*4]<<24|c[ye*64+xe*4+1]<<16|c[ye*64+xe*4+2]<<8|c[ye*64+xe*4+3];he[ye]=me}he[le-1][14]=(c.length-1)*8/Math.pow(2,32),he[le-1][14]=Math.floor(he[le-1][14]),he[le-1][15]=(c.length-1)*8&4294967295;for(var Ee=0;Ee<le;++Ee){for(var Se=new Uint32Array(80),Me=0;Me<16;++Me)Se[Me]=he[Ee][Me];for(var Be=16;Be<80;++Be)Se[Be]=ROTL(Se[Be-3]^Se[Be-8]^Se[Be-14]^Se[Be-16],1);for(var $e=n[0],Ce=n[1],ke=n[2],Pe=n[3],Ue=n[4],qe=0;qe<80;++qe){var He=Math.floor(qe/20),Ve=ROTL($e,5)+f$1(He,Ce,ke,Pe)+Ue+t[He]+Se[qe]>>>0;Ue=Pe,Pe=ke,ke=ROTL(Ce,30)>>>0,Ce=$e,$e=Ve}n[0]=n[0]+$e>>>0,n[1]=n[1]+Ce>>>0,n[2]=n[2]+ke>>>0,n[3]=n[3]+Pe>>>0,n[4]=n[4]+Ue>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var v5=v35("v5",80,sha1$3);const nil="00000000-0000-0000-0000-000000000000";function version$5(c){if(!validate(c))throw TypeError("Invalid UUID");return parseInt(c.substr(14,1),16)}const esmBrowser=Object.freeze(Object.defineProperty({__proto__:null,NIL:nil,parse:parse$1,stringify,v1,v3,v4,v5,validate,version:version$5},Symbol.toStringTag,{value:"Module"})),require$$0$2=getAugmentedNamespace(esmBrowser),uuid$1=require$$0$2.v4,generateRequest$1=function(c,t,n,ie){if(typeof c!="string")throw new TypeError(c+" must be a string");ie=ie||{};const fe=typeof ie.version=="number"?ie.version:2;if(fe!==1&&fe!==2)throw new TypeError(fe+" must be 1 or 2");const ae={method:c};if(fe===2&&(ae.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");ae.params=t}if(typeof n>"u"){const le=typeof ie.generator=="function"?ie.generator:function(){return uuid$1()};ae.id=le(ae,ie)}else fe===2&&n===null?ie.notificationIdNull&&(ae.id=null):ae.id=n;return ae};var generateRequest_1=generateRequest$1;const uuid=require$$0$2.v4,generateRequest=generateRequest_1,ClientBrowser=function(c,t){if(!(this instanceof ClientBrowser))return new ClientBrowser(c,t);t||(t={}),this.options={reviver:typeof t.reviver<"u"?t.reviver:null,replacer:typeof t.replacer<"u"?t.replacer:null,generator:typeof t.generator<"u"?t.generator:function(){return uuid()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=c};var browser$c=ClientBrowser;ClientBrowser.prototype.request=function(c,t,n,ie){const fe=this;let ae=null;const le=Array.isArray(c)&&typeof t=="function";if(this.options.version===1&&le)throw new TypeError("JSON-RPC 1.0 does not support batching");if(le||!le&&c&&typeof c=="object"&&typeof t=="function")ie=t,ae=c;else{typeof n=="function"&&(ie=n,n=void 0);const me=typeof ie=="function";try{ae=generateRequest(c,t,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(xe){if(me)return ie(xe);throw xe}if(!me)return ae}let ye;try{ye=JSON.stringify(ae,this.options.replacer)}catch(me){return ie(me)}return this.callServer(ye,function(me,xe){fe._parseResponse(me,xe,ie)}),ae};ClientBrowser.prototype._parseResponse=function(c,t,n){if(c){n(c);return}if(!t)return n();let ie;try{ie=JSON.parse(t,this.options.reviver)}catch(fe){return n(fe)}if(n.length===3)if(Array.isArray(ie)){const fe=function(le){return typeof le.error<"u"},ae=function(le){return!fe(le)};return n(null,ie.filter(fe),ie.filter(ae))}else return n(null,ie.error,ie.result);n(null,ie)};const RpcClient=getDefaultExportFromCjs$2(browser$c);var eventemitter3={exports:{}};(function(c){var t=Object.prototype.hasOwnProperty,n="~";function ie(){}Object.create&&(ie.prototype=Object.create(null),new ie().__proto__||(n=!1));function fe(ye,me,xe){this.fn=ye,this.context=me,this.once=xe||!1}function ae(ye,me,xe,Ee,Se){if(typeof xe!="function")throw new TypeError("The listener must be a function");var Me=new fe(xe,Ee||ye,Se),Be=n?n+me:me;return ye._events[Be]?ye._events[Be].fn?ye._events[Be]=[ye._events[Be],Me]:ye._events[Be].push(Me):(ye._events[Be]=Me,ye._eventsCount++),ye}function le(ye,me){--ye._eventsCount===0?ye._events=new ie:delete ye._events[me]}function he(){this._events=new ie,this._eventsCount=0}he.prototype.eventNames=function(){var me=[],xe,Ee;if(this._eventsCount===0)return me;for(Ee in xe=this._events)t.call(xe,Ee)&&me.push(n?Ee.slice(1):Ee);return Object.getOwnPropertySymbols?me.concat(Object.getOwnPropertySymbols(xe)):me},he.prototype.listeners=function(me){var xe=n?n+me:me,Ee=this._events[xe];if(!Ee)return[];if(Ee.fn)return[Ee.fn];for(var Se=0,Me=Ee.length,Be=new Array(Me);Se<Me;Se++)Be[Se]=Ee[Se].fn;return Be},he.prototype.listenerCount=function(me){var xe=n?n+me:me,Ee=this._events[xe];return Ee?Ee.fn?1:Ee.length:0},he.prototype.emit=function(me,xe,Ee,Se,Me,Be){var $e=n?n+me:me;if(!this._events[$e])return!1;var Ce=this._events[$e],ke=arguments.length,Pe,Ue;if(Ce.fn){switch(Ce.once&&this.removeListener(me,Ce.fn,void 0,!0),ke){case 1:return Ce.fn.call(Ce.context),!0;case 2:return Ce.fn.call(Ce.context,xe),!0;case 3:return Ce.fn.call(Ce.context,xe,Ee),!0;case 4:return Ce.fn.call(Ce.context,xe,Ee,Se),!0;case 5:return Ce.fn.call(Ce.context,xe,Ee,Se,Me),!0;case 6:return Ce.fn.call(Ce.context,xe,Ee,Se,Me,Be),!0}for(Ue=1,Pe=new Array(ke-1);Ue<ke;Ue++)Pe[Ue-1]=arguments[Ue];Ce.fn.apply(Ce.context,Pe)}else{var qe=Ce.length,He;for(Ue=0;Ue<qe;Ue++)switch(Ce[Ue].once&&this.removeListener(me,Ce[Ue].fn,void 0,!0),ke){case 1:Ce[Ue].fn.call(Ce[Ue].context);break;case 2:Ce[Ue].fn.call(Ce[Ue].context,xe);break;case 3:Ce[Ue].fn.call(Ce[Ue].context,xe,Ee);break;case 4:Ce[Ue].fn.call(Ce[Ue].context,xe,Ee,Se);break;default:if(!Pe)for(He=1,Pe=new Array(ke-1);He<ke;He++)Pe[He-1]=arguments[He];Ce[Ue].fn.apply(Ce[Ue].context,Pe)}}return!0},he.prototype.on=function(me,xe,Ee){return ae(this,me,xe,Ee,!1)},he.prototype.once=function(me,xe,Ee){return ae(this,me,xe,Ee,!0)},he.prototype.removeListener=function(me,xe,Ee,Se){var Me=n?n+me:me;if(!this._events[Me])return this;if(!xe)return le(this,Me),this;var Be=this._events[Me];if(Be.fn)Be.fn===xe&&(!Se||Be.once)&&(!Ee||Be.context===Ee)&&le(this,Me);else{for(var $e=0,Ce=[],ke=Be.length;$e<ke;$e++)(Be[$e].fn!==xe||Se&&!Be[$e].once||Ee&&Be[$e].context!==Ee)&&Ce.push(Be[$e]);Ce.length?this._events[Me]=Ce.length===1?Ce[0]:Ce:le(this,Me)}return this},he.prototype.removeAllListeners=function(me){var xe;return me?(xe=n?n+me:me,this._events[xe]&&le(this,xe)):(this._events=new ie,this._eventsCount=0),this},he.prototype.off=he.prototype.removeListener,he.prototype.addListener=he.prototype.on,he.prefixed=n,he.EventEmitter=he,c.exports=he})(eventemitter3);var eventemitter3Exports=eventemitter3.exports;const EventEmitter=getDefaultExportFromCjs$2(eventemitter3Exports);var WebSocketBrowserImpl=class extends EventEmitter{constructor(t,n,ie){super();Xn(this,"socket");this.socket=new window.WebSocket(t,ie),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=fe=>this.emit("message",fe.data),this.socket.onerror=fe=>this.emit("error",fe),this.socket.onclose=fe=>{this.emit("close",fe.code,fe.reason)}}send(t,n,ie){const fe=ie||n;try{this.socket.send(t),fe()}catch(ae){fe(ae)}}close(t,n){this.socket.close(t,n)}addEventListener(t,n,ie){this.socket.addEventListener(t,n,ie)}};function WebSocket(c,t){return new WebSocketBrowserImpl(c,t)}var DefaultDataPack=class{encode(c){return JSON.stringify(c)}decode(c){return JSON.parse(c)}},CommonClient=class extends EventEmitter{constructor(t,n="ws://localhost:8080",{autoconnect:ie=!0,reconnect:fe=!0,reconnect_interval:ae=1e3,max_reconnects:le=5,...he}={},ye,me){super();Xn(this,"address");Xn(this,"rpc_id");Xn(this,"queue");Xn(this,"options");Xn(this,"autoconnect");Xn(this,"ready");Xn(this,"reconnect");Xn(this,"reconnect_timer_id");Xn(this,"reconnect_interval");Xn(this,"max_reconnects");Xn(this,"rest_options");Xn(this,"current_reconnects");Xn(this,"generate_request_id");Xn(this,"socket");Xn(this,"webSocketFactory");Xn(this,"dataPack");this.webSocketFactory=t,this.queue={},this.rpc_id=0,this.address=n,this.autoconnect=ie,this.ready=!1,this.reconnect=fe,this.reconnect_timer_id=void 0,this.reconnect_interval=ae,this.max_reconnects=le,this.rest_options=he,this.current_reconnects=0,this.generate_request_id=ye||(()=>typeof this.rpc_id=="number"?++this.rpc_id:Number(this.rpc_id)+1),me?this.dataPack=me:this.dataPack=new DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(t,n,ie,fe){return!fe&&typeof ie=="object"&&(fe=ie,ie=null),new Promise((ae,le)=>{if(!this.ready)return le(new Error("socket not ready"));const he=this.generate_request_id(t,n),ye={jsonrpc:"2.0",method:t,params:n||void 0,id:he};this.socket.send(this.dataPack.encode(ye),fe,me=>{if(me)return le(me);this.queue[he]={promise:[ae,le]},ie&&(this.queue[he].timeout=setTimeout(()=>{delete this.queue[he],le(new Error("reply timeout"))},ie))})})}async login(t){const n=await this.call("rpc.login",t);if(!n)throw new Error("authentication failed");return n}async listMethods(){return await this.call("__listMethods")}notify(t,n){return new Promise((ie,fe)=>{if(!this.ready)return fe(new Error("socket not ready"));const ae={jsonrpc:"2.0",method:t,params:n};this.socket.send(this.dataPack.encode(ae),le=>{if(le)return fe(le);ie()})})}async subscribe(t){typeof t=="string"&&(t=[t]);const n=await this.call("rpc.on",t);if(typeof t=="string"&&n[t]!=="ok")throw new Error("Failed subscribing to an event '"+t+"' with: "+n[t]);return n}async unsubscribe(t){typeof t=="string"&&(t=[t]);const n=await this.call("rpc.off",t);if(typeof t=="string"&&n[t]!=="ok")throw new Error("Failed unsubscribing from an event with: "+n);return n}close(t,n){this.socket&&this.socket.close(t||1e3,n)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return this.reconnect_timer_id!==void 0}willReconnect(){return this.reconnect&&(this.max_reconnects===0||this.current_reconnects<this.max_reconnects)}_connect(t,n){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,n),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:ie})=>{ie instanceof ArrayBuffer&&(ie=Buffer$1$1.from(ie).toString());try{ie=this.dataPack.decode(ie)}catch{return}if(ie.notification&&this.listeners(ie.notification).length){if(!Object.keys(ie.params).length)return this.emit(ie.notification);const fe=[ie.notification];if(ie.params.constructor===Object)fe.push(ie.params);else for(let ae=0;ae<ie.params.length;ae++)fe.push(ie.params[ae]);return Promise.resolve().then(()=>{this.emit.apply(this,fe)})}if(!this.queue[ie.id])return ie.method?Promise.resolve().then(()=>{this.emit(ie.method,ie==null?void 0:ie.params)}):void 0;"error"in ie=="result"in ie&&this.queue[ie.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[ie.id].timeout&&clearTimeout(this.queue[ie.id].timeout),ie.error?this.queue[ie.id].promise[1](ie.error):this.queue[ie.id].promise[0](ie.result),delete this.queue[ie.id]}),this.socket.addEventListener("error",ie=>this.emit("error",ie)),this.socket.addEventListener("close",({code:ie,reason:fe})=>{this.ready&&setTimeout(()=>this.emit("close",ie,fe),0),this.ready=!1,this.socket=void 0,ie!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)?this.reconnect_timer_id=setTimeout(()=>this._connect(t,n),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",ie,fe),1))})}};class HMAC extends Hash{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,ahash(t);const ie=toBytes(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 fe=this.blockLen,ae=new Uint8Array(fe);ae.set(ie.length>fe?t.create().update(ie).digest():ie);for(let le=0;le<ae.length;le++)ae[le]^=54;this.iHash.update(ae),this.oHash=t.create();for(let le=0;le<ae.length;le++)ae[le]^=106;this.oHash.update(ae),clean(ae)}update(t){return aexists(this),this.iHash.update(t),this}digestInto(t){aexists(this),abytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:ie,finished:fe,destroyed:ae,blockLen:le,outputLen:he}=this;return t=t,t.finished=fe,t.destroyed=ae,t.blockLen=le,t.outputLen=he,t.oHash=n._cloneInto(t.oHash),t.iHash=ie._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const hmac=(c,t,n)=>new HMAC(c,t).update(n).digest();hmac.create=(c,t)=>new HMAC(c,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const divNearest=(c,t)=>(c+(c>=0?t:-t)/_2n$1)/t;function _splitEndoScalar(c,t,n){const[[ie,fe],[ae,le]]=t,he=divNearest(le*c,n),ye=divNearest(-fe*c,n);let me=c-he*ie-ye*ae,xe=-he*fe-ye*le;const Ee=me<_0n,Se=xe<_0n;Ee&&(me=-me),Se&&(xe=-xe);const Me=bitMask(Math.ceil(bitLen(n)/2))+_1n;if(me<_0n||me>=Me||xe<_0n||xe>=Me)throw new Error("splitScalar (endomorphism): failed, k="+c);return{k1neg:Ee,k1:me,k2neg:Se,k2:xe}}function validateSigFormat(c){if(!["compact","recovered","der"].includes(c))throw new Error('Signature format must be "compact", "recovered", or "der"');return c}function validateSigOpts(c,t){const n={};for(let ie of Object.keys(t))n[ie]=c[ie]===void 0?t[ie]:c[ie];return _abool2(n.lowS,"lowS"),_abool2(n.prehash,"prehash"),n.format!==void 0&&validateSigFormat(n.format),n}class DERErr extends Error{constructor(t=""){super(t)}}const DER={Err:DERErr,_tlv:{encode:(c,t)=>{const{Err:n}=DER;if(c<0||c>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const ie=t.length/2,fe=numberToHexUnpadded(ie);if(fe.length/2&128)throw new n("tlv.encode: long form length too big");const ae=ie>127?numberToHexUnpadded(fe.length/2|128):"";return numberToHexUnpadded(c)+ae+fe+t},decode(c,t){const{Err:n}=DER;let ie=0;if(c<0||c>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[ie++]!==c)throw new n("tlv.decode: wrong tlv");const fe=t[ie++],ae=!!(fe&128);let le=0;if(!ae)le=fe;else{const ye=fe&127;if(!ye)throw new n("tlv.decode(long): indefinite length not supported");if(ye>4)throw new n("tlv.decode(long): byte length is too big");const me=t.subarray(ie,ie+ye);if(me.length!==ye)throw new n("tlv.decode: length bytes not complete");if(me[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const xe of me)le=le<<8|xe;if(ie+=ye,le<128)throw new n("tlv.decode(long): not minimal encoding")}const he=t.subarray(ie,ie+le);if(he.length!==le)throw new n("tlv.decode: wrong value length");return{v:he,l:t.subarray(ie+le)}}},_int:{encode(c){const{Err:t}=DER;if(c<_0n)throw new t("integer: negative integers are not allowed");let n=numberToHexUnpadded(c);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(c){const{Err:t}=DER;if(c[0]&128)throw new t("invalid signature integer: negative");if(c[0]===0&&!(c[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return bytesToNumberBE(c)}},toSig(c){const{Err:t,_int:n,_tlv:ie}=DER,fe=ensureBytes("signature",c),{v:ae,l:le}=ie.decode(48,fe);if(le.length)throw new t("invalid signature: left bytes after parsing");const{v:he,l:ye}=ie.decode(2,ae),{v:me,l:xe}=ie.decode(2,ye);if(xe.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(he),s:n.decode(me)}},hexFromSig(c){const{_tlv:t,_int:n}=DER,ie=t.encode(2,n.encode(c.r)),fe=t.encode(2,n.encode(c.s)),ae=ie+fe;return t.encode(48,ae)}},_0n=BigInt(0),_1n=BigInt(1),_2n$1=BigInt(2),_3n=BigInt(3),_4n=BigInt(4);function _normFnElement(c,t){const{BYTES:n}=c;let ie;if(typeof t=="bigint")ie=t;else{let fe=ensureBytes("private key",t);try{ie=c.fromBytes(fe)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!c.isValidNot0(ie))throw new Error("invalid private key: out of range [1..N-1]");return ie}function weierstrassN(c,t={}){const n=_createCurveFields("weierstrass",c,t),{Fp:ie,Fn:fe}=n;let ae=n.CURVE;const{h:le,n:he}=ae;_validateObject(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:ye}=t;if(ye&&(!ie.is0(ae.a)||typeof ye.beta!="bigint"||!Array.isArray(ye.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const me=getWLengths(ie,fe);function xe(){if(!ie.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function Ee(se,ce,de){const{x:pe,y:ve}=ce.toAffine(),we=ie.toBytes(pe);if(_abool2(de,"isCompressed"),de){xe();const Ae=!ie.isOdd(ve);return concatBytes(pprefix(Ae),we)}else return concatBytes(Uint8Array.of(4),we,ie.toBytes(ve))}function Se(se){_abytes2(se,void 0,"Point");const{publicKey:ce,publicKeyUncompressed:de}=me,pe=se.length,ve=se[0],we=se.subarray(1);if(pe===ce&&(ve===2||ve===3)){const Ae=ie.fromBytes(we);if(!ie.isValid(Ae))throw new Error("bad point: is not on curve, wrong x");const ge=$e(Ae);let ue;try{ue=ie.sqrt(ge)}catch(Ne){const Fe=Ne instanceof Error?": "+Ne.message:"";throw new Error("bad point: is not on curve, sqrt error"+Fe)}xe();const be=ie.isOdd(ue);return(ve&1)===1!==be&&(ue=ie.neg(ue)),{x:Ae,y:ue}}else if(pe===de&&ve===4){const Ae=ie.BYTES,ge=ie.fromBytes(we.subarray(0,Ae)),ue=ie.fromBytes(we.subarray(Ae,Ae*2));if(!Ce(ge,ue))throw new Error("bad point: is not on curve");return{x:ge,y:ue}}else throw new Error(`bad point: got length ${pe}, expected compressed=${ce} or uncompressed=${de}`)}const Me=t.toBytes||Ee,Be=t.fromBytes||Se;function $e(se){const ce=ie.sqr(se),de=ie.mul(ce,se);return ie.add(ie.add(de,ie.mul(se,ae.a)),ae.b)}function Ce(se,ce){const de=ie.sqr(ce),pe=$e(se);return ie.eql(de,pe)}if(!Ce(ae.Gx,ae.Gy))throw new Error("bad curve params: generator point");const ke=ie.mul(ie.pow(ae.a,_3n),_4n),Pe=ie.mul(ie.sqr(ae.b),BigInt(27));if(ie.is0(ie.add(ke,Pe)))throw new Error("bad curve params: a or b");function Ue(se,ce,de=!1){if(!ie.isValid(ce)||de&&ie.is0(ce))throw new Error(`bad point coordinate ${se}`);return ce}function qe(se){if(!(se instanceof Ke))throw new Error("ProjectivePoint expected")}function He(se){if(!ye||!ye.basises)throw new Error("no endo");return _splitEndoScalar(se,ye.basises,fe.ORDER)}const Ve=memoized((se,ce)=>{const{X:de,Y:pe,Z:ve}=se;if(ie.eql(ve,ie.ONE))return{x:de,y:pe};const we=se.is0();ce==null&&(ce=we?ie.ONE:ie.inv(ve));const Ae=ie.mul(de,ce),ge=ie.mul(pe,ce),ue=ie.mul(ve,ce);if(we)return{x:ie.ZERO,y:ie.ZERO};if(!ie.eql(ue,ie.ONE))throw new Error("invZ was invalid");return{x:Ae,y:ge}}),Ye=memoized(se=>{if(se.is0()){if(t.allowInfinityPoint&&!ie.is0(se.Y))return;throw new Error("bad point: ZERO")}const{x:ce,y:de}=se.toAffine();if(!ie.isValid(ce)||!ie.isValid(de))throw new Error("bad point: x or y not field elements");if(!Ce(ce,de))throw new Error("bad point: equation left != right");if(!se.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function Qe(se,ce,de,pe,ve){return de=new Ke(ie.mul(de.X,se),de.Y,de.Z),ce=negateCt(pe,ce),de=negateCt(ve,de),ce.add(de)}class Ke{constructor(ce,de,pe){this.X=Ue("x",ce),this.Y=Ue("y",de,!0),this.Z=Ue("z",pe),Object.freeze(this)}static CURVE(){return ae}static fromAffine(ce){const{x:de,y:pe}=ce||{};if(!ce||!ie.isValid(de)||!ie.isValid(pe))throw new Error("invalid affine point");if(ce instanceof Ke)throw new Error("projective point not allowed");return ie.is0(de)&&ie.is0(pe)?Ke.ZERO:new Ke(de,pe,ie.ONE)}static fromBytes(ce){const de=Ke.fromAffine(Be(_abytes2(ce,void 0,"point")));return de.assertValidity(),de}static fromHex(ce){return Ke.fromBytes(ensureBytes("pointHex",ce))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(ce=8,de=!0){return _e.createCache(this,ce),de||this.multiply(_3n),this}assertValidity(){Ye(this)}hasEvenY(){const{y:ce}=this.toAffine();if(!ie.isOdd)throw new Error("Field doesn't support isOdd");return!ie.isOdd(ce)}equals(ce){qe(ce);const{X:de,Y:pe,Z:ve}=this,{X:we,Y:Ae,Z:ge}=ce,ue=ie.eql(ie.mul(de,ge),ie.mul(we,ve)),be=ie.eql(ie.mul(pe,ge),ie.mul(Ae,ve));return ue&&be}negate(){return new Ke(this.X,ie.neg(this.Y),this.Z)}double(){const{a:ce,b:de}=ae,pe=ie.mul(de,_3n),{X:ve,Y:we,Z:Ae}=this;let ge=ie.ZERO,ue=ie.ZERO,be=ie.ZERO,Re=ie.mul(ve,ve),Ne=ie.mul(we,we),Fe=ie.mul(Ae,Ae),Ie=ie.mul(ve,we);return Ie=ie.add(Ie,Ie),be=ie.mul(ve,Ae),be=ie.add(be,be),ge=ie.mul(ce,be),ue=ie.mul(pe,Fe),ue=ie.add(ge,ue),ge=ie.sub(Ne,ue),ue=ie.add(Ne,ue),ue=ie.mul(ge,ue),ge=ie.mul(Ie,ge),be=ie.mul(pe,be),Fe=ie.mul(ce,Fe),Ie=ie.sub(Re,Fe),Ie=ie.mul(ce,Ie),Ie=ie.add(Ie,be),be=ie.add(Re,Re),Re=ie.add(be,Re),Re=ie.add(Re,Fe),Re=ie.mul(Re,Ie),ue=ie.add(ue,Re),Fe=ie.mul(we,Ae),Fe=ie.add(Fe,Fe),Re=ie.mul(Fe,Ie),ge=ie.sub(ge,Re),be=ie.mul(Fe,Ne),be=ie.add(be,be),be=ie.add(be,be),new Ke(ge,ue,be)}add(ce){qe(ce);const{X:de,Y:pe,Z:ve}=this,{X:we,Y:Ae,Z:ge}=ce;let ue=ie.ZERO,be=ie.ZERO,Re=ie.ZERO;const Ne=ae.a,Fe=ie.mul(ae.b,_3n);let Ie=ie.mul(de,we),je=ie.mul(pe,Ae),Te=ie.mul(ve,ge),De=ie.add(de,pe),ze=ie.add(we,Ae);De=ie.mul(De,ze),ze=ie.add(Ie,je),De=ie.sub(De,ze),ze=ie.add(de,ve);let Xe=ie.add(we,ge);return ze=ie.mul(ze,Xe),Xe=ie.add(Ie,Te),ze=ie.sub(ze,Xe),Xe=ie.add(pe,ve),ue=ie.add(Ae,ge),Xe=ie.mul(Xe,ue),ue=ie.add(je,Te),Xe=ie.sub(Xe,ue),Re=ie.mul(Ne,ze),ue=ie.mul(Fe,Te),Re=ie.add(ue,Re),ue=ie.sub(je,Re),Re=ie.add(je,Re),be=ie.mul(ue,Re),je=ie.add(Ie,Ie),je=ie.add(je,Ie),Te=ie.mul(Ne,Te),ze=ie.mul(Fe,ze),je=ie.add(je,Te),Te=ie.sub(Ie,Te),Te=ie.mul(Ne,Te),ze=ie.add(ze,Te),Ie=ie.mul(je,ze),be=ie.add(be,Ie),Ie=ie.mul(Xe,ze),ue=ie.mul(De,ue),ue=ie.sub(ue,Ie),Ie=ie.mul(De,je),Re=ie.mul(Xe,Re),Re=ie.add(Re,Ie),new Ke(ue,be,Re)}subtract(ce){return this.add(ce.negate())}is0(){return this.equals(Ke.ZERO)}multiply(ce){const{endo:de}=t;if(!fe.isValidNot0(ce))throw new Error("invalid scalar: out of range");let pe,ve;const we=Ae=>_e.cached(this,Ae,ge=>normalizeZ(Ke,ge));if(de){const{k1neg:Ae,k1:ge,k2neg:ue,k2:be}=He(ce),{p:Re,f:Ne}=we(ge),{p:Fe,f:Ie}=we(be);ve=Ne.add(Ie),pe=Qe(de.beta,Re,Fe,Ae,ue)}else{const{p:Ae,f:ge}=we(ce);pe=Ae,ve=ge}return normalizeZ(Ke,[pe,ve])[0]}multiplyUnsafe(ce){const{endo:de}=t,pe=this;if(!fe.isValid(ce))throw new Error("invalid scalar: out of range");if(ce===_0n||pe.is0())return Ke.ZERO;if(ce===_1n)return pe;if(_e.hasCache(this))return this.multiply(ce);if(de){const{k1neg:ve,k1:we,k2neg:Ae,k2:ge}=He(ce),{p1:ue,p2:be}=mulEndoUnsafe(Ke,pe,we,ge);return Qe(de.beta,ue,be,ve,Ae)}else return _e.unsafe(pe,ce)}multiplyAndAddUnsafe(ce,de,pe){const ve=this.multiplyUnsafe(de).add(ce.multiplyUnsafe(pe));return ve.is0()?void 0:ve}toAffine(ce){return Ve(this,ce)}isTorsionFree(){const{isTorsionFree:ce}=t;return le===_1n?!0:ce?ce(Ke,this):_e.unsafe(this,he).is0()}clearCofactor(){const{clearCofactor:ce}=t;return le===_1n?this:ce?ce(Ke,this):this.multiplyUnsafe(le)}isSmallOrder(){return this.multiplyUnsafe(le).is0()}toBytes(ce=!0){return _abool2(ce,"isCompressed"),this.assertValidity(),Me(Ke,this,ce)}toHex(ce=!0){return bytesToHex(this.toBytes(ce))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(ce=!0){return this.toBytes(ce)}_setWindowSize(ce){this.precompute(ce)}static normalizeZ(ce){return normalizeZ(Ke,ce)}static msm(ce,de){return pippenger(Ke,fe,ce,de)}static fromPrivateKey(ce){return Ke.BASE.multiply(_normFnElement(fe,ce))}}Ke.BASE=new Ke(ae.Gx,ae.Gy,ie.ONE),Ke.ZERO=new Ke(ie.ZERO,ie.ONE,ie.ZERO),Ke.Fp=ie,Ke.Fn=fe;const Pt=fe.BITS,_e=new wNAF(Ke,t.endo?Math.ceil(Pt/2):Pt);return Ke.BASE.precompute(8),Ke}function pprefix(c){return Uint8Array.of(c?2:3)}function getWLengths(c,t){return{secretKey:t.BYTES,publicKey:1+c.BYTES,publicKeyUncompressed:1+2*c.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function ecdh(c,t={}){const{Fn:n}=c,ie=t.randomBytes||randomBytes,fe=Object.assign(getWLengths(c.Fp,n),{seed:getMinHashLength(n.ORDER)});function ae(Me){try{return!!_normFnElement(n,Me)}catch{return!1}}function le(Me,Be){const{publicKey:$e,publicKeyUncompressed:Ce}=fe;try{const ke=Me.length;return Be===!0&&ke!==$e||Be===!1&&ke!==Ce?!1:!!c.fromBytes(Me)}catch{return!1}}function he(Me=ie(fe.seed)){return mapHashToField(_abytes2(Me,fe.seed,"seed"),n.ORDER)}function ye(Me,Be=!0){return c.BASE.multiply(_normFnElement(n,Me)).toBytes(Be)}function me(Me){const Be=he(Me);return{secretKey:Be,publicKey:ye(Be)}}function xe(Me){if(typeof Me=="bigint")return!1;if(Me instanceof c)return!0;const{secretKey:Be,publicKey:$e,publicKeyUncompressed:Ce}=fe;if(n.allowedLengths||Be===$e)return;const ke=ensureBytes("key",Me).length;return ke===$e||ke===Ce}function Ee(Me,Be,$e=!0){if(xe(Me)===!0)throw new Error("first arg must be private key");if(xe(Be)===!1)throw new Error("second arg must be public key");const Ce=_normFnElement(n,Me);return c.fromHex(Be).multiply(Ce).toBytes($e)}return Object.freeze({getPublicKey:ye,getSharedSecret:Ee,keygen:me,Point:c,utils:{isValidSecretKey:ae,isValidPublicKey:le,randomSecretKey:he,isValidPrivateKey:ae,randomPrivateKey:he,normPrivateKeyToScalar:Me=>_normFnElement(n,Me),precompute(Me=8,Be=c.BASE){return Be.precompute(Me,!1)}},lengths:fe})}function ecdsa(c,t,n={}){ahash(t),_validateObject(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const ie=n.randomBytes||randomBytes,fe=n.hmac||((de,...pe)=>hmac(t,de,concatBytes(...pe))),{Fp:ae,Fn:le}=c,{ORDER:he,BITS:ye}=le,{keygen:me,getPublicKey:xe,getSharedSecret:Ee,utils:Se,lengths:Me}=ecdh(c,n),Be={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},$e="compact";function Ce(de){const pe=he>>_1n;return de>pe}function ke(de,pe){if(!le.isValidNot0(pe))throw new Error(`invalid signature ${de}: out of range 1..Point.Fn.ORDER`);return pe}function Pe(de,pe){validateSigFormat(pe);const ve=Me.signature,we=pe==="compact"?ve:pe==="recovered"?ve+1:void 0;return _abytes2(de,we,`${pe} signature`)}class Ue{constructor(pe,ve,we){this.r=ke("r",pe),this.s=ke("s",ve),we!=null&&(this.recovery=we),Object.freeze(this)}static fromBytes(pe,ve=$e){Pe(pe,ve);let we;if(ve==="der"){const{r:be,s:Re}=DER.toSig(_abytes2(pe));return new Ue(be,Re)}ve==="recovered"&&(we=pe[0],ve="compact",pe=pe.subarray(1));const Ae=le.BYTES,ge=pe.subarray(0,Ae),ue=pe.subarray(Ae,Ae*2);return new Ue(le.fromBytes(ge),le.fromBytes(ue),we)}static fromHex(pe,ve){return this.fromBytes(hexToBytes(pe),ve)}addRecoveryBit(pe){return new Ue(this.r,this.s,pe)}recoverPublicKey(pe){const ve=ae.ORDER,{r:we,s:Ae,recovery:ge}=this;if(ge==null||![0,1,2,3].includes(ge))throw new Error("recovery id invalid");if(he*_2n$1<ve&&ge>1)throw new Error("recovery id is ambiguous for h>1 curve");const be=ge===2||ge===3?we+he:we;if(!ae.isValid(be))throw new Error("recovery id 2 or 3 invalid");const Re=ae.toBytes(be),Ne=c.fromBytes(concatBytes(pprefix((ge&1)===0),Re)),Fe=le.inv(be),Ie=He(ensureBytes("msgHash",pe)),je=le.create(-Ie*Fe),Te=le.create(Ae*Fe),De=c.BASE.multiplyUnsafe(je).add(Ne.multiplyUnsafe(Te));if(De.is0())throw new Error("point at infinify");return De.assertValidity(),De}hasHighS(){return Ce(this.s)}toBytes(pe=$e){if(validateSigFormat(pe),pe==="der")return hexToBytes(DER.hexFromSig(this));const ve=le.toBytes(this.r),we=le.toBytes(this.s);if(pe==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return concatBytes(Uint8Array.of(this.recovery),ve,we)}return concatBytes(ve,we)}toHex(pe){return bytesToHex(this.toBytes(pe))}assertValidity(){}static fromCompact(pe){return Ue.fromBytes(ensureBytes("sig",pe),"compact")}static fromDER(pe){return Ue.fromBytes(ensureBytes("sig",pe),"der")}normalizeS(){return this.hasHighS()?new Ue(this.r,le.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return bytesToHex(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return bytesToHex(this.toBytes("compact"))}}const qe=n.bits2int||function(pe){if(pe.length>8192)throw new Error("input is too large");const ve=bytesToNumberBE(pe),we=pe.length*8-ye;return we>0?ve>>BigInt(we):ve},He=n.bits2int_modN||function(pe){return le.create(qe(pe))},Ve=bitMask(ye);function Ye(de){return aInRange("num < 2^"+ye,de,_0n,Ve),le.toBytes(de)}function Qe(de,pe){return _abytes2(de,void 0,"message"),pe?_abytes2(t(de),void 0,"prehashed message"):de}function Ke(de,pe,ve){if(["recovered","canonical"].some(je=>je in ve))throw new Error("sign() legacy options not supported");const{lowS:we,prehash:Ae,extraEntropy:ge}=validateSigOpts(ve,Be);de=Qe(de,Ae);const ue=He(de),be=_normFnElement(le,pe),Re=[Ye(be),Ye(ue)];if(ge!=null&&ge!==!1){const je=ge===!0?ie(Me.secretKey):ge;Re.push(ensureBytes("extraEntropy",je))}const Ne=concatBytes(...Re),Fe=ue;function Ie(je){const Te=qe(je);if(!le.isValidNot0(Te))return;const De=le.inv(Te),ze=c.BASE.multiply(Te).toAffine(),Xe=le.create(ze.x);if(Xe===_0n)return;const Rt=le.create(De*le.create(Fe+Xe*be));if(Rt===_0n)return;let Oe=(ze.x===Xe?0:2)|Number(ze.y&_1n),Ze=Rt;return we&&Ce(Rt)&&(Ze=le.neg(Rt),Oe^=1),new Ue(Xe,Ze,Oe)}return{seed:Ne,k2sig:Ie}}function Pt(de,pe,ve={}){de=ensureBytes("message",de);const{seed:we,k2sig:Ae}=Ke(de,pe,ve);return createHmacDrbg(t.outputLen,le.BYTES,fe)(we,Ae)}function _e(de){let pe;const ve=typeof de=="string"||isBytes(de),we=!ve&&de!==null&&typeof de=="object"&&typeof de.r=="bigint"&&typeof de.s=="bigint";if(!ve&&!we)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(we)pe=new Ue(de.r,de.s);else if(ve){try{pe=Ue.fromBytes(ensureBytes("sig",de),"der")}catch(Ae){if(!(Ae instanceof DER.Err))throw Ae}if(!pe)try{pe=Ue.fromBytes(ensureBytes("sig",de),"compact")}catch{return!1}}return pe||!1}function se(de,pe,ve,we={}){const{lowS:Ae,prehash:ge,format:ue}=validateSigOpts(we,Be);if(ve=ensureBytes("publicKey",ve),pe=Qe(ensureBytes("message",pe),ge),"strict"in we)throw new Error("options.strict was renamed to lowS");const be=ue===void 0?_e(de):Ue.fromBytes(ensureBytes("sig",de),ue);if(be===!1)return!1;try{const Re=c.fromBytes(ve);if(Ae&&be.hasHighS())return!1;const{r:Ne,s:Fe}=be,Ie=He(pe),je=le.inv(Fe),Te=le.create(Ie*je),De=le.create(Ne*je),ze=c.BASE.multiplyUnsafe(Te).add(Re.multiplyUnsafe(De));return ze.is0()?!1:le.create(ze.x)===Ne}catch{return!1}}function ce(de,pe,ve={}){const{prehash:we}=validateSigOpts(ve,Be);return pe=Qe(pe,we),Ue.fromBytes(de,"recovered").recoverPublicKey(pe).toBytes()}return Object.freeze({keygen:me,getPublicKey:xe,getSharedSecret:Ee,utils:Se,lengths:Me,Point:c,sign:Pt,verify:se,recoverPublicKey:ce,Signature:Ue,hash:t})}function _weierstrass_legacy_opts_to_new(c){const t={a:c.a,b:c.b,p:c.Fp.ORDER,n:c.n,h:c.h,Gx:c.Gx,Gy:c.Gy},n=c.Fp;let ie=c.allowedPrivateKeyLengths?Array.from(new Set(c.allowedPrivateKeyLengths.map(le=>Math.ceil(le/2)))):void 0;const fe=Field(t.n,{BITS:c.nBitLength,allowedLengths:ie,modFromBytes:c.wrapPrivateKey}),ae={Fp:n,Fn:fe,allowInfinityPoint:c.allowInfinityPoint,endo:c.endo,isTorsionFree:c.isTorsionFree,clearCofactor:c.clearCofactor,fromBytes:c.fromBytes,toBytes:c.toBytes};return{CURVE:t,curveOpts:ae}}function _ecdsa_legacy_opts_to_new(c){const{CURVE:t,curveOpts:n}=_weierstrass_legacy_opts_to_new(c),ie={hmac:c.hmac,randomBytes:c.randomBytes,lowS:c.lowS,bits2int:c.bits2int,bits2int_modN:c.bits2int_modN};return{CURVE:t,curveOpts:n,hash:c.hash,ecdsaOpts:ie}}function _ecdsa_new_output_to_legacy(c,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},c,nLength(n.Fn.ORDER,n.Fn.BITS))})}function weierstrass(c){const{CURVE:t,curveOpts:n,hash:ie,ecdsaOpts:fe}=_ecdsa_legacy_opts_to_new(c),ae=weierstrassN(t,n),le=ecdsa(ae,ie,fe);return _ecdsa_new_output_to_legacy(c,le)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function createCurve(c,t){const n=ie=>weierstrass({...c,hash:ie});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1_CURVE={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},secp256k1_ENDO={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},_2n=BigInt(2);function sqrtMod(c){const t=secp256k1_CURVE.p,n=BigInt(3),ie=BigInt(6),fe=BigInt(11),ae=BigInt(22),le=BigInt(23),he=BigInt(44),ye=BigInt(88),me=c*c*c%t,xe=me*me*c%t,Ee=pow2(xe,n,t)*xe%t,Se=pow2(Ee,n,t)*xe%t,Me=pow2(Se,_2n,t)*me%t,Be=pow2(Me,fe,t)*Me%t,$e=pow2(Be,ae,t)*Be%t,Ce=pow2($e,he,t)*$e%t,ke=pow2(Ce,ye,t)*Ce%t,Pe=pow2(ke,he,t)*$e%t,Ue=pow2(Pe,n,t)*xe%t,qe=pow2(Ue,le,t)*Be%t,He=pow2(qe,ie,t)*me%t,Ve=pow2(He,_2n,t);if(!Fpk1.eql(Fpk1.sqr(Ve),c))throw new Error("Cannot find square root");return Ve}const Fpk1=Field(secp256k1_CURVE.p,{sqrt:sqrtMod}),secp256k1$1=createCurve({...secp256k1_CURVE,Fp:Fpk1,lowS:!0,endo:secp256k1_ENDO},sha256$5);ed25519.utils.randomPrivateKey;ed25519.getPublicKey;function isOnCurve(c){try{return ed25519.ExtendedPoint.fromHex(c),!0}catch{return!1}}const sign$2=(c,t)=>ed25519.sign(c,t.slice(0,32)),verify$1=ed25519.verify,toBuffer$1=c=>Buffer$1$1.isBuffer(c)?c:c instanceof Uint8Array?Buffer$1$1.from(c.buffer,c.byteOffset,c.byteLength):Buffer$1$1.from(c);class Struct{constructor(t){Object.assign(this,t)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA,this))}static decode(t){return deserialize_1(SOLANA_SCHEMA,this,t)}static decodeUnchecked(t){return deserializeUnchecked_1(SOLANA_SCHEMA,this,t)}}const SOLANA_SCHEMA=new Map;var _PublicKey;const MAX_SEED_LENGTH=32,PUBLIC_KEY_LENGTH=32;function isPublicKeyData(c){return c._bn!==void 0}let uniquePublicKeyCounter=1;class PublicKey extends Struct{constructor(t){if(super({}),this._bn=void 0,isPublicKeyData(t))this._bn=t._bn;else{if(typeof t=="string"){const n=o$1.decode(t);if(n.length!=PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input");this._bn=new BN$8(n)}else this._bn=new BN$8(t);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input")}}static unique(){const t=new PublicKey(uniquePublicKeyCounter);return uniquePublicKeyCounter+=1,new PublicKey(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return o$1.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(Buffer$1$1);if(t.length===PUBLIC_KEY_LENGTH)return t;const n=Buffer$1$1.alloc(32);return t.copy(n,32-t.length),n}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,n,ie){const fe=Buffer$1$1.concat([t.toBuffer(),Buffer$1$1.from(n),ie.toBuffer()]),ae=sha256$4(fe);return new PublicKey(ae)}static createProgramAddressSync(t,n){let ie=Buffer$1$1.alloc(0);t.forEach(function(ae){if(ae.length>MAX_SEED_LENGTH)throw new TypeError("Max seed length exceeded");ie=Buffer$1$1.concat([ie,toBuffer$1(ae)])}),ie=Buffer$1$1.concat([ie,n.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const fe=sha256$4(ie);if(isOnCurve(fe))throw new Error("Invalid seeds, address must fall off the curve");return new PublicKey(fe)}static async createProgramAddress(t,n){return this.createProgramAddressSync(t,n)}static findProgramAddressSync(t,n){let ie=255,fe;for(;ie!=0;){try{const ae=t.concat(Buffer$1$1.from([ie]));fe=this.createProgramAddressSync(ae,n)}catch(ae){if(ae instanceof TypeError)throw ae;ie--;continue}return[fe,ie]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,n){return this.findProgramAddressSync(t,n)}static isOnCurve(t){const n=new PublicKey(t);return isOnCurve(n.toBytes())}}_PublicKey=PublicKey;PublicKey.default=new _PublicKey("11111111111111111111111111111111");SOLANA_SCHEMA.set(PublicKey,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey("BPFLoader1111111111111111111111111111111111");const PACKET_DATA_SIZE=1232,VERSION_PREFIX_MASK=127,SIGNATURE_LENGTH_IN_BYTES=64;class TransactionExpiredBlockheightExceededError extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(TransactionExpiredBlockheightExceededError.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class TransactionExpiredTimeoutError extends Error{constructor(t,n){super(`Transaction was not confirmed in ${n.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(TransactionExpiredTimeoutError.prototype,"name",{value:"TransactionExpiredTimeoutError"});class TransactionExpiredNonceInvalidError extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(TransactionExpiredNonceInvalidError.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class MessageAccountKeys{constructor(t,n){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=n}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const n of this.keySegments()){if(t<n.length)return n[t];t-=n.length}}get length(){return this.keySegments().flat().length}compileInstructions(t){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const ie=new Map;this.keySegments().flat().forEach((ae,le)=>{ie.set(ae.toBase58(),le)});const fe=ae=>{const le=ie.get(ae.toBase58());if(le===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return le};return t.map(ae=>({programIdIndex:fe(ae.programId),accountKeyIndexes:ae.keys.map(le=>fe(le.pubkey)),data:ae.data}))}}const publicKey$1=(c="publicKey")=>blob(32,c),signature$2=(c="signature")=>blob(64,c),rustString=(c="string")=>{const t=struct([u32("length"),u32("lengthPadding"),blob(offset(u32(),-8),"chars")],c),n=t.decode.bind(t),ie=t.encode.bind(t),fe=t;return fe.decode=(ae,le)=>n(ae,le).chars.toString(),fe.encode=(ae,le,he)=>{const ye={chars:Buffer$1$1.from(ae,"utf8")};return ie(ye,le,he)},fe.alloc=ae=>u32().span+u32().span+Buffer$1$1.from(ae,"utf8").length,fe},authorized=(c="authorized")=>struct([publicKey$1("staker"),publicKey$1("withdrawer")],c),lockup=(c="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$1("custodian")],c),voteInit=(c="voteInit")=>struct([publicKey$1("nodePubkey"),publicKey$1("authorizedVoter"),publicKey$1("authorizedWithdrawer"),u8("commission")],c),voteAuthorizeWithSeedArgs=(c="voteAuthorizeWithSeedArgs")=>struct([u32("voteAuthorizationType"),publicKey$1("currentAuthorityDerivedKeyOwnerPubkey"),rustString("currentAuthorityDerivedKeySeed"),publicKey$1("newAuthorized")],c);function getAlloc(c,t){const n=fe=>{if(fe.span>=0)return fe.span;if(typeof fe.alloc=="function")return fe.alloc(t[fe.property]);if("count"in fe&&"elementLayout"in fe){const ae=t[fe.property];if(Array.isArray(ae))return ae.length*n(fe.elementLayout)}else if("fields"in fe)return getAlloc({layout:fe},t[fe.property]);return 0};let ie=0;return c.layout.fields.forEach(fe=>{ie+=n(fe)}),ie}function decodeLength(c){let t=0,n=0;for(;;){let ie=c.shift();if(t|=(ie&127)<<n*7,n+=1,!(ie&128))break}return t}function encodeLength(c,t){let n=t;for(;;){let ie=n&127;if(n>>=7,n==0){c.push(ie);break}else ie|=128,c.push(ie)}}function assert$9(c,t){if(!c)throw new Error(t||"Assertion failed")}class CompiledKeys{constructor(t,n){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=n}static compile(t,n){const ie=new Map,fe=le=>{const he=le.toBase58();let ye=ie.get(he);return ye===void 0&&(ye={isSigner:!1,isWritable:!1,isInvoked:!1},ie.set(he,ye)),ye},ae=fe(n);ae.isSigner=!0,ae.isWritable=!0;for(const le of t){fe(le.programId).isInvoked=!0;for(const he of le.keys){const ye=fe(he.pubkey);ye.isSigner||(ye.isSigner=he.isSigner),ye.isWritable||(ye.isWritable=he.isWritable)}}return new CompiledKeys(n,ie)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];assert$9(t.length<=256,"Max static account keys length exceeded");const n=t.filter(([,ye])=>ye.isSigner&&ye.isWritable),ie=t.filter(([,ye])=>ye.isSigner&&!ye.isWritable),fe=t.filter(([,ye])=>!ye.isSigner&&ye.isWritable),ae=t.filter(([,ye])=>!ye.isSigner&&!ye.isWritable),le={numRequiredSignatures:n.length+ie.length,numReadonlySignedAccounts:ie.length,numReadonlyUnsignedAccounts:ae.length};{assert$9(n.length>0,"Expected at least one writable signer key");const[ye]=n[0];assert$9(ye===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const he=[...n.map(([ye])=>new PublicKey(ye)),...ie.map(([ye])=>new PublicKey(ye)),...fe.map(([ye])=>new PublicKey(ye)),...ae.map(([ye])=>new PublicKey(ye))];return[le,he]}extractTableLookup(t){const[n,ie]=this.drainKeysFoundInLookupTable(t.state.addresses,le=>!le.isSigner&&!le.isInvoked&&le.isWritable),[fe,ae]=this.drainKeysFoundInLookupTable(t.state.addresses,le=>!le.isSigner&&!le.isInvoked&&!le.isWritable);if(!(n.length===0&&fe.length===0))return[{accountKey:t.key,writableIndexes:n,readonlyIndexes:fe},{writable:ie,readonly:ae}]}drainKeysFoundInLookupTable(t,n){const ie=new Array,fe=new Array;for(const[ae,le]of this.keyMetaMap.entries())if(n(le)){const he=new PublicKey(ae),ye=t.findIndex(me=>me.equals(he));ye>=0&&(assert$9(ye<256,"Max lookup table index exceeded"),ie.push(ye),fe.push(he),this.keyMetaMap.delete(ae))}return[ie,fe]}}const END_OF_BUFFER_ERROR_MESSAGE="Reached end of buffer unexpectedly";function guardedShift(c){if(c.length===0)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return c.shift()}function guardedSplice(c,...t){const[n]=t;if(t.length===2?n+(t[1]??0)>c.length:n>=c.length)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return c.splice(...t)}class Message{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(n=>new PublicKey(n)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(n=>this.indexToProgramIds.set(n.programIdIndex,this.accountKeys[n.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:o$1.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new MessageAccountKeys(this.staticAccountKeys)}static compile(t){const n=CompiledKeys.compile(t.instructions,t.payerKey),[ie,fe]=n.getMessageComponents(),le=new MessageAccountKeys(fe).compileInstructions(t.instructions).map(he=>({programIdIndex:he.programIdIndex,accounts:he.accountKeyIndexes,data:o$1.encode(he.data)}));return new Message({header:ie,accountKeys:fe,recentBlockhash:t.recentBlockhash,instructions:le})}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const n=this.header.numRequiredSignatures;if(t>=this.header.numRequiredSignatures){const ie=t-n,ae=this.accountKeys.length-n-this.header.numReadonlyUnsignedAccounts;return ie<ae}else{const ie=n-this.header.numReadonlySignedAccounts;return t<ie}}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((t,n)=>!this.isProgramId(n))}serialize(){const t=this.accountKeys.length;let n=[];encodeLength(n,t);const ie=this.instructions.map(Ee=>{const{accounts:Se,programIdIndex:Me}=Ee,Be=Array.from(o$1.decode(Ee.data));let $e=[];encodeLength($e,Se.length);let Ce=[];return encodeLength(Ce,Be.length),{programIdIndex:Me,keyIndicesCount:Buffer$1$1.from($e),keyIndices:Se,dataLength:Buffer$1$1.from(Ce),data:Be}});let fe=[];encodeLength(fe,ie.length);let ae=Buffer$1$1.alloc(PACKET_DATA_SIZE);Buffer$1$1.from(fe).copy(ae);let le=fe.length;ie.forEach(Ee=>{const Me=struct([u8("programIdIndex"),blob(Ee.keyIndicesCount.length,"keyIndicesCount"),seq(u8("keyIndex"),Ee.keyIndices.length,"keyIndices"),blob(Ee.dataLength.length,"dataLength"),seq(u8("userdatum"),Ee.data.length,"data")]).encode(Ee,ae,le);le+=Me}),ae=ae.slice(0,le);const he=struct([blob(1,"numRequiredSignatures"),blob(1,"numReadonlySignedAccounts"),blob(1,"numReadonlyUnsignedAccounts"),blob(n.length,"keyCount"),seq(publicKey$1("key"),t,"keys"),publicKey$1("recentBlockhash")]),ye={numRequiredSignatures:Buffer$1$1.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Buffer$1$1.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Buffer$1$1.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Buffer$1$1.from(n),keys:this.accountKeys.map(Ee=>toBuffer$1(Ee.toBytes())),recentBlockhash:o$1.decode(this.recentBlockhash)};let me=Buffer$1$1.alloc(2048);const xe=he.encode(ye,me);return ae.copy(me,xe),me.slice(0,xe+ae.length)}static from(t){let n=[...t];const ie=guardedShift(n);if(ie!==(ie&VERSION_PREFIX_MASK))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const fe=guardedShift(n),ae=guardedShift(n),le=decodeLength(n);let he=[];for(let Se=0;Se<le;Se++){const Me=guardedSplice(n,0,PUBLIC_KEY_LENGTH);he.push(new PublicKey(Buffer$1$1.from(Me)))}const ye=guardedSplice(n,0,PUBLIC_KEY_LENGTH),me=decodeLength(n);let xe=[];for(let Se=0;Se<me;Se++){const Me=guardedShift(n),Be=decodeLength(n),$e=guardedSplice(n,0,Be),Ce=decodeLength(n),ke=guardedSplice(n,0,Ce),Pe=o$1.encode(Buffer$1$1.from(ke));xe.push({programIdIndex:Me,accounts:$e,data:Pe})}const Ee={header:{numRequiredSignatures:ie,numReadonlySignedAccounts:fe,numReadonlyUnsignedAccounts:ae},recentBlockhash:o$1.encode(Buffer$1$1.from(ye)),accountKeys:he,instructions:xe};return new Message(Ee)}}class MessageV0{constructor(t){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let t=0;for(const n of this.addressTableLookups)t+=n.readonlyIndexes.length+n.writableIndexes.length;return t}getAccountKeys(t){let n;if(t&&"accountKeysFromLookups"in t&&t.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=t.accountKeysFromLookups.writable.length+t.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");n=t.accountKeysFromLookups}else if(t&&"addressLookupTableAccounts"in t&&t.addressLookupTableAccounts)n=this.resolveAddressTableLookups(t.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new MessageAccountKeys(this.staticAccountKeys,n)}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const n=this.header.numRequiredSignatures,ie=this.staticAccountKeys.length;if(t>=ie){const fe=t-ie,ae=this.addressTableLookups.reduce((le,he)=>le+he.writableIndexes.length,0);return fe<ae}else if(t>=this.header.numRequiredSignatures){const fe=t-n,le=ie-n-this.header.numReadonlyUnsignedAccounts;return fe<le}else{const fe=n-this.header.numReadonlySignedAccounts;return t<fe}}resolveAddressTableLookups(t){const n={writable:[],readonly:[]};for(const ie of this.addressTableLookups){const fe=t.find(ae=>ae.key.equals(ie.accountKey));if(!fe)throw new Error(`Failed to find address lookup table account for table key ${ie.accountKey.toBase58()}`);for(const ae of ie.writableIndexes)if(ae<fe.state.addresses.length)n.writable.push(fe.state.addresses[ae]);else throw new Error(`Failed to find address for index ${ae} in address lookup table ${ie.accountKey.toBase58()}`);for(const ae of ie.readonlyIndexes)if(ae<fe.state.addresses.length)n.readonly.push(fe.state.addresses[ae]);else throw new Error(`Failed to find address for index ${ae} in address lookup table ${ie.accountKey.toBase58()}`)}return n}static compile(t){const n=CompiledKeys.compile(t.instructions,t.payerKey),ie=new Array,fe={writable:new Array,readonly:new Array},ae=t.addressLookupTableAccounts||[];for(const xe of ae){const Ee=n.extractTableLookup(xe);if(Ee!==void 0){const[Se,{writable:Me,readonly:Be}]=Ee;ie.push(Se),fe.writable.push(...Me),fe.readonly.push(...Be)}}const[le,he]=n.getMessageComponents(),me=new MessageAccountKeys(he,fe).compileInstructions(t.instructions);return new MessageV0({header:le,staticAccountKeys:he,recentBlockhash:t.recentBlockhash,compiledInstructions:me,addressTableLookups:ie})}serialize(){const t=Array();encodeLength(t,this.staticAccountKeys.length);const n=this.serializeInstructions(),ie=Array();encodeLength(ie,this.compiledInstructions.length);const fe=this.serializeAddressTableLookups(),ae=Array();encodeLength(ae,this.addressTableLookups.length);const le=struct([u8("prefix"),struct([u8("numRequiredSignatures"),u8("numReadonlySignedAccounts"),u8("numReadonlyUnsignedAccounts")],"header"),blob(t.length,"staticAccountKeysLength"),seq(publicKey$1(),this.staticAccountKeys.length,"staticAccountKeys"),publicKey$1("recentBlockhash"),blob(ie.length,"instructionsLength"),blob(n.length,"serializedInstructions"),blob(ae.length,"addressTableLookupsLength"),blob(fe.length,"serializedAddressTableLookups")]),he=new Uint8Array(PACKET_DATA_SIZE),me=le.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map(xe=>xe.toBytes()),recentBlockhash:o$1.decode(this.recentBlockhash),instructionsLength:new Uint8Array(ie),serializedInstructions:n,addressTableLookupsLength:new Uint8Array(ae),serializedAddressTableLookups:fe},he);return he.slice(0,me)}serializeInstructions(){let t=0;const n=new Uint8Array(PACKET_DATA_SIZE);for(const ie of this.compiledInstructions){const fe=Array();encodeLength(fe,ie.accountKeyIndexes.length);const ae=Array();encodeLength(ae,ie.data.length);const le=struct([u8("programIdIndex"),blob(fe.length,"encodedAccountKeyIndexesLength"),seq(u8(),ie.accountKeyIndexes.length,"accountKeyIndexes"),blob(ae.length,"encodedDataLength"),blob(ie.data.length,"data")]);t+=le.encode({programIdIndex:ie.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(fe),accountKeyIndexes:ie.accountKeyIndexes,encodedDataLength:new Uint8Array(ae),data:ie.data},n,t)}return n.slice(0,t)}serializeAddressTableLookups(){let t=0;const n=new Uint8Array(PACKET_DATA_SIZE);for(const ie of this.addressTableLookups){const fe=Array();encodeLength(fe,ie.writableIndexes.length);const ae=Array();encodeLength(ae,ie.readonlyIndexes.length);const le=struct([publicKey$1("accountKey"),blob(fe.length,"encodedWritableIndexesLength"),seq(u8(),ie.writableIndexes.length,"writableIndexes"),blob(ae.length,"encodedReadonlyIndexesLength"),seq(u8(),ie.readonlyIndexes.length,"readonlyIndexes")]);t+=le.encode({accountKey:ie.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(fe),writableIndexes:ie.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(ae),readonlyIndexes:ie.readonlyIndexes},n,t)}return n.slice(0,t)}static deserialize(t){let n=[...t];const ie=guardedShift(n),fe=ie&VERSION_PREFIX_MASK;assert$9(ie!==fe,"Expected versioned message but received legacy message");const ae=fe;assert$9(ae===0,`Expected versioned message with version 0 but found version ${ae}`);const le={numRequiredSignatures:guardedShift(n),numReadonlySignedAccounts:guardedShift(n),numReadonlyUnsignedAccounts:guardedShift(n)},he=[],ye=decodeLength(n);for(let Be=0;Be<ye;Be++)he.push(new PublicKey(guardedSplice(n,0,PUBLIC_KEY_LENGTH)));const me=o$1.encode(guardedSplice(n,0,PUBLIC_KEY_LENGTH)),xe=decodeLength(n),Ee=[];for(let Be=0;Be<xe;Be++){const $e=guardedShift(n),Ce=decodeLength(n),ke=guardedSplice(n,0,Ce),Pe=decodeLength(n),Ue=new Uint8Array(guardedSplice(n,0,Pe));Ee.push({programIdIndex:$e,accountKeyIndexes:ke,data:Ue})}const Se=decodeLength(n),Me=[];for(let Be=0;Be<Se;Be++){const $e=new PublicKey(guardedSplice(n,0,PUBLIC_KEY_LENGTH)),Ce=decodeLength(n),ke=guardedSplice(n,0,Ce),Pe=decodeLength(n),Ue=guardedSplice(n,0,Pe);Me.push({accountKey:$e,writableIndexes:ke,readonlyIndexes:Ue})}return new MessageV0({header:le,staticAccountKeys:he,recentBlockhash:me,compiledInstructions:Ee,addressTableLookups:Me})}}const VersionedMessage={deserializeMessageVersion(c){const t=c[0],n=t&VERSION_PREFIX_MASK;return n===t?"legacy":n},deserialize:c=>{const t=VersionedMessage.deserializeMessageVersion(c);if(t==="legacy")return Message.from(c);if(t===0)return MessageV0.deserialize(c);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let TransactionStatus=function(c){return c[c.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",c[c.PROCESSED=1]="PROCESSED",c[c.TIMED_OUT=2]="TIMED_OUT",c[c.NONCE_INVALID=3]="NONCE_INVALID",c}({});const DEFAULT_SIGNATURE=Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);class TransactionInstruction{constructor(t){this.keys=void 0,this.programId=void 0,this.data=Buffer$1$1.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map(({pubkey:t,isSigner:n,isWritable:ie})=>({pubkey:t.toJSON(),isSigner:n,isWritable:ie})),programId:this.programId.toJSON(),data:[...this.data]}}}class Transaction{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:n,nonceInfo:ie}=t;this.minNonceContextSlot=n,this.nonceInfo=ie}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:n,lastValidBlockHeight:ie}=t;this.recentBlockhash=n,this.lastValidBlockHeight=ie}else{const{recentBlockhash:n,nonceInfo:ie}=t;ie&&(this.nonceInfo=ie),this.recentBlockhash=n}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(n=>{"instructions"in n?this.instructions=this.instructions.concat(n.instructions):"data"in n&&"programId"in n&&"keys"in n?this.instructions.push(n):this.instructions.push(new TransactionInstruction(n))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?n=[this.nonceInfo.nonceInstruction,...this.instructions]:n=this.instructions):(t=this.recentBlockhash,n=this.instructions),!t)throw new Error("Transaction recentBlockhash required");n.length<1&&console.warn("No instructions provided");let ie;if(this.feePayer)ie=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)ie=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let $e=0;$e<n.length;$e++)if(n[$e].programId===void 0)throw new Error(`Transaction instruction index ${$e} has undefined program id`);const fe=[],ae=[];n.forEach($e=>{$e.keys.forEach(ke=>{ae.push({...ke})});const Ce=$e.programId.toString();fe.includes(Ce)||fe.push(Ce)}),fe.forEach($e=>{ae.push({pubkey:new PublicKey($e),isSigner:!1,isWritable:!1})});const le=[];ae.forEach($e=>{const Ce=$e.pubkey.toString(),ke=le.findIndex(Pe=>Pe.pubkey.toString()===Ce);ke>-1?(le[ke].isWritable=le[ke].isWritable||$e.isWritable,le[ke].isSigner=le[ke].isSigner||$e.isSigner):le.push($e)}),le.sort(function($e,Ce){if($e.isSigner!==Ce.isSigner)return $e.isSigner?-1:1;if($e.isWritable!==Ce.isWritable)return $e.isWritable?-1:1;const ke={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return $e.pubkey.toBase58().localeCompare(Ce.pubkey.toBase58(),"en",ke)});const he=le.findIndex($e=>$e.pubkey.equals(ie));if(he>-1){const[$e]=le.splice(he,1);$e.isSigner=!0,$e.isWritable=!0,le.unshift($e)}else le.unshift({pubkey:ie,isSigner:!0,isWritable:!0});for(const $e of this.signatures){const Ce=le.findIndex(ke=>ke.pubkey.equals($e.publicKey));if(Ce>-1)le[Ce].isSigner||(le[Ce].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${$e.publicKey.toString()}`)}let ye=0,me=0,xe=0;const Ee=[],Se=[];le.forEach(({pubkey:$e,isSigner:Ce,isWritable:ke})=>{Ce?(Ee.push($e.toString()),ye+=1,ke||(me+=1)):(Se.push($e.toString()),ke||(xe+=1))});const Me=Ee.concat(Se),Be=n.map($e=>{const{data:Ce,programId:ke}=$e;return{programIdIndex:Me.indexOf(ke.toString()),accounts:$e.keys.map(Pe=>Me.indexOf(Pe.pubkey.toString())),data:o$1.encode(Ce)}});return Be.forEach($e=>{assert$9($e.programIdIndex>=0),$e.accounts.forEach(Ce=>assert$9(Ce>=0))}),new Message({header:{numRequiredSignatures:ye,numReadonlySignedAccounts:me,numReadonlyUnsignedAccounts:xe},accountKeys:Me,recentBlockhash:t,instructions:Be})}_compile(){const t=this.compileMessage(),n=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===n.length&&this.signatures.every((fe,ae)=>n[ae].equals(fe.publicKey))||(this.signatures=n.map(ie=>({signature:null,publicKey:ie}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");const n=new Set;this.signatures=t.filter(ie=>{const fe=ie.toString();return n.has(fe)?!1:(n.add(fe),!0)}).map(ie=>({signature:null,publicKey:ie}))}sign(...t){if(t.length===0)throw new Error("No signers");const n=new Set,ie=[];for(const ae of t){const le=ae.publicKey.toString();n.has(le)||(n.add(le),ie.push(ae))}this.signatures=ie.map(ae=>({signature:null,publicKey:ae.publicKey}));const fe=this._compile();this._partialSign(fe,...ie)}partialSign(...t){if(t.length===0)throw new Error("No signers");const n=new Set,ie=[];for(const ae of t){const le=ae.publicKey.toString();n.has(le)||(n.add(le),ie.push(ae))}const fe=this._compile();this._partialSign(fe,...ie)}_partialSign(t,...n){const ie=t.serialize();n.forEach(fe=>{const ae=sign$2(ie,fe.secretKey);this._addSignature(fe.publicKey,toBuffer$1(ae))})}addSignature(t,n){this._compile(),this._addSignature(t,n)}_addSignature(t,n){assert$9(n.length===64);const ie=this.signatures.findIndex(fe=>t.equals(fe.publicKey));if(ie<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[ie].signature=Buffer$1$1.from(n)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,n){const ie={};for(const{signature:fe,publicKey:ae}of this.signatures)fe===null?n&&(ie.missing||(ie.missing=[])).push(ae):verify$1(fe,t,ae.toBytes())||(ie.invalid||(ie.invalid=[])).push(ae);return ie.invalid||ie.missing?ie:void 0}serialize(t){const{requireAllSignatures:n,verifySignatures:ie}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),fe=this.serializeMessage();if(ie){const ae=this._getMessageSignednessErrors(fe,n);if(ae){let le="Signature verification failed.";throw ae.invalid&&(le+=`
|
|
20
20
|
Invalid signature for public key${ae.invalid.length===1?"":"(s)"} [\`${ae.invalid.map(he=>he.toBase58()).join("`, `")}\`].`),ae.missing&&(le+=`
|
|
@@ -46,4 +46,4 @@ we accept pull requests
|
|
|
46
46
|
https://github.com/browserify/crypto-browserify`)},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}var hasRequiredCore;function requireCore(){return hasRequiredCore||(hasRequiredCore=1,function(c,t){(function(n,ie){c.exports=ie()})(commonjsGlobal,function(){var n=n||function(ie,fe){var ae;if(typeof window<"u"&&window.crypto&&(ae=window.crypto),typeof self<"u"&&self.crypto&&(ae=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(ae=globalThis.crypto),!ae&&typeof window<"u"&&window.msCrypto&&(ae=window.msCrypto),!ae&&typeof globalThis<"u"&&globalThis.crypto&&(ae=globalThis.crypto),!ae&&typeof commonjsRequire=="function")try{ae=requireCryptoBrowserify()}catch{}var le=function(){if(ae){if(typeof ae.getRandomValues=="function")try{return ae.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof ae.randomBytes=="function")try{return ae.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},he=Object.create||function(){function Pe(){}return function(Ue){var qe;return Pe.prototype=Ue,qe=new Pe,Pe.prototype=null,qe}}(),ye={},me=ye.lib={},xe=me.Base=function(){return{extend:function(Pe){var Ue=he(this);return Pe&&Ue.mixIn(Pe),(!Ue.hasOwnProperty("init")||this.init===Ue.init)&&(Ue.init=function(){Ue.$super.init.apply(this,arguments)}),Ue.init.prototype=Ue,Ue.$super=this,Ue},create:function(){var Pe=this.extend();return Pe.init.apply(Pe,arguments),Pe},init:function(){},mixIn:function(Pe){for(var Ue in Pe)Pe.hasOwnProperty(Ue)&&(this[Ue]=Pe[Ue]);Pe.hasOwnProperty("toString")&&(this.toString=Pe.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),Ee=me.WordArray=xe.extend({init:function(Pe,Ue){Pe=this.words=Pe||[],Ue!=fe?this.sigBytes=Ue:this.sigBytes=Pe.length*4},toString:function(Pe){return(Pe||Me).stringify(this)},concat:function(Pe){var Ue=this.words,qe=Pe.words,He=this.sigBytes,Ve=Pe.sigBytes;if(this.clamp(),He%4)for(var Ye=0;Ye<Ve;Ye++){var Qe=qe[Ye>>>2]>>>24-Ye%4*8&255;Ue[He+Ye>>>2]|=Qe<<24-(He+Ye)%4*8}else for(var Ke=0;Ke<Ve;Ke+=4)Ue[He+Ke>>>2]=qe[Ke>>>2];return this.sigBytes+=Ve,this},clamp:function(){var Pe=this.words,Ue=this.sigBytes;Pe[Ue>>>2]&=4294967295<<32-Ue%4*8,Pe.length=ie.ceil(Ue/4)},clone:function(){var Pe=xe.clone.call(this);return Pe.words=this.words.slice(0),Pe},random:function(Pe){for(var Ue=[],qe=0;qe<Pe;qe+=4)Ue.push(le());return new Ee.init(Ue,Pe)}}),Se=ye.enc={},Me=Se.Hex={stringify:function(Pe){for(var Ue=Pe.words,qe=Pe.sigBytes,He=[],Ve=0;Ve<qe;Ve++){var Ye=Ue[Ve>>>2]>>>24-Ve%4*8&255;He.push((Ye>>>4).toString(16)),He.push((Ye&15).toString(16))}return He.join("")},parse:function(Pe){for(var Ue=Pe.length,qe=[],He=0;He<Ue;He+=2)qe[He>>>3]|=parseInt(Pe.substr(He,2),16)<<24-He%8*4;return new Ee.init(qe,Ue/2)}},Be=Se.Latin1={stringify:function(Pe){for(var Ue=Pe.words,qe=Pe.sigBytes,He=[],Ve=0;Ve<qe;Ve++){var Ye=Ue[Ve>>>2]>>>24-Ve%4*8&255;He.push(String.fromCharCode(Ye))}return He.join("")},parse:function(Pe){for(var Ue=Pe.length,qe=[],He=0;He<Ue;He++)qe[He>>>2]|=(Pe.charCodeAt(He)&255)<<24-He%4*8;return new Ee.init(qe,Ue)}},$e=Se.Utf8={stringify:function(Pe){try{return decodeURIComponent(escape(Be.stringify(Pe)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(Pe){return Be.parse(unescape(encodeURIComponent(Pe)))}},Ce=me.BufferedBlockAlgorithm=xe.extend({reset:function(){this._data=new Ee.init,this._nDataBytes=0},_append:function(Pe){typeof Pe=="string"&&(Pe=$e.parse(Pe)),this._data.concat(Pe),this._nDataBytes+=Pe.sigBytes},_process:function(Pe){var Ue,qe=this._data,He=qe.words,Ve=qe.sigBytes,Ye=this.blockSize,Qe=Ye*4,Ke=Ve/Qe;Pe?Ke=ie.ceil(Ke):Ke=ie.max((Ke|0)-this._minBufferSize,0);var Pt=Ke*Ye,_e=ie.min(Pt*4,Ve);if(Pt){for(var se=0;se<Pt;se+=Ye)this._doProcessBlock(He,se);Ue=He.splice(0,Pt),qe.sigBytes-=_e}return new Ee.init(Ue,_e)},clone:function(){var Pe=xe.clone.call(this);return Pe._data=this._data.clone(),Pe},_minBufferSize:0});me.Hasher=Ce.extend({cfg:xe.extend(),init:function(Pe){this.cfg=this.cfg.extend(Pe),this.reset()},reset:function(){Ce.reset.call(this),this._doReset()},update:function(Pe){return this._append(Pe),this._process(),this},finalize:function(Pe){Pe&&this._append(Pe);var Ue=this._doFinalize();return Ue},blockSize:16,_createHelper:function(Pe){return function(Ue,qe){return new Pe.init(qe).finalize(Ue)}},_createHmacHelper:function(Pe){return function(Ue,qe){return new ke.HMAC.init(Pe,qe).finalize(Ue)}}});var ke=ye.algo={};return ye}(Math);return n})}(core)),core.exports}(function(c,t){(function(n,ie){c.exports=ie(requireCore())})(commonjsGlobal,function(n){return function(ie){var fe=n,ae=fe.lib,le=ae.WordArray,he=ae.Hasher,ye=fe.algo,me=[],xe=[];(function(){function Me(ke){for(var Pe=ie.sqrt(ke),Ue=2;Ue<=Pe;Ue++)if(!(ke%Ue))return!1;return!0}function Be(ke){return(ke-(ke|0))*4294967296|0}for(var $e=2,Ce=0;Ce<64;)Me($e)&&(Ce<8&&(me[Ce]=Be(ie.pow($e,1/2))),xe[Ce]=Be(ie.pow($e,1/3)),Ce++),$e++})();var Ee=[],Se=ye.SHA256=he.extend({_doReset:function(){this._hash=new le.init(me.slice(0))},_doProcessBlock:function(Me,Be){for(var $e=this._hash.words,Ce=$e[0],ke=$e[1],Pe=$e[2],Ue=$e[3],qe=$e[4],He=$e[5],Ve=$e[6],Ye=$e[7],Qe=0;Qe<64;Qe++){if(Qe<16)Ee[Qe]=Me[Be+Qe]|0;else{var Ke=Ee[Qe-15],Pt=(Ke<<25|Ke>>>7)^(Ke<<14|Ke>>>18)^Ke>>>3,_e=Ee[Qe-2],se=(_e<<15|_e>>>17)^(_e<<13|_e>>>19)^_e>>>10;Ee[Qe]=Pt+Ee[Qe-7]+se+Ee[Qe-16]}var ce=qe&He^~qe&Ve,de=Ce&ke^Ce&Pe^ke&Pe,pe=(Ce<<30|Ce>>>2)^(Ce<<19|Ce>>>13)^(Ce<<10|Ce>>>22),ve=(qe<<26|qe>>>6)^(qe<<21|qe>>>11)^(qe<<7|qe>>>25),we=Ye+ve+ce+xe[Qe]+Ee[Qe],Ae=pe+de;Ye=Ve,Ve=He,He=qe,qe=Ue+we|0,Ue=Pe,Pe=ke,ke=Ce,Ce=we+Ae|0}$e[0]=$e[0]+Ce|0,$e[1]=$e[1]+ke|0,$e[2]=$e[2]+Pe|0,$e[3]=$e[3]+Ue|0,$e[4]=$e[4]+qe|0,$e[5]=$e[5]+He|0,$e[6]=$e[6]+Ve|0,$e[7]=$e[7]+Ye|0},_doFinalize:function(){var Me=this._data,Be=Me.words,$e=this._nDataBytes*8,Ce=Me.sigBytes*8;return Be[Ce>>>5]|=128<<24-Ce%32,Be[(Ce+64>>>9<<4)+14]=ie.floor($e/4294967296),Be[(Ce+64>>>9<<4)+15]=$e,Me.sigBytes=Be.length*4,this._process(),this._hash},clone:function(){var Me=he.clone.call(this);return Me._hash=this._hash.clone(),Me}});fe.SHA256=he._createHelper(Se),fe.HmacSHA256=he._createHmacHelper(Se)}(Math),n.SHA256})})(sha256$2);var sha256Exports=sha256$2.exports,sha3={exports:{}},x64Core={exports:{}},hasRequiredX64Core;function requireX64Core(){return hasRequiredX64Core||(hasRequiredX64Core=1,function(c,t){(function(n,ie){c.exports=ie(requireCore())})(commonjsGlobal,function(n){return function(ie){var fe=n,ae=fe.lib,le=ae.Base,he=ae.WordArray,ye=fe.x64={};ye.Word=le.extend({init:function(me,xe){this.high=me,this.low=xe}}),ye.WordArray=le.extend({init:function(me,xe){me=this.words=me||[],xe!=ie?this.sigBytes=xe:this.sigBytes=me.length*8},toX32:function(){for(var me=this.words,xe=me.length,Ee=[],Se=0;Se<xe;Se++){var Me=me[Se];Ee.push(Me.high),Ee.push(Me.low)}return he.create(Ee,this.sigBytes)},clone:function(){for(var me=le.clone.call(this),xe=me.words=this.words.slice(0),Ee=xe.length,Se=0;Se<Ee;Se++)xe[Se]=xe[Se].clone();return me}})}(),n})}(x64Core)),x64Core.exports}(function(c,t){(function(n,ie,fe){c.exports=ie(requireCore(),requireX64Core())})(commonjsGlobal,function(n){return function(ie){var fe=n,ae=fe.lib,le=ae.WordArray,he=ae.Hasher,ye=fe.x64,me=ye.Word,xe=fe.algo,Ee=[],Se=[],Me=[];(function(){for(var Ce=1,ke=0,Pe=0;Pe<24;Pe++){Ee[Ce+5*ke]=(Pe+1)*(Pe+2)/2%64;var Ue=ke%5,qe=(2*Ce+3*ke)%5;Ce=Ue,ke=qe}for(var Ce=0;Ce<5;Ce++)for(var ke=0;ke<5;ke++)Se[Ce+5*ke]=ke+(2*Ce+3*ke)%5*5;for(var He=1,Ve=0;Ve<24;Ve++){for(var Ye=0,Qe=0,Ke=0;Ke<7;Ke++){if(He&1){var Pt=(1<<Ke)-1;Pt<32?Qe^=1<<Pt:Ye^=1<<Pt-32}He&128?He=He<<1^113:He<<=1}Me[Ve]=me.create(Ye,Qe)}})();var Be=[];(function(){for(var Ce=0;Ce<25;Ce++)Be[Ce]=me.create()})();var $e=xe.SHA3=he.extend({cfg:he.cfg.extend({outputLength:512}),_doReset:function(){for(var Ce=this._state=[],ke=0;ke<25;ke++)Ce[ke]=new me.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(Ce,ke){for(var Pe=this._state,Ue=this.blockSize/2,qe=0;qe<Ue;qe++){var He=Ce[ke+2*qe],Ve=Ce[ke+2*qe+1];He=(He<<8|He>>>24)&16711935|(He<<24|He>>>8)&4278255360,Ve=(Ve<<8|Ve>>>24)&16711935|(Ve<<24|Ve>>>8)&4278255360;var Ye=Pe[qe];Ye.high^=Ve,Ye.low^=He}for(var Qe=0;Qe<24;Qe++){for(var Ke=0;Ke<5;Ke++){for(var Pt=0,_e=0,se=0;se<5;se++){var Ye=Pe[Ke+5*se];Pt^=Ye.high,_e^=Ye.low}var ce=Be[Ke];ce.high=Pt,ce.low=_e}for(var Ke=0;Ke<5;Ke++)for(var de=Be[(Ke+4)%5],pe=Be[(Ke+1)%5],ve=pe.high,we=pe.low,Pt=de.high^(ve<<1|we>>>31),_e=de.low^(we<<1|ve>>>31),se=0;se<5;se++){var Ye=Pe[Ke+5*se];Ye.high^=Pt,Ye.low^=_e}for(var Ae=1;Ae<25;Ae++){var Pt,_e,Ye=Pe[Ae],ge=Ye.high,ue=Ye.low,be=Ee[Ae];be<32?(Pt=ge<<be|ue>>>32-be,_e=ue<<be|ge>>>32-be):(Pt=ue<<be-32|ge>>>64-be,_e=ge<<be-32|ue>>>64-be);var Re=Be[Se[Ae]];Re.high=Pt,Re.low=_e}var Ne=Be[0],Fe=Pe[0];Ne.high=Fe.high,Ne.low=Fe.low;for(var Ke=0;Ke<5;Ke++)for(var se=0;se<5;se++){var Ae=Ke+5*se,Ye=Pe[Ae],Ie=Be[Ae],je=Be[(Ke+1)%5+5*se],Te=Be[(Ke+2)%5+5*se];Ye.high=Ie.high^~je.high&Te.high,Ye.low=Ie.low^~je.low&Te.low}var Ye=Pe[0],De=Me[Qe];Ye.high^=De.high,Ye.low^=De.low}},_doFinalize:function(){var Ce=this._data,ke=Ce.words;this._nDataBytes*8;var Pe=Ce.sigBytes*8,Ue=this.blockSize*32;ke[Pe>>>5]|=1<<24-Pe%32,ke[(ie.ceil((Pe+1)/Ue)*Ue>>>5)-1]|=128,Ce.sigBytes=ke.length*4,this._process();for(var qe=this._state,He=this.cfg.outputLength/8,Ve=He/8,Ye=[],Qe=0;Qe<Ve;Qe++){var Ke=qe[Qe],Pt=Ke.high,_e=Ke.low;Pt=(Pt<<8|Pt>>>24)&16711935|(Pt<<24|Pt>>>8)&4278255360,_e=(_e<<8|_e>>>24)&16711935|(_e<<24|_e>>>8)&4278255360,Ye.push(_e),Ye.push(Pt)}return new le.init(Ye,He)},clone:function(){for(var Ce=he.clone.call(this),ke=Ce._state=this._state.slice(0),Pe=0;Pe<25;Pe++)ke[Pe]=ke[Pe].clone();return Ce}});fe.SHA3=he._createHelper($e),fe.HmacSHA3=he._createHmacHelper($e)}(Math),n.SHA3})})(sha3);var sha3Exports=sha3.exports,encHex={exports:{}};(function(c,t){(function(n,ie){c.exports=ie(requireCore())})(commonjsGlobal,function(n){return n.enc.Hex})})(encHex);var encHexExports=encHex.exports,libTypedarrays={exports:{}};(function(c,t){(function(n,ie){c.exports=ie(requireCore())})(commonjsGlobal,function(n){return function(){if(typeof ArrayBuffer=="function"){var ie=n,fe=ie.lib,ae=fe.WordArray,le=ae.init,he=ae.init=function(ye){if(ye instanceof ArrayBuffer&&(ye=new Uint8Array(ye)),(ye instanceof Int8Array||typeof Uint8ClampedArray<"u"&&ye instanceof Uint8ClampedArray||ye instanceof Int16Array||ye instanceof Uint16Array||ye instanceof Int32Array||ye instanceof Uint32Array||ye instanceof Float32Array||ye instanceof Float64Array)&&(ye=new Uint8Array(ye.buffer,ye.byteOffset,ye.byteLength)),ye instanceof Uint8Array){for(var me=ye.byteLength,xe=[],Ee=0;Ee<me;Ee++)xe[Ee>>>2]|=ye[Ee]<<24-Ee%4*8;le.call(this,xe,me)}else le.apply(this,arguments)};he.prototype=ae}}(),n.lib.WordArray})})(libTypedarrays);var libTypedarraysExports=libTypedarrays.exports;(function(c){var t=commonjsGlobal&&commonjsGlobal.__importDefault||function(qe){return qe&&qe.__esModule?qe:{default:qe}};Object.defineProperty(c,"__esModule",{value:!0}),c.getParentDomain=c.labelNameHash=c.splitDomainName=c.fromDecStringToHex=c.fromHexStringToDecimals=c.znsChildhash=c.znsNamehash=c.eip137Childhash=c.eip137Namehash=void 0;var n=t(sha256Exports),ie=t(sha3Exports),fe=t(encHexExports),ae=t(libTypedarraysExports),le=t(bnExports$2),he=sha3Exports$1;function ye(qe){var He=Me(qe,"sha3");return Be(He)}c.eip137Namehash=ye;function me(qe,He){return Se(qe,He,"sha3")}c.eip137Childhash=me;function xe(qe){var He=Me(qe,"sha256");return Be(He)}c.znsNamehash=xe;function Ee(qe,He){return Se(qe,He,"sha256")}c.znsChildhash=Ee;function Se(qe,He,Ve){var Ye=Ve==="sha256"?n.default:ie.default,Qe={outputLength:256},Ke=qe.replace(/^0x/,""),Pt=fe.default.stringify(Ye(He,Qe));return"0x".concat(fe.default.stringify(Ye(fe.default.parse("".concat(Ke).concat(Pt)),Qe)))}function Me(qe,He){if(!qe)return ae.default.create(Array.from(new Uint8Array(8)));var Ve=He==="sha256"?n.default:ie.default,Ye={outputLength:256},Qe=qe.split("."),Ke=Qe[0],Pt=Qe.slice(1),_e=Ve(Ke,Ye),se=Me(Pt.join("."),He);return Ve(se.concat(_e),Ye)}function Be(qe){return"0x".concat(fe.default.stringify(qe))}function $e(qe){if(qe.startsWith("0x")){var He=qe.slice(2,qe.length),Ve=new le.default(He,16);return Ve.toString(10)}return qe}c.fromHexStringToDecimals=$e;function Ce(qe){if(!qe.startsWith("0x")){var He=new le.default(qe,10),Ve=He.toString(16);return"0x".concat(Ve.padStart(64,"0"))}return qe}c.fromDecStringToHex=Ce;var ke=function(qe){var He=qe.split("."),Ve=He[0],Ye=He[1];return He.length-1<2?{label:Ve,tld:Ye}:(Ye=He[-1],Ve=He.slice(0,-1).join("."),{label:Ve,tld:Ye})};c.splitDomainName=ke;var Pe=function(qe){var He=(0,c.splitDomainName)(qe),Ve=(0,he.keccak256)(Buffer$7.from(He.label,"utf8"));return"0x".concat(Ve)};c.labelNameHash=Pe;var Ue=function(qe){var He=qe.split(".");return"".concat(He[-2],".").concat(He[-1])};c.getParentDomain=Ue})(namehash);var NamingService$1={};Object.defineProperty(NamingService$1,"__esModule",{value:!0});NamingService$1.NamingService=void 0;var NamingService=function(){function c(){}return c}();NamingService$1.NamingService=NamingService;var configurationError={};(function(c){var t=commonjsGlobal&&commonjsGlobal.__extends||function(){var le=function(he,ye){return le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(me,xe){me.__proto__=xe}||function(me,xe){for(var Ee in xe)Object.prototype.hasOwnProperty.call(xe,Ee)&&(me[Ee]=xe[Ee])},le(he,ye)};return function(he,ye){if(typeof ye!="function"&&ye!==null)throw new TypeError("Class extends value "+String(ye)+" is not a constructor or null");le(he,ye);function me(){this.constructor=he}he.prototype=ye===null?Object.create(ye):(me.prototype=ye.prototype,new me)}}(),n;Object.defineProperty(c,"__esModule",{value:!0}),c.ConfigurationError=c.ConfigurationErrorCode=void 0;var ie;(function(le){le.IncorrectProvider="IncorrectProvider",le.UnsupportedNetwork="UnsupportedNetwork",le.UnspecifiedUrl="UnspecifiedUrl",le.NetworkConfigMissing="NetworkConfigMissing",le.CustomNetworkConfigMissing="CustomNetworkConfigMissing",le.InvalidConfigurationField="InvalidProxyReader",le.DependencyMissing="DependencyMissing"})(ie=c.ConfigurationErrorCode||(c.ConfigurationErrorCode={}));var fe=(n={},n[ie.IncorrectProvider]=function(){return"Provider doesn't implement sendAsync or send method"},n[ie.UnsupportedNetwork]=function(le){return"Unsupported network in Resolution ".concat(le.method||""," configuration")},n[ie.UnspecifiedUrl]=function(le){return"Unspecified url in Resolution ".concat(le.method," configuration")},n[ie.NetworkConfigMissing]=function(le){return"Missing configuration in Resolution ".concat(le.method,". Please specify ").concat(le.config)},n[ie.CustomNetworkConfigMissing]=function(le){return"Missing configuration in Resolution ".concat(le.method,". Please specify ").concat(le.config," when using a custom network")},n[ie.InvalidConfigurationField]=function(le){return"Invalid '".concat(le.field,"' in Resolution ").concat(le.method)},n[ie.DependencyMissing]=function(le){return"Missing dependency for this functionality. Please install ".concat(le.dependency," @ ").concat(le.version," via npm or yarn")},n),ae=function(le){t(he,le);function he(ye,me){me===void 0&&(me={});var xe=this,Ee=fe[ye];return xe=le.call(this,Ee(me))||this,xe.code=ye,xe.method=me.method,xe.name="ConfigurationError",Object.setPrototypeOf(xe,he.prototype),xe}return he}(Error);c.ConfigurationError=ae,c.default=ae})(configurationError);const version$2="0.2.6",networks$1={1:{contracts:{ENSRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",deploymentBlock:"0x8f221c"},BaseRegistrarImplementation:{address:"0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85",deploymentBlock:"0x8f223a"},ReverseRegistrar:{address:"0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb",deploymentBlock:"0x10243a6"},DummyOracle:{address:"0x0000000000000000000000000000000000000000",deploymentBlock:"0x0"},StablePriceOracle:{address:"0x0000000000000000000000000000000000000000",deploymentBlock:"0x0"},NameWrapper:{address:"0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",deploymentBlock:"0x10243a8"},ETHRegistrarController:{address:"0x253553366Da8546fC250F225fe3d25d0C782303b",deploymentBlock:"0x10243b2"},PublicResolver:{address:"0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63",legacyAddresses:["0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"],deploymentBlock:"0x10243b3"},ProxyAdmin:{address:"0xAA16DA78110D9A9742c760a1a064F28654Ab93de",deploymentBlock:"0xc2fedc"},ENSCustody:{address:"0x27c9B34eB43523447d3e1bcf26f009D814522687",deploymentBlock:"0x010ae8a9",implementation:"0x1FF7fC4473E3CDA0428830a1bc96028A0C12244C",forwarder:"0x27c9B34eB43523447d3e1bcf26f009D814522687"},LegacyENSRegistry:{address:"0x314159265dD8dbb310642f98f50C066173C1259b",deploymentBlock:"0x32c5b9"},LegacyETHRegistrarController:{address:"0x283Af0B28c62C092C9727F1Ee09c02CA627EB7F5",deploymentBlock:"0x8f2277"},DNSRegistrar:{address:"0x58774Bb8acD458A640aF0B88238369A167546ef2",deploymentBlock:"0xc6faf4"},DNSSECImpl:{address:"0x46c6F79952d3046Bf673a28132ff2a81F306959c",deploymentBlock:"0xc6fa9e"},Root:{address:"0xaB528d626EC275E3faD363fF1393A41F581c5897",deploymentBlock:"0x8F22BC"}}},1337:{contracts:{ENSRegistry:{address:"0x50eBEc0b0EAfc732324C1A28963C1FcB7889DA39",deploymentBlock:"0x5e",legacyAddresses:[]},BaseRegistrarImplementation:{address:"0xc86965b7720a64c86263030f7B2902c752084F46",deploymentBlock:"0x5f",legacyAddresses:[]},ReverseRegistrar:{address:"0xdb787398b6595b4F0a8d6072A8AF69774D967f5F",deploymentBlock:"0x60",legacyAddresses:[]},NameWrapper:{address:"0xd70Ab4F5767a8fa0e1e261A2f51189316a7C0d86",deploymentBlock:"0x63",legacyAddresses:[]},DummyOracle:{address:"0x6D264795bBa755974bBBB84Ea5E66eA893BbF606",deploymentBlock:"0x65",legacyAddresses:[]},StablePriceOracle:{address:"0x25D0359804421aDF8E28c3629f611bfD4F04F4fD",deploymentBlock:"0x66",legacyAddresses:[]},ETHRegistrarController:{address:"0x51A944e573DdcA58500583A997F2E46616A15770",deploymentBlock:"0x67",legacyAddresses:[]},PublicResolver:{address:"0xcA8C131DC1f9f62EE54012b10BCA2DA71B8d42e7",deploymentBlock:"0x70",legacyAddresses:["0xb9025e16A304BA1604e4b93e0A5d6cc4C699a772"]},ProxyAdmin:{address:"0x4e44E79e0cEc05D9e62e952B2088c02A3C450aeC",deploymentBlock:"0x36",legacyAddresses:[]},ENSCustody:{address:"0x57b1b0EABC6d5004a227A707625BdCD2257Acd63",deploymentBlock:"0x87",implementation:"0x97e711b69fa03aA2859153FCA5656F213A7b51c3",forwarder:"0x57b1b0EABC6d5004a227A707625BdCD2257Acd63",legacyAddresses:[]},LegacyENSRegistry:{address:"0xDF1eCDd1d075d212f62d77e33f152c2FF8F26D69",deploymentBlock:"0x73",legacyAddresses:[]},LegacyETHRegistrarController:{address:"0x942518378eb0f32aAaB57B9c8176432AcCCdA331",deploymentBlock:"0x68",legacyAddresses:[]},DNSSECImpl:{address:"0x87d45031F0507132474f7b913ba7e1B8A9B222a6",deploymentBlock:"0x7a"},DNSRegistrar:{address:"0x15f5427fbbE5e4c3aA2137C176B7558F5B53265D",deploymentBlock:"0x81"},Root:{address:"0x99127fc7FB6d6ef5eE2d59b9e0F30c8451A0d9ce",deploymentBlock:"0x82"},LegacyPublicResolver:{address:"0x4fbf7B2f171336958BE5D15FF762a5CfF5363568",deploymentBlock:"0x3b"}}},11155111:{contracts:{ENSRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",deploymentBlock:"0x387fc8"},BaseRegistrarImplementation:{address:"0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85",deploymentBlock:"0x387fcb"},ReverseRegistrar:{address:"0xA0a1AbcDAe1a2a4A2EF8e9113Ff0e02DD81DC0C6",deploymentBlock:"0x39d263"},NameWrapper:{address:"0x0635513f179D50A207757E05759CbD106d7dFcE8",deploymentBlock:"0x39d549"},DummyOracle:{address:"0x10E7e7D64d7dA687f7DcF8443Df58A0415329b15",deploymentBlock:"0x39d560"},StablePriceOracle:{address:"0x0000000000000000000000000000000000000000",deploymentBlock:"0x0"},ETHRegistrarController:{address:"0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72",deploymentBlock:"0x39d5a4"},PublicResolver:{address:"0x8FADE66B79cC9f707aB26799354482EB93a5B7dD",legacyAddresses:["0x0CeEC524b2807841739D3B5E161F5bf1430FFA48"],deploymentBlock:"0x39d5ab"},LegacyENSRegistry:{address:"0x94f523b8261B815b87EFfCf4d18E6aBeF18d6e4b",deploymentBlock:"0x387fc1"},LegacyETHRegistrarController:{address:"0x7e02892cfc2Bfd53a75275451d73cF620e793fc0",deploymentBlock:"0x39d575"},DNSRegistrar:{address:"0x5a07C75Ae469Bf3ee2657B588e8E6ABAC6741b4f",deploymentBlock:"0x4c7608"},DNSSECImpl:{address:"0xe62E4b6cE018Ad6e916fcC24545e20a33b9d8653",deploymentBlock:"0x3f3236"},Root:{address:"0xDaaF96c344f63131acadD0Ea35170E7892d3dfBA",deploymentBlock:"0x387fc9"},ProxyAdmin:{address:"0xCbF16B0E2A06916F0Ca4892F704349d13E11cF66",legacyAddresses:[],deploymentBlock:"0x5588B8"},ENSCustody:{address:"0xd2Bf816C7b23fF6e7d141ECC4c1e41DcC857aD45",deploymentBlock:"0x5588b9",implementation:"0x49Ac063337cF2fB26dD421Ab650b893CD54b900F",forwarder:"0xd2Bf816C7b23fF6e7d141ECC4c1e41DcC857aD45"}}}},require$$17={version:version$2,networks:networks$1};var __extends$3=commonjsGlobal&&commonjsGlobal.__extends||function(){var c=function(t,n){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ie,fe){ie.__proto__=fe}||function(ie,fe){for(var ae in fe)Object.prototype.hasOwnProperty.call(fe,ae)&&(ie[ae]=fe[ae])},c(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");c(t,n);function ie(){this.constructor=t}t.prototype=n===null?Object.create(n):(ie.prototype=n.prototype,new ie)}}(),__createBinding$7=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$7=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar$7=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding$7(t,c,n);return __setModuleDefault$7(t,c),t},__awaiter$6=commonjsGlobal&&commonjsGlobal.__awaiter||function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function he(xe){try{me(ie.next(xe))}catch(Ee){le(Ee)}}function ye(xe){try{me(ie.throw(xe))}catch(Ee){le(Ee)}}function me(xe){xe.done?ae(xe.value):fe(xe.value).then(he,ye)}me((ie=ie.apply(c,t||[])).next())})},__generator$6=commonjsGlobal&&commonjsGlobal.__generator||function(c,t){var n={label:0,sent:function(){if(ae[0]&1)throw ae[1];return ae[1]},trys:[],ops:[]},ie,fe,ae,le;return le={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(le[Symbol.iterator]=function(){return this}),le;function he(me){return function(xe){return ye([me,xe])}}function ye(me){if(ie)throw new TypeError("Generator is already executing.");for(;n;)try{if(ie=1,fe&&(ae=me[0]&2?fe.return:me[0]?fe.throw||((ae=fe.return)&&ae.call(fe),0):fe.next)&&!(ae=ae.call(fe,me[1])).done)return ae;switch(fe=0,ae&&(me=[me[0]&2,ae.value]),me[0]){case 0:case 1:ae=me;break;case 4:return n.label++,{value:me[1],done:!1};case 5:n.label++,fe=me[1],me=[0];continue;case 7:me=n.ops.pop(),n.trys.pop();continue;default:if(ae=n.trys,!(ae=ae.length>0&&ae[ae.length-1])&&(me[0]===6||me[0]===2)){n=0;continue}if(me[0]===3&&(!ae||me[1]>ae[0]&&me[1]<ae[3])){n.label=me[1];break}if(me[0]===6&&n.label<ae[1]){n.label=ae[1],ae=me;break}if(ae&&n.label<ae[2]){n.label=ae[2],n.ops.push(me);break}ae[2]&&n.ops.pop(),n.trys.pop();continue}me=t.call(c,n)}catch(xe){me=[6,xe],fe=0}finally{ie=ae=0}if(me[0]&5)throw me[1];return{value:me[0]?me[1]:void 0,done:!0}}},__importDefault$5=commonjsGlobal&&commonjsGlobal.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(Ens$1,"__esModule",{value:!0});var contentHash=__importStar$7(src),bip44_constants_1=__importDefault$5(bip44Constants),address_encoder_1=require$$2$1,ens_1=__importDefault$5(ens),resolver_1=__importDefault$5(resolver),nameWrapper_1=__importDefault$5(nameWrapper),baseRegistrar_1=__importDefault$5(baseRegistrar),reverseRegistrar_1=__importDefault$5(reverseRegistrar),types_1$3=types$3,resolutionError_1$7=resolutionError,EthereumContract_1$1=__importDefault$5(EthereumContract$1),publicTypes_1$5=publicTypes,utils_1$5=utils$d,FetchProvider_1$3=__importDefault$5(FetchProvider$1),namehash_1$6=namehash,NamingService_1$3=NamingService$1,configurationError_1$5=__importStar$7(configurationError),utils_2=utils$d,ens_config_json_1=__importDefault$5(require$$17),Networking_1$3=__importDefault$5(Networking$1),Ens=function(c){__extends$3(t,c);function t(n){var ie=c.call(this)||this;ie.name=publicTypes_1$5.NamingServiceName.ENS;var fe={url:"",network:"mainnet"};n&&(fe=ie.checkNetworkConfig(n)),ie.network=utils_2.EthereumNetworks[fe.network],ie.networkName=fe.network,ie.url=fe.url,ie.provider=fe.provider||FetchProvider_1$3.default.factory(publicTypes_1$5.NamingServiceName.ENS,ie.url),ie.proxyServiceApiKey=fe.proxyServiceApiKey;var ae=fe.registryAddress||ens_config_json_1.default.networks[ie.network].contracts.ENSRegistry.address;ie.registryContract=new EthereumContract_1$1.default(ens_1.default,ae,ie.provider,ie.proxyServiceApiKey);var le=ie.determineNameWrapperAddress(ie.network);ie.nameWrapperContract=new EthereumContract_1$1.default(nameWrapper_1.default,le,ie.provider,ie.proxyServiceApiKey);var he=ie.determineBaseRegistrarAddress(ie.network);return ie.baseRegistrarContract=new EthereumContract_1$1.default(baseRegistrar_1.default,he,ie.provider,ie.proxyServiceApiKey),ie}return t.autoNetwork=function(n){return __awaiter$6(this,void 0,void 0,function(){var ie,fe,ae;return __generator$6(this,function(le){switch(le.label){case 0:if((0,types_1$3.hasProvider)(n))ie=n.provider;else{if(!n.url)throw new configurationError_1$5.default(configurationError_1$5.ConfigurationErrorCode.UnspecifiedUrl,{method:publicTypes_1$5.NamingServiceName.ENS});ie=FetchProvider_1$3.default.factory(publicTypes_1$5.NamingServiceName.ENS,n.url)}return[4,ie.request({method:"net_version"})];case 1:if(fe=le.sent(),ae=utils_1$5.EthereumNetworksInverted[fe],!ae||!types_1$3.EnsSupportedNetwork.guard(ae))throw new configurationError_1$5.default(configurationError_1$5.ConfigurationErrorCode.UnsupportedNetwork,{method:publicTypes_1$5.NamingServiceName.ENS});return[2,new this({network:ae,provider:ie})]}})})},t.prototype.serviceName=function(){return this.name},t.prototype.namehash=function(n){if(!this.checkSupportedDomain(n))throw new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.UnsupportedDomain,{domain:n});return(0,namehash_1$6.eip137Namehash)(n)},t.prototype.childhash=function(n,ie){return(0,namehash_1$6.eip137Childhash)(n,ie)},t.prototype.isSupportedDomain=function(n){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(ie){return[2,this.checkSupportedDomain(n)]})})},t.prototype.owner=function(n){return __awaiter$6(this,void 0,void 0,function(){var ie,fe;return __generator$6(this,function(ae){switch(ae.label){case 0:return ie=this.namehash(n),[4,this.determineIsWrappedDomain(ie)];case 1:return fe=ae.sent(),fe?[4,this.callMethod(this.nameWrapperContract,"ownerOf",[ie])]:[3,3];case 2:return[2,ae.sent()];case 3:return[4,this.callMethod(this.registryContract,"owner",[ie])];case 4:return[2,ae.sent()]}})})},t.prototype.resolver=function(n){return __awaiter$6(this,void 0,void 0,function(){var ie,fe;return __generator$6(this,function(ae){switch(ae.label){case 0:return ie=this.namehash(n),[4,this.callMethod(this.registryContract,"resolver",[ie])];case 1:if(fe=ae.sent(),(0,utils_1$5.isNullAddress)(fe))throw new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.UnspecifiedResolver);return[2,fe]}})})},t.prototype.record=function(n,ie){return __awaiter$6(this,void 0,void 0,function(){var fe;return __generator$6(this,function(ae){switch(ae.label){case 0:return[4,this.getTextRecord(n,ie)];case 1:if(fe=ae.sent(),!fe)throw new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.RecordNotFound,{domain:n,recordName:ie,method:this.name,methodName:"record"});return[2,fe]}})})},t.prototype.records=function(n,ie){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(fe){throw new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.UnsupportedMethod,{methodName:"records",domain:n,method:this.serviceName()})})})},t.prototype.dns=function(n,ie){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(fe){throw new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.UnsupportedMethod,{methodName:"dns",method:this.serviceName(),domain:n})})})},t.prototype.reverse=function(n,ie){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(fe){throw new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.UnsupportedMethod,{methodName:"reverse"})})})},t.prototype.reverseOf=function(n){return __awaiter$6(this,void 0,void 0,function(){var ie,fe,ae,le,he,ye,me,xe;return __generator$6(this,function(Ee){switch(Ee.label){case 0:return ie=n,n.startsWith("0x")&&(n=n.substr(2)),fe=this.determineReverseRegistrarAddress(this.network),ae=new EthereumContract_1$1.default(reverseRegistrar_1.default,fe,this.provider,this.proxyServiceApiKey),[4,this.reverseRegistrarCallToNode(ae,n)];case 1:return le=Ee.sent(),[4,this.callMethod(this.registryContract,"resolver",[le])];case 2:return he=Ee.sent(),(0,utils_1$5.isNullAddress)(he)?[2,null]:(ye=new EthereumContract_1$1.default((0,resolver_1.default)(he,types_1$3.EthCoinIndex),he,this.provider,this.proxyServiceApiKey),[4,this.resolverCallToName(ye,le)]);case 3:return me=Ee.sent(),[4,this.resolverCallToAddr(ye,me)];case 4:return xe=Ee.sent(),(xe==null?void 0:xe.toLowerCase())!==ie.toLowerCase()?[2,null]:[2,me]}})})},t.prototype.getTokenUri=function(n){return __awaiter$6(this,void 0,void 0,function(){var ie,fe,ae;return __generator$6(this,function(le){switch(le.label){case 0:return ie=this.namehash(n),[4,this.determineIsWrappedDomain(ie)];case 1:return fe=le.sent(),fe?[2,"https://metadata.ens.domains/".concat(this.networkName,"/").concat(this.nameWrapperContract.address,"/").concat(ie)]:(ae=(0,namehash_1$6.labelNameHash)(n),[2,"https://metadata.ens.domains/".concat(this.networkName,"/").concat(this.baseRegistrarContract.address,"/").concat(ae)])}})})},t.prototype.isAvailable=function(n){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(ie){switch(ie.label){case 0:return[4,this.isRegistered(n)];case 1:return[2,!ie.sent()]}})})},t.prototype.registryAddress=function(n){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(ie){return[2,this.registryContract.address]})})},t.prototype.isRegistered=function(n){return __awaiter$6(this,void 0,void 0,function(){var ie;return __generator$6(this,function(fe){switch(fe.label){case 0:return[4,this.owner(n)];case 1:return ie=fe.sent(),[2,!(0,utils_1$5.isNullAddress)(ie)]}})})},t.prototype.getDomainFromTokenId=function(n){return __awaiter$6(this,void 0,void 0,function(){var ie,fe,le,ae,le;return __generator$6(this,function(he){switch(he.label){case 0:return ie="",[4,Networking_1$3.default.fetch("https://metadata.ens.domains/".concat(this.networkName,"/").concat(this.nameWrapperContract.address,"/").concat(n))];case 1:return fe=he.sent(),fe.status!==200?[3,3]:[4,fe.json()];case 2:return le=he.sent(),ie=le.name,[2,ie];case 3:return[4,Networking_1$3.default.fetch("https://metadata.ens.domains/".concat(this.networkName,"/").concat(this.baseRegistrarContract.address,"/").concat(n))];case 4:return ae=he.sent(),ae.status!==200?[3,6]:[4,ae.json()];case 5:le=he.sent(),ie=le.name,he.label=6;case 6:return[2,ie]}})})},t.prototype.locations=function(n){return __awaiter$6(this,void 0,void 0,function(){var ie,fe,ae,le,he,ye,me;return __generator$6(this,function(xe){switch(xe.label){case 0:ie={},fe=0,ae=n,xe.label=1;case 1:return fe<ae.length?(le=ae[fe],he=ie,ye=le,me={},[4,this.getResolverContract(le)]):[3,5];case 2:return me.resolverAddress=xe.sent().address,me.registryAddress=this.registryContract.address,me.networkId=this.network,me.blockchain=publicTypes_1$5.BlockchainType.ETH,[4,this.addr(le,publicTypes_1$5.BlockchainType.ETH)];case 3:he[ye]=(me.ownerAddress=xe.sent()||"",me.blockchainProviderUrl=this.url,me),xe.label=4;case 4:return fe++,[3,1];case 5:return[2,ie]}})})},t.prototype.getAddress=function(n,ie,fe){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(ae){throw new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.UnsupportedMethod,{methodName:"getAddress",domain:n,method:this.serviceName()})})})},t.prototype.resolverCallToName=function(n,ie){return this.callMethod(n,"name",[ie])},t.prototype.reverseRegistrarCallToNode=function(n,ie){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(fe){switch(fe.label){case 0:return[4,this.callMethod(n,"node",[ie])];case 1:return[2,fe.sent()]}})})},t.prototype.resolverCallToAddr=function(n,ie){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(fe){switch(fe.label){case 0:return[4,this.callMethod(n,"addr",[this.namehash(ie)])];case 1:return[2,fe.sent()]}})})},t.prototype.twitter=function(n){return __awaiter$6(this,void 0,void 0,function(){var ie;return __generator$6(this,function(fe){switch(fe.label){case 0:return fe.trys.push([0,2,,3]),[4,this.record(n,"com.twitter")];case 1:return[2,fe.sent()];case 2:throw ie=fe.sent(),new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.RecordNotFound,{domain:n,method:this.name,methodName:"twitter",recordName:ie.recordName});case 3:return[2]}})})},t.prototype.allRecords=function(n){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(ie){throw new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.UnsupportedMethod,{domain:n,methodName:"allRecords"})})})},t.prototype.getCoinType=function(n){var ie=bip44_constants_1.default.findIndex(function(fe){return fe[1]===n.toUpperCase()||fe[2]===n.toUpperCase()});if(ie<0||!address_encoder_1.formatsByCoinType[ie])throw new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.UnsupportedCurrency,{currencyTicker:n});return ie.toString()},t.prototype.addr=function(n,ie){return __awaiter$6(this,void 0,void 0,function(){var fe,ae,le;return __generator$6(this,function(he){switch(he.label){case 0:return[4,this.resolver(n).catch(function(ye){if(ye.code!==resolutionError_1$7.ResolutionErrorCode.UnspecifiedResolver)throw ye})];case 1:return fe=he.sent(),fe?[3,3]:[4,this.owner(n)];case 2:throw ae=he.sent(),(0,utils_1$5.isNullAddress)(ae)?new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.UnregisteredDomain,{domain:n}):new resolutionError_1$7.ResolutionError(resolutionError_1$7.ResolutionErrorCode.UnspecifiedResolver,{domain:n});case 3:return le=this.getCoinType(ie.toUpperCase()),[4,this.fetchAddress(fe,n,le)];case 4:return[2,he.sent()]}})})},t.prototype.fetchAddress=function(n,ie,fe){return __awaiter$6(this,void 0,void 0,function(){var ae,le,he,ye,me;return __generator$6(this,function(xe){switch(xe.label){case 0:return ae=new EthereumContract_1$1.default((0,resolver_1.default)(n,fe),n,this.provider,this.proxyServiceApiKey),le=this.namehash(ie),fe===types_1$3.EthCoinIndex?[3,2]:[4,this.callMethod(ae,"addr",[le,fe])];case 1:return ye=xe.sent(),[3,4];case 2:return[4,this.callMethod(ae,"addr",[le])];case 3:ye=xe.sent(),xe.label=4;case 4:return he=ye,(0,utils_1$5.isNullAddress)(he)?[2,void 0]:(me=Buffer$7.from(he.replace("0x",""),"hex"),[2,address_encoder_1.formatsByCoinType[fe].encoder(me)])}})})},t.prototype.getTextRecord=function(n,ie){return __awaiter$6(this,void 0,void 0,function(){var fe,ae,le;return __generator$6(this,function(he){switch(he.label){case 0:return ie!=="contenthash"?[3,2]:[4,this.getContentHash(n)];case 1:return[2,he.sent()];case 2:return fe=this.namehash(n),[4,this.getResolverContract(n)];case 3:return ae=he.sent(),[4,this.callMethod(ae,"text",[fe,ie])];case 4:return le=he.sent(),[2,le]}})})},t.prototype.getContentHash=function(n){return __awaiter$6(this,void 0,void 0,function(){var ie,fe,ae,le;return __generator$6(this,function(he){switch(he.label){case 0:return ie=this.namehash(n),[4,this.getResolverContract(n)];case 1:return fe=he.sent(),[4,this.callMethod(fe,"contenthash",[ie])];case 2:return ae=he.sent(),le=contentHash.getCodec(ae),le!=="ipfs-ns"?[2,void 0]:[2,contentHash.decode(ae)]}})})},t.prototype.getResolverContract=function(n,ie){return __awaiter$6(this,void 0,void 0,function(){var fe;return __generator$6(this,function(ae){switch(ae.label){case 0:return[4,this.resolver(n)];case 1:return fe=ae.sent(),[2,new EthereumContract_1$1.default((0,resolver_1.default)(fe,ie),fe,this.provider,this.proxyServiceApiKey)]}})})},t.prototype.callMethod=function(n,ie,fe){return __awaiter$6(this,void 0,void 0,function(){var ae;return __generator$6(this,function(le){switch(le.label){case 0:return[4,n.call(ie,fe)];case 1:return ae=le.sent(),[2,ae[0]]}})})},t.prototype.checkSupportedDomain=function(n){return n==="eth"||/^([^\s\\.]+\.)+(eth)+$/.test(n)||/^([^\s\\.]+\.)(addr\.)(reverse)$/.test(n)},t.prototype.checkNetworkConfig=function(n){if(!(n!=null&&n.network))throw new configurationError_1$5.default(configurationError_1$5.ConfigurationErrorCode.UnsupportedNetwork,{method:this.name});return types_1$3.EnsSupportedNetwork.guard(n.network)||this.checkCustomNetworkConfig(n),n},t.prototype.checkCustomNetworkConfig=function(n){if(!this.isValidRegistryAddress(n.registryAddress))throw new configurationError_1$5.default(configurationError_1$5.ConfigurationErrorCode.InvalidConfigurationField,{method:this.name,field:"registryAddress"});if(!n.url&&!n.provider)throw new configurationError_1$5.default(configurationError_1$5.ConfigurationErrorCode.CustomNetworkConfigMissing,{method:this.name,config:"url or provider"})},t.prototype.isValidRegistryAddress=function(n){if(!n)throw new configurationError_1$5.default(configurationError_1$5.ConfigurationErrorCode.CustomNetworkConfigMissing,{method:this.name,config:"registryAddress"});var ie=new RegExp("^0x[a-fA-F0-9]{40}$");return ie.test(n)},t.prototype.getAddressForWrappedDomain=function(n){return __awaiter$6(this,void 0,void 0,function(){var ie,fe;return __generator$6(this,function(ae){switch(ae.label){case 0:return[4,this.getOwnerOfFromNameHashContract(n)];case 1:return ie=ae.sent(),[4,this.owner(n)];case 2:return fe=ae.sent(),ie?[2,ie]:fe?[2,fe]:[2]}})})},t.prototype.determineNameWrapperAddress=function(n){return ens_config_json_1.default.networks[n].contracts.NameWrapper.address},t.prototype.determineBaseRegistrarAddress=function(n){return ens_config_json_1.default.networks[n].contracts.BaseRegistrarImplementation.address},t.prototype.determineReverseRegistrarAddress=function(n){return ens_config_json_1.default.networks[n].contracts.ReverseRegistrar.address},t.prototype.determineIsWrappedDomain=function(n){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(ie){switch(ie.label){case 0:return[4,this.callMethod(this.nameWrapperContract,"isWrapped",[n])];case 1:return[2,ie.sent()]}})})},t.prototype.getOwnerOfFromNameHashContract=function(n){return __awaiter$6(this,void 0,void 0,function(){return __generator$6(this,function(ie){switch(ie.label){case 0:return[4,this.callMethod(this.nameWrapperContract,"ownerOf",[this.namehash(n)])];case 1:return[2,ie.sent()]}})})},t}(NamingService_1$3.NamingService);Ens$1.default=Ens;var Zns$1={},znsUtils={};(function(c){var t=commonjsGlobal&&commonjsGlobal.__importDefault||function(He){return He&&He.__esModule?He:{default:He}};Object.defineProperty(c,"__esModule",{value:!0}),c.fromBech32Address=c.toBech32Address=c.toChecksumAddress=void 0;var n=t(bnExports$2),ie=t(sha256Exports),fe=t(encHexExports),ae="qpzry9x8gf2tvdw0s3jn54khce6mua7l",le=[996825010,642813549,513874426,1027748829,705979059],he="zil",ye="tzil";function me(He,Ve){return!!He.replace("0x","").match("^[0-9a-fA-F]{".concat(Ve,"}$"))}function xe(He){return me(He,40)}function Ee(He,Ve,Ye,Qe){Qe===void 0&&(Qe=!0);for(var Ke=0,Pt=0,_e=[],se=(1<<Ye)-1,ce=0;ce<He.length;++ce){var de=He[ce];if(de<0||de>>Ve)return null;for(Ke=Ke<<Ve|de,Pt+=Ve;Pt>=Ye;)Pt-=Ye,_e.push(Ke>>Pt&se)}if(Qe)Pt>0&&_e.push(Ke<<Ye-Pt&se);else if(Pt>=Ve||Ke<<Ye-Pt&se)return null;return Buffer$7.from(_e)}function Se(He){var Ve=[],Ye;for(Ye=0;Ye<He.length;++Ye)Ve.push(He.charCodeAt(Ye)>>5);for(Ve.push(0),Ye=0;Ye<He.length;++Ye)Ve.push(He.charCodeAt(Ye)&31);return Buffer$7.from(Ve)}function Me(He){for(var Ve=1,Ye=0;Ye<He.length;++Ye){var Qe=Ve>>25;Ve=(Ve&33554431)<<5^He[Ye];for(var Ke=0;Ke<5;++Ke)Qe>>Ke&1&&(Ve^=le[Ke])}return Ve}function Be(He,Ve){for(var Ye=Buffer$7.concat([Buffer$7.from(Se(He)),Ve,Buffer$7.from([0,0,0,0,0,0])]),Qe=Me(Ye)^1,Ke=[],Pt=0;Pt<6;++Pt)Ke.push(Qe>>5*(5-Pt)&31);return Buffer$7.from(Ke)}function $e(He,Ve){return Me(Buffer$7.concat([Se(He),Ve]))===1}function Ce(He,Ve){for(var Ye=Buffer$7.concat([Ve,Be(He,Ve)]),Qe=He+"1",Ke=0;Ke<Ye.length;++Ke)Qe+=ae.charAt(Ye[Ke]);return Qe}function ke(He){var Ve,Ye=!1,Qe=!1;for(Ve=0;Ve<He.length;++Ve){if(He.charCodeAt(Ve)<33||He.charCodeAt(Ve)>126)return null;He.charCodeAt(Ve)>=97&&He.charCodeAt(Ve)<=122&&(Ye=!0),He.charCodeAt(Ve)>=65&&He.charCodeAt(Ve)<=90&&(Qe=!0)}if(Ye&&Qe)return null;He=He.toLowerCase();var Ke=He.lastIndexOf("1");if(Ke<1||Ke+7>He.length||He.length>90)return null;var Pt=He.substring(0,Ke),_e=[];for(Ve=Ke+1;Ve<He.length;++Ve){var se=ae.indexOf(He.charAt(Ve));if(se===-1)return null;_e.push(se)}return $e(Pt,Buffer$7.from(_e))?{hrp:Pt,data:Buffer$7.from(_e.slice(0,_e.length-6))}:null}var Pe=function(He){if(!xe(He))throw new Error("".concat(He," is not a valid base 16 address"));He=He.toLowerCase().replace("0x","");for(var Ve=fe.default.stringify((0,ie.default)(fe.default.parse(He))),Ye=new n.default(Ve,"hex","be"),Qe="0x",Ke=0;Ke<He.length;Ke++)"0123456789".indexOf(He[Ke])!==-1?Qe+=He[Ke]:Qe+=Ye.and(new n.default(2).pow(new n.default(255-6*Ke))).gte(new n.default(1))?He[Ke].toUpperCase():He[Ke].toLowerCase();return Qe};c.toChecksumAddress=Pe;function Ue(He,Ve){if(Ve===void 0&&(Ve=!1),!xe(He))throw new Error("Invalid address format.");var Ye=Ee(Buffer$7.from(He.replace("0x",""),"hex"),8,5);if(Ye===null)throw new Error("Could not convert byte Buffer to 5-bit Buffer");return Ce(Ve?ye:he,Ye)}c.toBech32Address=Ue;function qe(He,Ve){Ve===void 0&&(Ve=!1);var Ye=ke(He);if(Ye===null)throw new Error("Invalid bech32 address");var Qe=Ye.hrp,Ke=Ye.data,Pt=Ve?ye:he;if(Qe!==Pt)throw new Error("Expected hrp to be ".concat(Pt," but got ").concat(Qe));var _e=Ee(Ke,5,8,!1);if(_e===null)throw new Error("Could not convert buffer to bytes");return(0,c.toChecksumAddress)(_e.toString("hex"))}c.fromBech32Address=qe})(znsUtils);var __extends$2=commonjsGlobal&&commonjsGlobal.__extends||function(){var c=function(t,n){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ie,fe){ie.__proto__=fe}||function(ie,fe){for(var ae in fe)Object.prototype.hasOwnProperty.call(fe,ae)&&(ie[ae]=fe[ae])},c(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");c(t,n);function ie(){this.constructor=t}t.prototype=n===null?Object.create(n):(ie.prototype=n.prototype,new ie)}}(),__assign$1=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign$1=Object.assign||function(c){for(var t,n=1,ie=arguments.length;n<ie;n++){t=arguments[n];for(var fe in t)Object.prototype.hasOwnProperty.call(t,fe)&&(c[fe]=t[fe])}return c},__assign$1.apply(this,arguments)},__createBinding$6=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$6=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar$6=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding$6(t,c,n);return __setModuleDefault$6(t,c),t},__awaiter$5=commonjsGlobal&&commonjsGlobal.__awaiter||function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function he(xe){try{me(ie.next(xe))}catch(Ee){le(Ee)}}function ye(xe){try{me(ie.throw(xe))}catch(Ee){le(Ee)}}function me(xe){xe.done?ae(xe.value):fe(xe.value).then(he,ye)}me((ie=ie.apply(c,t||[])).next())})},__generator$5=commonjsGlobal&&commonjsGlobal.__generator||function(c,t){var n={label:0,sent:function(){if(ae[0]&1)throw ae[1];return ae[1]},trys:[],ops:[]},ie,fe,ae,le;return le={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(le[Symbol.iterator]=function(){return this}),le;function he(me){return function(xe){return ye([me,xe])}}function ye(me){if(ie)throw new TypeError("Generator is already executing.");for(;n;)try{if(ie=1,fe&&(ae=me[0]&2?fe.return:me[0]?fe.throw||((ae=fe.return)&&ae.call(fe),0):fe.next)&&!(ae=ae.call(fe,me[1])).done)return ae;switch(fe=0,ae&&(me=[me[0]&2,ae.value]),me[0]){case 0:case 1:ae=me;break;case 4:return n.label++,{value:me[1],done:!1};case 5:n.label++,fe=me[1],me=[0];continue;case 7:me=n.ops.pop(),n.trys.pop();continue;default:if(ae=n.trys,!(ae=ae.length>0&&ae[ae.length-1])&&(me[0]===6||me[0]===2)){n=0;continue}if(me[0]===3&&(!ae||me[1]>ae[0]&&me[1]<ae[3])){n.label=me[1];break}if(me[0]===6&&n.label<ae[1]){n.label=ae[1],ae=me;break}if(ae&&n.label<ae[2]){n.label=ae[2],n.ops.push(me);break}ae[2]&&n.ops.pop(),n.trys.pop();continue}me=t.call(c,n)}catch(xe){me=[6,xe],fe=0}finally{ie=ae=0}if(me[0]&5)throw me[1];return{value:me[0]?me[1]:void 0,done:!0}}},__importDefault$4=commonjsGlobal&&commonjsGlobal.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(Zns$1,"__esModule",{value:!0});var znsUtils_1$1=znsUtils,utils_1$4=utils$d,types_1$2=types$3,resolutionError_1$6=resolutionError,publicTypes_1$4=publicTypes,FetchProvider_1$2=__importDefault$4(FetchProvider$1),namehash_1$5=namehash,NamingService_1$2=NamingService$1,configurationError_1$4=__importStar$6(configurationError),Zns=function(c){__extends$2(t,c);function t(n){n===void 0&&(n={url:t.UrlMap[1],network:"mainnet"});var ie=c.call(this)||this;return ie.name=publicTypes_1$4.NamingServiceName.ZNS,ie.checkNetworkConfig(n),ie.network=t.NetworkNameMap[n.network],ie.url=n.url||t.UrlMap[ie.network],ie.provider=n.provider||new FetchProvider_1$2.default(ie.name,ie.url),ie.registryAddr=n.registryAddress||t.RegistryMap[ie.network],ie.checkRegistryAddress(ie.registryAddr),ie.registryAddr.startsWith("0x")&&(ie.registryAddr=(0,znsUtils_1$1.toBech32Address)(ie.registryAddr)),ie}return t.prototype.owner=function(n){return __awaiter$5(this,void 0,void 0,function(){var ie,fe;return __generator$5(this,function(ae){switch(ae.label){case 0:return[4,this.getRecordsAddresses(n)];case 1:if(ie=ae.sent(),!ie)throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnregisteredDomain,{domain:n});if(fe=ie[0],!fe)throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnregisteredDomain,{domain:n});return[2,fe]}})})},t.prototype.resolver=function(n){return __awaiter$5(this,void 0,void 0,function(){var ie,fe;return __generator$5(this,function(ae){switch(ae.label){case 0:return[4,this.getRecordsAddresses(n)];case 1:if(ie=ae.sent(),!ie||!ie[0])throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnregisteredDomain,{domain:n});if(fe=ie[1],(0,utils_1$4.isNullAddress)(fe))throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnspecifiedResolver,{domain:n});return[2,fe]}})})},t.prototype.namehash=function(n){if(!this.checkDomain(n))throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnsupportedDomain,{domain:n});return(0,namehash_1$5.znsNamehash)(n)},t.prototype.childhash=function(n,ie){return(0,namehash_1$5.znsChildhash)(n,ie)},t.prototype.isSupportedDomain=function(n){return __awaiter$5(this,void 0,void 0,function(){return __generator$5(this,function(ie){return[2,this.checkDomain(n)]})})},t.prototype.record=function(n,ie){return __awaiter$5(this,void 0,void 0,function(){var fe,ae;return __generator$5(this,function(le){switch(le.label){case 0:return[4,this.records(n,[ie])];case 1:if(fe=le.sent(),ae=fe[ie],!ae)throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.RecordNotFound,{domain:n,recordName:ie});return[2,ae]}})})},t.prototype.getAddress=function(n,ie,fe){return __awaiter$5(this,void 0,void 0,function(){return __generator$5(this,function(ae){throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnsupportedMethod,{methodName:"isSupportedDomain"})})})},t.prototype.records=function(n,ie){return __awaiter$5(this,void 0,void 0,function(){var fe;return __generator$5(this,function(ae){switch(ae.label){case 0:return[4,this.allRecords(n)];case 1:return fe=ae.sent(),[2,(0,utils_1$4.constructRecords)(ie,fe)]}})})},t.prototype.allRecords=function(n){return __awaiter$5(this,void 0,void 0,function(){var ie;return __generator$5(this,function(fe){switch(fe.label){case 0:return[4,this.resolver(n)];case 1:return ie=fe.sent(),[2,this.getResolverRecords(ie)]}})})},t.prototype.twitter=function(n){return __awaiter$5(this,void 0,void 0,function(){return __generator$5(this,function(ie){throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnsupportedMethod,{domain:n,methodName:"twitter"})})})},t.prototype.reverse=function(n,ie){return __awaiter$5(this,void 0,void 0,function(){return __generator$5(this,function(fe){throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnsupportedMethod,{methodName:"reverse"})})})},t.prototype.reverseOf=function(n,ie){return __awaiter$5(this,void 0,void 0,function(){return __generator$5(this,function(fe){throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnsupportedMethod,{methodName:"reverseOf"})})})},t.prototype.isRegistered=function(n){return __awaiter$5(this,void 0,void 0,function(){var ie;return __generator$5(this,function(fe){switch(fe.label){case 0:return[4,this.getRecordsAddresses(n)];case 1:return ie=fe.sent(),[2,!!(ie&&ie[0])]}})})},t.prototype.getTokenUri=function(n){return __awaiter$5(this,void 0,void 0,function(){return __generator$5(this,function(ie){throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnsupportedMethod,{methodName:"getTokenUri"})})})},t.prototype.getDomainFromTokenId=function(n){return __awaiter$5(this,void 0,void 0,function(){return __generator$5(this,function(ie){throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnsupportedMethod,{methodName:"getDomainFromTokenId"})})})},t.prototype.isAvailable=function(n){return __awaiter$5(this,void 0,void 0,function(){return __generator$5(this,function(ie){switch(ie.label){case 0:return[4,this.isRegistered(n)];case 1:return[2,!ie.sent()]}})})},t.prototype.registryAddress=function(n){return __awaiter$5(this,void 0,void 0,function(){return __generator$5(this,function(ie){return[2,this.registryAddr]})})},t.prototype.locations=function(n){return __awaiter$5(this,void 0,void 0,function(){var ie,fe=this;return __generator$5(this,function(ae){switch(ae.label){case 0:return[4,Promise.all(n.map(function(le){return fe.getRecordsAddresses(le)}))];case 1:return ie=ae.sent(),[2,n.reduce(function(le,he,ye){var me,xe=null,Ee=ie[ye];if(Ee){var Se=Ee[0],Me=Ee[1];xe={registryAddress:fe.registryAddr,resolverAddress:Me,networkId:fe.network,blockchain:publicTypes_1$4.BlockchainType.ZIL,ownerAddress:Se,blockchainProviderUrl:fe.url}}return __assign$1(__assign$1({},le),(me={},me[he]=xe,me))},{})]}})})},t.prototype.getRecordsAddresses=function(n){return __awaiter$5(this,void 0,void 0,function(){var ie,fe,ae,le;return __generator$5(this,function(he){switch(he.label){case 0:if(!this.isSupportedDomain(n))throw new resolutionError_1$6.ResolutionError(resolutionError_1$6.ResolutionErrorCode.UnsupportedDomain,{domain:n});return[4,this.getContractMapValue(this.registryAddr,"records",this.namehash(n))];case 1:return ie=he.sent(),ie?(fe=ie.arguments,ae=fe[0],le=fe[1],[2,[ae.startsWith("0x")?(0,znsUtils_1$1.toBech32Address)(ae):ae,le]]):[2,void 0]}})})},t.prototype.getResolverRecords=function(n){return __awaiter$5(this,void 0,void 0,function(){var ie;return __generator$5(this,function(fe){switch(fe.label){case 0:return(0,utils_1$4.isNullAddress)(n)?[2,{}]:(ie=(0,znsUtils_1$1.toChecksumAddress)(n),[4,this.getContractField(ie,"records")]);case 1:return[2,fe.sent()||{}]}})})},t.prototype.fetchSubState=function(n,ie,fe){return fe===void 0&&(fe=[]),__awaiter$5(this,void 0,void 0,function(){var ae,le;return __generator$5(this,function(he){return ae=[n.replace("0x",""),ie,fe],le="GetSmartContractSubState",[2,this.provider.request({method:le,params:ae})]})})},t.prototype.getContractField=function(n,ie,fe){return fe===void 0&&(fe=[]),__awaiter$5(this,void 0,void 0,function(){var ae,le;return __generator$5(this,function(he){switch(he.label){case 0:return ae=n.startsWith("zil1")?(0,znsUtils_1$1.fromBech32Address)(n):n,[4,this.fetchSubState(ae,ie,fe)];case 1:return le=he.sent()||{},[2,le[ie]]}})})},t.prototype.getContractMapValue=function(n,ie,fe){return __awaiter$5(this,void 0,void 0,function(){var ae;return __generator$5(this,function(le){switch(le.label){case 0:return[4,this.getContractField(n,ie,[fe])];case 1:return ae=le.sent(),[2,ae&&ae[fe]||null]}})})},t.prototype.checkDomain=function(n){var ie=n.split(".");return!!ie.length&&ie[ie.length-1]==="zil"&&ie.every(function(fe){return!!fe.length})},t.prototype.checkNetworkConfig=function(n){if(!n.network)throw new configurationError_1$4.default(configurationError_1$4.ConfigurationErrorCode.UnsupportedNetwork,{method:publicTypes_1$4.NamingServiceName.ZNS});types_1$2.ZnsSupportedNetwork.guard(n.network)||this.checkCustomNetworkConfig(n)},t.prototype.checkRegistryAddress=function(n){var ie=new RegExp("^0x[a-fA-F0-9]{40}$|^zil1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38}$");if(!ie.test(n))throw new configurationError_1$4.default(configurationError_1$4.ConfigurationErrorCode.InvalidConfigurationField,{method:this.name,field:"registryAddress"})},t.prototype.checkCustomNetworkConfig=function(n){if(!n.registryAddress)throw new configurationError_1$4.default(configurationError_1$4.ConfigurationErrorCode.CustomNetworkConfigMissing,{method:publicTypes_1$4.NamingServiceName.ZNS,config:"registryAddress"});if(!n.url&&!n.provider)throw new configurationError_1$4.default(configurationError_1$4.ConfigurationErrorCode.CustomNetworkConfigMissing,{method:publicTypes_1$4.NamingServiceName.ZNS,config:"url or provider"})},t.UrlMap={1:"https://api.zilliqa.com",333:"https://dev-api.zilliqa.com",111:"http://localhost:4201"},t.NetworkNameMap={mainnet:1,testnet:333,localnet:111},t.RegistryMap={1:"zil1jcgu2wlx6xejqk9jw3aaankw6lsjzeunx2j0jz",333:"zil1hyj6m5w4atcn7s806s69r0uh5g4t84e8gp6nps"},t}(NamingService_1$2.NamingService);Zns$1.default=Zns;var Uns$1={},TwitterSignatureValidator={},recoverSignature={};(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.recover=c.hashMessage=void 0;var t=sha3Exports$1,n=utils$d,ie=requireElliptic(),fe=new ie.ec("secp256k1"),ae=function(Se){return(Se.length-2)/2},le=function(Se,Me,Be){return"0x"+Be.slice(Se*2+2,Me*2+2)},he=function(Se){return parseInt(Se.slice(2),16)},ye=function(Se){return[le(64,ae(Se),Se),le(0,32,Se),le(32,64,Se)]},me=function(Se){for(var Me=(0,t.keccak256)(Se.slice(2)),Be="0x",$e=0;$e<40;$e++)Be+=parseInt(Me[$e+2],16)>7?Se[$e+2].toUpperCase():Se[$e+2];return Be},xe=function(Se){var Me=(0,n.hexToBytes)(Buffer$7.from(Se,"utf8").toString("hex")),Be=Buffer$7.from(Me),$e=`Ethereum Signed Message:
|
|
47
47
|
`+Me.length,Ce=Buffer$7.from($e),ke=Buffer$7.concat([Ce,Be]);return"0x"+(0,t.keccak256)(ke.toString())};c.hashMessage=xe;var Ee=function(Se,Me){var Be=(0,c.hashMessage)(Se),$e=ye(Me),Ce={v:he($e[0]),r:$e[1].slice(2),s:$e[2].slice(2)},ke=fe.recoverPubKey(Buffer$7.from(Be.slice(2),"hex"),Ce,Ce.v<2?Ce.v:1-Ce.v%2),Pe="0x"+ke.encode("hex",!1).slice(2),Ue="0x"+(0,t.keccak256)((0,n.hexToBytes)(Pe));return me("0x"+Ue.slice(-40))};c.recover=Ee})(recoverSignature);Object.defineProperty(TwitterSignatureValidator,"__esModule",{value:!0});TwitterSignatureValidator.isValidTwitterSignature=void 0;var index_1=utils$d,js_sha3_1=sha3Exports$1,recoverSignature_1=recoverSignature,namehash_1$4=namehash,TwitterVerificationAddress="0x12cfb13522F13a78b650a8bCbFCf50b7CB899d82",isValidTwitterSignature=function(c){var t=c.tokenId,n=c.owner,ie=c.twitterHandle,fe=c.validationSignature,ae=(0,namehash_1$4.fromHexStringToDecimals)(t),le=[ae,n,"social.twitter.username",ie].map(function(ye){return"0x"+(0,js_sha3_1.keccak256)(ye.startsWith("0x")?(0,index_1.hexToBytes)(ye):ye)}).reduce(function(ye,me){return ye+me},""),he=(0,recoverSignature_1.recover)(le,fe);return he===TwitterVerificationAddress};TwitterSignatureValidator.isValidTwitterSignature=isValidTwitterSignature;var UnsInternal$1={},proxyReader={};Object.defineProperty(proxyReader,"__esModule",{value:!0});proxyReader.default=[{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"tokenKey",type:"string"}],name:"SetLegacyRecords",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"network",type:"string"}],name:"SetNetworkFamily",type:"event"},{inputs:[],name:"NAME",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string[]",name:"networks",type:"string[]"},{internalType:"string[]",name:"families",type:"string[]"}],name:"addBlockchainNetworks",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string[]",name:"networks",type:"string[]"},{internalType:"string",name:"family",type:"string"}],name:"addBlockchainNetworks",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string[]",name:"keys",type:"string[]"},{internalType:"string[][]",name:"legacyKeys",type:"string[][]"}],name:"addLegacyRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"exists",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"key",type:"string"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"get",outputs:[{internalType:"string",name:"value",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"network",type:"string"},{internalType:"string",name:"token",type:"string"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getAddress",outputs:[{internalType:"string",name:"addr",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"network",type:"string"},{internalType:"string",name:"token",type:"string"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getAddressKey",outputs:[{internalType:"string",name:"key",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"network",type:"string"},{internalType:"string",name:"token",type:"string"}],name:"getAddressKeys",outputs:[{internalType:"string[]",name:"keys",type:"string[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"keyHash",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getByHash",outputs:[{internalType:"string",name:"key",type:"string"},{internalType:"string",name:"value",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string[]",name:"keys",type:"string[]"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getData",outputs:[{internalType:"address",name:"resolver",type:"address"},{internalType:"address",name:"owner",type:"address"},{internalType:"string[]",name:"values",type:"string[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256[]",name:"keyHashes",type:"uint256[]"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getDataByHash",outputs:[{internalType:"address",name:"resolver",type:"address"},{internalType:"address",name:"owner",type:"address"},{internalType:"string[]",name:"keys",type:"string[]"},{internalType:"string[]",name:"values",type:"string[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256[]",name:"keyHashes",type:"uint256[]"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],name:"getDataByHashForMany",outputs:[{internalType:"address[]",name:"resolvers",type:"address[]"},{internalType:"address[]",name:"owners",type:"address[]"},{internalType:"string[][]",name:"keys",type:"string[][]"},{internalType:"string[][]",name:"values",type:"string[][]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string[]",name:"keys",type:"string[]"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],name:"getDataForMany",outputs:[{internalType:"address[]",name:"resolvers",type:"address[]"},{internalType:"address[]",name:"owners",type:"address[]"},{internalType:"string[][]",name:"values",type:"string[][]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string[]",name:"keys",type:"string[]"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getMany",outputs:[{internalType:"string[]",name:"values",type:"string[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256[]",name:"keyHashes",type:"uint256[]"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getManyByHash",outputs:[{internalType:"string[]",name:"keys",type:"string[]"},{internalType:"string[]",name:"values",type:"string[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IUNSRegistry",name:"unsRegistry",type:"address"},{internalType:"contract ICNSRegistry",name:"cnsRegistry",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"isApprovedOrOwner",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string[]",name:"labels",type:"string[]"}],name:"namehash",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],name:"ownerOfForMany",outputs:[{internalType:"address[]",name:"owners",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"registryOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"resolverOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"reverseNameOf",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"reverseOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"setOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];const version$1="0.9.11",networks={1:{contracts:{UNSRegistry:{address:"0x049aba7510f45BA5b64ea9E658E342F904DB358D",implementation:"0xCd451149ffa9d059030528917842bcE14327DfD6",legacyAddresses:[],deploymentBlock:"0xc2fede",forwarder:"0x049aba7510f45BA5b64ea9E658E342F904DB358D"},CNSRegistry:{address:"0xD1E5b0FF1287aA9f9A268759062E4Ab08b9Dacbe",legacyAddresses:[],deploymentBlock:"0x8a958b",forwarder:"0x97B0E89fC1B7eD4A8B237D9d8Fcce9b234f25A37"},MintingManager:{address:"0x2a7084870bB724175a3C96Da8FaA55128fa3E19D",implementation:"0xc2729efaBe5746C0875AE8969ce386a02A19fB13",legacyAddresses:[],deploymentBlock:"0xc2fee0",forwarder:"0xb970fbCF52cd8111c76c379D4f2FE12E7f8AE7fb"},UNSOperator:{address:"0x28400c6e89f11a99fD7145a24d39c19f949Ab86e",implementation:"0x4f78Db4b434128a45C6236bd61dFf2258637cd7f",legacyAddresses:[],deploymentBlock:"0xfdd3a7"},ProxyAdmin:{address:"0xAA16DA78110D9A9742c760a1a064F28654Ab93de",legacyAddresses:[],deploymentBlock:"0xc2fedc"},SignatureController:{address:"0x82EF94294C95aD0930055f31e53A34509227c5f7",legacyAddresses:[],deploymentBlock:"0x8a95a6"},MintingController:{address:"0xb0EE56339C3253361730F50c08d3d7817ecD60Ca",legacyAddresses:[],deploymentBlock:"0x8a95aa",deprecated:!0},WhitelistedMinter:{address:"0xd3fF3377b0ceade1303dAF9Db04068ef8a650757",legacyAddresses:[],deploymentBlock:"0xa76ad3",deprecated:!0},URIPrefixController:{address:"0x09B091492759737C03da9dB7eDF1CD6BCC3A9d91",legacyAddresses:[],deploymentBlock:"0x8a95ae",deprecated:!0},DomainZoneController:{address:"0xeA70777e28E00E81f58b8921fC47F78B8a72eFE7",legacyAddresses:[],deploymentBlock:"0x98ca20",deprecated:!0},Resolver:{address:"0xb66DcE2DA6afAAa98F2013446dBCB0f4B0ab2842",legacyAddresses:["0xa1cac442be6673c49f8e74ffc7c4fd746f3cbd0d","0x878bc2f3f717766ab69c0a5f9a6144931e61aed3"],deploymentBlock:"0x960844",forwarder:"0x486eb10E4F48C038513ECAf11585Ca2779768CF2"},ProxyReader:{address:"0x578853aa776Eef10CeE6c4dd2B5862bdcE767A8B",implementation:"0xF83b08F90C1d5eEf255E8DB50b3Ab158A37a9AD4",legacyAddresses:["0x6E68f3EaAD2CC946C6CC7f4859251d8D70Dd3EDB","0x1BDc0fD4fbABeed3E611fd6195fCd5d41dcEF393","0x58034A288D2E56B661c9056A0C27273E5460B63c","0xc3C2BAB5e3e52DBF311b2aAcEf2e40344f19494E","0xfEe4D4F0aDFF8D84c12170306507554bC7045878","0xa6E7cEf2EDDEA66352Fd68E5915b60BDbb7309f5","0x7ea9Ee21077F84339eDa9C80048ec6db678642B1"],deploymentBlock:"0xf2f03c"},TwitterValidationOperator:{address:"0x2F659766E3D08561CA3408FbAba7C0749ab2c402",legacyAddresses:["0xbb486C6E9cF1faA86a6E3eAAFE2e5665C0507855"],deploymentBlock:"0xc300b5"},FreeMinter:{address:"0x1fC985cAc641ED5846b631f96F35d9b48Bc3b834",legacyAddresses:[],deploymentBlock:"0xacc390",deprecated:!0},MintableERC721Predicate:{address:"0x932532aA4c0174b8453839A6E44eE09Cc615F2b7",legacyAddresses:[],deploymentBlock:"0xa3cf69"},RootChainManager:{address:"0xA0c68C638235ee32657e8f720a23ceC1bFc77C77",legacyAddresses:[],deploymentBlock:"0xa3cf4d"},DotCoinBurner:{address:"0x65c6abdf52aD08A53A77488D1Acc5c666ada840F",legacyAddresses:[],deploymentBlock:"0xf335e0"},ZilliqaRecover:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},Seaport:{address:"0x0000000000000068F116a894984e2DB1123eB395",deploymentBlock:"0x0"},SeaportProxyBuyer:{address:"0x0000000000000000000000000000000000000000",deploymentBlock:"0x0",implementation:"0x0000000000000000000000000000000000000000",forwarder:"0x0000000000000000000000000000000000000000"},USDC:{address:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",deploymentBlock:"0x0"},L1GasPriceOracle:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"}}},137:{contracts:{UNSRegistry:{address:"0xa9a6A3626993D487d2Dbda3173cf58cA1a9D9e9f",implementation:"0x11227E54F19934164A81d5aDd1ce5825D46B2271",legacyAddresses:[],deploymentBlock:"0x01272eb5",forwarder:"0xa9a6A3626993D487d2Dbda3173cf58cA1a9D9e9f"},CNSRegistry:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",forwarder:"0x0000000000000000000000000000000000000000"},MintingManager:{address:"0x7be83293BeeDc9Eba1bd76c66A65F10F3efaeC26",implementation:"0x8Efbe119357753c5d12f078AC081E37a5AFACf33",legacyAddresses:[],deploymentBlock:"0x01272f41",forwarder:"0xC37d3c4326ab0E1D2b9D8b916bBdf5715f780fcF"},UNSOperator:{address:"0x8f0c61C9BD21d3a5c078FB03eCA01AE2Ff5380dB",implementation:"0xbB101ae4B5Df5F9375112D38D9f5a3394916EA97",legacyAddresses:[],deploymentBlock:"0x025809c0"},ProxyAdmin:{address:"0xe1D668052D52388F52b90f4d1798DB2b04bC3b88",legacyAddresses:[],deploymentBlock:"0x01272d15"},SignatureController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},MintingController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},WhitelistedMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},URIPrefixController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},DomainZoneController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},Resolver:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",forwarder:"0x0000000000000000000000000000000000000000"},ProxyReader:{address:"0x91EDd8708062bd4233f4Dd0FCE15A7cb4d500091",implementation:"0x989730eAe394d0415eaB088e0C1d83aCD40A66A1",legacyAddresses:["0x68Af8fFFCdC6218836C62Bc2Fd2D35dA544471dD","0x3E67b8c702a1292d1CEb025494C84367fcb12b45","0x423F2531bd5d3C3D4EF7C318c2D1d9BEDE67c680","0xA3f32c8cd786dc089Bd1fC175F2707223aeE5d00"],deploymentBlock:"0x021b1c05"},TwitterValidationOperator:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},FreeMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},MintableERC721Predicate:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},RootChainManager:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},DotCoinBurner:{address:"0x65c6abdf52aD08A53A77488D1Acc5c666ada840F",legacyAddresses:[],deploymentBlock:"0x021cac00"},ZilliqaRecover:{address:"0x07B58C81f160257BCb3a2d549ea02D36E3e70461",legacyAddresses:[],deploymentBlock:"0x032b35a6",implementation:"0x50752EcBedBb07543C4191E2492e2e888a7D04bD",forwarder:"0x07B58C81f160257BCb3a2d549ea02D36E3e70461"},Seaport:{address:"0x0000000000000068F116a894984e2DB1123eB395",deploymentBlock:"0x0"},SeaportProxyBuyer:{address:"0x8b031F472F7f90ac1fAE1616Ddf1283CDDe084bF",deploymentBlock:"0x037b22db",implementation:"0x53B01e32807127D3c2Fb6eA1A3b268753183Ed68",forwarder:"0x8b031F472F7f90ac1fAE1616Ddf1283CDDe084bF"},USDC:{address:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",deploymentBlock:"0x0"},L1GasPriceOracle:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"}}},1337:{contracts:{UNSRegistry:{address:"0x107733feD96C4Cd390c944a31F5425A7FB98Ae5e",implementation:"0x62b11ad5F582a5C5d378fB310125b030042554F1",legacyAddresses:[],deploymentBlock:"0x15",forwarder:"0x107733feD96C4Cd390c944a31F5425A7FB98Ae5e"},CNSRegistry:{address:"0xC58206842E4030a3B2CaBC78780Ae7635173C533",legacyAddresses:[],deploymentBlock:"0x01",forwarder:"0xAc52F68f31577E44aE0C7E95A42dC9eb574B9383"},MintingManager:{address:"0x39a27956B78d00a4E00EA8833Ff0947410A2933F",implementation:"0x229C56b7805aB5935a883207F6a6bD5847E65Aee",legacyAddresses:[],deploymentBlock:"0x17",forwarder:"0x7c3c91245769c8B7450aD522792deC4bd4bf797f"},UNSOperator:{address:"0xCE4bb7Dc1Eb9DCe75743dE6a4B48534fD427Ef51",legacyAddresses:[],deploymentBlock:"0x19",implementation:"0xe85541865Bbb62A05064ce5C9F41cC293A8eA996"},ProxyAdmin:{address:"0x4e44E79e0cEc05D9e62e952B2088c02A3C450aeC",legacyAddresses:[],deploymentBlock:"0x01"},SignatureController:{address:"0x7bB6Cd9be29fab783c0b494A06FED8b2E2596B7a",legacyAddresses:[],deploymentBlock:"0x02"},MintingController:{address:"0x4a3C194eB88966178bfDD81744ddDafED611B830",legacyAddresses:[],deploymentBlock:"0x03",deprecated:!0},WhitelistedMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},URIPrefixController:{address:"0x4872CC1be60A9DB9c880A0A437Da7a6AF134F08f",legacyAddresses:[],deploymentBlock:"0x04",deprecated:!0},DomainZoneController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},Resolver:{address:"0xF8C26340C1eAeA6c7fF1760B25005e1306953572",legacyAddresses:[],deploymentBlock:"0x08",forwarder:"0x11dD97b7Ca847DfB6504e61B7B9Eb30F55E554a0"},ProxyReader:{address:"0xcd12F3f3faae97679a844aA184c0589ea8176656",implementation:"0x0930ffb2c192B0C9A9dd2372Cf7f2845ef39CBb6",legacyAddresses:[],deploymentBlock:"0x23"},TwitterValidationOperator:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},FreeMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},MintableERC721Predicate:{address:"0x58a175BEbc8ec21A94ea63Aa5a28743945940EE6",legacyAddresses:[],deploymentBlock:"0x0d"},RootChainManager:{address:"0x27935e7e85db3c4e7885eB828B9e889BA69a4e7f",legacyAddresses:[],deploymentBlock:"0x0f"},DotCoinBurner:{address:"0x951c830a0471C04DCB60Ce244DEe38eE4b0609ec",legacyAddresses:[],deploymentBlock:"0x5c"},ZilliqaRecover:{address:"0xDD622cF8306F18d736705e4Cc03f7FF83A899FD0",deploymentBlock:"0x2e",implementation:"0xf6b7c221342BC966f4396790895530bF4E9799eB",legacyAddresses:[],forwarder:"0xDD622cF8306F18d736705e4Cc03f7FF83A899FD0"},Seaport:{address:"0x5CC819C9915eADfcEBd76952B8C1BC36CADd7376",deploymentBlock:"0x1f"},SeaportProxyBuyer:{address:"0x7e76aE49D6F4c6158757693b050BF88f039DeA21",deploymentBlock:"0x29",implementation:"0x24F45688D421f46cca60734BdC648ad192dB0f2E",forwarder:"0x7e76aE49D6F4c6158757693b050BF88f039DeA21"},USDC:{address:"0xbE92182CAB5b84Fd18b34881A0c32771e84f5b8B",deploymentBlock:"0x21",implementation:"0xDa9E1b3e395bFb0A45F03C7F615146B9d896c959",forwarder:"0xbE92182CAB5b84Fd18b34881A0c32771e84f5b8B"},L1GasPriceOracle:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"}}},8453:{contracts:{CNSRegistry:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",forwarder:"0x0000000000000000000000000000000000000000"},SignatureController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},MintingController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},WhitelistedMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},URIPrefixController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},DomainZoneController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},Resolver:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",forwarder:"0x0000000000000000000000000000000000000000"},TwitterValidationOperator:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},FreeMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},MintableERC721Predicate:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},RootChainManager:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},Seaport:{address:"0x0000000000000068F116a894984e2DB1123eB395",deploymentBlock:"0x0",legacyAddresses:[]},DotCoinBurner:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},ZilliqaRecover:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},USDC:{address:"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",deploymentBlock:"0x0",legacyAddresses:[]},ProxyAdmin:{address:"0x03EBd257caDe479638c9f1Dc69d1ECbbF98e301C",deploymentBlock:"0x1215A51",legacyAddresses:[]},UNSRegistry:{address:"0xF6c1b83977DE3dEffC476f5048A0a84d3375d498",deploymentBlock:"0x01215a53",implementation:"0xE0F063F1e63E8Ac83118B08b03603d7826C718bb",forwarder:"0xF6c1b83977DE3dEffC476f5048A0a84d3375d498",legacyAddresses:[]},MintingManager:{address:"0xe56D6aa367B7a16385Ea867F556339bbC361F983",deploymentBlock:"0x01215a5c",implementation:"0xd30b3cB992777134E2a338BcF422a311339E75b1",forwarder:"0xd57f8F7be4BaE8f2bf24792Fec2Ca06513c83c1D",legacyAddresses:[]},UNSOperator:{address:"0x1E2A1f502fbe0018ED1a019D9c874e21d0a66Cb3",deploymentBlock:"0x01215a62",implementation:"0x9fd7AF306e76DCf7CF41D5c9bFbc55BA33C962B1",legacyAddresses:[]},ProxyReader:{address:"0x78c4b414e1abdf0de267deda01dffd4cd0817a16",deploymentBlock:"0x1219245",implementation:"0x6B5F9068Aa94eFf728585665244cb5AB8735E71A",legacyAddresses:[]},SeaportProxyBuyer:{address:"0x19d40e8b3338669BfC40747F5D5bDb8a14422Fdb",deploymentBlock:"0x01215b4f",implementation:"0x99d55A02f5d9c76d31C6Ff57cc36A7862D5E1029",forwarder:"0x19d40e8b3338669BfC40747F5D5bDb8a14422Fdb",legacyAddresses:[]},L1GasPriceOracle:{address:"0x420000000000000000000000000000000000000F",legacyAddresses:[],deploymentBlock:"0x0"}}},80002:{contracts:{CNSRegistry:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",forwarder:"0x0000000000000000000000000000000000000000"},SignatureController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},MintingController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},WhitelistedMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},URIPrefixController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},DomainZoneController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},Resolver:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",forwarder:"0x0000000000000000000000000000000000000000"},TwitterValidationOperator:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},FreeMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},MintableERC721Predicate:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},RootChainManager:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},ProxyAdmin:{address:"0xCbF16B0E2A06916F0Ca4892F704349d13E11cF66",legacyAddresses:[],deploymentBlock:"0x53f24d"},UNSOperator:{address:"0x89D35aABc8427a32ee7032e73975271e1480fd4E",legacyAddresses:[],deploymentBlock:"0x53f775",implementation:"0x49Ac063337cF2fB26dD421Ab650b893CD54b900F"},UNSRegistry:{address:"0xAb005176D74900A9c25fDA144e2f9f329A409166",legacyAddresses:[],deploymentBlock:"0x53f76a",implementation:"0x223350B4892300EA6E8adEF48C955dcf1C544D02",forwarder:"0xAb005176D74900A9c25fDA144e2f9f329A409166"},MintingManager:{address:"0xabec3fF0F0b6375F65CB9aEB01e8347bf697082F",legacyAddresses:[],deploymentBlock:"0x53f770",implementation:"0x5e6f02BA94648Fb25Ca98C6a577c04A0Db34c724",forwarder:"0xC738bD0E31CF0f7a777D815F8cA965f3c064C012"},ProxyReader:{address:"0x109e7315189E476AB21166955a0fB9BE9b531BEc",legacyAddresses:[],deploymentBlock:"0x53fff5",implementation:"0xA35F199591bD4F0Cb301ff85b6109Bda146dfb09"},DotCoinBurner:{address:"0xFc86844dE82FA7906C9789ca3161004F18Ca8ff4",legacyAddresses:[],deploymentBlock:"0x540d0d"},ZilliqaRecover:{address:"0x002380ccAFf852dEF50a176873d50f8019e36FBc",legacyAddresses:[],deploymentBlock:"0x540d6a",implementation:"0xBf101Ad6226024D1d26180136311d77387353c71",forwarder:"0x002380ccAFf852dEF50a176873d50f8019e36FBc"},Seaport:{address:"0x0000000000000068F116a894984e2DB1123eB395",deploymentBlock:"0x0"},SeaportProxyBuyer:{address:"0x4FF860525ccb6E992E0A4579860465f7EF581aed",deploymentBlock:"0x7c4d06",implementation:"0xf02a5fA08b86aC35EC3D6Df6878832334696788E",forwarder:"0x4FF860525ccb6E992E0A4579860465f7EF581aed"},USDC:{address:"0x9E85b0F8a298Eb0ACc175cFFEd0674718d552C11",deploymentBlock:"0xb7c92b",implementation:"0xf66A05D55F6a71E74e131b9870B9131EE56ef12E",forwarder:"0x9E85b0F8a298Eb0ACc175cFFEd0674718d552C11"},L1GasPriceOracle:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"}}},84532:{contracts:{CNSRegistry:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",forwarder:"0x0000000000000000000000000000000000000000"},SignatureController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},MintingController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},WhitelistedMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},URIPrefixController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},DomainZoneController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},Resolver:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",forwarder:"0x0000000000000000000000000000000000000000"},TwitterValidationOperator:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},FreeMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},MintableERC721Predicate:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},RootChainManager:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},Seaport:{address:"0x0000000000000068F116a894984e2DB1123eB395",deploymentBlock:"0x0",legacyAddresses:[]},ProxyAdmin:{address:"0xd57f8F7be4BaE8f2bf24792Fec2Ca06513c83c1D",legacyAddresses:[],deploymentBlock:"0xcbf182"},UNSRegistry:{address:"0xEc353DCE22C2B97814608A6b2e44889506A4Aabf",deploymentBlock:"0xcbf184",implementation:"0xD0AB7f2490736c60575123aF2Ce0D2D6b13D5490",forwarder:"0xEc353DCE22C2B97814608A6b2e44889506A4Aabf",legacyAddresses:[]},MintingManager:{address:"0x050Ceb85167D510558E793a483b479f2917B4b9b",deploymentBlock:"0xcbf18d",implementation:"0x6B5F9068Aa94eFf728585665244cb5AB8735E71A",forwarder:"0xEa5AE30C714ccd63Fca6D791Eea1E26CB1be0c1d",legacyAddresses:[]},UNSOperator:{address:"0x99d55A02f5d9c76d31C6Ff57cc36A7862D5E1029",deploymentBlock:"0xcbf193",implementation:"0x3a2Ad968667a8214BEAe6AfA45192DD24109a3e7",legacyAddresses:[]},ProxyReader:{address:"0x8Fc4DBA4A6F5AE8992E8f9B64D6d995BD3AfE2c4",deploymentBlock:"0xcbf1a9",implementation:"0x37e22Fd398B8c95128f5235e991682cF6e9F5d9c",legacyAddresses:[]},SeaportProxyBuyer:{address:"0x78c4B414e1AbdF0dE267deDa01DFFd4cd0817A16",deploymentBlock:"0xcbf1b5",implementation:"0x6C95A12CcEA79971C51b16f707D8CdDd7d1b5033",forwarder:"0x78c4B414e1AbdF0dE267deDa01DFFd4cd0817A16",legacyAddresses:[]},DotCoinBurner:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},ZilliqaRecover:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},USDC:{address:"0x5dEaC602762362FE5f135FA5904351916053cF70",deploymentBlock:"0x0"},L1GasPriceOracle:{address:"0x420000000000000000000000000000000000000F",legacyAddresses:[],deploymentBlock:"0x0"}}},11155111:{contracts:{ProxyAdmin:{address:"0xCbF16B0E2A06916F0Ca4892F704349d13E11cF66",legacyAddresses:[],deploymentBlock:"0x5588B8"},ENSCustody:{address:"0xd2Bf816C7b23fF6e7d141ECC4c1e41DcC857aD45",legacyAddresses:[],deploymentBlock:"0x5588b9",implementation:"0x49Ac063337cF2fB26dD421Ab650b893CD54b900F",forwarder:"0xd2Bf816C7b23fF6e7d141ECC4c1e41DcC857aD45"},CNSRegistry:{address:"0xAb005176D74900A9c25fDA144e2f9f329A409166",legacyAddresses:[],deploymentBlock:"0x558be7",forwarder:"0xD3146C740c0Fa128ab1aEA90e4E75194AC0Bbc9B"},SignatureController:{address:"0x5e6f02BA94648Fb25Ca98C6a577c04A0Db34c724",legacyAddresses:[],deploymentBlock:"0x558bee"},MintingController:{address:"0xabec3fF0F0b6375F65CB9aEB01e8347bf697082F",legacyAddresses:[],deploymentBlock:"0x558bef",deprecated:!0},URIPrefixController:{address:"0x89D35aABc8427a32ee7032e73975271e1480fd4E",legacyAddresses:[],deploymentBlock:"0x558bf6",deprecated:!0},Resolver:{address:"0xf8F0622A88eC688140890153191Db1713442618D",legacyAddresses:[],deploymentBlock:"0x558bfc",forwarder:"0xA35F199591bD4F0Cb301ff85b6109Bda146dfb09"},WhitelistedMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},DomainZoneController:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},TwitterValidationOperator:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},FreeMinter:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0",deprecated:!0},MintableERC721Predicate:{address:"0xf8D2ecCA43F50F04922A13c417aEd05C34F1EF52",legacyAddresses:[],deploymentBlock:"0x486873"},RootChainManager:{address:"0x34F5A25B627f50Bb3f5cAb72807c4D4F405a9232",legacyAddresses:[],deploymentBlock:"0x486867"},UNSRegistry:{address:"0xDD907B4d80B4a979fd77eE502580c55F2700292c",deploymentBlock:"0x55a711",legacyAddresses:[],implementation:"0x7f21bA760352326c55FD6A83D218c2FCd294Dd1c",forwarder:"0xDD907B4d80B4a979fd77eE502580c55F2700292c"},MintingManager:{address:"0x1620637c0ce88cccfa919ef562b4398e3187189d",deploymentBlock:"0x55a715",legacyAddresses:[],implementation:"0x63B6F3F80d12A70eA26a57cdFDc16F33e6fD319A",forwarder:"0x38F532B32E0b42E747483A37Dfaf05460b1F4Fa3"},UNSOperator:{address:"0x41fD65E5a1cbdcCdD69F8C11DA4c829F7d3565A6",deploymentBlock:"0x55A717",legacyAddresses:[],implementation:"0xf9A7A6516Ee73E4Bd3FA9fbABdA3C8DeA40c89FA"},ProxyReader:{address:"0x880F7D37E9E4EB6868F92F4bB9C8C0995178fdA9",deploymentBlock:"0x55a857",legacyAddresses:[],implementation:"0xdA0E8ec8f801593161e689275Ab1394e7791ee18"},DotCoinBurner:{address:"0x64E3ecF931610d2503247b7c7A885688de54241A",legacyAddresses:[],deploymentBlock:"0x55f932"},ZilliqaRecover:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"},Seaport:{address:"0x0000000000000068F116a894984e2DB1123eB395",deploymentBlock:"0x0"},SeaportProxyBuyer:{address:"0x0000000000000000000000000000000000000000",deploymentBlock:"0x0",implementation:"0x0000000000000000000000000000000000000000",forwarder:"0x0000000000000000000000000000000000000000"},USDC:{address:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",deploymentBlock:"0x0"},L1GasPriceOracle:{address:"0x0000000000000000000000000000000000000000",legacyAddresses:[],deploymentBlock:"0x0"}}}},require$$6={version:version$1,networks};var __createBinding$5=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$5=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar$5=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding$5(t,c,n);return __setModuleDefault$5(t,c),t},__awaiter$4=commonjsGlobal&&commonjsGlobal.__awaiter||function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function he(xe){try{me(ie.next(xe))}catch(Ee){le(Ee)}}function ye(xe){try{me(ie.throw(xe))}catch(Ee){le(Ee)}}function me(xe){xe.done?ae(xe.value):fe(xe.value).then(he,ye)}me((ie=ie.apply(c,t||[])).next())})},__generator$4=commonjsGlobal&&commonjsGlobal.__generator||function(c,t){var n={label:0,sent:function(){if(ae[0]&1)throw ae[1];return ae[1]},trys:[],ops:[]},ie,fe,ae,le;return le={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(le[Symbol.iterator]=function(){return this}),le;function he(me){return function(xe){return ye([me,xe])}}function ye(me){if(ie)throw new TypeError("Generator is already executing.");for(;n;)try{if(ie=1,fe&&(ae=me[0]&2?fe.return:me[0]?fe.throw||((ae=fe.return)&&ae.call(fe),0):fe.next)&&!(ae=ae.call(fe,me[1])).done)return ae;switch(fe=0,ae&&(me=[me[0]&2,ae.value]),me[0]){case 0:case 1:ae=me;break;case 4:return n.label++,{value:me[1],done:!1};case 5:n.label++,fe=me[1],me=[0];continue;case 7:me=n.ops.pop(),n.trys.pop();continue;default:if(ae=n.trys,!(ae=ae.length>0&&ae[ae.length-1])&&(me[0]===6||me[0]===2)){n=0;continue}if(me[0]===3&&(!ae||me[1]>ae[0]&&me[1]<ae[3])){n.label=me[1];break}if(me[0]===6&&n.label<ae[1]){n.label=ae[1],ae=me;break}if(ae&&n.label<ae[2]){n.label=ae[2],n.ops.push(me);break}ae[2]&&n.ops.pop(),n.trys.pop();continue}me=t.call(c,n)}catch(xe){me=[6,xe],fe=0}finally{ie=ae=0}if(me[0]&5)throw me[1];return{value:me[0]?me[1]:void 0,done:!0}}},__spreadArray$2=commonjsGlobal&&commonjsGlobal.__spreadArray||function(c,t,n){if(n||arguments.length===2)for(var ie=0,fe=t.length,ae;ie<fe;ie++)(ae||!(ie in t))&&(ae||(ae=Array.prototype.slice.call(t,0,ie)),ae[ie]=t[ie]);return c.concat(ae||Array.prototype.slice.call(t))},__importDefault$3=commonjsGlobal&&commonjsGlobal.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(UnsInternal$1,"__esModule",{value:!0});var types_1$1=types$3,configurationError_1$3=__importDefault$3(configurationError),configurationError_2$1=configurationError,utils_1$3=utils$d,FetchProvider_1$1=__importDefault$3(FetchProvider$1),EthereumContract_1=__importDefault$3(EthereumContract$1),proxyReader_1=__importDefault$3(proxyReader),uns_config_json_1=__importDefault$3(require$$6),resolutionError_1$5=__importStar$5(resolutionError),namehash_1$3=namehash,UnsInternal=function(){function c(t,n,ie){this.unsLocation=t,this.checkNetworkConfig(t,n),this.network=n.network,this.blockchain=ie,this.url=n.url,this.provider=n.provider||new FetchProvider_1$1.default(this.unsLocation,this.url),this.readerContract=new EthereumContract_1.default(proxyReader_1.default,n.proxyReaderAddress||c.ProxyReaderMap[utils_1$3.EthereumNetworks[this.network]],this.provider,n.proxyServiceApiKey)}return c.prototype.exists=function(t){return __awaiter$4(this,void 0,void 0,function(){var n;return __generator$4(this,function(ie){switch(ie.label){case 0:return[4,this.readerContract.call("exists",[this.namehash(t)])];case 1:return n=ie.sent()[0],[2,n]}})})},c.prototype.reverseOf=function(t){return __awaiter$4(this,void 0,void 0,function(){var n;return __generator$4(this,function(ie){switch(ie.label){case 0:return[4,this.readerContract.call("reverseOf",[t])];case 1:return n=ie.sent()[0],[2,n]}})})},c.prototype.getAddress=function(t,n,ie){return __awaiter$4(this,void 0,void 0,function(){var fe,ae;return __generator$4(this,function(le){switch(le.label){case 0:return fe=this.namehash(t),[4,this.readerContract.call("getAddress",[n,ie,fe])];case 1:return ae=le.sent()[0],[2,ae]}})})},c.prototype.getTokenUri=function(t){return __awaiter$4(this,void 0,void 0,function(){var n;return __generator$4(this,function(ie){switch(ie.label){case 0:return[4,this.readerContract.call("tokenURI",[t])];case 1:return n=ie.sent()[0],[2,n]}})})},c.prototype.registryAddress=function(t){return __awaiter$4(this,void 0,void 0,function(){var n,ie,fe;return __generator$4(this,function(ae){switch(ae.label){case 0:if(n=!t.includes("."),!this.checkDomain(t,n))throw new resolutionError_1$5.default(resolutionError_1$5.ResolutionErrorCode.UnsupportedDomain,{domain:t});return ie=n?t:this.namehash(t),[4,this.readerContract.call("registryOf",[ie])];case 1:if(fe=ae.sent()[0],(0,utils_1$3.isNullAddress)(fe))throw new resolutionError_1$5.default(resolutionError_1$5.ResolutionErrorCode.UnregisteredDomain,{domain:t});return[2,fe]}})})},c.prototype.resolver=function(t){return __awaiter$4(this,void 0,void 0,function(){return __generator$4(this,function(n){switch(n.label){case 0:return[4,this.getVerifiedData(t)];case 1:return[2,n.sent().resolver]}})})},c.prototype.get=function(t,n){return n===void 0&&(n=[]),__awaiter$4(this,void 0,void 0,function(){var ie,fe,ae,le;return __generator$4(this,function(he){switch(he.label){case 0:return[4,this.readerContract.call("getData",[n,t])];case 1:return ie=he.sent(),fe=ie[0],ae=ie[1],le=ie[2],[2,{owner:ae,resolver:fe,records:(0,utils_1$3.constructRecords)(n,le),location:this.unsLocation}]}})})},c.prototype.locations=function(t){return __awaiter$4(this,void 0,void 0,function(){var n,ie,fe,ae,le,he,ye,me=this;return __generator$4(this,function(xe){switch(xe.label){case 0:return n=t.map(function(Ee){return me.namehash(Ee)}),[4,this.readerContract.multicall(__spreadArray$2([{method:"getDataForMany",args:[[],n]}],n.map(function(Ee){return{method:"registryOf",args:[Ee]}}),!0))];case 1:return ie=xe.sent(),fe=ie[0],ae=fe[0],le=fe[1],he=ie.slice(1),ye=t.reduce(function(Ee,Se,Me){return Ee[Se]=null,le&&le[Me]!==types_1$1.NullAddress&&(Ee[Se]={resolverAddress:ae[Me],registryAddress:he[Me][0],ownerAddress:le[Me],networkId:utils_1$3.EthereumNetworks[me.network],blockchain:me.blockchain,blockchainProviderUrl:me.url}),Ee},{}),[2,ye]}})})},c.prototype.namehash=function(t){if(!this.checkDomain(t))throw new resolutionError_1$5.default(resolutionError_1$5.ResolutionErrorCode.UnsupportedDomain,{domain:t});return(0,namehash_1$3.eip137Namehash)(t)},c.prototype.checkDomain=function(t,n){if(n===void 0&&(n=!1),n)return!0;var ie=t.split(".");return!!ie.length&&!(t==="eth"||/^[^-]*[^-]*\.(eth|addr\.reverse)$/.test(t))&&ie.every(function(fe){return!!fe.length})},c.prototype.getVerifiedData=function(t,n){return __awaiter$4(this,void 0,void 0,function(){var ie,fe;return __generator$4(this,function(ae){switch(ae.label){case 0:return ie=this.namehash(t),[4,this.get(ie,n)];case 1:if(fe=ae.sent(),(0,utils_1$3.isNullAddress)(fe.resolver))throw(0,utils_1$3.isNullAddress)(fe.owner)?new resolutionError_1$5.default(resolutionError_1$5.ResolutionErrorCode.UnregisteredDomain,{domain:t}):new resolutionError_1$5.default(resolutionError_1$5.ResolutionErrorCode.UnspecifiedResolver,{location:this.unsLocation,domain:t});return[2,fe]}})})},c.prototype.checkNetworkConfig=function(t,n){if(!n.network)throw new configurationError_1$3.default(configurationError_2$1.ConfigurationErrorCode.UnsupportedNetwork,{method:t});if(n.proxyReaderAddress&&!this.isValidProxyReader(n.proxyReaderAddress))throw new configurationError_1$3.default(configurationError_2$1.ConfigurationErrorCode.InvalidConfigurationField,{method:this.unsLocation,field:"proxyReaderAddress"});types_1$1.UnsSupportedNetwork.guard(n.network)||this.checkCustomNetworkConfig(n)},c.prototype.checkCustomNetworkConfig=function(t){if(!this.isValidProxyReader(t.proxyReaderAddress))throw new configurationError_1$3.default(configurationError_2$1.ConfigurationErrorCode.InvalidConfigurationField,{method:this.unsLocation,field:"proxyReaderAddress"});if(!t.url&&!t.provider)throw new configurationError_1$3.default(configurationError_2$1.ConfigurationErrorCode.CustomNetworkConfigMissing,{method:this.unsLocation,config:"url or provider"})},c.prototype.isValidProxyReader=function(t){if(!t)throw new configurationError_1$3.default(configurationError_2$1.ConfigurationErrorCode.CustomNetworkConfigMissing,{method:this.unsLocation,config:"proxyReaderAddress"});var n=new RegExp("^0x[a-fA-F0-9]{40}$");return n.test(t)},c.ProxyReaderMap=getProxyReaderMap(),c}();UnsInternal$1.default=UnsInternal;function getProxyReaderMap(){for(var c={},t=0,n=Object.keys(uns_config_json_1.default.networks);t<n.length;t++){var ie=n[t];c[ie]=uns_config_json_1.default.networks[ie].contracts.ProxyReader.address.toLowerCase()}return c}const version="2.1.33",information={description:"This file describes all resolver keys with a defined meaning and related metadata used by Unstoppable Domains UNS Registry",documentation:"https://docs.unstoppabledomains.com/developer-toolkit/records-reference/",contribution:"https://github.com/unstoppabledomains/uns/blob/main/resolver-keys.json"},keys={"crypto.BTC.address":{deprecatedKeyName:"BTC",deprecated:!1,validationRegex:"^bc1[ac-hj-np-z02-9]{6,87}$|^[13][a-km-zA-HJ-NP-Z1-9]{25,39}$"},"crypto.B2M.version.MATIC.address":{deprecatedKeyName:"B2M_MATIC",validationRegex:"^0x[a-zA-Z0-9]*$",deprecated:!1},"crypto.B2M.version.BEP20.address":{deprecatedKeyName:"B2M_BEP20",validationRegex:"^0x[a-zA-Z0-9]*$",deprecated:!1},"crypto.B2M.version.ERC20.address":{deprecatedKeyName:"B2M_ERC20",validationRegex:"^0x[a-zA-Z0-9]*$",deprecated:!1},"crypto.ETH.address":{deprecatedKeyName:"ETH",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.ZIL.address":{deprecatedKeyName:"ZIL",deprecated:!1,validationRegex:"^zil1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38}$"},"crypto.LTC.address":{deprecatedKeyName:"LTC",deprecated:!1,validationRegex:"^[LM3][a-km-zA-HJ-NP-Z1-9]{26,33}$|^ltc1[a-zA-HJ-NP-Z0-9]{25,39}$"},"crypto.ETC.address":{deprecatedKeyName:"ETC",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.EQL.address":{deprecatedKeyName:"EQL",deprecated:!1,validationRegex:"^bnb[0-9a-z]{39}$"},"crypto.LINK.address":{deprecatedKeyName:"LINK",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.FARMS.version.MATIC.address":{deprecatedKeyName:"FARMS_MATIC",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.USDC.address":{deprecatedKeyName:"USDC",deprecated:!0,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.USDC.version.ERC20.address":{deprecatedKeyName:"USDC_ERC20",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.USDC.version.OKT.address":{deprecatedKeyName:"USDC_OKT",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$|^ex[a-zA-HJ-NP-Z0-9]{6,90}$"},"crypto.USDC.version.MATIC.address":{deprecatedKeyName:"USDC_MATIC",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.USDC.version.SOL.address":{deprecatedKeyName:"USDC_SOL",deprecated:!1,validationRegex:"^[a-zA-Z0-9]*$"},"crypto.USDC.version.AVAX.address":{deprecatedKeyName:"USDC_AVAX",deprecated:!1,validationRegex:"^[a-zA-Z0-9]*$"},"crypto.BAT.address":{deprecatedKeyName:"BAT",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.REP.address":{deprecatedKeyName:"REP",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.ZRX.address":{deprecatedKeyName:"ZRX",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.DAI.address":{deprecatedKeyName:"DAI",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.BCH.address":{deprecatedKeyName:"BCH",deprecated:!1,validationRegex:"^[13][a-km-zA-HJ-NP-Z1-9]{33}$|^((bitcoincash|bchreg|bchtest):)?(q|p)[a-z0-9]{41}$|^((BITCOINCASH:)?(Q|P)[A-Z0-9]{41})$"},"crypto.XMR.address":{deprecatedKeyName:"XMR",deprecated:!1,validationRegex:"^[48]{1}[0-9AB][1-9A-HJ-NP-Za-km-z]{93}$"},"crypto.DASH.address":{deprecatedKeyName:"DASH",deprecated:!1,validationRegex:"^X[1-9A-HJ-NP-Za-km-z]{33}$"},"crypto.NEO.address":{deprecatedKeyName:"NEO",deprecated:!1,validationRegex:"^A[0-9a-zA-Z]{33}$"},"crypto.SWTH.address":{deprecatedKeyName:"SWTH",deprecated:!1,validationRegex:"^A[0-9a-zA-Z]{33}$"},"crypto.DOGE.address":{deprecatedKeyName:"DOGE",deprecated:!1,validationRegex:"^D[5-9A-HJ-NP-U]{1}[1-9A-HJ-NP-Za-km-z]{32}$"},"crypto.XRP.address":{deprecatedKeyName:"XRP",deprecated:!1,validationRegex:"^r[1-9a-km-zA-HJ-NP-Z]{24,34}$"},"crypto.ZEC.address":{deprecatedKeyName:"ZEC",deprecated:!1,validationRegex:"^z([a-zA-Z0-9]){94}$|^zs1([a-zA-Z0-9]){75}$|^t([a-zA-Z0-9]){34}$"},"crypto.YEC.address":{deprecatedKeyName:"YEC",deprecated:!1,validationRegex:"^y([a-zA-Z0-9]){94}$|^ys1([a-zA-Z0-9]){75}$|^s([a-zA-Z0-9]){34}$"},"crypto.ADA.address":{deprecatedKeyName:"ADA",deprecated:!1,validationRegex:"^[1-9a-km-zA-HJ-NP-Z]{104}$|^A[1-9A-HJ-NP-Za-km-z]{58}$|^addr([0-9a-zA-Z]{99}|[0-9a-zA-Z]{54})$"},"crypto.EOS.address":{deprecatedKeyName:"EOS",deprecated:!1,validationRegex:"^[1-5a-z]{12}$|^EOS[a-zA-Z0-9]{50}$|^PUB_K[0-9]_[a-zA-Z0-9]{50}$"},"crypto.XLM.address":{deprecatedKeyName:"XLM",deprecated:!1,validationRegex:"^G[A-Z2-7]{55}$"},"crypto.BNB.address":{deprecatedKeyName:"BNB",deprecated:!0,validationRegex:"^bnb[0-9a-z]{39}$"},"crypto.BNB.version.BEP2.address":{deprecatedKeyName:"BNB_BEP2",deprecated:!1,validationRegex:"^(bnb|tbnb)[a-zA-HJ-NP-Z0-9]{39}$"},"crypto.BNB.version.BEP20.address":{deprecatedKeyName:"BNB_BEP20",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.BTG.address":{deprecatedKeyName:"BTG",deprecated:!1,validationRegex:"^[GA][a-km-zA-HJ-NP-Z1-9]{33}$"},"crypto.NANO.address":{deprecatedKeyName:"NANO",deprecated:!1,validationRegex:"^nano_[1-9a-z]{60}$"},"crypto.WAVES.address":{deprecatedKeyName:"WAVES",deprecated:!1,validationRegex:"^3[a-km-zA-HJ-NP-Z1-9]{34}$"},"crypto.KMD.address":{deprecatedKeyName:"KMD",deprecated:!1,validationRegex:"^R[a-km-zA-Z1-9]{33}$"},"crypto.AE.address":{deprecatedKeyName:"AE",deprecated:!1,validationRegex:"^ak_[a-km-zA-Z1-9]{48,52}$"},"crypto.RSK.address":{deprecatedKeyName:"RSK",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.WAN.address":{deprecatedKeyName:"WAN",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.STRAT.address":{deprecatedKeyName:"STRAT",deprecated:!1,validationRegex:"^S[a-km-zA-HJ-NP-Z1-9]{33}$"},"crypto.UBQ.address":{deprecatedKeyName:"UBQ",deprecated:!1,validationRegex:"^0x[a-km-zA-HJ-NP-Z0-9]{40}$"},"crypto.XTZ.address":{deprecatedKeyName:"XTZ",deprecated:!1,validationRegex:"^(tz|KT)[a-km-zA-HJ-NP-Z1-9]{34}$"},"crypto.IOTA.address":{deprecatedKeyName:"IOTA",deprecated:!1,validationRegex:"^[A-Z0-9]{90}$|^iota1[a-z0-9]{59}$"},"crypto.VET.address":{deprecatedKeyName:"VET",deprecated:!1,validationRegex:"^0x[a-km-zA-HJ-NP-Z0-9]{40}$"},"crypto.QTUM.address":{deprecatedKeyName:"QTUM",deprecated:!1,validationRegex:"^Q[a-km-zA-HJ-NP-Z1-9]{33}$"},"crypto.ICX.address":{deprecatedKeyName:"ICX",deprecated:!1,validationRegex:"^[a-km-zA-HJ-NP-Z0-9]{42}$"},"crypto.DGB.address":{deprecatedKeyName:"DGB",deprecated:!1,validationRegex:"(^[a-km-zA-HJ-NP-Z1-9]{34}$)|(^[a-zA-Z1-9]{42}$)|(^dgb1[a-zA-Z0-9]{39}$)"},"crypto.XZC.address":{deprecatedKeyName:"XZC",deprecated:!0,validationRegex:"^[a-km-zA-HJ-NP-Z1-9]{34}$"},"crypto.FIRO.address":{deprecatedKeyName:"FIRO",deprecated:!1,validationRegex:"^[a-km-zA-HJ-NP-Z1-9]{34}$"},"crypto.BURST.address":{deprecatedKeyName:"BURST",deprecated:!1,validationRegex:"^BURST-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{5}"},"crypto.DCR.address":{deprecatedKeyName:"DCR",deprecated:!1,validationRegex:"^D[a-zA-Z0-9]*$"},"crypto.XEM.address":{deprecatedKeyName:"XEM",deprecated:!1,validationRegex:"^N[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]{39}$"},"crypto.LSK.address":{deprecatedKeyName:"LSK",deprecated:!1,validationRegex:"^[0-9a-z]{3}[23456789abcdefghjkmnopqrstuvwxyz]{38}$"},"crypto.ATOM.address":{deprecatedKeyName:"ATOM",deprecated:!1,validationRegex:"^(cosmos)1([qpzry9x8gf2tvdw0s3jn54khce6mua7l]+)$"},"crypto.ONG.address":{deprecatedKeyName:"ONG",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.ONT.address":{deprecatedKeyName:"ONT",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.SMART.address":{deprecatedKeyName:"SMART",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.TPAY.address":{deprecatedKeyName:"TPAY",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.GRS.address":{deprecatedKeyName:"GRS",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.BSV.address":{deprecatedKeyName:"BSV",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{33,34}$"},"crypto.GAS.address":{deprecatedKeyName:"GAS",deprecated:!1,validationRegex:"^[a-zA-Z0-9]*$"},"crypto.TRX.address":{deprecatedKeyName:"TRX",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.VTHO.address":{deprecatedKeyName:"VTHO",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{42}$"},"crypto.BCD.address":{deprecatedKeyName:"BCD",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.BTT.address":{deprecatedKeyName:"BTT",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.KIN.address":{deprecatedKeyName:"KIN",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{56}$"},"crypto.RVN.address":{deprecatedKeyName:"RVN",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.ARK.address":{deprecatedKeyName:"ARK",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.XVG.address":{deprecatedKeyName:"XVG",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$|^[1-9A-HJ-NP-Za-km-z]{95}$"},"crypto.ALGO.address":{deprecatedKeyName:"ALGO",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{58}$"},"crypto.NEBL.address":{deprecatedKeyName:"NEBL",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.XPM.address":{deprecatedKeyName:"XPM",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.ONE.address":{deprecatedKeyName:"ONE",deprecated:!1,validationRegex:"^one[a-zA-Z0-9]{39}$|^0x[a-fA-F0-9]{40}$"},"crypto.BNTY.address":{deprecatedKeyName:"BNTY",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.CRO.address":{deprecatedKeyName:"CRO",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.TWT.address":{deprecatedKeyName:"TWT",deprecated:!1,validationRegex:"^bnb[0-9a-z]{39}$"},"crypto.SIERRA.address":{deprecatedKeyName:"SIERRA",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.VSYS.address":{deprecatedKeyName:"VSYS",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{35}$"},"crypto.HIVE.address":{deprecatedKeyName:"HIVE",validationRegex:"^(?!s*$).+",deprecated:!1},"crypto.HT.address":{deprecatedKeyName:"HT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.ENJ.address":{deprecatedKeyName:"ENJ",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.YFI.address":{deprecatedKeyName:"YFI",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MTA.address":{deprecatedKeyName:"MTA",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.COMP.address":{deprecatedKeyName:"COMP",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.BAL.address":{deprecatedKeyName:"BAL",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.AMPL.address":{deprecatedKeyName:"AMPL",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.LEND.address":{deprecatedKeyName:"LEND",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.TLOS.address":{deprecatedKeyName:"TLOS",validationRegex:"^[1-5a-z]{12}$",deprecated:!1},"crypto.XDC.address":{deprecatedKeyName:"XDC",validationRegex:"^xdc[a-fA-F0-9]{40}$",deprecated:!1},"crypto.XST.address":{deprecatedKeyName:"XST",validationRegex:"(?:RwxQ3jUs2BjKhseNX1em4msn2GyV5XAec[PQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]|RwxQ3jUs2BjKhseNX1em4msn2GyV5XAe[defghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]|RwxQ3jUs2BjKhseNX1em4msn2GyV5XA[fghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{2}|RwxQ3jUs2BjKhseNX1em4msn2GyV5X[BCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{3}|RwxQ3jUs2BjKhseNX1em4msn2GyV5[YZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{4}|RwxQ3jUs2BjKhseNX1em4msn2GyV[6789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{5}|RwxQ3jUs2BjKhseNX1em4msn2Gy[WXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{6}|RwxQ3jUs2BjKhseNX1em4msn2G[z][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{7}|RwxQ3jUs2BjKhseNX1em4msn2[HJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{8}|RwxQ3jUs2BjKhseNX1em4msn[3456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{9}|RwxQ3jUs2BjKhseNX1em4ms[opqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{10}|RwxQ3jUs2BjKhseNX1em4m[tuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{11}|RwxQ3jUs2BjKhseNX1em4[nopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{12}|RwxQ3jUs2BjKhseNX1em[56789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{13}|RwxQ3jUs2BjKhseNX1e[nopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{14}|RwxQ3jUs2BjKhseNX1[fghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{15}|RwxQ3jUs2BjKhseNX[23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{16}|RwxQ3jUs2BjKhseN[YZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{17}|RwxQ3jUs2BjKhse[PQRSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{18}|RwxQ3jUs2BjKhs[fghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{19}|RwxQ3jUs2BjKh[tuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{20}|RwxQ3jUs2BjK[ijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21}|RwxQ3jUs2Bj[LMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{22}|RwxQ3jUs2B[kmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{23}|RwxQ3jUs2[CDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{24}|RwxQ3jUs[3456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{25}|RwxQ3jU[tuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{26}|RwxQ3j[VWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{27}|RwxQ3[kmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{28}|RwxQ[456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{29}|Rwx[RSTUVWXYZabcdefghijkmnopqrstuvwxyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{30}|Rw[yz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{31}|R[xyz][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{32}|S[123456789ABCDEFGHJKL][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{32}|SM[123456789ABCDEFGH][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{31}|SMJ11[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{29}|SMJ11[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{29}|SMJ12[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnop][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{28}|SMJ12q[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkm][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{27}|SMJ12qn[12345678][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{26}|SMJ12qn9[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghi][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{25}|SMJ12qn9j[123456789ABCDEFGHJKLM][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{24}|SMJ12qn9jN[123456789AB][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{23}|SMJ12qn9jNC[123456789AB][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{22}|SMJ12qn9jNCC[123456789ABCDEFGHJKLMNPQRSTUVW][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21}|SMJ12qn9jNCCX[123456789ABCDEFGH][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{20}|SMJ12qn9jNCCXJ[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkm][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{19}|SMJ12qn9jNCCXJn[123456789ABCDEFGHJKLMNPQRS][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{18}|SMJ12qn9jNCCXJnT[123456789ABCDEFGHJKLMNPQRSTUVWX][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{17}|SMJ12qn9jNCCXJnTY[123456789ABCDEFGHJKLMNPQ][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{16}|SMJ12qn9jNCCXJnTYR[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxy][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{15}|SMJ12qn9jNCCXJnTYRz[1234][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{14}|SMJ12qn9jNCCXJnTYRz5[123456789ABCDEFGHJKLMNPQRSTUVWX][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{13}|SMJ12qn9jNCCXJnTYRz5Y[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrst][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{12}|SMJ12qn9jNCCXJnTYRz5Yu[12345678][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{11}|SMJ12qn9jNCCXJnTYRz5Yu9[123456789ABCDEFGHJKLMNPQRSTUVWXY][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{10}|SMJ12qn9jNCCXJnTYRz5Yu9Z[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcd][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{9}|SMJ12qn9jNCCXJnTYRz5Yu9Ze[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkm][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{8}|SMJ12qn9jNCCXJnTYRz5Yu9Zen[123456789ABCD][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{7}|SMJ12qn9jNCCXJnTYRz5Yu9ZenE[123456789ABCDEFGHJKLMNPQ][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{6}|SMJ12qn9jNCCXJnTYRz5Yu9ZenER[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkm][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{5}|SMJ12qn9jNCCXJnTYRz5Yu9ZenERn[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghij][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{4}|SMJ12qn9jNCCXJnTYRz5Yu9ZenERnk[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghij][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{3}|SMJ12qn9jNCCXJnTYRz5Yu9ZenERnkk[123456789ABCDEFGHJKLMNPQRST][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{2}|SMJ12qn9jNCCXJnTYRz5Yu9ZenERnkkU[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstu][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]|SMJ12qn9jNCCXJnTYRz5Yu9ZenERnkkUv[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghi])",deprecated:!1},"crypto.STRAX.address":{deprecatedKeyName:"STRAX",validationRegex:"^X[a-km-zA-HJ-NP-Z1-9]{33}$",deprecated:!1},"crypto.SIGNA.address":{deprecatedKeyName:"SIGNA",validationRegex:"^S-((?=[A-Z2-9]{4})(?:[^IO]{4})-){3}(?=[A-Z2-9]{5})(?:[^IO]{5})$",deprecated:!1},"crypto.NIM.address":{deprecatedKeyName:"NIM",validationRegex:"^NQ[0-9]{2} ([A-Z0-9]{4} ){7}[A-Z0-9]{4}$",deprecated:!1},"crypto.GUAP.address":{deprecatedKeyName:"GUAP",validationRegex:"^(G|P)[a-zA-HJ-NP-Z0-9]{25,39}$",deprecated:!1},"crypto.YLD.address":{deprecatedKeyName:"YLD",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.OKT.address":{deprecatedKeyName:"OKT",validationRegex:"^0x[a-fA-F0-9]{40}$|^ex[a-zA-HJ-NP-Z0-9]{6,90}$",deprecated:!1},"crypto.ELA.version.ELA.address":{deprecatedKeyName:"ELA_ELA",validationRegex:"E[a-zA-HJ-NP-Z0-9]{33}",deprecated:!1},"crypto.ELA.version.ESC.address":{deprecatedKeyName:"ELA_ESC",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.WETH.version.ERC20.address":{deprecatedKeyName:"WETH_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.WETH.version.MATIC.address":{deprecatedKeyName:"WETH_MATIC",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.WETH.version.BEP20.address":{deprecatedKeyName:"WETH_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.USDT.version.ERC20.address":{deprecatedKeyName:"USDT_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.USDT.version.MATIC.address":{deprecatedKeyName:"USDT_MATIC",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.USDT.version.TRON.address":{deprecatedKeyName:"USDT_TRON",validationRegex:"^[T][a-zA-HJ-NP-Z0-9]{33}$",deprecated:!1},"crypto.USDT.version.EOS.address":{deprecatedKeyName:"USDT_EOS",validationRegex:"^[1-5a-z]{12}$|^EOS[a-zA-Z0-9]{50}$|^PUB_K[0-9]_[a-zA-Z0-9]{50}$",deprecated:!1},"crypto.USDT.version.OMNI.address":{deprecatedKeyName:"USDT_OMNI",validationRegex:"^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$",deprecated:!1},"crypto.USDT.version.OKB.address":{deprecatedKeyName:"USDT_OKB",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.USDT.version.OKC.address":{deprecatedKeyName:"USDT_OKC",validationRegex:"^0x[a-fA-F0-9]{40}$|^ex[a-zA-HJ-NP-Z0-9]{6,90}$",deprecated:!0},"crypto.FTM.version.ERC20.address":{deprecatedKeyName:"FTM_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.FTM.version.BEP2.address":{deprecatedKeyName:"FTM_BEP2",validationRegex:"^(bnb|tbnb)[a-zA-HJ-NP-Z0-9]{39}$",deprecated:!1},"crypto.FTM.version.OPERA.address":{deprecatedKeyName:"FTM_OPERA",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.FUSE.version.ERC20.address":{deprecatedKeyName:"FUSE_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.FUSE.version.FUSE.address":{deprecatedKeyName:"FUSE_FUSE",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MATIC.version.MATIC.address":{deprecatedKeyName:"MATIC_MATIC",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MATIC.version.BEP20.address":{deprecatedKeyName:"MATIC_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MATIC.version.ERC20.address":{deprecatedKeyName:"MATIC_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"social.payid.name":{deprecatedKeyName:"payid",validationRegex:"^[0-9a-zA-Z]+\\$[0-9a-zA-Z]+\\.[0-9a-zA-Z]+$",deprecated:!1},"social.picture.value":{deprecatedKeyName:"picture",validationRegex:null,deprecated:!1},"whois.email.value":{deprecatedKeyName:"email",validationRegex:"^[^@]+@[^\\.]+\\..+$",deprecated:!1},"whois.for_sale.value":{deprecatedKeyName:"for_sale",validationRegex:"(true)|(false)",deprecated:!1},"ipfs.html.value":{deprecatedKeyName:"html",validationRegex:".{0,100}",deprecated:!1},"ipfs.redirect_domain.value":{deprecatedKeyName:"redirect_domain",validationRegex:".{0,253}",deprecated:!1},"dweb.ipfs.hash":{deprecatedKeyName:"dweb_hash",validationRegex:".{0,100}",deprecated:!1},"browser.redirect_url":{deprecatedKeyName:"browser_redirect",validationRegex:".{0,253}",deprecated:!1},"browser.preferred_protocols":{deprecatedKeyName:"browser_preferred_protocols",validationRegex:null,deprecated:!1},"gundb.username.value":{deprecatedKeyName:"gundb_username",validationRegex:null,deprecated:!1},"gundb.public_key.value":{deprecatedKeyName:"gundb_public_key",validationRegex:null,deprecated:!1},"social.image.value":{deprecatedKeyName:"image",validationRegex:null,deprecated:!1},"social.twitter.username":{deprecatedKeyName:"twitter_username",validationRegex:null,deprecated:!1},"validation.social.twitter.username":{deprecatedKeyName:"validation_twitter_username",validationRegex:null,deprecated:!1},"forwarding.url":{deprecatedKeyName:"forwarding_url",validationRegex:"^(https?)://[^\\s/$.?#].[^\\s]*$",deprecated:!1},"dns.ttl":{deprecatedKeyName:"dns_ttl",validationRegex:null,deprecated:!1},"dns.A":{deprecatedKeyName:"dns_A",validationRegex:null,deprecated:!1},"dns.A.ttl":{deprecatedKeyName:"dns_A_ttl",validationRegex:null,deprecated:!1},"dns.AAAA":{deprecatedKeyName:"dns_AAAA",validationRegex:null,deprecated:!1},"dns.AAAA.ttl":{deprecatedKeyName:"dns_AAAA_ttl",validationRegex:null,deprecated:!1},"dns.AFSDB":{deprecatedKeyName:"dns_AFSDB",validationRegex:null,deprecated:!1},"dns.AFSDB.ttl":{deprecatedKeyName:"dns_AFSDB_ttl",validationRegex:null,deprecated:!1},"dns.APL":{deprecatedKeyName:"dns_APL",validationRegex:null,deprecated:!1},"dns.APL.ttl":{deprecatedKeyName:"dns_APL_ttl",validationRegex:null,deprecated:!1},"dns.CAA":{deprecatedKeyName:"dns_CAA",validationRegex:null,deprecated:!1},"dns.CAA.ttl":{deprecatedKeyName:"dns_CAA_ttl",validationRegex:null,deprecated:!1},"dns.CDNSKEY":{deprecatedKeyName:"dns_CDNSKEY",validationRegex:null,deprecated:!1},"dns.CDNSKEY.ttl":{deprecatedKeyName:"dns_CDNSKEY_ttl",validationRegex:null,deprecated:!1},"dns.CDS":{deprecatedKeyName:"dns_CDS",validationRegex:null,deprecated:!1},"dns.CDS.ttl":{deprecatedKeyName:"dns_CDS_ttl",validationRegex:null,deprecated:!1},"dns.CERT":{deprecatedKeyName:"dns_CERT",validationRegex:null,deprecated:!1},"dns.CERT.ttl":{deprecatedKeyName:"dns_CERT_ttl",validationRegex:null,deprecated:!1},"dns.CNAME":{deprecatedKeyName:"dns_CNAME",validationRegex:null,deprecated:!1},"dns.CNAME.ttl":{deprecatedKeyName:"dns_CNAME_ttl",validationRegex:null,deprecated:!1},"dns.CSYNC":{deprecatedKeyName:"dns_CSYNC",validationRegex:null,deprecated:!1},"dns.CSYNC.ttl":{deprecatedKeyName:"dns_CSYNC_ttl",validationRegex:null,deprecated:!1},"dns.DHCID":{deprecatedKeyName:"dns_DHCID",validationRegex:null,deprecated:!1},"dns.DHCID.ttl":{deprecatedKeyName:"dns_DHCID_ttl",validationRegex:null,deprecated:!1},"dns.DLV":{deprecatedKeyName:"dns_DLV",validationRegex:null,deprecated:!1},"dns.DLV.ttl":{deprecatedKeyName:"dns_DLV_ttl",validationRegex:null,deprecated:!1},"dns.DNAME":{deprecatedKeyName:"dns_DNAME",validationRegex:null,deprecated:!1},"dns.DNAME.ttl":{deprecatedKeyName:"dns_DNAME_ttl",validationRegex:null,deprecated:!1},"dns.DNSKEY":{deprecatedKeyName:"dns_DNSKEY",validationRegex:null,deprecated:!1},"dns.DNSKEY.ttl":{deprecatedKeyName:"dns_DNSKEY_ttl",validationRegex:null,deprecated:!1},"dns.DS":{deprecatedKeyName:"dns_DS",validationRegex:null,deprecated:!1},"dns.DS.ttl":{deprecatedKeyName:"dns_DS_ttl",validationRegex:null,deprecated:!1},"dns.EUI48":{deprecatedKeyName:"dns_EUI48",validationRegex:null,deprecated:!1},"dns.EUI48.ttl":{deprecatedKeyName:"dns_EUI48_ttl",validationRegex:null,deprecated:!1},"dns.EUI64":{deprecatedKeyName:"dns_EUI64",validationRegex:null,deprecated:!1},"dns.EUI64.ttl":{deprecatedKeyName:"dns_EUI64_ttl",validationRegex:null,deprecated:!1},"dns.HINFO":{deprecatedKeyName:"dns_HINFO",validationRegex:null,deprecated:!1},"dns.HINFO.ttl":{deprecatedKeyName:"dns_HINFO_ttl",validationRegex:null,deprecated:!1},"dns.HIP":{deprecatedKeyName:"dns_HIP",validationRegex:null,deprecated:!1},"dns.HIP.ttl":{deprecatedKeyName:"dns_HIP_ttl",validationRegex:null,deprecated:!1},"dns.HTTPS":{deprecatedKeyName:"dns_HTTPS",validationRegex:null,deprecated:!1},"dns.HTTPS.ttl":{deprecatedKeyName:"dns_HTTPS_ttl",validationRegex:null,deprecated:!1},"dns.IPSECKEY":{deprecatedKeyName:"dns_IPSECKEY",validationRegex:null,deprecated:!1},"dns.IPSECKEY.ttl":{deprecatedKeyName:"dns_IPSECKEY_ttl",validationRegex:null,deprecated:!1},"dns.KEY":{deprecatedKeyName:"dns_KEY",validationRegex:null,deprecated:!1},"dns.KEY.ttl":{deprecatedKeyName:"dns_KEY_ttl",validationRegex:null,deprecated:!1},"dns.KX":{deprecatedKeyName:"dns_KX",validationRegex:null,deprecated:!1},"dns.KX.ttl":{deprecatedKeyName:"dns_KX_ttl",validationRegex:null,deprecated:!1},"dns.LOC":{deprecatedKeyName:"dns_LOC",validationRegex:null,deprecated:!1},"dns.LOC.ttl":{deprecatedKeyName:"dns_LOC_ttl",validationRegex:null,deprecated:!1},"dns.MX":{deprecatedKeyName:"dns_MX",validationRegex:null,deprecated:!1},"dns.MX.ttl":{deprecatedKeyName:"dns_MX_ttl",validationRegex:null,deprecated:!1},"dns.NAPTR":{deprecatedKeyName:"dns_NAPTR",validationRegex:null,deprecated:!1},"dns.NAPTR.ttl":{deprecatedKeyName:"dns_NAPTR_ttl",validationRegex:null,deprecated:!1},"dns.NS":{deprecatedKeyName:"dns_NS",validationRegex:null,deprecated:!1},"dns.NS.ttl":{deprecatedKeyName:"dns_NS_ttl",validationRegex:null,deprecated:!1},"dns.NSEC":{deprecatedKeyName:"dns_NSEC",validationRegex:null,deprecated:!1},"dns.NSEC.ttl":{deprecatedKeyName:"dns_NSEC_ttl",validationRegex:null,deprecated:!1},"dns.NSEC3":{deprecatedKeyName:"dns_NSEC3",validationRegex:null,deprecated:!1},"dns.NSEC3.ttl":{deprecatedKeyName:"dns_NSEC3_ttl",validationRegex:null,deprecated:!1},"dns.NSEC3PARAM":{deprecatedKeyName:"dns_NSEC3PARAM",validationRegex:null,deprecated:!1},"dns.NSEC3PARAM.ttl":{deprecatedKeyName:"dns_NSEC3PARAM_ttl",validationRegex:null,deprecated:!1},"dns.OPENPGPKEY":{deprecatedKeyName:"dns_OPENPGPKEY",validationRegex:null,deprecated:!1},"dns.OPENPGPKEY.ttl":{deprecatedKeyName:"dns_OPENPGPKEY_ttl",validationRegex:null,deprecated:!1},"dns.PTR":{deprecatedKeyName:"dns_PTR",validationRegex:null,deprecated:!1},"dns.PTR.ttl":{deprecatedKeyName:"dns_PTR_ttl",validationRegex:null,deprecated:!1},"dns.RP":{deprecatedKeyName:"dns_RP",validationRegex:null,deprecated:!1},"dns.RP.ttl":{deprecatedKeyName:"dns_RP_ttl",validationRegex:null,deprecated:!1},"dns.RRSIG":{deprecatedKeyName:"dns_RRSIG",validationRegex:null,deprecated:!1},"dns.RRSIG.ttl":{deprecatedKeyName:"dns_RRSIG_ttl",validationRegex:null,deprecated:!1},"dns.SIG":{deprecatedKeyName:"dns_SIG",validationRegex:null,deprecated:!1},"dns.SIG.ttl":{deprecatedKeyName:"dns_SIG_ttl",validationRegex:null,deprecated:!1},"dns.SMIMEA":{deprecatedKeyName:"dns_SMIMEA",validationRegex:null,deprecated:!1},"dns.SMIMEA.ttl":{deprecatedKeyName:"dns_SMIMEA_ttl",validationRegex:null,deprecated:!1},"dns.SOA":{deprecatedKeyName:"dns_SOA",validationRegex:null,deprecated:!1},"dns.SOA.ttl":{deprecatedKeyName:"dns_SOA_ttl",validationRegex:null,deprecated:!1},"dns.SRV":{deprecatedKeyName:"dns_SRV",validationRegex:null,deprecated:!1},"dns.SRV.ttl":{deprecatedKeyName:"dns_SRV_ttl",validationRegex:null,deprecated:!1},"dns.SSHFP":{deprecatedKeyName:"dns_SSHFP",validationRegex:null,deprecated:!1},"dns.SSHFP.ttl":{deprecatedKeyName:"dns_SSHFP_ttl",validationRegex:null,deprecated:!1},"dns.SVCB":{deprecatedKeyName:"dns_SVCB",validationRegex:null,deprecated:!1},"dns.SVCB.ttl":{deprecatedKeyName:"dns_SVCB_ttl",validationRegex:null,deprecated:!1},"dns.TA":{deprecatedKeyName:"dns_TA",validationRegex:null,deprecated:!1},"dns.TA.ttl":{deprecatedKeyName:"dns_TA_ttl",validationRegex:null,deprecated:!1},"dns.TKEY":{deprecatedKeyName:"dns_TKEY",validationRegex:null,deprecated:!1},"dns.TKEY.ttl":{deprecatedKeyName:"dns_TKEY_ttl",validationRegex:null,deprecated:!1},"dns.TLSA":{deprecatedKeyName:"dns_TLSA",validationRegex:null,deprecated:!1},"dns.TLSA.ttl":{deprecatedKeyName:"dns_TLSA_ttl",validationRegex:null,deprecated:!1},"dns.TSIG":{deprecatedKeyName:"dns_TSIG",validationRegex:null,deprecated:!1},"dns.TSIG.ttl":{deprecatedKeyName:"dns_TSIG_ttl",validationRegex:null,deprecated:!1},"dns.TXT":{deprecatedKeyName:"dns_TXT",validationRegex:null,deprecated:!1},"dns.TXT.ttl":{deprecatedKeyName:"dns_TXT_ttl",validationRegex:null,deprecated:!1},"dns.URI":{deprecatedKeyName:"dns_URI",validationRegex:null,deprecated:!1},"dns.URI.ttl":{deprecatedKeyName:"dns_URI_ttl",validationRegex:null,deprecated:!1},"dns.ZONEMD":{deprecatedKeyName:"dns_ZONEMD",validationRegex:null,deprecated:!1},"dns.ZONEMD.ttl":{deprecatedKeyName:"dns_ZONEMD_ttl",validationRegex:null,deprecated:!1},"crypto.DOT.address":{deprecatedKeyName:"DOT",validationRegex:"^1[a-zA-Z0-9]*$",deprecated:!1},"crypto.UNI.version.ERC20.address":{deprecatedKeyName:"UNI_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.UNI.version.BEP20.address":{deprecatedKeyName:"UNI_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.UNI.version.MATIC.address":{deprecatedKeyName:"UNI_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.UNI.version.HRC20.address":{deprecatedKeyName:"UNI_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.UNI.version.XDAI.address":{deprecatedKeyName:"UNI_XDAI",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.SOL.address":{deprecatedKeyName:"SOL",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.BUSD.version.ERC20.address":{deprecatedKeyName:"BUSD_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.BUSD.version.BEP20.address":{deprecatedKeyName:"BUSD_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.BUSD.version.HRC20.address":{deprecatedKeyName:"BUSD_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.ICP.address":{deprecatedKeyName:"ICP",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.THETA.address":{deprecatedKeyName:"THETA",validationRegex:"^0x[a-zA-Z0-9]*$",deprecated:!1},"crypto.WBTC.version.ERC20.address":{deprecatedKeyName:"WBTC_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.WBTC.version.MATIC.address":{deprecatedKeyName:"WBTC_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.WBTC.version.FANTOM.address":{deprecatedKeyName:"WBTC_FANTOM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.WBTC.version.HRC20.address":{deprecatedKeyName:"WBTC_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.WBTC.version.XDAI.address":{deprecatedKeyName:"WBTC_XDAI",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.FIL.address":{deprecatedKeyName:"FIL",validationRegex:"^f[a-zA-Z0-9]*$",deprecated:!1},"crypto.CDAI.address":{deprecatedKeyName:"CDAI",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.KSM.address":{deprecatedKeyName:"KSM",validationRegex:"^[CDEFGHJ][a-zA-Z0-9]*$",deprecated:!1},"crypto.OKB.address":{deprecatedKeyName:"OKB",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.AAVE.version.ERC20.address":{deprecatedKeyName:"AAVE_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.AAVE.version.MATIC.address":{deprecatedKeyName:"AAVE_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.AAVE.version.FANTOM.address":{deprecatedKeyName:"AAVE_FANTOM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.AAVE.version.HRC20.address":{deprecatedKeyName:"AAVE_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.BLOCKS.address":{deprecatedKeyName:"BLOCKS",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SHIB.version.ERC20.address":{deprecatedKeyName:"SHIB_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SHIB.version.MATIC.address":{deprecatedKeyName:"SHIB_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.SHIB.version.FANTOM.address":{deprecatedKeyName:"SHIB_FANTOM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.CEL.version.ERC20.address":{deprecatedKeyName:"CEL_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CEL.version.MATIC.address":{deprecatedKeyName:"CEL_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.CEL.version.FANTOM.address":{deprecatedKeyName:"CEL_FANTOM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.CEL.version.HRC20.address":{deprecatedKeyName:"CEL_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CUSDC.address":{deprecatedKeyName:"CUSDC",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CETH.address":{deprecatedKeyName:"CETH",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.AMP.address":{deprecatedKeyName:"AMP",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CAKE.version.BEP20.address":{deprecatedKeyName:"CAKE_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CAKE.version.HRC20.address":{deprecatedKeyName:"CAKE_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MIOTA.address":{deprecatedKeyName:"MIOTA",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.FTT.address":{deprecatedKeyName:"FTT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MKR.address":{deprecatedKeyName:"MKR",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.TFUEL.address":{deprecatedKeyName:"TFUEL",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.KLAY.address":{deprecatedKeyName:"KLAY",validationRegex:"^0x[a-zA-Z0-9]*$",deprecated:!1},"crypto.LUNA.address":{deprecatedKeyName:"LUNA",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.AVAX.address":{deprecatedKeyName:"AVAX",validationRegex:"^0x[a-zA-Z0-9]*$",deprecated:!1},"crypto.LEO.address":{deprecatedKeyName:"LEO",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SAFEMOON.version.BEP20.address":{deprecatedKeyName:"SAFEMOON_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SAFEMOON.version.HRC20.address":{deprecatedKeyName:"SAFEMOON_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.UST.address":{deprecatedKeyName:"UST",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.RUNE.address":{deprecatedKeyName:"RUNE",validationRegex:"^thor[a-zA-HJ-NP-Z0-9]{39}$",deprecated:!1},"crypto.HBAR.address":{deprecatedKeyName:"HBAR",validationRegex:"^(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))(?:-([a-z]{5}))?$",deprecated:!1},"crypto.TEL.version.ERC20.address":{deprecatedKeyName:"TEL_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.TEL.version.MATIC.address":{deprecatedKeyName:"TEL_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.CHZ.address":{deprecatedKeyName:"CHZ",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SUSHI.version.ERC20.address":{deprecatedKeyName:"SUSHI_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SUSHI.version.BEP20.address":{deprecatedKeyName:"SUSHI_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SUSHI.version.MATIC.address":{deprecatedKeyName:"SUSHI_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.SUSHI.version.FANTOM.address":{deprecatedKeyName:"SUSHI_FANTOM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.SUSHI.version.HRC20.address":{deprecatedKeyName:"SUSHI_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.EGLD.address":{deprecatedKeyName:"EGLD",validationRegex:"^erd[a-zA-Z0-9]{59}$",deprecated:!1},"crypto.TUSD.version.ERC20.address":{deprecatedKeyName:"TUSD_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.TUSD.version.BEP20.address":{deprecatedKeyName:"TUSD_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.TUSD.version.AVAX.address":{deprecatedKeyName:"TUSD_AVAX",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.TUSD.version.HRC20.address":{deprecatedKeyName:"TUSD_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.TUSD.version.BEP2.address":{deprecatedKeyName:"TUSD_BEP2",validationRegex:"^(bnb|tbnb)[a-zA-HJ-NP-Z0-9]{39}$",deprecated:!1},"crypto.TUSD.version.TRON.address":{deprecatedKeyName:"TUSD_TRON",validationRegex:"^[T][a-zA-HJ-NP-Z0-9]{33}$",deprecated:!1},"crypto.HBTC.version.ERC20.address":{deprecatedKeyName:"HBTC_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.HBTC.version.HRC20.address":{deprecatedKeyName:"HBTC_HRC20",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.SNX.version.ERC20.address":{deprecatedKeyName:"SNX_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SNX.version.MATIC.address":{deprecatedKeyName:"SNX_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.SNX.version.FANTOM.address":{deprecatedKeyName:"SNX_FANTOM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.SNX.version.HRC20.address":{deprecatedKeyName:"SNX_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.HOT.version.ERC20.address":{deprecatedKeyName:"HOT_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.HOT.version.HRC20.address":{deprecatedKeyName:"HOT_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.NEAR.address":{deprecatedKeyName:"NEAR",validationRegex:"^((([a-z\\d]+[\\-_])*[a-z\\d]+\\.)*([a-z\\d]+[\\-_])*[a-z\\d]+)|([a-f0-9]{64})$",deprecated:!1},"crypto.HNT.address":{deprecatedKeyName:"HNT",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.STETH.address":{deprecatedKeyName:"STETH",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.NEXO.version.ERC20.address":{deprecatedKeyName:"NEXO_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.NEXO.version.FANTOM.address":{deprecatedKeyName:"NEXO_FANTOM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.PAX.address":{deprecatedKeyName:"PAX",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.STX.address":{deprecatedKeyName:"STX",validationRegex:"^SP[A-Z0-9]{38,39}$",deprecated:!1},"crypto.MANA.version.ERC20.address":{deprecatedKeyName:"MANA_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MANA.version.MATIC.address":{deprecatedKeyName:"MANA_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.MDX.version.HRC20.address":{deprecatedKeyName:"MDX_HRC20",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.MDX.version.BEP20.address":{deprecatedKeyName:"MDX_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.ZEN.address":{deprecatedKeyName:"ZEN",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.ARRR.address":{deprecatedKeyName:"ARRR",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.BNT.address":{deprecatedKeyName:"BNT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.LUSD.version.ERC20.address":{deprecatedKeyName:"LUSD_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.LUSD.version.MATIC.address":{deprecatedKeyName:"LUSD_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.GRT.version.ERC20.address":{deprecatedKeyName:"GRT_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.GRT.version.MATIC.address":{deprecatedKeyName:"GRT_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.GRT.version.HRC20.address":{deprecatedKeyName:"GRT_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SC.address":{deprecatedKeyName:"SC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.HUSD.version.ERC20.address":{deprecatedKeyName:"HUSD_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.HUSD.version.HRC20.address":{deprecatedKeyName:"HUSD_HRC20",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.CRV.version.ERC20.address":{deprecatedKeyName:"CRV_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CRV.version.MATIC.address":{deprecatedKeyName:"CRV_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.CRV.version.FANTOM.address":{deprecatedKeyName:"CRV_FANTOM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.UMA.address":{deprecatedKeyName:"UMA",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.WRX.version.BEP2.address":{deprecatedKeyName:"WRX_BEP2",validationRegex:"^(bnb|tbnb)[a-zA-HJ-NP-Z0-9]{39}$",deprecated:!1},"crypto.WRX.version.MATIC.address":{deprecatedKeyName:"WRX_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.AR.address":{deprecatedKeyName:"AR",validationRegex:"^[a-zA-Z0-9-_]{43}$",deprecated:!1},"crypto.OMG.address":{deprecatedKeyName:"OMG",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.GT.address":{deprecatedKeyName:"GT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.QNT.address":{deprecatedKeyName:"QNT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CHSB.address":{deprecatedKeyName:"CHSB",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.IOST.address":{deprecatedKeyName:"IOST",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.NXM.address":{deprecatedKeyName:"NXM",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.KCS.address":{deprecatedKeyName:"KCS",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.LPT.version.ERC20.address":{deprecatedKeyName:"LPT_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.LPT.version.HRC20.address":{deprecatedKeyName:"LPT_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.XSUSHI.address":{deprecatedKeyName:"XSUSHI",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CUSDT.address":{deprecatedKeyName:"CUSDT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.FLOW.address":{deprecatedKeyName:"FLOW",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.ANKR.address":{deprecatedKeyName:"ANKR",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.HBC.address":{deprecatedKeyName:"HBC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.VGX.address":{deprecatedKeyName:"VGX",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.FEI.address":{deprecatedKeyName:"FEI",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.BAKE.version.BEP20.address":{deprecatedKeyName:"BAKE_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.BAKE.version.HRC20.address":{deprecatedKeyName:"BAKE_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.1INCH.version.ERC20.address":{deprecatedKeyName:"1INCH_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.1INCH.version.BEP20.address":{deprecatedKeyName:"1INCH_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.1INCH.version.MATIC.address":{deprecatedKeyName:"1INCH_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.1INCH.version.HRC20.address":{deprecatedKeyName:"1INCH_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CKB.address":{deprecatedKeyName:"CKB",validationRegex:"^ckb1q[a-zA-Z0-9]*$",deprecated:!1},"crypto.WOO.version.ERC20.address":{deprecatedKeyName:"WOO_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.WOO.version.HRC20.address":{deprecatedKeyName:"WOO_HRC20",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.TITAN.address":{deprecatedKeyName:"TITAN",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.OMI.address":{deprecatedKeyName:"OMI",validationRegex:"^0x[a-zA-Z0-9]*$",deprecated:!1},"crypto.MINA.address":{deprecatedKeyName:"MINA",validationRegex:"^B62[a-zA-Z0-9]*$",deprecated:!1},"crypto.SETH.address":{deprecatedKeyName:"SETH",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.RSR.address":{deprecatedKeyName:"RSR",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.OXY.version.SOLANA.address":{deprecatedKeyName:"OXY_SOLANA",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.OXY.version.ERC20.address":{deprecatedKeyName:"OXY_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.REN.version.ERC20.address":{deprecatedKeyName:"REN_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.REN.version.HRC20.address":{deprecatedKeyName:"REN_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.XCH.address":{deprecatedKeyName:"XCH",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.RENBTC.version.ERC20.address":{deprecatedKeyName:"RENBTC_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.RENBTC.version.BEP20.address":{deprecatedKeyName:"RENBTC_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.RENBTC.version.HRC20.address":{deprecatedKeyName:"RENBTC_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.USDN.address":{deprecatedKeyName:"USDN",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.BCHA.address":{deprecatedKeyName:"BCHA",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.LRC.address":{deprecatedKeyName:"LRC",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.PUNDIX.address":{deprecatedKeyName:"PUNDIX",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.ERG.address":{deprecatedKeyName:"ERG",validationRegex:"^[a-zA-Z0-9]{51}$",deprecated:!1},"crypto.WIN.address":{deprecatedKeyName:"WIN",validationRegex:"^[T][a-zA-HJ-NP-Z0-9]{33}$",deprecated:!1},"crypto.NPXS.address":{deprecatedKeyName:"NPXS",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.TRIBE.address":{deprecatedKeyName:"TRIBE",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MAID.address":{deprecatedKeyName:"MAID",validationRegex:"^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$",deprecated:!1},"crypto.ASD.address":{deprecatedKeyName:"ASD",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CUNI.address":{deprecatedKeyName:"CUNI",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CELO.address":{deprecatedKeyName:"CELO",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.DENT.address":{deprecatedKeyName:"DENT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SNT.address":{deprecatedKeyName:"SNT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.FEG.version.ERC20.address":{deprecatedKeyName:"FEG_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.FEG.version.HRC20.address":{deprecatedKeyName:"FEG_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SKL.address":{deprecatedKeyName:"SKL",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.ALUSD.address":{deprecatedKeyName:"ALUSD",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MIR.version.ERC20.address":{deprecatedKeyName:"MIR_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MIR.version.BEP20.address":{deprecatedKeyName:"MIR_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.GLM.address":{deprecatedKeyName:"GLM",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.PAXG.version.ERC20.address":{deprecatedKeyName:"PAXG_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.PAXG.version.HRC20.address":{deprecatedKeyName:"PAXG_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CFX.address":{deprecatedKeyName:"CFX",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.UOS.address":{deprecatedKeyName:"UOS",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SVCS.address":{deprecatedKeyName:"SVCS",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.REEF.version.ERC20.address":{deprecatedKeyName:"REEF_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.REEF.version.BEP20.address":{deprecatedKeyName:"REEF_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.REEF.version.HRC20.address":{deprecatedKeyName:"REEF_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.GNO.address":{deprecatedKeyName:"GNO",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.USDP.address":{deprecatedKeyName:"USDP",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.KAVA.address":{deprecatedKeyName:"KAVA",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.ALCX.address":{deprecatedKeyName:"ALCX",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.EWT.address":{deprecatedKeyName:"EWT",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.TON.address":{deprecatedKeyName:"TON",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.RLC.address":{deprecatedKeyName:"RLC",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.AXS.address":{deprecatedKeyName:"AXS",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.AUDIO.address":{deprecatedKeyName:"AUDIO",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.XVS.address":{deprecatedKeyName:"XVS",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.BAND.version.ERC20.address":{deprecatedKeyName:"BAND_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.BAND.version.FANTOM.address":{deprecatedKeyName:"BAND_FANTOM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.NMR.address":{deprecatedKeyName:"NMR",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.INJ.version.ERC20.address":{deprecatedKeyName:"INJ_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.INJ.version.BEP20.address":{deprecatedKeyName:"INJ_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.WAXP.address":{deprecatedKeyName:"WAXP",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.UQC.address":{deprecatedKeyName:"UQC",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.IOTX.address":{deprecatedKeyName:"IOTX",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.FUN.address":{deprecatedKeyName:"FUN",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.OCEAN.address":{deprecatedKeyName:"OCEAN",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SAND.version.ERC20.address":{deprecatedKeyName:"SAND_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SAND.version.HRC20.address":{deprecatedKeyName:"SAND_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CTSI.version.ERC20.address":{deprecatedKeyName:"CTSI_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CTSI.version.BEP20.address":{deprecatedKeyName:"CTSI_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CTSI.version.MATIC.address":{deprecatedKeyName:"CTSI_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.RAY.address":{deprecatedKeyName:"RAY",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.ANC.version.TERRA.address":{deprecatedKeyName:"ANC_TERRA",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.ANC.version.ERC20.address":{deprecatedKeyName:"ANC_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.IQ.version.ERC20.address":{deprecatedKeyName:"IQ_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.IQ.version.BEP20.address":{deprecatedKeyName:"IQ_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.IQ.version.MATIC.address":{deprecatedKeyName:"IQ_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.SUSD.version.ERC20.address":{deprecatedKeyName:"SUSD_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SUSD.version.FANTOM.address":{deprecatedKeyName:"SUSD_FANTOM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.KLV.address":{deprecatedKeyName:"KLV",validationRegex:"^((k|K)(l|L)(v|V))[a-zA-Z0-9]{59}$",deprecated:!1},"crypto.BTCST.address":{deprecatedKeyName:"BTCST",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.TLM.address":{deprecatedKeyName:"TLM",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.AKT.address":{deprecatedKeyName:"AKT",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.STMX.address":{deprecatedKeyName:"STMX",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.PROM.address":{deprecatedKeyName:"PROM",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.XPRT.address":{deprecatedKeyName:"XPRT",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.SRM.version.ERC20.address":{deprecatedKeyName:"SRM_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SRM.version.SOLANA.address":{deprecatedKeyName:"SRM_SOLANA",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.RPL.address":{deprecatedKeyName:"RPL",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.AGIX.address":{deprecatedKeyName:"AGIX",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CELR.address":{deprecatedKeyName:"CELR",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.FET.address":{deprecatedKeyName:"FET",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!0},"crypto.FET.version.ERC20.address":{deprecatedKeyName:"FET_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.FET.version.FETCHAI.address":{deprecatedKeyName:"FET_FETCHAI",validationRegex:"^fetch[a-zA-Z0-9]{39}$",deprecated:!1},"crypto.OXT.address":{deprecatedKeyName:"OXT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.ARDR.address":{deprecatedKeyName:"ARDR",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.MATH.address":{deprecatedKeyName:"MATH",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.10SET.address":{deprecatedKeyName:"10SET",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.POLY.address":{deprecatedKeyName:"POLY",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.GUSD.address":{deprecatedKeyName:"GUSD",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.NKN.address":{deprecatedKeyName:"NKN",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CVC.address":{deprecatedKeyName:"CVC",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.GTC.address":{deprecatedKeyName:"GTC",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.STEEM.address":{deprecatedKeyName:"STEEM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.ORN.address":{deprecatedKeyName:"ORN",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.KEEP.version.ERC20.address":{deprecatedKeyName:"KEEP_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.KEEP.version.HRC20.address":{deprecatedKeyName:"KEEP_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.HXRO.address":{deprecatedKeyName:"HXRO",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.ORBS.address":{deprecatedKeyName:"ORBS",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.ALPHA.version.ERC20.address":{deprecatedKeyName:"ALPHA_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.ALPHA.version.BEP20.address":{deprecatedKeyName:"ALPHA_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MCONTENT.version.ERC20.address":{deprecatedKeyName:"MCONTENT_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MCONTENT.version.BEP20.address":{deprecatedKeyName:"MCONTENT_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.DODO.version.ERC20.address":{deprecatedKeyName:"DODO_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.DODO.version.BEP20.address":{deprecatedKeyName:"DODO_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.OGN.address":{deprecatedKeyName:"OGN",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.KNCL.version.ERC20.address":{deprecatedKeyName:"KNCL_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.KNCL.version.FANTOM.address":{deprecatedKeyName:"KNCL_FANTOM",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.KNCL.version.HRC20.address":{deprecatedKeyName:"KNCL_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MED.address":{deprecatedKeyName:"MED",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.XAUT.address":{deprecatedKeyName:"XAUT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.VLX.address":{deprecatedKeyName:"VLX",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.PHA.address":{deprecatedKeyName:"PHA",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.KOBE.address":{deprecatedKeyName:"KOBE",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.PERP.address":{deprecatedKeyName:"PERP",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.XHV.address":{deprecatedKeyName:"XHV",validationRegex:"^hv[a-zA-Z0-9]*$",deprecated:!1},"crypto.META.address":{deprecatedKeyName:"META",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SEUR.address":{deprecatedKeyName:"SEUR",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.MONA.address":{deprecatedKeyName:"MONA",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.ANT.address":{deprecatedKeyName:"ANT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.HYDRA.address":{deprecatedKeyName:"HYDRA",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.ZKS.address":{deprecatedKeyName:"ZKS",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SXP.version.ERC20.address":{deprecatedKeyName:"SXP_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SXP.version.BEP20.address":{deprecatedKeyName:"SXP_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SXP.version.HRC20.address":{deprecatedKeyName:"SXP_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.CSPR.address":{deprecatedKeyName:"CSPR",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.MTL.address":{deprecatedKeyName:"MTL",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.NU.address":{deprecatedKeyName:"NU",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.ZMT.address":{deprecatedKeyName:"ZMT",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.LOC.address":{deprecatedKeyName:"LOC",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.TKO.address":{deprecatedKeyName:"TKO",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.ETN.address":{deprecatedKeyName:"ETN",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.UBT.version.ERC20.address":{deprecatedKeyName:"UBT_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.UBT.version.MATIC.address":{deprecatedKeyName:"UBT_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.EXRD.address":{deprecatedKeyName:"EXRD",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.NMX.address":{deprecatedKeyName:"NMX",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.RIF.address":{deprecatedKeyName:"RIF",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.STORJ.version.ERC20.address":{deprecatedKeyName:"STORJ_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.STORJ.version.HRC20.address":{deprecatedKeyName:"STORJ_HRC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.AVA.address":{deprecatedKeyName:"AVA",validationRegex:"^(bnb|tbnb)[a-zA-HJ-NP-Z0-9]{39}$",deprecated:!1},"crypto.DPI.version.ERC20.address":{deprecatedKeyName:"DPI_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.DPI.version.MATIC.address":{deprecatedKeyName:"DPI_MATIC",validationRegex:"^[a-zA-Z0-9]*$",deprecated:!1},"crypto.DOG.version.MATIC.address":{deprecatedKeyName:"DOG_MATIC",validationRegex:null,deprecated:!1},"crypto.DOG.version.BEP20.address":{deprecatedKeyName:"DOG_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.DOG.version.ERC20.address":{deprecatedKeyName:"DOG_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.DOG.version.AETH.address":{deprecatedKeyName:"DOG_AETH",validationRegex:null,deprecated:!1},"crypto.DOG.version.OP.address":{deprecatedKeyName:"DOG_OP",validationRegex:null,deprecated:!1},"crypto.GALA.version.ERC20.address":{deprecatedKeyName:"GALA_ERC20",validationRegex:"^0x[a-zA-Z0-9]{40}$",deprecated:!1},"crypto.GALA.version.BEP20.address":{deprecatedKeyName:"GALA_BEP20",validationRegex:"^0x[a-zA-Z0-9]{40}$",deprecated:!1},"crypto.MOBX.address":{deprecatedKeyName:"MOBX",validationRegex:"^fetch[a-zA-Z0-9]{39}$",deprecated:!1},"crypto.FAB.address":{deprecatedKeyName:"FAB",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{34}$"},"crypto.BEAM.address":{deprecatedKeyName:"BEAM",deprecated:!1,validationRegex:null},"crypto.DESO.address":{deprecatedKeyName:"DESO",deprecated:!1,validationRegex:"^[a-zA-Z0-9]{54,55}$"},"crypto.FLR.address":{deprecatedKeyName:"FLR",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.SGB.address":{deprecatedKeyName:"SGB",deprecated:!1,validationRegex:"^0x[a-fA-F0-9]{40}$"},"crypto.0ZK.version.ERC20.address":{deprecatedKeyName:"0ZK_ERC20",validationRegex:"(^0zk1)([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{52})([qzyxg2vwsj5kc6u7])(unpd9kxwatwq)([qpzry9x8])([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{57})",deprecated:!1},"crypto.0ZK.version.BEP20.address":{deprecatedKeyName:"0ZK_BEP20",validationRegex:"(^0zk1)([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{52})([qzyxg2vwsj5kc6u7])(unpd9kxwatw8)([qpzry9x8])([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{57})",deprecated:!1},"crypto.0ZK.version.MATIC.address":{deprecatedKeyName:"0ZK_MATIC",validationRegex:"(^0zk1)([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{52})([qzyxg2vwsj5kc6u7])(unpd9kxwatw3)([qpzry9x8])([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{57})",deprecated:!1},"crypto.0ZK.version.0ZK.address":{deprecatedKeyName:"0ZK_0ZK",validationRegex:"(^0zk1)([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{52})([pr98ftd03n4hemal])(rv7j6fe3z53l)([ce6mua7l])([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{57})",deprecated:!1},"crypto.SUI.address":{deprecatedKeyName:"SUI",validationRegex:"^0x([0-9a-fA-F]{64}|[a-fA-F0-9]{40})$",deprecated:!1},"crypto.MOON.address":{deprecatedKeyName:"MOON",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SWEAT.version.ERC20.address":{deprecatedKeyName:"SWEAT_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.SWEAT.version.NEP-141.address":{deprecatedKeyName:"SWEAT_NEP-141",validationRegex:"^([a-f0-9]{64})|([a-z\\d_-]{2,59}\\.near)$",deprecated:!1},"crypto.POKT.address":{deprecatedKeyName:"POKT",validationRegex:"^[0-9a-fA-F]{40}$",deprecated:!1},"crypto.KAI.address":{deprecatedKeyName:"KAI",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.XLA.address":{deprecatedKeyName:"XLA",validationRegex:"^(S|Ss)+([1-9A-HJ-NP-Za-km-z]{96})$",deprecated:!1},"crypto.APT.address":{deprecatedKeyName:"APT",validationRegex:"^0x[a-f0-9]{64}$",deprecated:!1},"crypto.GTH.address":{deprecatedKeyName:"GTH",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.HI.version.ERC20.address":{deprecatedKeyName:"HI_ERC20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.HI.version.BEP20.address":{deprecatedKeyName:"HI_BEP20",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.VERSE.address":{deprecatedKeyName:"VERSE",validationRegex:"^0x[a-fA-F0-9]{40}$",deprecated:!1},"crypto.NIBI.address":{deprecatedKeyName:"NIBI",validationRegex:"^nibi1[a-z0-9]{38}$",deprecated:!1}},require$$11={version,information,keys};var __extends$1=commonjsGlobal&&commonjsGlobal.__extends||function(){var c=function(t,n){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ie,fe){ie.__proto__=fe}||function(ie,fe){for(var ae in fe)Object.prototype.hasOwnProperty.call(fe,ae)&&(ie[ae]=fe[ae])},c(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");c(t,n);function ie(){this.constructor=t}t.prototype=n===null?Object.create(n):(ie.prototype=n.prototype,new ie)}}(),__assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(c){for(var t,n=1,ie=arguments.length;n<ie;n++){t=arguments[n];for(var fe in t)Object.prototype.hasOwnProperty.call(t,fe)&&(c[fe]=t[fe])}return c},__assign.apply(this,arguments)},__createBinding$4=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$4=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar$4=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding$4(t,c,n);return __setModuleDefault$4(t,c),t},__awaiter$3=commonjsGlobal&&commonjsGlobal.__awaiter||function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function he(xe){try{me(ie.next(xe))}catch(Ee){le(Ee)}}function ye(xe){try{me(ie.throw(xe))}catch(Ee){le(Ee)}}function me(xe){xe.done?ae(xe.value):fe(xe.value).then(he,ye)}me((ie=ie.apply(c,t||[])).next())})},__generator$3=commonjsGlobal&&commonjsGlobal.__generator||function(c,t){var n={label:0,sent:function(){if(ae[0]&1)throw ae[1];return ae[1]},trys:[],ops:[]},ie,fe,ae,le;return le={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(le[Symbol.iterator]=function(){return this}),le;function he(me){return function(xe){return ye([me,xe])}}function ye(me){if(ie)throw new TypeError("Generator is already executing.");for(;n;)try{if(ie=1,fe&&(ae=me[0]&2?fe.return:me[0]?fe.throw||((ae=fe.return)&&ae.call(fe),0):fe.next)&&!(ae=ae.call(fe,me[1])).done)return ae;switch(fe=0,ae&&(me=[me[0]&2,ae.value]),me[0]){case 0:case 1:ae=me;break;case 4:return n.label++,{value:me[1],done:!1};case 5:n.label++,fe=me[1],me=[0];continue;case 7:me=n.ops.pop(),n.trys.pop();continue;default:if(ae=n.trys,!(ae=ae.length>0&&ae[ae.length-1])&&(me[0]===6||me[0]===2)){n=0;continue}if(me[0]===3&&(!ae||me[1]>ae[0]&&me[1]<ae[3])){n.label=me[1];break}if(me[0]===6&&n.label<ae[1]){n.label=ae[1],ae=me;break}if(ae&&n.label<ae[2]){n.label=ae[2],n.ops.push(me);break}ae[2]&&n.ops.pop(),n.trys.pop();continue}me=t.call(c,n)}catch(xe){me=[6,xe],fe=0}finally{ie=ae=0}if(me[0]&5)throw me[1];return{value:me[0]?me[1]:void 0,done:!0}}},__asyncValues=commonjsGlobal&&commonjsGlobal.__asyncValues||function(c){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=c[Symbol.asyncIterator],n;return t?t.call(c):(c=typeof __values=="function"?__values(c):c[Symbol.iterator](),n={},ie("next"),ie("throw"),ie("return"),n[Symbol.asyncIterator]=function(){return this},n);function ie(ae){n[ae]=c[ae]&&function(le){return new Promise(function(he,ye){le=c[ae](le),fe(he,ye,le.done,le.value)})}}function fe(ae,le,he,ye){Promise.resolve(ye).then(function(me){ae({value:me,done:he})},le)}},__spreadArray$1=commonjsGlobal&&commonjsGlobal.__spreadArray||function(c,t,n){if(n||arguments.length===2)for(var ie=0,fe=t.length,ae;ie<fe;ie++)(ae||!(ie in t))&&(ae||(ae=Array.prototype.slice.call(t,0,ie)),ae[ie]=t[ie]);return c.concat(ae||Array.prototype.slice.call(t))},__importDefault$2=commonjsGlobal&&commonjsGlobal.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(Uns$1,"__esModule",{value:!0});var types_1=types$3,resolutionError_1$4=__importStar$4(resolutionError),utils_1$2=utils$d,publicTypes_1$3=publicTypes,TwitterSignatureValidator_1$1=TwitterSignatureValidator,FetchProvider_1=__importDefault$2(FetchProvider$1),namehash_1$2=namehash,NamingService_1$1=NamingService$1,configurationError_1$2=__importStar$4(configurationError),UnsInternal_1=__importDefault$2(UnsInternal$1),Networking_1$2=__importDefault$2(Networking$1),resolver_keys_json_1=__importDefault$2(require$$11),ensureValidSourceConfig=function(c){var t;if(!c.locations||!c.locations.Layer1||!c.locations.Layer2)throw new configurationError_1$2.default(configurationError_1$2.ConfigurationErrorCode.NetworkConfigMissing,{method:publicTypes_1$3.NamingServiceName.UNS,config:!((t=c==null?void 0:c.locations)===null||t===void 0)&&t.Layer1?"Layer2":"Layer1"});var n=c.locations.Layer1;if(!n.url&&!n.provider)throw new configurationError_1$2.default(configurationError_1$2.ConfigurationErrorCode.NetworkConfigMissing,{method:publicTypes_1$3.NamingServiceName.UNS,config:"Layer1.url"});var ie=c.locations.Layer2;if(!ie.url&&!ie.provider)throw new configurationError_1$2.default(configurationError_1$2.ConfigurationErrorCode.NetworkConfigMissing,{method:publicTypes_1$3.NamingServiceName.UNS,config:"Layer2.url"})},Uns=function(c){__extends$1(t,c);function t(n){var ie=this,fe,ae;return ie=c.call(this)||this,ie.name=publicTypes_1$3.NamingServiceName.UNS,n?ensureValidSourceConfig(n):n={locations:{Layer1:{url:"",network:"mainnet"},Layer2:{url:"",network:"polygon-mainnet"}}},ie.unsl1=new UnsInternal_1.default(publicTypes_1$3.UnsLocation.Layer1,n.locations.Layer1,(fe=n.locations.Layer1.blockchain)!==null&&fe!==void 0?fe:publicTypes_1$3.BlockchainType.ETH),ie.unsl2=new UnsInternal_1.default(publicTypes_1$3.UnsLocation.Layer2,n.locations.Layer2,(ae=n.locations.Layer2.blockchain)!==null&&ae!==void 0?ae:publicTypes_1$3.BlockchainType.POL),ie}return t.autoNetwork=function(n){return __awaiter$3(this,void 0,void 0,function(){var ie,fe,ae,le,he,ye;return __generator$3(this,function(me){switch(me.label){case 0:if((0,types_1.hasProvider)(n.locations.Layer1)&&(0,types_1.hasProvider)(n.locations.Layer2))ie=n.locations.Layer1.provider,fe=n.locations.Layer2.provider;else{if(!n.locations.Layer1.url||!n.locations.Layer2.url)throw new configurationError_1$2.default(configurationError_1$2.ConfigurationErrorCode.UnspecifiedUrl,{method:publicTypes_1$3.NamingServiceName.UNS});ie=FetchProvider_1.default.factory(publicTypes_1$3.NamingServiceName.UNS,n.locations.Layer1.url),fe=FetchProvider_1.default.factory(publicTypes_1$3.NamingServiceName.UNS,n.locations.Layer2.url)}return[4,ie.request({method:"net_version"})];case 1:return ae=me.sent(),[4,fe.request({method:"net_version"})];case 2:if(le=me.sent(),he=utils_1$2.EthereumNetworksInverted[ae],ye=utils_1$2.EthereumNetworksInverted[le],!he||!types_1.UnsSupportedNetwork.guard(he)||!ye||!types_1.UnsSupportedNetwork.guard(ye))throw new configurationError_1$2.default(configurationError_1$2.ConfigurationErrorCode.UnsupportedNetwork,{method:publicTypes_1$3.NamingServiceName.UNS});return[2,new this({locations:{Layer1:{network:he,provider:ie},Layer2:{network:ye,provider:fe}}})]}})})},t.prototype.namehash=function(n){if(!this.checkDomain(n))throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.UnsupportedDomain,{domain:n});return(0,namehash_1$2.eip137Namehash)(n)},t.prototype.childhash=function(n,ie){return(0,namehash_1$2.eip137Childhash)(n,ie)},t.prototype.isSupportedDomain=function(n){return __awaiter$3(this,void 0,void 0,function(){var ie,fe,ae,le;return __generator$3(this,function(he){switch(he.label){case 0:return this.checkDomain(n)?(ie=n.split(".").pop(),ie?[4,Promise.all([this.unsl1.exists(ie),this.unsl2.exists(ie)])]:[2,!1]):[2,!1];case 1:return fe=he.sent(),ae=fe[0],le=fe[1],[2,ae||le]}})})},t.prototype.owner=function(n){return __awaiter$3(this,void 0,void 0,function(){var ie,fe;return __generator$3(this,function(ae){switch(ae.label){case 0:return ie=this.namehash(n),[4,this.get(ie,[])];case 1:if(fe=ae.sent(),(0,utils_1$2.isNullAddress)(fe.owner))throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.UnregisteredDomain,{domain:n});return[2,fe.owner]}})})},t.prototype.resolver=function(n){return __awaiter$3(this,void 0,void 0,function(){return __generator$3(this,function(ie){switch(ie.label){case 0:return[4,this.getVerifiedData(n)];case 1:return[2,ie.sent().resolver]}})})},t.prototype.record=function(n,ie){return __awaiter$3(this,void 0,void 0,function(){var fe;return __generator$3(this,function(ae){switch(ae.label){case 0:return[4,this.records(n,[ie])];case 1:if(fe=ae.sent()[ie],!fe)throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.RecordNotFound,{recordName:ie,domain:n});return[2,fe]}})})},t.prototype.records=function(n,ie){return __awaiter$3(this,void 0,void 0,function(){return __generator$3(this,function(fe){switch(fe.label){case 0:return[4,this.getVerifiedData(n,ie)];case 1:return[2,fe.sent().records]}})})},t.prototype.allRecords=function(n){return __awaiter$3(this,void 0,void 0,function(){return __generator$3(this,function(ie){return[2,this.records(n,__spreadArray$1([],Object.keys(resolver_keys_json_1.default.keys),!0))]})})},t.prototype.twitter=function(n){return __awaiter$3(this,void 0,void 0,function(){var ie,fe,ae,le,he,ye,me,xe;return __generator$3(this,function(Ee){switch(Ee.label){case 0:return ie=this.namehash(n),fe=["validation.social.twitter.username","social.twitter.username"],[4,this.getVerifiedData(n,fe)];case 1:if(ae=Ee.sent(),le=ae.records,he=ae.location,ye=le["validation.social.twitter.username"],me=le["social.twitter.username"],(0,utils_1$2.isNullAddress)(ye))throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.RecordNotFound,{domain:n,location:he,recordName:"validation.social.twitter.username"});if(!me)throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.RecordNotFound,{domain:n,location:he,recordName:"social.twitter.username"});if(xe=ae.owner,!(0,TwitterSignatureValidator_1$1.isValidTwitterSignature)({tokenId:ie,owner:xe,twitterHandle:me,validationSignature:ye}))throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.InvalidTwitterVerification,{domain:n});return[2,me]}})})},t.prototype.reverse=function(n,ie){return __awaiter$3(this,void 0,void 0,function(){return __generator$3(this,function(fe){throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.UnsupportedMethod,{methodName:"reverse"})})})},t.prototype.isRegistered=function(n){return __awaiter$3(this,void 0,void 0,function(){var ie,fe;return __generator$3(this,function(ae){switch(ae.label){case 0:return ie=this.namehash(n),[4,this.get(ie,[])];case 1:return fe=ae.sent(),[2,!(0,utils_1$2.isNullAddress)(fe.owner)]}})})},t.prototype.getTokenUri=function(n){var ie,fe;return __awaiter$3(this,void 0,void 0,function(){var ae,le,he,ye,me,xe=this;return __generator$3(this,function(Ee){switch(Ee.label){case 0:Ee.trys.push([0,5,6,11]),ae=__asyncValues([(0,utils_1$2.wrapResult)(function(){return xe.unsl2.getTokenUri(n)}),(0,utils_1$2.wrapResult)(function(){return xe.unsl1.getTokenUri(n)})]),Ee.label=1;case 1:return[4,ae.next()];case 2:if(le=Ee.sent(),!!le.done)return[3,4];if(he=le.value,ye=(0,utils_1$2.unwrapResult)(he),ye)return[2,ye];Ee.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return me=Ee.sent(),ie={error:me},[3,11];case 6:return Ee.trys.push([6,,9,10]),le&&!le.done&&(fe=ae.return)?[4,fe.call(ae)]:[3,8];case 7:Ee.sent(),Ee.label=8;case 8:return[3,10];case 9:if(ie)throw ie.error;return[7];case 10:return[7];case 11:throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.UnregisteredDomain,{domain:"with tokenId ".concat(n)})}})})},t.prototype.isAvailable=function(n){return __awaiter$3(this,void 0,void 0,function(){return __generator$3(this,function(ie){switch(ie.label){case 0:return[4,this.isRegistered(n)];case 1:return[2,!ie.sent()]}})})},t.prototype.registryAddress=function(n){return __awaiter$3(this,void 0,void 0,function(){var ie,fe,ae;return __generator$3(this,function(le){switch(le.label){case 0:return[4,Promise.all([this.unsl1.registryAddress(n).catch(function(he){return he}),this.unsl2.registryAddress(n).catch(function(he){return he})])];case 1:if(ie=le.sent(),fe=ie[0],ae=ie[1],ae instanceof Error)validResolutionErrorOrThrow(ae,resolutionError_1$4.ResolutionErrorCode.UnregisteredDomain);else if(!(0,utils_1$2.isNullAddress)(ae))return[2,ae];return[2,validResultOrThrow(fe)]}})})},t.prototype.locations=function(n){return __awaiter$3(this,void 0,void 0,function(){var ie,fe,ae,le;return __generator$3(this,function(he){switch(he.label){case 0:return[4,Promise.all([this.unsl1.locations(n),this.unsl2.locations(n)])];case 1:return ie=he.sent(),fe=ie[0],ae=ie[1],le=Object.keys(ae).filter(function(ye){return ae[ye]!=null}).reduce(function(ye,me){var xe;return __assign(__assign({},ye),(xe={},xe[me]=ae[me],xe))},{}),[2,__assign(__assign({},fe),le)]}})})},t.prototype.reverseOf=function(n,ie){return __awaiter$3(this,void 0,void 0,function(){var fe,ae,le,he,ye,me,xe;return __generator$3(this,function(Ee){switch(Ee.label){case 0:return[4,Promise.all([this.unsl1.reverseOf(n).catch(function(Se){return Se}),this.unsl2.reverseOf(n).catch(function(Se){return Se})])];case 1:return fe=Ee.sent(),ae=fe[0],le=fe[1],he=function(){return validResultOrThrow(ae),ae._hex!=="0x00"?(0,namehash_1$2.fromHexStringToDecimals)(ae._hex):null},ye=function(){return validResultOrThrow(le),le._hex!=="0x00"?(0,namehash_1$2.fromHexStringToDecimals)(le._hex):null},ie===publicTypes_1$3.UnsLocation.Layer1?[2,he()]:ie===publicTypes_1$3.UnsLocation.Layer2?[2,ye()]:(me=he(),me?[2,me]:(xe=ye(),xe?[2,xe]:[2,null]))}})})},t.prototype.getAddress=function(n,ie,fe){return __awaiter$3(this,void 0,void 0,function(){var ae,le,he,ye,me,xe,Ee;return __generator$3(this,function(Se){switch(Se.label){case 0:return ie=ie.toUpperCase(),fe=fe.toUpperCase(),[4,Promise.all([this.unsl1.getAddress(n,ie,fe).catch(function(Me){return Me}),this.unsl2.getAddress(n,ie,fe).catch(function(Me){return Me})])];case 1:return ae=Se.sent(),le=ae[0],he=ae[1],ye=function(){return validResultOrThrow(le),le!==""?le:null},me=function(){return validResultOrThrow(he),he!==""?he:null},xe=me(),xe?[2,xe]:(Ee=ye(),Ee?[2,Ee]:[2,null])}})})},t.prototype.getDomainFromTokenId=function(n){return __awaiter$3(this,void 0,void 0,function(){var ie;return __generator$3(this,function(fe){switch(fe.label){case 0:return[4,this.getMetadata(n)];case 1:if(ie=fe.sent(),this.namehash(ie.name)!==n)throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.ServiceProviderError,{methodName:"unhash",domain:ie.name,providerMessage:"Service provider returned an invalid domain name"});return[2,ie.name]}})})},t.prototype.getMetadata=function(n){return __awaiter$3(this,void 0,void 0,function(){var ie,fe,ae;return __generator$3(this,function(le){switch(le.label){case 0:return[4,this.getTokenUri(n)];case 1:return ie=le.sent(),[4,Networking_1$2.default.fetch(ie).catch(function(he){throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.MetadataEndpointError,{tokenUri:ie||"undefined",errorMessage:he.message})})];case 2:if(fe=le.sent(),!fe.ok)throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.MetadataEndpointError,{tokenUri:ie||"undefined"});return[4,fe.json()];case 3:if(ae=le.sent(),!ae.name)throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.UnregisteredDomain,{domain:"with tokenId ".concat(n)});if(this.namehash(ae.name)!==n)throw new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.ServiceProviderError,{methodName:"unhash",domain:ae.name,providerMessage:"Service provider returned an invalid domain name"});return[2,ae]}})})},t.prototype.getVerifiedData=function(n,ie){return __awaiter$3(this,void 0,void 0,function(){var fe,ae;return __generator$3(this,function(le){switch(le.label){case 0:return fe=this.namehash(n),[4,this.get(fe,ie)];case 1:if(ae=le.sent(),(0,utils_1$2.isNullAddress)(ae.resolver))throw(0,utils_1$2.isNullAddress)(ae.owner)?new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.UnregisteredDomain,{domain:n}):new resolutionError_1$4.default(resolutionError_1$4.ResolutionErrorCode.UnspecifiedResolver,{location:ae.location,domain:n});return[2,ae]}})})},t.prototype.get=function(n,ie){return ie===void 0&&(ie=[]),__awaiter$3(this,void 0,void 0,function(){var fe,ae,le,he,ye,me,xe,Ee,Se;return __generator$3(this,function(Me){switch(Me.label){case 0:return[4,Promise.all([this.unsl1.get(n,ie).catch(function(Be){return Be}),this.unsl2.get(n,ie).catch(function(Be){return Be})])];case 1:return fe=Me.sent(),ae=fe[0],le=fe[1],validResultOrThrow(le),he=le.resolver,ye=le.owner,me=le.records,(0,utils_1$2.isNullAddress)(ye)?(validResultOrThrow(ae),xe=ae.resolver,Ee=ae.owner,Se=ae.records,[2,{resolver:xe,owner:Ee,records:(0,utils_1$2.constructRecords)(ie,Se),location:publicTypes_1$3.UnsLocation.Layer1}]):[2,{resolver:he,owner:ye,records:(0,utils_1$2.constructRecords)(ie,me),location:publicTypes_1$3.UnsLocation.Layer2}]}})})},t.prototype.checkDomain=function(n,ie){if(ie===void 0&&(ie=!1),ie)return!0;var fe=n.split(".");return!!fe.length&&!(n==="eth"||/^[^-]*[^-]*\.(eth|addr\.reverse)$/.test(n))&&fe.every(function(ae){return!!ae.length})},t}(NamingService_1$1.NamingService);Uns$1.default=Uns;function validResultOrThrow(c){if(c instanceof Error)throw c;return c}function validResolutionErrorOrThrow(c,t){if(!(c instanceof resolutionError_1$4.default))throw c;if(c.code===t)return!0;throw c}var UdApi$1={},__extends=commonjsGlobal&&commonjsGlobal.__extends||function(){var c=function(t,n){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ie,fe){ie.__proto__=fe}||function(ie,fe){for(var ae in fe)Object.prototype.hasOwnProperty.call(fe,ae)&&(ie[ae]=fe[ae])},c(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");c(t,n);function ie(){this.constructor=t}t.prototype=n===null?Object.create(n):(ie.prototype=n.prototype,new ie)}}(),__awaiter$2=commonjsGlobal&&commonjsGlobal.__awaiter||function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function he(xe){try{me(ie.next(xe))}catch(Ee){le(Ee)}}function ye(xe){try{me(ie.throw(xe))}catch(Ee){le(Ee)}}function me(xe){xe.done?ae(xe.value):fe(xe.value).then(he,ye)}me((ie=ie.apply(c,t||[])).next())})},__generator$2=commonjsGlobal&&commonjsGlobal.__generator||function(c,t){var n={label:0,sent:function(){if(ae[0]&1)throw ae[1];return ae[1]},trys:[],ops:[]},ie,fe,ae,le;return le={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(le[Symbol.iterator]=function(){return this}),le;function he(me){return function(xe){return ye([me,xe])}}function ye(me){if(ie)throw new TypeError("Generator is already executing.");for(;n;)try{if(ie=1,fe&&(ae=me[0]&2?fe.return:me[0]?fe.throw||((ae=fe.return)&&ae.call(fe),0):fe.next)&&!(ae=ae.call(fe,me[1])).done)return ae;switch(fe=0,ae&&(me=[me[0]&2,ae.value]),me[0]){case 0:case 1:ae=me;break;case 4:return n.label++,{value:me[1],done:!1};case 5:n.label++,fe=me[1],me=[0];continue;case 7:me=n.ops.pop(),n.trys.pop();continue;default:if(ae=n.trys,!(ae=ae.length>0&&ae[ae.length-1])&&(me[0]===6||me[0]===2)){n=0;continue}if(me[0]===3&&(!ae||me[1]>ae[0]&&me[1]<ae[3])){n.label=me[1];break}if(me[0]===6&&n.label<ae[1]){n.label=ae[1],ae=me;break}if(ae&&n.label<ae[2]){n.label=ae[2],n.ops.push(me);break}ae[2]&&n.ops.pop(),n.trys.pop();continue}me=t.call(c,n)}catch(xe){me=[6,xe],fe=0}finally{ie=ae=0}if(me[0]&5)throw me[1];return{value:me[0]?me[1]:void 0,done:!0}}},__importDefault$1=commonjsGlobal&&commonjsGlobal.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(UdApi$1,"__esModule",{value:!0});var znsUtils_1=znsUtils,resolutionError_1$3=resolutionError,TwitterSignatureValidator_1=TwitterSignatureValidator,publicTypes_1$2=publicTypes,Networking_1$1=__importDefault$1(Networking$1),utils_1$1=utils$d,namehash_1$1=namehash,NamingService_1=NamingService$1,UdApi=function(c){__extends(t,c);function t(n){var ie=c.call(this)||this;ie.url=(n==null?void 0:n.url)||"https://unstoppabledomains.com/api/v1";var fe="cross-fetch/4.0.0 (+https://github.com/lquixada/cross-fetch)",ae="".concat(fe," Resolution");return ie.headers={"X-user-agent":ae},ie}return t.prototype.isSupportedDomain=function(n){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(ie){throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.UnsupportedMethod,{methodName:"isSupportedDomain"})})})},t.prototype.namehash=function(n){throw new Error("Unsupported method when using UD Resolution API")},t.prototype.childhash=function(n,ie){throw new Error("Unsupported method when using UD Resolution API")},t.prototype.record=function(n,ie){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(fe){switch(fe.label){case 0:return[4,this.records(n,[ie])];case 1:return[2,fe.sent()[ie]]}})})},t.prototype.records=function(n,ie){return __awaiter$2(this,void 0,void 0,function(){var fe;return __generator$2(this,function(ae){switch(ae.label){case 0:return[4,this.allRecords(n)];case 1:return fe=ae.sent(),[2,(0,utils_1$1.constructRecords)(ie,fe)]}})})},t.prototype.owner=function(n){return __awaiter$2(this,void 0,void 0,function(){var ie,fe,ae,le;return __generator$2(this,function(he){switch(he.label){case 0:return[4,this.resolve(n)];case 1:if(ie=he.sent(),fe=ie.meta,ae=fe.owner,le=fe.blockchain,!ae)throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.UnregisteredDomain,{domain:n});return le===publicTypes_1$2.BlockchainType.ZIL&&!ae.startsWith("zil1")?[2,(0,znsUtils_1.toBech32Address)(ae)]:[2,ae]}})})},t.prototype.twitter=function(n){return __awaiter$2(this,void 0,void 0,function(){var ie,fe,ae,le,he,ye;return __generator$2(this,function(me){switch(me.label){case 0:return[4,(0,utils_1$1.findNamingServiceName)(n)];case 1:if(ie=me.sent(),ie!==publicTypes_1$2.NamingServiceName.UNS)throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.UnsupportedMethod,{domain:n,methodName:"twitter"});return[4,this.resolve(n)];case 2:if(fe=me.sent(),!fe.meta.owner)throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.UnregisteredDomain,{domain:n});if(ae=fe.meta.owner,le=fe.records||{},he=le["validation.social.twitter.username"],ye=le["social.twitter.username"],!he)throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.RecordNotFound,{recordName:"validation.social.twitter.username",domain:n});if(!ye)throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.RecordNotFound,{recordName:"social.twitter.username",domain:n});if(!(0,TwitterSignatureValidator_1.isValidTwitterSignature)({tokenId:fe.meta.namehash,owner:ae,twitterHandle:ye,validationSignature:he}))throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.InvalidTwitterVerification,{domain:n});return[2,ye]}})})},t.prototype.getAddress=function(n,ie,fe){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(ae){throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.UnsupportedMethod,{methodName:"isSupportedDomain"})})})},t.prototype.allRecords=function(n){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(ie){switch(ie.label){case 0:return[4,this.resolve(n)];case 1:return[2,ie.sent().records||{}]}})})},t.prototype.getDomainFromTokenId=function(n){return __awaiter$2(this,void 0,void 0,function(){var ie;return __generator$2(this,function(fe){switch(fe.label){case 0:return n=(0,namehash_1$1.fromDecStringToHex)(n),[4,this.getMetadata(n)];case 1:return ie=fe.sent(),[2,ie.meta.domain]}})})},t.prototype.getMetadata=function(n){return __awaiter$2(this,void 0,void 0,function(){var ie,fe,ae,le;return __generator$2(this,function(he){switch(he.label){case 0:return ie="".concat(this.url,"/").concat(n),[4,Networking_1$1.default.fetch(ie).catch(function(ye){throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.MetadataEndpointError,{tokenUri:ie||"undefined",errorMessage:ye.message})})];case 1:return fe=he.sent(),[4,fe.json()];case 2:if(ae=he.sent(),!ae.meta||!ae.meta.domain)throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.UnregisteredDomain,{domain:"with tokenId ".concat(n)});if(le=ae.meta.blockchain===publicTypes_1$2.BlockchainType.ZIL?(0,namehash_1$1.znsNamehash)(ae.meta.domain):(0,namehash_1$1.eip137Namehash)(ae.meta.domain),le!==n)throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.ServiceProviderError,{methodName:"unhash",domain:ae.meta.domain,providerMessage:"Service provider returned an invalid domain name"});return[2,ae]}})})},t.prototype.resolve=function(n){return __awaiter$2(this,void 0,void 0,function(){var ie;return __generator$2(this,function(fe){switch(fe.label){case 0:return[4,Networking_1$1.default.fetch("".concat(this.url,"/").concat(n),{method:"GET",headers:this.headers})];case 1:return ie=fe.sent(),[2,ie.json()]}})})},t.prototype.resolver=function(n){return __awaiter$2(this,void 0,void 0,function(){var ie;return __generator$2(this,function(fe){switch(fe.label){case 0:return[4,this.resolve(n)];case 1:return ie=fe.sent(),[2,ie.meta.resolver]}})})},t.prototype.reverse=function(n,ie){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(fe){throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.UnsupportedMethod,{methodName:"reverse"})})})},t.prototype.reverseOf=function(n,ie){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(fe){throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.UnsupportedMethod,{methodName:"reverseOf"})})})},t.prototype.isRegistered=function(n){return __awaiter$2(this,void 0,void 0,function(){var ie;return __generator$2(this,function(fe){switch(fe.label){case 0:return[4,this.resolve(n)];case 1:return ie=fe.sent(),[2,!(0,utils_1$1.isNullAddress)(ie.meta.owner)]}})})},t.prototype.getTokenUri=function(n){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(ie){throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.UnsupportedMethod,{methodName:"getTokenUri"})})})},t.prototype.isAvailable=function(n){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(ie){switch(ie.label){case 0:return[4,this.isRegistered(n)];case 1:return[2,!ie.sent()]}})})},t.prototype.registryAddress=function(n){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(ie){throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.UnsupportedMethod,{domain:n,methodName:"registryAddress"})})})},t.prototype.locations=function(n){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(ie){throw new resolutionError_1$3.ResolutionError(resolutionError_1$3.ResolutionErrorCode.UnsupportedMethod,{methodName:"locations"})})})},t}(NamingService_1.NamingService);UdApi$1.default=UdApi;var DnsUtils$1={},dnsRecordsError={};(function(c){var t=commonjsGlobal&&commonjsGlobal.__extends||function(){var le=function(he,ye){return le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(me,xe){me.__proto__=xe}||function(me,xe){for(var Ee in xe)Object.prototype.hasOwnProperty.call(xe,Ee)&&(me[Ee]=xe[Ee])},le(he,ye)};return function(he,ye){if(typeof ye!="function"&&ye!==null)throw new TypeError("Class extends value "+String(ye)+" is not a constructor or null");le(he,ye);function me(){this.constructor=he}he.prototype=ye===null?Object.create(ye):(me.prototype=ye.prototype,new me)}}(),n;Object.defineProperty(c,"__esModule",{value:!0}),c.DnsRecordsError=c.DnsRecordsErrorCode=void 0;var ie;(function(le){le.InconsistentTtl="InconsistentTtl",le.DnsRecordCorrupted="DnsRecordCorrupted"})(ie=c.DnsRecordsErrorCode||(c.DnsRecordsErrorCode={}));var fe=(n={},n[ie.InconsistentTtl]=function(le){return"ttl for record ".concat(le.recordType," is different for other records of the same type")},n[ie.DnsRecordCorrupted]=function(le){return"dns record ".concat(le.recordType," is invalid json-string")},n),ae=function(le){t(he,le);function he(ye,me){me===void 0&&(me={});var xe=this,Ee=fe[ye];return xe=le.call(this,Ee(me))||this,xe.code=ye,xe.name="DnsRecordsError",Object.setPrototypeOf(xe,he.prototype),xe}return he}(Error);c.DnsRecordsError=ae,c.default=ae})(dnsRecordsError);var __createBinding$3=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$3=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar$3=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding$3(t,c,n);return __setModuleDefault$3(t,c),t};Object.defineProperty(DnsUtils$1,"__esModule",{value:!0});var dnsRecordsError_1=__importStar$3(dnsRecordsError),publicTypes_1$1=publicTypes,DnsUtils=function(){function c(){}return c.prototype.toList=function(t){var n,ie=this,fe=this.getAllDnsTypes(t);return(n=[]).concat.apply(n,fe.map(function(ae){return ie.constructDnsRecords(t,ae)}))},c.prototype.toCrypto=function(t){for(var n={},ie=0,fe=t;ie<fe.length;ie++){var ae=fe[ie],le=ae.type,he=ae.TTL,ye=ae.data,me=this.getJsonNumber(n["dns.".concat(le,".ttl")]),xe=this.getJsonArray(n,"dns.".concat(le));if(xe?(xe.push(ye),n["dns.".concat(le)]=JSON.stringify(xe)):(n["dns.".concat(le)]=JSON.stringify([ye]),n["dns.".concat(le,".ttl")]=he.toString(10)),me&&me!==he)throw new dnsRecordsError_1.default(dnsRecordsError_1.DnsRecordsErrorCode.InconsistentTtl,{recordType:le})}return n},c.prototype.protectFromCorruptRecord=function(t,n){try{return t?JSON.parse(t):void 0}catch(ie){throw ie instanceof SyntaxError?new dnsRecordsError_1.default(dnsRecordsError_1.DnsRecordsErrorCode.DnsRecordCorrupted,{recordType:n}):ie}},c.prototype.getJsonArray=function(t,n){var ie=t[n],fe=n.split(".")[1];return this.protectFromCorruptRecord(ie,fe)},c.prototype.getJsonNumber=function(t){return t?parseInt(t,10):void 0},c.prototype.getAllDnsTypes=function(t){var n=new Set;return Object.keys(t).forEach(function(ie){var fe=ie.split("."),ae=fe[1]&&fe[1]!=="ttl";ae&&n.add(publicTypes_1$1.DnsRecordType[fe[1]])}),Array.from(n)},c.prototype.constructDnsRecords=function(t,n){var ie=this.parseTtl(t,n),fe=t["dns.".concat(n)];if(!fe)return[];var ae=this.protectFromCorruptRecord(fe,n);return this.isStringArray(ae)?ae.map(function(le){return{TTL:ie,data:le,type:n}}):[]},c.prototype.parseTtl=function(t,n){var ie=t["dns.ttl"],fe=t["dns.".concat(n,".ttl")];if(fe){var ae=this.parseIfNumber(fe);if(ae)return ae}if(ie){var ae=this.parseIfNumber(ie);if(ae)return ae}return c.DefaultTtl},c.prototype.parseIfNumber=function(t){var n=parseInt(t,10);if(!isNaN(n))return n},c.prototype.isStringArray=function(t){return t instanceof Array?t.every(function(n){return typeof n=="string"}):!1},c.DefaultTtl=300,c}();DnsUtils$1.default=DnsUtils;var Eip1993Factories={},__createBinding$2=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$2=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar$2=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding$2(t,c,n);return __setModuleDefault$2(t,c),t},__awaiter$1=commonjsGlobal&&commonjsGlobal.__awaiter||function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function he(xe){try{me(ie.next(xe))}catch(Ee){le(Ee)}}function ye(xe){try{me(ie.throw(xe))}catch(Ee){le(Ee)}}function me(xe){xe.done?ae(xe.value):fe(xe.value).then(he,ye)}me((ie=ie.apply(c,t||[])).next())})},__generator$1=commonjsGlobal&&commonjsGlobal.__generator||function(c,t){var n={label:0,sent:function(){if(ae[0]&1)throw ae[1];return ae[1]},trys:[],ops:[]},ie,fe,ae,le;return le={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(le[Symbol.iterator]=function(){return this}),le;function he(me){return function(xe){return ye([me,xe])}}function ye(me){if(ie)throw new TypeError("Generator is already executing.");for(;n;)try{if(ie=1,fe&&(ae=me[0]&2?fe.return:me[0]?fe.throw||((ae=fe.return)&&ae.call(fe),0):fe.next)&&!(ae=ae.call(fe,me[1])).done)return ae;switch(fe=0,ae&&(me=[me[0]&2,ae.value]),me[0]){case 0:case 1:ae=me;break;case 4:return n.label++,{value:me[1],done:!1};case 5:n.label++,fe=me[1],me=[0];continue;case 7:me=n.ops.pop(),n.trys.pop();continue;default:if(ae=n.trys,!(ae=ae.length>0&&ae[ae.length-1])&&(me[0]===6||me[0]===2)){n=0;continue}if(me[0]===3&&(!ae||me[1]>ae[0]&&me[1]<ae[3])){n.label=me[1];break}if(me[0]===6&&n.label<ae[1]){n.label=ae[1],ae=me;break}if(ae&&n.label<ae[2]){n.label=ae[2],n.ops.push(me);break}ae[2]&&n.ops.pop(),n.trys.pop();continue}me=t.call(c,n)}catch(xe){me=[6,xe],fe=0}finally{ie=ae=0}if(me[0]&5)throw me[1];return{value:me[0]?me[1]:void 0,done:!0}}},__spreadArray=commonjsGlobal&&commonjsGlobal.__spreadArray||function(c,t,n){if(n||arguments.length===2)for(var ie=0,fe=t.length,ae;ie<fe;ie++)(ae||!(ie in t))&&(ae||(ae=Array.prototype.slice.call(t,0,ie)),ae[ie]=t[ie]);return c.concat(ae||Array.prototype.slice.call(t))};Object.defineProperty(Eip1993Factories,"__esModule",{value:!0});Eip1993Factories.Eip1993Factories=void 0;var configurationError_1$1=configurationError,resolutionError_1$2=__importStar$2(resolutionError);Eip1993Factories.Eip1993Factories={fromWeb3Version0Provider,fromWeb3Version1Provider,fromEthersProvider,fromZilliqaProvider};function fromWeb3Version0Provider(c){if(c.sendAsync===void 0)throw new configurationError_1$1.ConfigurationError(configurationError_1$1.ConfigurationErrorCode.IncorrectProvider);return{request:function(t){return new Promise(function(n,ie){c.sendAsync({jsonrpc:"2.0",method:t.method,params:wrapArray(t.params),id:1},function(fe,ae){fe&&ie(fe),ae.error&&ie(new resolutionError_1$2.default(resolutionError_1$2.ResolutionErrorCode.ServiceProviderError,{providerMessage:ae.error})),n(ae.result)})})}}}function fromWeb3Version1Provider(c){if(c&&c.send===void 0)throw new configurationError_1$1.ConfigurationError(configurationError_1$1.ConfigurationErrorCode.IncorrectProvider);return{request:function(t){return new Promise(function(n,ie){c.send({jsonrpc:"2.0",method:t.method,params:wrapArray(t.params),id:1},function(fe,ae){fe&&ie(fe),ae.error&&ie(new resolutionError_1$2.default(resolutionError_1$2.ResolutionErrorCode.ServiceProviderError,{providerMessage:ae.error})),n(ae.result)})})}}}function fromEthersProvider(c){var t=this;if(c.call===void 0)throw new configurationError_1$1.ConfigurationError(configurationError_1$1.ConfigurationErrorCode.IncorrectProvider);return{request:function(n){return __awaiter$1(t,void 0,void 0,function(){var ie,fe;return __generator$1(this,function(ae){switch(ae.label){case 0:switch(ae.trys.push([0,7,,8]),ie=n.method,ie){case"eth_call":return[3,1];case"eth_getLogs":return[3,3]}return[3,5];case 1:return[4,c.call(n.params[0])];case 2:return[2,ae.sent()];case 3:return[4,c.getLogs(n.params[0])];case 4:return[2,ae.sent()];case 5:throw new resolutionError_1$2.default(resolutionError_1$2.ResolutionErrorCode.ServiceProviderError,{providerMessage:"Unsupported provider method ".concat(n.method)});case 6:return[3,8];case 7:throw fe=ae.sent(),new resolutionError_1$2.default(resolutionError_1$2.ResolutionErrorCode.ServiceProviderError,{providerMessage:fe.message});case 8:return[2]}})})}}}function fromZilliqaProvider(c){var t=this;if(c.middleware===void 0||c.send===void 0)throw new configurationError_1$1.ConfigurationError(configurationError_1$1.ConfigurationErrorCode.IncorrectProvider);return{request:function(n){return __awaiter$1(t,void 0,void 0,function(){var ie,fe;return __generator$1(this,function(ae){switch(ae.label){case 0:return ae.trys.push([0,2,,3]),[4,c.send.apply(c,__spreadArray([n.method],n.params||[],!1))];case 1:if(ie=ae.sent(),ie.error)throw new Error(ie.error.message);return[2,ie.result];case 2:throw fe=ae.sent(),new resolutionError_1$2.default(resolutionError_1$2.ResolutionErrorCode.ServiceProviderError,{providerMessage:fe.message});case 3:return[2]}})})}}}function wrapArray(c){return c===void 0&&(c=[]),c instanceof Array?c:[c]}var prepareAndValidate={},__createBinding$1=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$1=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar$1=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding$1(t,c,n);return __setModuleDefault$1(t,c),t};Object.defineProperty(prepareAndValidate,"__esModule",{value:!0});prepareAndValidate.prepareAndValidateDomain=void 0;var resolutionError_1$1=__importStar$1(resolutionError),reg=RegExp("^[.a-z0-9-]+$");function prepareAndValidateDomain(c){var t=c?c.trim().toLowerCase():"";if(!reg.test(t))throw new resolutionError_1$1.default(resolutionError_1$1.ResolutionErrorCode.InvalidDomainAddress,{domain:c});return t}prepareAndValidate.prepareAndValidateDomain=prepareAndValidateDomain;var __createBinding=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding(t,c,n);return __setModuleDefault(t,c),t},__awaiter=commonjsGlobal&&commonjsGlobal.__awaiter||function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function he(xe){try{me(ie.next(xe))}catch(Ee){le(Ee)}}function ye(xe){try{me(ie.throw(xe))}catch(Ee){le(Ee)}}function me(xe){xe.done?ae(xe.value):fe(xe.value).then(he,ye)}me((ie=ie.apply(c,t||[])).next())})},__generator=commonjsGlobal&&commonjsGlobal.__generator||function(c,t){var n={label:0,sent:function(){if(ae[0]&1)throw ae[1];return ae[1]},trys:[],ops:[]},ie,fe,ae,le;return le={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(le[Symbol.iterator]=function(){return this}),le;function he(me){return function(xe){return ye([me,xe])}}function ye(me){if(ie)throw new TypeError("Generator is already executing.");for(;n;)try{if(ie=1,fe&&(ae=me[0]&2?fe.return:me[0]?fe.throw||((ae=fe.return)&&ae.call(fe),0):fe.next)&&!(ae=ae.call(fe,me[1])).done)return ae;switch(fe=0,ae&&(me=[me[0]&2,ae.value]),me[0]){case 0:case 1:ae=me;break;case 4:return n.label++,{value:me[1],done:!1};case 5:n.label++,fe=me[1],me=[0];continue;case 7:me=n.ops.pop(),n.trys.pop();continue;default:if(ae=n.trys,!(ae=ae.length>0&&ae[ae.length-1])&&(me[0]===6||me[0]===2)){n=0;continue}if(me[0]===3&&(!ae||me[1]>ae[0]&&me[1]<ae[3])){n.label=me[1];break}if(me[0]===6&&n.label<ae[1]){n.label=ae[1],ae=me;break}if(ae&&n.label<ae[2]){n.label=ae[2],n.ops.push(me);break}ae[2]&&n.ops.pop(),n.trys.pop();continue}me=t.call(c,n)}catch(xe){me=[6,xe],fe=0}finally{ie=ae=0}if(me[0]&5)throw me[1];return{value:me[0]?me[1]:void 0,done:!0}}},__importDefault=commonjsGlobal&&commonjsGlobal.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(Resolution$1,"__esModule",{value:!0});Resolution$1.Resolution=void 0;var bn_js_1=__importDefault(bnExports$2),Ens_1=__importDefault(Ens$1),Zns_1=__importDefault(Zns$1),Uns_1=__importDefault(Uns$1),UdApi_1=__importDefault(UdApi$1),publicTypes_1=publicTypes,resolutionError_1=__importStar(resolutionError),DnsUtils_1=__importDefault(DnsUtils$1),utils_1=utils$d,Eip1993Factories_1=Eip1993Factories,configurationError_1=__importDefault(configurationError),configurationError_2=configurationError,Networking_1=__importDefault(Networking$1),prepareAndValidate_1=prepareAndValidate,namehash_1=namehash,DEFAULT_UNS_PROXY_SERVICE_URL="https://api.unstoppabledomains.com/resolve",Resolution=function(){function c(t){var n;t===void 0&&(t={});var ie=this.getUnsConfig(t),fe=this.getUnsBaseConfig(t),ae=this.getZnsConfig(t),le=this.getEnsConfig(t),he=ie instanceof UdApi_1.default&&ae instanceof UdApi_1.default&&ie.url===ae.url;this.serviceMap=(n={},n[publicTypes_1.NamingServiceName.UNS]={usedServices:[ie],native:ie instanceof Uns_1.default?ie:new Uns_1.default},n[publicTypes_1.NamingServiceName.ZNS]={usedServices:he?[ie]:[ie,ae],native:ae instanceof Zns_1.default?ae:new Zns_1.default},n[publicTypes_1.NamingServiceName.ENS]={usedServices:[le],native:le instanceof Ens_1.default?le:new Ens_1.default},n),fe&&(this.serviceMap[publicTypes_1.NamingServiceName.UNS_BASE]={usedServices:[fe],native:fe instanceof Uns_1.default?fe:new Uns_1.default})}return c.prototype.getService=function(t){var n=this.serviceMap[t];if(!n)throw new configurationError_1.default(configurationError_2.ConfigurationErrorCode.NetworkConfigMissing,{method:t,config:t===publicTypes_1.NamingServiceName.UNS_BASE?"sourceConfig.uns.base":"sourceConfig.".concat(t.toLowerCase())});return n},c.autoNetwork=function(t){return __awaiter(this,void 0,void 0,function(){var n,ie,fe;return __generator(this,function(ae){switch(ae.label){case 0:if(n=new this,!t.uns&&!t.ens)throw new configurationError_1.default(configurationError_2.ConfigurationErrorCode.UnsupportedNetwork);return t.uns?[4,Uns_1.default.autoNetwork(t.uns)]:[3,2];case 1:ie=ae.sent(),n.serviceMap[publicTypes_1.NamingServiceName.UNS]={usedServices:[ie],native:ie},ae.label=2;case 2:return t.ens?[4,Ens_1.default.autoNetwork(t.ens)]:[3,4];case 3:fe=ae.sent(),n.serviceMap[publicTypes_1.NamingServiceName.ENS]={usedServices:[fe],native:fe},ae.label=4;case 4:return[2,n]}})})},c.infura=function(t,n){var ie,fe,ae,le,he,ye;return new this({sourceConfig:{ens:{url:(0,utils_1.signedInfuraLink)(t,(ie=n==null?void 0:n.ens)===null||ie===void 0?void 0:ie.network),network:((fe=n==null?void 0:n.ens)===null||fe===void 0?void 0:fe.network)||"mainnet"},uns:{locations:{Layer1:{url:(0,utils_1.signedLink)(t,((ae=n==null?void 0:n.uns)===null||ae===void 0?void 0:ae.locations.Layer1.network)||"mainnet","infura"),network:((le=n==null?void 0:n.uns)===null||le===void 0?void 0:le.locations.Layer1.network)||"mainnet"},Layer2:{url:(0,utils_1.signedLink)(t,((he=n==null?void 0:n.uns)===null||he===void 0?void 0:he.locations.Layer2.network)||"polygon-mainnet","infura"),network:((ye=n==null?void 0:n.uns)===null||ye===void 0?void 0:ye.locations.Layer2.network)||"polygon-mainnet"}}}}})},c.alchemy=function(t,n){var ie,fe,ae,le;return new this({sourceConfig:{uns:{locations:{Layer1:{url:(0,utils_1.signedLink)(t,((ie=n==null?void 0:n.uns)===null||ie===void 0?void 0:ie.locations.Layer1.network)||"mainnet"),network:((fe=n==null?void 0:n.uns)===null||fe===void 0?void 0:fe.locations.Layer1.network)||"mainnet"},Layer2:{url:(0,utils_1.signedLink)(t,((ae=n==null?void 0:n.uns)===null||ae===void 0?void 0:ae.locations.Layer2.network)||"polygon-mainnet"),network:((le=n==null?void 0:n.uns)===null||le===void 0?void 0:le.locations.Layer2.network)||"polygon-mainnet"}}}}})},c.fromResolutionProvider=function(t){if(t.ens||t.uns)return this.fromEthereumEip1193Provider({ens:t.ens,uns:t.uns});if(t.zns)return this.fromZilliqaProvider(t.zns.provider,t);throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.ServiceProviderError,{providerMessage:"Must specify network for uns, ens, or zns"})},c.fromEthereumEip1193Provider=function(t){var n,ie={};return t.ens&&(ie.ens={provider:t.ens.provider,network:((n=t==null?void 0:t.ens)===null||n===void 0?void 0:n.network)||"mainnet"}),t.uns&&(ie.uns={locations:{Layer1:{provider:t.uns.locations.Layer1.provider,network:t.uns.locations.Layer1.network||"mainnet"},Layer2:{provider:t.uns.locations.Layer2.provider,network:t.uns.locations.Layer2.network||"polygon-mainnet"}}}),new this({sourceConfig:ie})},c.fromZilliqaProvider=function(t,n){var ie;return new this({sourceConfig:{zns:{provider:t,network:((ie=n==null?void 0:n.zns)===null||ie===void 0?void 0:ie.network)||"mainnet"}}})},c.fromWeb3Version0Provider=function(t){return this.fromEthereumEip1193Provider({ens:t.ens?{network:t.ens.network,provider:Eip1993Factories_1.Eip1993Factories.fromWeb3Version0Provider(t.ens.provider)}:void 0,uns:t.uns?{locations:{Layer1:{network:t.uns.locations.Layer1.network,provider:Eip1993Factories_1.Eip1993Factories.fromWeb3Version0Provider(t.uns.locations.Layer1.provider)},Layer2:{network:t.uns.locations.Layer2.network,provider:Eip1993Factories_1.Eip1993Factories.fromWeb3Version0Provider(t.uns.locations.Layer2.provider)}}}:void 0})},c.fromWeb3Version1Provider=function(t){return this.fromEthereumEip1193Provider({ens:t.ens?{network:t.ens.network,provider:Eip1993Factories_1.Eip1993Factories.fromWeb3Version1Provider(t.ens.provider)}:void 0,uns:t.uns?{locations:{Layer1:{network:t.uns.locations.Layer1.network,provider:Eip1993Factories_1.Eip1993Factories.fromWeb3Version1Provider(t.uns.locations.Layer1.provider)},Layer2:{network:t.uns.locations.Layer2.network,provider:Eip1993Factories_1.Eip1993Factories.fromWeb3Version1Provider(t.uns.locations.Layer2.provider)}}}:void 0})},c.fromEthersProvider=function(t){return this.fromEthereumEip1193Provider({ens:t.ens?{network:t.ens.network,provider:Eip1993Factories_1.Eip1993Factories.fromEthersProvider(t.ens.provider)}:void 0,uns:t.uns?{locations:{Layer1:{network:t.uns.locations.Layer1.network,provider:Eip1993Factories_1.Eip1993Factories.fromEthersProvider(t.uns.locations.Layer1.provider)},Layer2:{network:t.uns.locations.Layer2.network,provider:Eip1993Factories_1.Eip1993Factories.fromEthersProvider(t.uns.locations.Layer2.provider)}}}:void 0})},c.prototype.addr=function(t,n){return __awaiter(this,void 0,void 0,function(){var ie=this;return __generator(this,function(fe){switch(fe.label){case 0:return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[4,this.callServiceForDomain(t,function(ae){return __awaiter(ie,void 0,void 0,function(){return __generator(this,function(le){switch(le.label){case 0:return ae instanceof Ens_1.default?[4,ae.addr(t,n)]:[3,2];case 1:return[2,le.sent()];case 2:return[4,this.record(t,"crypto.".concat(n.toUpperCase(),".address"))];case 3:return[2,le.sent()]}})})})];case 1:return[2,fe.sent()]}})})},c.prototype.multiChainAddr=function(t,n,ie){return __awaiter(this,void 0,void 0,function(){var fe,ae=this;return __generator(this,function(le){return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),fe="crypto.".concat(n.toUpperCase(),".version.").concat(ie.toUpperCase(),".address"),[2,this.callServiceForDomain(t,function(he){return __awaiter(ae,void 0,void 0,function(){return __generator(this,function(ye){switch(ye.label){case 0:if(he instanceof Ens_1.default)throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.UnsupportedMethod,{methodName:"multiChainAddr",domain:t,method:he.name});return[4,he.record(t,fe)];case 1:return[2,ye.sent()]}})})})]})})},c.prototype.twitter=function(t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[2,this.callServiceForDomain(t,function(ie){return ie.twitter(t)})]})})},c.prototype.chatId=function(t){return __awaiter(this,void 0,void 0,function(){var n;return __generator(this,function(ie){switch(ie.label){case 0:return ie.trys.push([0,2,,3]),[4,this.record(t,"gundb.username.value")];case 1:return[2,ie.sent()];case 2:throw n=ie.sent(),n.code===resolutionError_1.ResolutionErrorCode.RecordNotFound?new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.RecordNotFound,{domain:t,method:n.method,methodName:"chatId",recordName:n.recordName}):n;case 3:return[2]}})})},c.prototype.chatPk=function(t){return __awaiter(this,void 0,void 0,function(){var n;return __generator(this,function(ie){switch(ie.label){case 0:return ie.trys.push([0,2,,3]),[4,this.record(t,"gundb.public_key.value")];case 1:return[2,ie.sent()];case 2:throw n=ie.sent(),n.code===resolutionError_1.ResolutionErrorCode.RecordNotFound?new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.RecordNotFound,{domain:t,method:n.method,methodName:"chatId",recordName:n.recordName}):n;case 3:return[2]}})})},c.prototype.ipfsHash=function(t){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(ie){switch(ie.label){case 0:return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[4,this.callServiceForDomain(t,function(fe){return __awaiter(n,void 0,void 0,function(){var ae;return __generator(this,function(le){switch(le.label){case 0:return fe instanceof Ens_1.default?[4,fe.record(t,"contenthash")]:[3,2];case 1:return ae=le.sent(),[2,"ipfs://".concat(ae)];case 2:return[4,this.getPreferableNewRecord(t,"dweb.ipfs.hash","ipfs.html.value")];case 3:return[2,le.sent()]}})})})];case 1:return[2,ie.sent()]}})})},c.prototype.httpUrl=function(t){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(ie){switch(ie.label){case 0:return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[4,this.callServiceForDomain(t,function(fe){return __awaiter(n,void 0,void 0,function(){return __generator(this,function(ae){switch(ae.label){case 0:return fe instanceof Ens_1.default?[4,fe.record(t,"url")]:[3,2];case 1:return[2,ae.sent()];case 2:return[4,this.getPreferableNewRecord(t,"browser.redirect_url","ipfs.redirect_domain.value")];case 3:return[2,ae.sent()]}})})})];case 1:return[2,ie.sent()]}})})},c.prototype.email=function(t){return __awaiter(this,void 0,void 0,function(){var n,ie,fe;return __generator(this,function(ae){switch(ae.label){case 0:return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),n="whois.email.value",[4,(0,utils_1.findNamingServiceName)(t)];case 1:ie=ae.sent(),ie==="ENS"&&(n="email"),ae.label=2;case 2:return ae.trys.push([2,4,,5]),[4,this.record(t,n)];case 3:return[2,ae.sent()];case 4:throw fe=ae.sent(),new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.RecordNotFound,{domain:t,method:fe.method,methodName:"email",recordName:fe.recordName});case 5:return[2]}})})},c.prototype.resolver=function(t){return __awaiter(this,void 0,void 0,function(){var n;return __generator(this,function(ie){switch(ie.label){case 0:return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[4,this.callServiceForDomain(t,function(fe){return fe.resolver(t)})];case 1:if(n=ie.sent(),!n)throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.UnspecifiedResolver,{domain:t});return[2,n]}})})},c.prototype.owner=function(t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[2,this.callServiceForDomain(t,function(ie){return ie.owner(t)})]})})},c.prototype.getAddress=function(t,n,ie){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(fe){return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[2,this.callServiceForDomain(t,function(ae){return ae.getAddress(t,n,ie)})]})})},c.prototype.record=function(t,n){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(ie){return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[2,this.callServiceForDomain(t,function(fe){return fe.record(t,n)})]})})},c.prototype.records=function(t,n){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(ie){return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[2,this.callServiceForDomain(t,function(fe){return fe.records(t,n)})]})})},c.prototype.isRegistered=function(t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[2,this.callServiceForDomainBoolean(t,function(ie){return ie.isRegistered(t)},{throwIfUnsupportedDomain:!0,expectedValue:!0})]})})},c.prototype.isAvailable=function(t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[2,this.callServiceForDomainBoolean(t,function(ie){return ie.isAvailable(t)},{throwIfUnsupportedDomain:!0,expectedValue:!1})]})})},c.prototype.namehash=function(t,n,ie){ie===void 0&&(ie=publicTypes_1.NamehashOptionsDefault);var fe=this.getService(n);if(!fe)throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.UnsupportedService,{namingService:n});return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),this.formatNamehash(fe.native.namehash(t),ie)},c.prototype.childhash=function(t,n,ie,fe){fe===void 0&&(fe=publicTypes_1.NamehashOptionsDefault);try{var ae=this.getService(ie);return this.formatNamehash(ae.native.childhash(t,n),fe)}catch(le){throw le instanceof configurationError_1.default&&le.code===configurationError_2.ConfigurationErrorCode.NetworkConfigMissing?new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.UnsupportedService,{namingService:ie}):le}},c.prototype.formatNamehash=function(t,n){return t=t.replace("0x",""),n.format==="dec"?new bn_js_1.default(t,"hex").toString(10):n.prefix?"0x"+t:t},c.prototype.isValidHash=function(t,n,ie){var fe=this.getService(ie);if(!fe)throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.UnsupportedService,{namingService:ie});return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),fe.native.namehash(t)===n},c.prototype.isSupportedDomain=function(t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[2,this.callServiceForDomainBoolean(t,function(ie){return ie.isSupportedDomain(t)},{throwIfUnsupportedDomain:!1,expectedValue:!0})]})})},c.prototype.allRecords=function(t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){return t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),[2,this.callServiceForDomain(t,function(ie){return ie.allRecords(t)})]})})},c.prototype.dns=function(t,n){return __awaiter(this,void 0,void 0,function(){var ie,fe,ae;return __generator(this,function(le){switch(le.label){case 0:return ie=new DnsUtils_1.default,t=(0,prepareAndValidate_1.prepareAndValidateDomain)(t),fe=this.getDnsRecordKeys(n),[4,this.callServiceForDomain(t,function(he){return he.records(t,fe)})];case 1:return ae=le.sent(),[2,ie.toList(ae)]}})})},c.prototype.tokenURI=function(t){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(ie){return[2,this.callServiceForDomain(t,function(fe){if(fe.name===publicTypes_1.NamingServiceName.UNS){var ae=n.namehash(t,publicTypes_1.NamingServiceName.UNS);return fe.getTokenUri(ae)}else if(fe.name===publicTypes_1.NamingServiceName.ENS)return fe.getTokenUri(t);var le=n.namehash(t,publicTypes_1.NamingServiceName.ZNS);return fe.getTokenUri(le)})]})})},c.prototype.tokenURIMetadata=function(t){return __awaiter(this,void 0,void 0,function(){var n;return __generator(this,function(ie){switch(ie.label){case 0:return[4,this.tokenURI(t)];case 1:return n=ie.sent(),[2,this.getMetadataFromTokenURI(n)]}})})},c.prototype.registryAddress=function(t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){return[2,this.callServiceForDomain(t,function(ie){return ie.registryAddress(t)})]})})},c.prototype.unhash=function(t,n){return __awaiter(this,void 0,void 0,function(){var ie,fe;return __generator(this,function(ae){return t=(0,namehash_1.fromDecStringToHex)(t),ie=this.getService(n).usedServices,fe=ie[ie.length-1],[2,fe.getDomainFromTokenId(t)]})})},c.prototype.locations=function(t){return __awaiter(this,void 0,void 0,function(){var n,ie,fe,ae,le,he,ye,me,xe,Ee,Se,Me,Be,$e,Ce;return __generator(this,function(ke){switch(ke.label){case 0:return n=t.filter(function(Pe){return Pe.endsWith(".zil")}),ie=t.filter(function(Pe){return Pe.match(/^([^\s\\.]+\.)+(eth)+$/)}),fe=t.filter(function(Pe){return!Pe.match(/^([^\s\\.]+\.)+(eth)+$/)}),ae=this.getService(publicTypes_1.NamingServiceName.UNS).usedServices[0].locations(fe),[4,ae];case 1:return le=ke.sent(),n.length?(he=this.getService(publicTypes_1.NamingServiceName.ZNS).usedServices,ye=he[he.length-1],me=(0,utils_1.wrapResult)(function(){return ye.locations(n)}),xe=Object.entries(le).filter(function(Pe){var Ue=Pe[0],qe=Pe[1];return Ue.endsWith(".zil")&&!qe}),[4,me.then(utils_1.unwrapResult)]):[3,3];case 2:for(Ee=ke.sent(),Se=0,Me=xe;Se<Me.length;Se++)Be=Me[Se][0],le[Be]=Ee[Be];ke.label=3;case 3:return ie.length?[4,this.getService(publicTypes_1.NamingServiceName.ENS).usedServices[0].locations(ie)]:[3,5];case 4:$e=ke.sent();for(Ce in $e)le[Ce]=$e[Ce];ke.label=5;case 5:return[2,le]}})})},c.prototype.reverseTokenId=function(t,n){return __awaiter(this,void 0,void 0,function(){var ie,fe,ae,le;return __generator(this,function(he){switch(he.label){case 0:return[4,this.reverseGetTokenId(t,n==null?void 0:n.location)];case 1:return ie=he.sent(),ie?[2,ie]:(fe=this.getService(publicTypes_1.NamingServiceName.ENS).native,[4,fe.reverseOf(t)]);case 2:return ae=he.sent(),ae?(le=fe.namehash(ae),[2,"".concat(BigInt(le))]):[2,null]}})})},c.prototype.reverse=function(t,n){return __awaiter(this,void 0,void 0,function(){var ie,fe,ae;return __generator(this,function(le){switch(le.label){case 0:return[4,this.reverseGetTokenId(t,n==null?void 0:n.location)];case 1:return ie=le.sent(),ie?[2,this.unhash(ie,publicTypes_1.NamingServiceName.UNS)]:(fe=this.getService(publicTypes_1.NamingServiceName.ENS).native,[4,fe.reverseOf(t)]);case 2:return ae=le.sent(),ae?[2,ae]:[2,null]}})})},c.prototype.getMetadataFromTokenURI=function(t){return __awaiter(this,void 0,void 0,function(){var n,ie,fe,ae;return __generator(this,function(le){switch(le.label){case 0:return[4,Networking_1.default.fetch(t)];case 1:return n=le.sent(),n.ok?[2,n.json()]:(ie=resolutionError_1.default.bind,fe=[void 0,resolutionError_1.ResolutionErrorCode.ServiceProviderError],ae={},[4,n.text()]);case 2:throw new(ie.apply(resolutionError_1.default,fe.concat([(ae.providerMessage=le.sent(),ae.method="UDAPI",ae.methodName="tokenURIMetadata",ae)])))}})})},c.prototype.getDnsRecordKeys=function(t){var n=["dns.ttl"];return t.forEach(function(ie){n.push("dns.".concat(ie)),n.push("dns.".concat(ie,".ttl"))}),n},c.prototype.getPreferableNewRecord=function(t,n,ie){return __awaiter(this,void 0,void 0,function(){var fe;return __generator(this,function(ae){switch(ae.label){case 0:return[4,this.records(t,[n,ie])];case 1:if(fe=ae.sent(),!fe[n]&&!fe[ie])throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.RecordNotFound,{recordName:n,domain:t});return[2,fe[n]||fe[ie]]}})})},c.prototype.callServiceForDomain=function(t,n){return __awaiter(this,void 0,void 0,function(){var ie,fe,ae,le,he,ye;return __generator(this,function(me){switch(me.label){case 0:return[4,(0,utils_1.findNamingServiceName)(t)];case 1:if(ie=me.sent(),!ie)throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.UnsupportedDomain,{domain:t});fe=this.getService(ie).usedServices.map(function(xe){return(0,utils_1.wrapResult)(function(){return n(xe)})}),ae=0,le=fe,me.label=2;case 2:return ae<le.length?(he=le[ae],[4,he]):[3,5];case 3:if(ye=me.sent(),ye.error!==null){if(!(ye.error instanceof resolutionError_1.default&&ye.error.code===resolutionError_1.ResolutionErrorCode.UnregisteredDomain))throw ye.error}else return[2,ye.result];me.label=4;case 4:return ae++,[3,2];case 5:throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.UnregisteredDomain,{domain:t})}})})},c.prototype.callServiceForDomainBoolean=function(t,n,ie){return __awaiter(this,void 0,void 0,function(){var fe,ae,le,he,ye,me,xe,Ee;return __generator(this,function(Se){switch(Se.label){case 0:return[4,(0,utils_1.findNamingServiceName)(t)];case 1:if(fe=Se.sent(),!fe){if(!ie.throwIfUnsupportedDomain)return[2,!ie.expectedValue];throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.UnsupportedDomain,{domain:t})}ae=this.getService(fe).usedServices.map(function(Me){return(0,utils_1.wrapResult)(function(){return n(Me)})}),le=0,he=ae,Se.label=2;case 2:return le<he.length?(ye=he[le],[4,ye]):[3,5];case 3:if(me=Se.sent(),xe=me.result,Ee=me.error,Ee){if(!(Ee instanceof resolutionError_1.default&&Ee.code===resolutionError_1.ResolutionErrorCode.UnregisteredDomain))throw Ee}else if(xe===ie.expectedValue)return[2,xe];Se.label=4;case 4:return le++,[3,2];case 5:return[2,!ie.expectedValue]}})})},c.prototype.reverseGetTokenId=function(t,n){return __awaiter(this,void 0,void 0,function(){var ie,fe,ae;return __generator(this,function(le){switch(le.label){case 0:return ie=null,fe=this.getService(publicTypes_1.NamingServiceName.UNS).native,[4,fe.reverseOf(t,n)];case 1:return ie=le.sent(),ie?[3,3]:(ae=this.getService(publicTypes_1.NamingServiceName.UNS_BASE).native,[4,ae.reverseOf(t,n)]);case 2:ie=le.sent(),le.label=3;case 3:return[2,ie]}})})},c.prototype.getUnsConfig=function(t){var n,ie,fe,ae,le,he,ye,me,xe,Ee;if(t.apiKey)return new Uns_1.default({locations:{Layer1:{url:"".concat(DEFAULT_UNS_PROXY_SERVICE_URL,"/chains/eth/rpc"),network:"mainnet",proxyServiceApiKey:t.apiKey,blockchain:publicTypes_1.BlockchainType.ETH},Layer2:{url:"".concat(DEFAULT_UNS_PROXY_SERVICE_URL,"/chains/matic/rpc"),network:"polygon-mainnet",proxyServiceApiKey:t.apiKey,blockchain:publicTypes_1.BlockchainType.POL}}});if(isApi((n=t.sourceConfig)===null||n===void 0?void 0:n.uns))return new UdApi_1.default((ie=t.sourceConfig)===null||ie===void 0?void 0:ie.uns);var Se=((ae=(fe=t.sourceConfig)===null||fe===void 0?void 0:fe.uns)===null||ae===void 0?void 0:ae.locations.Layer1)||((he=(le=t.sourceConfig)===null||le===void 0?void 0:le.uns)===null||he===void 0?void 0:he.locations.eth),Me=((me=(ye=t.sourceConfig)===null||ye===void 0?void 0:ye.uns)===null||me===void 0?void 0:me.locations.Layer2)||((Ee=(xe=t.sourceConfig)===null||xe===void 0?void 0:xe.uns)===null||Ee===void 0?void 0:Ee.locations.pol);return Se||Me?new Uns_1.default({locations:{Layer1:Se,Layer2:Me}}):new Uns_1.default},c.prototype.getUnsBaseConfig=function(t){var n,ie,fe,ae,le,he,ye,me;if(t.apiKey)return new Uns_1.default({locations:{Layer1:{url:"".concat(DEFAULT_UNS_PROXY_SERVICE_URL,"/chains/eth/rpc"),network:"mainnet",proxyServiceApiKey:t.apiKey,blockchain:publicTypes_1.BlockchainType.ETH},Layer2:{url:"".concat(DEFAULT_UNS_PROXY_SERVICE_URL,"/chains/base/rpc"),network:"base-mainnet",proxyServiceApiKey:t.apiKey,blockchain:publicTypes_1.BlockchainType.BASE}}});if(isApi((n=t.sourceConfig)===null||n===void 0?void 0:n.uns))return new UdApi_1.default((ie=t.sourceConfig)===null||ie===void 0?void 0:ie.uns);var xe=((ae=(fe=t.sourceConfig)===null||fe===void 0?void 0:fe.uns)===null||ae===void 0?void 0:ae.locations.Layer1)||((he=(le=t.sourceConfig)===null||le===void 0?void 0:le.uns)===null||he===void 0?void 0:he.locations.eth),Ee=(me=(ye=t.sourceConfig)===null||ye===void 0?void 0:ye.uns)===null||me===void 0?void 0:me.locations.base;return xe&&Ee?new Uns_1.default({locations:{Layer1:xe,Layer2:Ee}}):void 0},c.prototype.getZnsConfig=function(t){var n,ie,fe;return isApi((n=t.sourceConfig)===null||n===void 0?void 0:n.zns)?new UdApi_1.default((ie=t.sourceConfig)===null||ie===void 0?void 0:ie.zns):new Zns_1.default((fe=t.sourceConfig)===null||fe===void 0?void 0:fe.zns)},c.prototype.getEnsConfig=function(t){var n,ie,fe;return t.apiKey?new Ens_1.default({url:"".concat(DEFAULT_UNS_PROXY_SERVICE_URL,"/chains/eth/rpc"),network:"mainnet",proxyServiceApiKey:t.apiKey}):isApi((n=t.sourceConfig)===null||n===void 0?void 0:n.ens)?new UdApi_1.default((ie=t.sourceConfig)===null||ie===void 0?void 0:ie.ens):new Ens_1.default((fe=t.sourceConfig)===null||fe===void 0?void 0:fe.ens)},c}();Resolution$1.Resolution=Resolution;Resolution$1.default=Resolution;function isApi(c){return typeof c=="object"&&c!==null&&"api"in c&&typeof c.api=="boolean"}(function(c){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(Se,Me,Be,$e){$e===void 0&&($e=Be);var Ce=Object.getOwnPropertyDescriptor(Me,Be);(!Ce||("get"in Ce?!Me.__esModule:Ce.writable||Ce.configurable))&&(Ce={enumerable:!0,get:function(){return Me[Be]}}),Object.defineProperty(Se,$e,Ce)}:function(Se,Me,Be,$e){$e===void 0&&($e=Be),Se[$e]=Me[Be]}),n=commonjsGlobal&&commonjsGlobal.__exportStar||function(Se,Me){for(var Be in Se)Be!=="default"&&!Object.prototype.hasOwnProperty.call(Me,Be)&&t(Me,Se,Be)},ie=commonjsGlobal&&commonjsGlobal.__importDefault||function(Se){return Se&&Se.__esModule?Se:{default:Se}};Object.defineProperty(c,"__esModule",{value:!0}),c.ProviderFactories=c.Eip1193Factories=c.Eip1993Factories=c.DnsRecordsErrorCode=c.DnsRecordsError=c.ConfigurationErrorCode=c.ConfigurationError=c.ResolutionErrorCode=c.ResolutionError=c.DnsUtils=c.default=c.Resolution=void 0;var fe=Resolution$1;Object.defineProperty(c,"Resolution",{enumerable:!0,get:function(){return fe.Resolution}}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return fe.Resolution}}),n(publicTypes,c);var ae=DnsUtils$1;Object.defineProperty(c,"DnsUtils",{enumerable:!0,get:function(){return ie(ae).default}});var le=resolutionError;Object.defineProperty(c,"ResolutionError",{enumerable:!0,get:function(){return le.ResolutionError}}),Object.defineProperty(c,"ResolutionErrorCode",{enumerable:!0,get:function(){return le.ResolutionErrorCode}});var he=configurationError;Object.defineProperty(c,"ConfigurationError",{enumerable:!0,get:function(){return he.ConfigurationError}}),Object.defineProperty(c,"ConfigurationErrorCode",{enumerable:!0,get:function(){return he.ConfigurationErrorCode}});var ye=dnsRecordsError;Object.defineProperty(c,"DnsRecordsError",{enumerable:!0,get:function(){return ye.DnsRecordsError}}),Object.defineProperty(c,"DnsRecordsErrorCode",{enumerable:!0,get:function(){return ye.DnsRecordsErrorCode}});var me=Eip1993Factories;Object.defineProperty(c,"Eip1993Factories",{enumerable:!0,get:function(){return me.Eip1993Factories}});var xe=Eip1993Factories;Object.defineProperty(c,"Eip1193Factories",{enumerable:!0,get:function(){return xe.Eip1993Factories}});var Ee=Eip1993Factories;Object.defineProperty(c,"ProviderFactories",{enumerable:!0,get:function(){return Ee.Eip1993Factories}})})(build);var win;typeof window<"u"?win=window:typeof globalThis<"u"?win=globalThis:typeof self<"u"?win=self:win={};var window_1=win;const u=getDefaultExportFromCjs$2(window_1),crypto$1=crypto,isCryptoKey=c=>c instanceof CryptoKey,encoder=new TextEncoder,decoder=new TextDecoder;function concat(...c){const t=c.reduce((fe,{length:ae})=>fe+ae,0),n=new Uint8Array(t);let ie=0;return c.forEach(fe=>{n.set(fe,ie),ie+=fe.length}),n}const decodeBase64=c=>{const t=atob(c),n=new Uint8Array(t.length);for(let ie=0;ie<t.length;ie++)n[ie]=t.charCodeAt(ie);return n},decode=c=>{let t=c;t instanceof Uint8Array&&(t=decoder.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return decodeBase64(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class JOSEError extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(t){var n;super(t),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,(n=Error.captureStackTrace)===null||n===void 0||n.call(Error,this,this.constructor)}}class JWTClaimValidationFailed extends JOSEError{static get code(){return"ERR_JWT_CLAIM_VALIDATION_FAILED"}constructor(t,n="unspecified",ie="unspecified"){super(t),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=n,this.reason=ie}}class JWTExpired extends JOSEError{static get code(){return"ERR_JWT_EXPIRED"}constructor(t,n="unspecified",ie="unspecified"){super(t),this.code="ERR_JWT_EXPIRED",this.claim=n,this.reason=ie}}class JOSEAlgNotAllowed extends JOSEError{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}}class JOSENotSupported extends JOSEError{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}}class JWSInvalid extends JOSEError{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}}class JWTInvalid extends JOSEError{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}}class JWKSInvalid extends JOSEError{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}static get code(){return"ERR_JWKS_INVALID"}}class JWKSNoMatchingKey extends JOSEError{constructor(){super(...arguments),this.code="ERR_JWKS_NO_MATCHING_KEY",this.message="no applicable key found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_NO_MATCHING_KEY"}}class JWKSMultipleMatchingKeys extends JOSEError{constructor(){super(...arguments),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS",this.message="multiple matching keys found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}class JWKSTimeout extends JOSEError{constructor(){super(...arguments),this.code="ERR_JWKS_TIMEOUT",this.message="request timed out"}static get code(){return"ERR_JWKS_TIMEOUT"}}class JWSSignatureVerificationFailed extends JOSEError{constructor(){super(...arguments),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}function unusable(c,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${c}`)}function isAlgorithm(c,t){return c.name===t}function getHashLength(c){return parseInt(c.name.slice(4),10)}function getNamedCurve(c){switch(c){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function checkUsage(c,t){if(t.length&&!t.some(n=>c.usages.includes(n))){let n="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const ie=t.pop();n+=`one of ${t.join(", ")}, or ${ie}.`}else t.length===2?n+=`one of ${t[0]} or ${t[1]}.`:n+=`${t[0]}.`;throw new TypeError(n)}}function checkSigCryptoKey(c,t,...n){switch(t){case"HS256":case"HS384":case"HS512":{if(!isAlgorithm(c.algorithm,"HMAC"))throw unusable("HMAC");const ie=parseInt(t.slice(2),10);if(getHashLength(c.algorithm.hash)!==ie)throw unusable(`SHA-${ie}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!isAlgorithm(c.algorithm,"RSASSA-PKCS1-v1_5"))throw unusable("RSASSA-PKCS1-v1_5");const ie=parseInt(t.slice(2),10);if(getHashLength(c.algorithm.hash)!==ie)throw unusable(`SHA-${ie}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!isAlgorithm(c.algorithm,"RSA-PSS"))throw unusable("RSA-PSS");const ie=parseInt(t.slice(2),10);if(getHashLength(c.algorithm.hash)!==ie)throw unusable(`SHA-${ie}`,"algorithm.hash");break}case"EdDSA":{if(c.algorithm.name!=="Ed25519"&&c.algorithm.name!=="Ed448")throw unusable("Ed25519 or Ed448");break}case"ES256":case"ES384":case"ES512":{if(!isAlgorithm(c.algorithm,"ECDSA"))throw unusable("ECDSA");const ie=getNamedCurve(t);if(c.algorithm.namedCurve!==ie)throw unusable(ie,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}checkUsage(c,n)}function message(c,t,...n){if(n.length>2){const ie=n.pop();c+=`one of type ${n.join(", ")}, or ${ie}.`}else n.length===2?c+=`one of type ${n[0]} or ${n[1]}.`:c+=`of type ${n[0]}.`;return t==null?c+=` Received ${t}`:typeof t=="function"&&t.name?c+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&t.constructor&&t.constructor.name&&(c+=` Received an instance of ${t.constructor.name}`),c}const invalidKeyInput=(c,...t)=>message("Key must be ",c,...t);function withAlg(c,t,...n){return message(`Key for the ${c} algorithm must be `,t,...n)}const isKeyLike=c=>isCryptoKey(c),types=["CryptoKey"],isDisjoint=(...c)=>{const t=c.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(const ie of t){const fe=Object.keys(ie);if(!n||n.size===0){n=new Set(fe);continue}for(const ae of fe){if(n.has(ae))return!1;n.add(ae)}}return!0};function isObjectLike(c){return typeof c=="object"&&c!==null}function isObject(c){if(!isObjectLike(c)||Object.prototype.toString.call(c)!=="[object Object]")return!1;if(Object.getPrototypeOf(c)===null)return!0;let t=c;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(c)===t}const checkKeyLength=(c,t)=>{if(c.startsWith("RS")||c.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!="number"||n<2048)throw new TypeError(`${c} requires key modulusLength to be 2048 bits or larger`)}};function subtleMapping(c){let t,n;switch(c.kty){case"oct":{switch(c.alg){case"HS256":case"HS384":case"HS512":t={name:"HMAC",hash:`SHA-${c.alg.slice(-3)}`},n=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":throw new JOSENotSupported(`${c.alg} keys cannot be imported as CryptoKey instances`);case"A128GCM":case"A192GCM":case"A256GCM":case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":t={name:"AES-GCM"},n=["encrypt","decrypt"];break;case"A128KW":case"A192KW":case"A256KW":t={name:"AES-KW"},n=["wrapKey","unwrapKey"];break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":t={name:"PBKDF2"},n=["deriveBits"];break;default:throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"RSA":{switch(c.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${c.alg.slice(-3)}`},n=c.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${c.alg.slice(-3)}`},n=c.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(c.alg.slice(-3),10)||1}`},n=c.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(c.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=c.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=c.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=c.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:c.crv},n=c.d?["deriveBits"]:[];break;default:throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(c.alg){case"EdDSA":t={name:c.crv},n=c.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:c.crv},n=c.d?["deriveBits"]:[];break;default:throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}const parse=async c=>{var t,n;if(!c.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:ie,keyUsages:fe}=subtleMapping(c),ae=[ie,(t=c.ext)!==null&&t!==void 0?t:!1,(n=c.key_ops)!==null&&n!==void 0?n:fe];if(ie.name==="PBKDF2")return crypto$1.subtle.importKey("raw",decode(c.k),...ae);const le={...c};return delete le.alg,delete le.use,crypto$1.subtle.importKey("jwk",le,...ae)};async function importJWK(c,t,n){var ie;if(!isObject(c))throw new TypeError("JWK must be an object");switch(t||(t=c.alg),c.kty){case"oct":if(typeof c.k!="string"||!c.k)throw new TypeError('missing "k" (Key Value) Parameter value');return n??(n=c.ext!==!0),n?parse({...c,alg:t,ext:(ie=c.ext)!==null&&ie!==void 0?ie:!1}):decode(c.k);case"RSA":if(c.oth!==void 0)throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return parse({...c,alg:t});default:throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}}const symmetricTypeCheck=(c,t)=>{if(!(t instanceof Uint8Array)){if(!isKeyLike(t))throw new TypeError(withAlg(c,t,...types,"Uint8Array"));if(t.type!=="secret")throw new TypeError(`${types.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}},asymmetricTypeCheck=(c,t,n)=>{if(!isKeyLike(t))throw new TypeError(withAlg(c,t,...types));if(t.type==="secret")throw new TypeError(`${types.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if(t.algorithm&&n==="verify"&&t.type==="private")throw new TypeError(`${types.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);t.algorithm},checkKeyType=(c,t,n)=>{c.startsWith("HS")||c==="dir"||c.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(c)?symmetricTypeCheck(c,t):asymmetricTypeCheck(c,t,n)};function validateCrit(c,t,n,ie,fe){if(fe.crit!==void 0&&ie.crit===void 0)throw new c('"crit" (Critical) Header Parameter MUST be integrity protected');if(!ie||ie.crit===void 0)return new Set;if(!Array.isArray(ie.crit)||ie.crit.length===0||ie.crit.some(le=>typeof le!="string"||le.length===0))throw new c('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let ae;n!==void 0?ae=new Map([...Object.entries(n),...t.entries()]):ae=t;for(const le of ie.crit){if(!ae.has(le))throw new JOSENotSupported(`Extension Header Parameter "${le}" is not recognized`);if(fe[le]===void 0)throw new c(`Extension Header Parameter "${le}" is missing`);if(ae.get(le)&&ie[le]===void 0)throw new c(`Extension Header Parameter "${le}" MUST be integrity protected`)}return new Set(ie.crit)}const validateAlgorithms=(c,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(n=>typeof n!="string")))throw new TypeError(`"${c}" option must be an array of strings`);if(t)return new Set(t)};function subtleDsa(c,t){const n=`SHA-${c.slice(-3)}`;switch(c){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:c.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"EdDSA":return{name:t.name};default:throw new JOSENotSupported(`alg ${c} is not supported either by JOSE or your javascript runtime`)}}function getCryptoKey(c,t,n){if(isCryptoKey(t))return checkSigCryptoKey(t,c,n),t;if(t instanceof Uint8Array){if(!c.startsWith("HS"))throw new TypeError(invalidKeyInput(t,...types));return crypto$1.subtle.importKey("raw",t,{hash:`SHA-${c.slice(-3)}`,name:"HMAC"},!1,[n])}throw new TypeError(invalidKeyInput(t,...types,"Uint8Array"))}const verify=async(c,t,n,ie)=>{const fe=await getCryptoKey(c,t,"verify");checkKeyLength(c,fe);const ae=subtleDsa(c,fe.algorithm);try{return await crypto$1.subtle.verify(ae,fe,n,ie)}catch{return!1}};async function flattenedVerify(c,t,n){var ie;if(!isObject(c))throw new JWSInvalid("Flattened JWS must be an object");if(c.protected===void 0&&c.header===void 0)throw new JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');if(c.protected!==void 0&&typeof c.protected!="string")throw new JWSInvalid("JWS Protected Header incorrect type");if(c.payload===void 0)throw new JWSInvalid("JWS Payload missing");if(typeof c.signature!="string")throw new JWSInvalid("JWS Signature missing or incorrect type");if(c.header!==void 0&&!isObject(c.header))throw new JWSInvalid("JWS Unprotected Header incorrect type");let fe={};if(c.protected)try{const Ce=decode(c.protected);fe=JSON.parse(decoder.decode(Ce))}catch{throw new JWSInvalid("JWS Protected Header is invalid")}if(!isDisjoint(fe,c.header))throw new JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const ae={...fe,...c.header},le=validateCrit(JWSInvalid,new Map([["b64",!0]]),n==null?void 0:n.crit,fe,ae);let he=!0;if(le.has("b64")&&(he=fe.b64,typeof he!="boolean"))throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:ye}=ae;if(typeof ye!="string"||!ye)throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');const me=n&&validateAlgorithms("algorithms",n.algorithms);if(me&&!me.has(ye))throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(he){if(typeof c.payload!="string")throw new JWSInvalid("JWS Payload must be a string")}else if(typeof c.payload!="string"&&!(c.payload instanceof Uint8Array))throw new JWSInvalid("JWS Payload must be a string or an Uint8Array instance");let xe=!1;typeof t=="function"&&(t=await t(fe,c),xe=!0),checkKeyType(ye,t,"verify");const Ee=concat(encoder.encode((ie=c.protected)!==null&&ie!==void 0?ie:""),encoder.encode("."),typeof c.payload=="string"?encoder.encode(c.payload):c.payload);let Se;try{Se=decode(c.signature)}catch{throw new JWSInvalid("Failed to base64url decode the signature")}if(!await verify(ye,t,Se,Ee))throw new JWSSignatureVerificationFailed;let Be;if(he)try{Be=decode(c.payload)}catch{throw new JWSInvalid("Failed to base64url decode the payload")}else typeof c.payload=="string"?Be=encoder.encode(c.payload):Be=c.payload;const $e={payload:Be};return c.protected!==void 0&&($e.protectedHeader=fe),c.header!==void 0&&($e.unprotectedHeader=c.header),xe?{...$e,key:t}:$e}async function compactVerify(c,t,n){if(c instanceof Uint8Array&&(c=decoder.decode(c)),typeof c!="string")throw new JWSInvalid("Compact JWS must be a string or Uint8Array");const{0:ie,1:fe,2:ae,length:le}=c.split(".");if(le!==3)throw new JWSInvalid("Invalid Compact JWS");const he=await flattenedVerify({payload:fe,protected:ie,signature:ae},t,n),ye={payload:he.payload,protectedHeader:he.protectedHeader};return typeof t=="function"?{...ye,key:he.key}:ye}const epoch=c=>Math.floor(c.getTime()/1e3),minute=60,hour=minute*60,day=hour*24,week=day*7,year=day*365.25,REGEX=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i,secs=c=>{const t=REGEX.exec(c);if(!t)throw new TypeError("Invalid time period format");const n=parseFloat(t[1]);switch(t[2].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":return Math.round(n);case"minute":case"minutes":case"min":case"mins":case"m":return Math.round(n*minute);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(n*hour);case"day":case"days":case"d":return Math.round(n*day);case"week":case"weeks":case"w":return Math.round(n*week);default:return Math.round(n*year)}},normalizeTyp=c=>c.toLowerCase().replace(/^application\//,""),checkAudiencePresence=(c,t)=>typeof c=="string"?t.includes(c):Array.isArray(c)?t.some(Set.prototype.has.bind(new Set(c))):!1,jwtPayload=(c,t,n={})=>{const{typ:ie}=n;if(ie&&(typeof c.typ!="string"||normalizeTyp(c.typ)!==normalizeTyp(ie)))throw new JWTClaimValidationFailed('unexpected "typ" JWT header value',"typ","check_failed");let fe;try{fe=JSON.parse(decoder.decode(t))}catch{}if(!isObject(fe))throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");const{requiredClaims:ae=[],issuer:le,subject:he,audience:ye,maxTokenAge:me}=n;me!==void 0&&ae.push("iat"),ye!==void 0&&ae.push("aud"),he!==void 0&&ae.push("sub"),le!==void 0&&ae.push("iss");for(const Me of new Set(ae.reverse()))if(!(Me in fe))throw new JWTClaimValidationFailed(`missing required "${Me}" claim`,Me,"missing");if(le&&!(Array.isArray(le)?le:[le]).includes(fe.iss))throw new JWTClaimValidationFailed('unexpected "iss" claim value',"iss","check_failed");if(he&&fe.sub!==he)throw new JWTClaimValidationFailed('unexpected "sub" claim value',"sub","check_failed");if(ye&&!checkAudiencePresence(fe.aud,typeof ye=="string"?[ye]:ye))throw new JWTClaimValidationFailed('unexpected "aud" claim value',"aud","check_failed");let xe;switch(typeof n.clockTolerance){case"string":xe=secs(n.clockTolerance);break;case"number":xe=n.clockTolerance;break;case"undefined":xe=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:Ee}=n,Se=epoch(Ee||new Date);if((fe.iat!==void 0||me)&&typeof fe.iat!="number")throw new JWTClaimValidationFailed('"iat" claim must be a number',"iat","invalid");if(fe.nbf!==void 0){if(typeof fe.nbf!="number")throw new JWTClaimValidationFailed('"nbf" claim must be a number',"nbf","invalid");if(fe.nbf>Se+xe)throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed',"nbf","check_failed")}if(fe.exp!==void 0){if(typeof fe.exp!="number")throw new JWTClaimValidationFailed('"exp" claim must be a number',"exp","invalid");if(fe.exp<=Se-xe)throw new JWTExpired('"exp" claim timestamp check failed',"exp","check_failed")}if(me){const Me=Se-fe.iat,Be=typeof me=="number"?me:secs(me);if(Me-xe>Be)throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)',"iat","check_failed");if(Me<0-xe)throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)',"iat","check_failed")}return fe};async function jwtVerify(c,t,n){var ie;const fe=await compactVerify(c,t,n);if(!((ie=fe.protectedHeader.crit)===null||ie===void 0)&&ie.includes("b64")&&fe.protectedHeader.b64===!1)throw new JWTInvalid("JWTs MUST NOT use unencoded payload");const le={payload:jwtPayload(fe.protectedHeader,fe.payload,n),protectedHeader:fe.protectedHeader};return typeof t=="function"?{...le,key:fe.key}:le}function getKtyFromAlg(c){switch(typeof c=="string"&&c.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set')}}function isJWKSLike(c){return c&&typeof c=="object"&&Array.isArray(c.keys)&&c.keys.every(isJWKLike)}function isJWKLike(c){return isObject(c)}function clone(c){return typeof structuredClone=="function"?structuredClone(c):JSON.parse(JSON.stringify(c))}class LocalJWKSet{constructor(t){if(this._cached=new WeakMap,!isJWKSLike(t))throw new JWKSInvalid("JSON Web Key Set malformed");this._jwks=clone(t)}async getKey(t,n){const{alg:ie,kid:fe}={...t,...n==null?void 0:n.header},ae=getKtyFromAlg(ie),le=this._jwks.keys.filter(me=>{let xe=ae===me.kty;if(xe&&typeof fe=="string"&&(xe=fe===me.kid),xe&&typeof me.alg=="string"&&(xe=ie===me.alg),xe&&typeof me.use=="string"&&(xe=me.use==="sig"),xe&&Array.isArray(me.key_ops)&&(xe=me.key_ops.includes("verify")),xe&&ie==="EdDSA"&&(xe=me.crv==="Ed25519"||me.crv==="Ed448"),xe)switch(ie){case"ES256":xe=me.crv==="P-256";break;case"ES256K":xe=me.crv==="secp256k1";break;case"ES384":xe=me.crv==="P-384";break;case"ES512":xe=me.crv==="P-521";break}return xe}),{0:he,length:ye}=le;if(ye===0)throw new JWKSNoMatchingKey;if(ye!==1){const me=new JWKSMultipleMatchingKeys,{_cached:xe}=this;throw me[Symbol.asyncIterator]=async function*(){for(const Ee of le)try{yield await importWithAlgCache(xe,Ee,ie)}catch{continue}},me}return importWithAlgCache(this._cached,he,ie)}}async function importWithAlgCache(c,t,n){const ie=c.get(t)||c.set(t,{}).get(t);if(ie[n]===void 0){const fe=await importJWK({...t,ext:!0},n);if(fe instanceof Uint8Array||fe.type!=="public")throw new JWKSInvalid("JSON Web Key Set members must be public keys");ie[n]=fe}return ie[n]}const fetchJwks=async(c,t,n)=>{let ie,fe,ae=!1;typeof AbortController=="function"&&(ie=new AbortController,fe=setTimeout(()=>{ae=!0,ie.abort()},t));const le=await fetch(c.href,{signal:ie?ie.signal:void 0,redirect:"manual",headers:n.headers}).catch(he=>{throw ae?new JWKSTimeout:he});if(fe!==void 0&&clearTimeout(fe),le.status!==200)throw new JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await le.json()}catch{throw new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON")}};function isCloudflareWorkers(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}class RemoteJWKSet extends LocalJWKSet{constructor(t,n){if(super({keys:[]}),this._jwks=void 0,!(t instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(t.href),this._options={agent:n==null?void 0:n.agent,headers:n==null?void 0:n.headers},this._timeoutDuration=typeof(n==null?void 0:n.timeoutDuration)=="number"?n==null?void 0:n.timeoutDuration:5e3,this._cooldownDuration=typeof(n==null?void 0:n.cooldownDuration)=="number"?n==null?void 0:n.cooldownDuration:3e4,this._cacheMaxAge=typeof(n==null?void 0:n.cacheMaxAge)=="number"?n==null?void 0:n.cacheMaxAge:6e5}coolingDown(){return typeof this._jwksTimestamp=="number"?Date.now()<this._jwksTimestamp+this._cooldownDuration:!1}fresh(){return typeof this._jwksTimestamp=="number"?Date.now()<this._jwksTimestamp+this._cacheMaxAge:!1}async getKey(t,n){(!this._jwks||!this.fresh())&&await this.reload();try{return await super.getKey(t,n)}catch(ie){if(ie instanceof JWKSNoMatchingKey&&this.coolingDown()===!1)return await this.reload(),super.getKey(t,n);throw ie}}async reload(){this._pendingFetch&&isCloudflareWorkers()&&(this._pendingFetch=void 0),this._pendingFetch||(this._pendingFetch=fetchJwks(this._url,this._timeoutDuration,this._options).then(t=>{if(!isJWKSLike(t))throw new JWKSInvalid("JSON Web Key Set malformed");this._jwks={keys:t.keys},this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(t=>{throw this._pendingFetch=void 0,t})),await this._pendingFetch}}function createRemoteJWKSet(c,t){const n=new RemoteJWKSet(c,t);return async function(ie,fe){return n.getKey(ie,fe)}}function a(){return a=Object.assign||function(c){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var ie in n)Object.prototype.hasOwnProperty.call(n,ie)&&(c[ie]=n[ie])}return c},a.apply(this,arguments)}function l(c,t){c.prototype=Object.create(t.prototype),c.prototype.constructor=c,h(c,t)}function f(c){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(c)}function h(c,t){return h=Object.setPrototypeOf||function(n,ie){return n.__proto__=ie,n},h(c,t)}function p(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function d(c,t,n){return d=p()?Reflect.construct:function(ie,fe,ae){var le=[null];le.push.apply(le,fe);var he=new(Function.bind.apply(ie,le));return ae&&h(he,ae.prototype),he},d.apply(null,arguments)}function m(c){var t=typeof Map=="function"?new Map:void 0;return m=function(n){if(n===null||Function.toString.call(n).indexOf("[native code]")===-1)return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(n))return t.get(n);t.set(n,ie)}function ie(){return d(n,arguments,f(this).constructor)}return ie.prototype=Object.create(n.prototype,{constructor:{value:ie,enumerable:!1,writable:!0,configurable:!0}}),h(ie,n)},m(c)}function v(c,t){if(c==null)return{};var n,ie,fe={},ae=Object.keys(c);for(ie=0;ie<ae.length;ie++)t.indexOf(n=ae[ie])>=0||(fe[n]=c[n]);return fe}function g(c,t){(t==null||t>c.length)&&(t=c.length);for(var n=0,ie=new Array(t);n<t;n++)ie[n]=c[n];return ie}function _(c,t){var n=typeof Symbol<"u"&&c[Symbol.iterator]||c["@@iterator"];if(n)return(n=n.call(c)).next.bind(n);if(Array.isArray(c)||(n=function(fe,ae){if(fe){if(typeof fe=="string")return g(fe,ae);var le=Object.prototype.toString.call(fe).slice(8,-1);return le==="Object"&&fe.constructor&&(le=fe.constructor.name),le==="Map"||le==="Set"?Array.from(fe):le==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(le)?g(fe,ae):void 0}}(c))||t){n&&(c=n);var ie=0;return function(){return ie>=c.length?{done:!0}:{done:!1,value:c[ie++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
48
48
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(c,t){return function(n){function ie(){var fe;return(fe=n.call(this,t)||this).name=c,fe}return l(ie,n),ie}(m(Error))}var y=w("PopupTimeoutError","The popup has timed out."),b=w("PopupClosedError","The popup was closed."),P=function(c){return String.fromCharCode.apply(null,Array.from(new Uint8Array(c)))},k=new TextEncoder,S=function(){return u},O=function(c){return S().btoa(c)},R=function(c){return O(c).replace(/=+$/g,"").replace(/\+/g,"-").replace(/\//g,"_")},A=function(){var c;return(c=S().crypto)!=null?c:S().msCrypto},j=function(c){return A().getRandomValues(new Uint8Array(c))},T=function(){var c;return(c=A().subtle)!=null?c:A().webkitSubtle},I=function(c){try{var t=T().digest({name:"SHA-256"},c);return S().msCrypto?Promise.resolve(new Promise(function(n,ie){t.oncomplete=function(fe){return n(fe.target.result)},t.onerror=function(fe){return ie(fe.error)},t.onabort=function(){return ie("The digest operation was aborted")}})):Promise.resolve(t)}catch(n){return Promise.reject(n)}},z="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.",U=function(c){return S().atob(c)},E=new TextDecoder;function L(c){return Array.from(new Set(c))}var C=function(c){return L(c.trim().split(/\s+/)).sort().join(" ")};function x(c){var t={};return c.forEach(function(n,ie){t[ie]=c.getAll(ie).length>1?c.getAll(ie):c.get(ie)}),t}function q(c){var t=new URLSearchParams([].concat(Object.entries(c)).filter(function(n){return n[0]!=null&&n[1]!=null}));return t.sort(),t.toString()}var D={createCodeChallengeAndVerifier:function(c,t){c===void 0&&(c=43),t===void 0&&(t="S256");try{var n=function(ie){return Array.from(j(ie)).map(function(fe){return z[fe%z.length]}).join("")}(c);switch(t){case"plain":return Promise.resolve({verifier:n,challenge:n});case"S256":return Promise.resolve(I(k.encode(n).buffer)).then(function(ie){return{verifier:n,challenge:R(P(ie))}});default:throw new Error("bad challenge method")}}catch(ie){return Promise.reject(ie)}},getCrypto:A,getCryptoSubtle:T,getRandomBytes:j,sha256:I,verifyIdToken:function(c,t,n,ie){try{return Promise.resolve(jwtVerify(t,createRemoteJWKSet(new URL(c)),{audience:ie})).then(function(fe){var ae=fe.payload;if(ae.__raw=t,n!==ae.nonce)throw new Error("nonces don't match");return ae})}catch(fe){return Promise.reject(fe)}}},F={decodeState:function(c){var t=c.split("."),n=t[1];if(t.slice(2).length>0)throw new Error("failed to decode state");return(n==null?void 0:n.length)>0?JSON.parse(decodeURIComponent(U(n))):void 0},encodeState:function(c){return R(P(j(32)))+"."+(c==null?"":R(encodeURIComponent(JSON.stringify(c))))},fromBase64:U,textDecoder:E,textEncoder:k,toBase64:O,toUrlEncodedBase64:R,stringFromBuffer:P},N={__proto__:null,crypto:D,encoding:F,getSortedScope:C,getWindow:S,objectFromEntries:function(c){for(var t,n={},ie=_(c);!(t=ie()).done;){var fe=t.value;n[fe[0]]=fe[1]}return n},objectFromURLSearchParams:x,objectToKey:q,retry:function c(t,n,ie,fe,ae){return n===void 0&&(n=4),ie===void 0&&(ie=250),fe===void 0&&(fe=2),ae===void 0&&(ae=null),n<=0?Promise.reject(ae):t().catch(function(le){try{return Promise.resolve(new Promise(function(he){return setTimeout(he,ie)})).then(function(){return c(t,n-1,ie*fe,fe,le)})}catch(he){return Promise.reject(he)}})},uniqueElementsFromArray:L},B=function(c){function t(n,ie,fe){var ae;return(ae=c.call(this,n+": "+ie+(fe?`
|
|
49
|
-
See more at `+fe+".":""))||this).code=void 0,ae.description=void 0,ae.uri=void 0,ae.code=n,ae.description=ie,ae.uri=fe,ae}return l(t,c),t.fromResponse=function(n){return new t(n.error,n.error_description,n.error_uri)},t}(m(Error)),M=["url"],W=["url","client_id","client_secret","client_auth_method"],V=function(){function c(n){this.options=void 0,this.options=n}var t=c.prototype;return t.buildAuthorizeUrl=function(n){return this._buildUrl(n)},t.buildLogoutUrl=function(n){return this._buildUrl(n)},t.parseAuthorizeResponseFromFragment=function(n){return this._validateResponse(x(new URLSearchParams(new URL(n).hash.substring(1))))},t.parseAuthorizeResponseFromQuery=function(n){return this._validateResponse(x(new URL(n).searchParams))},t.authorizeWithPopup=function(n,ie){ie===void 0&&(ie={});try{var fe,ae=this;if(!window)throw new Error("no window in options");var le=ae.buildAuthorizeUrl(n),he=ie.popup,ye=(fe=ie.timeout)!=null?fe:36e5;if(he)he.location.href=le;else{var me,xe,Ee=(me=ie.width)!=null?me:600,Se=(xe=ie.height)!=null?xe:800;if(!(he=window.open(le,"uauth:authorize:popup","left="+(window.screenX+(window.innerWidth-Ee)/2)+",top="+(window.screenY+(window.innerHeight-Se)/2)+",width="+Ee+",height="+Se+",resizable,scrollbars=yes,status=1")))throw new Error("popup failed to be constructed")}var Me=!1;return Promise.resolve(new Promise(function(Be,$e){var Ce=setTimeout(function(){Me||(clearInterval(ke),he.close(),$e(new y))},ye),ke=setInterval(function(){var Pe,Ue,qe,He;!Me&&(Pe=he)!=null&&Pe.closed&&(clearInterval(ke),clearTimeout(Ce),$e(new b));try{Ue=he.location.href,qe=new URL(Ue),He=new URL(n.redirect_uri)}catch{return}if(qe.hash="",qe.href===He.href){Me=!0,clearInterval(ke),clearTimeout(Ce),he.close();try{Be(ae.parseAuthorizeResponseFromFragment(Ue))}catch(Ve){$e(Ve)}}},10)}))}catch(Be){return Promise.reject(Be)}},t.authorizeWithDevice=function(n){return Promise.resolve({})},t.getToken=function(n){try{var ie=this._buildRequest(n,{method:"POST"});return Promise.resolve(this._fetchJSON(ie[0],ie[1]))}catch(fe){return Promise.reject(fe)}},t.introspect=function(n){var ie=this._buildRequest(n,{method:"POST"});return this._fetchJSON(ie[0],ie[1])},t.revoke=function(n){try{var ie=this._buildRequest(n,{method:"POST"});return Promise.resolve(this._fetchJSON(ie[0],ie[1])).then(function(){})}catch(fe){return Promise.reject(fe)}},t.userinfo=function(n){var ie=this._buildRequest(n,{method:"GET",headers:{Authorization:"Basic "+n.access_token}});return this._fetchJSON(ie[0],ie[1])},t.jwks=function(n){var ie=this._buildRequest(n,{method:"GET"});return this._fetchJSON(ie[0],ie[1])},t.getTokenWithAuthorizationCode=function(n){return this.getToken(n)},t.getTokenWithRefreshToken=function(n){return this.getToken(n)},t.getTokenWithDeviceCode=function(n){return this.getToken(n)},t.getTokenWithPassword=function(n){return this.getToken(n)},t.getTokenWithSAML=function(n){return this.getToken(n)},t.getTokenWithClientCredentials=function(n){return this.getToken(n)},t._buildUrl=function(n){for(var ie=n.url,fe=v(n,M),ae=new URL(ie),le=new URLSearchParams,he=0,ye=Object.entries(fe);he<ye.length;he++){var me=ye[he],xe=me[0],Ee=me[1];xe!=null&&Ee!=null&&le.append(xe,Ee)}return ae.search=le.toString(),ae.toString()},t._buildRequest=function(n,ie){var fe,ae=n.url,le=n.client_id,he=n.client_secret,ye=n.client_auth_method,me=v(n,W),xe=ie.headers,Ee=ie.method,Se=new Headers((fe=this.options.headers)!=null?fe:[]);new Headers(xe??[]).forEach(function(Be,$e){Se.set($e,Be)}),ie.method==="POST"&&Se.set("Content-Type","application/x-www-form-urlencoded");var Me=a({client_id:le},me);switch(ye){case"client_secret_basic":if(he==null)throw new Error("Client secret not present!");Se.set("Authorization","Basic "+O(le+":"+he));break;case"client_secret_post":if(he==null)throw new Error("Client secret not present!");Me.client_secret=he;break;case"none":case void 0:case null:break;default:throw new Error("Bad client_auth_method")}return[ae,{method:Ee,headers:Se,body:Ee==="POST"?new URLSearchParams(Object.entries(Me)):void 0}]},t._validateResponse=function(n){if(n.error)throw c.Error.fromResponse(n);return n},t._fetchJSON=function(n,ie){try{var fe,ae=this;if(ie.headers){var le=new Headers(ie.headers);le.set("Accept","application/json"),ie.headers=le}else ie.headers={Accept:"application/json"};return Promise.resolve((fe=window)==null?void 0:fe.fetch(n,ie)).then(function(he){return Promise.resolve(he.json()).then(function(ye){if(ae._validateResponse(ye),!he.ok)throw new Error(he.status+" "+he.statusText+": "+JSON.stringify(ye));return ye})})}catch(he){return Promise.reject(he)}},c}();V.Error=B;var J,H,K,Q,G,Y,X=function(){function c(n){this.client=void 0,this.client=n}var t=c.prototype;return t.get=function(n,ie){var fe=ie===void 0?{}:ie,ae=fe.mustExist,le=ae!==void 0&&ae,he=fe.deleteAfter,ye=he!==void 0&&he;try{var me=this;return Promise.resolve(me.client.getStore().get(n)).then(function(xe){var Ee;function Se(Ce){if(Ee)return Ce;var ke=function(){if(ye)return Promise.resolve(me.client.getStore().delete(n)).then(function(){})}();return ke&&ke.then?ke.then(function(){return Me}):Me}if(xe!=null){var Me=xe.value,Be=xe.expiresAt,$e=function(){if(Be!==0&&Be<Date.now())return Promise.resolve(me.client.getStore().delete(n)).then(function(){if(le)throw new Error(n+" does not exist in store");Ee=1})}();return $e&&$e.then?$e.then(Se):Se($e)}if(le)throw new Error(n+" does not exist in store")})}catch(xe){return Promise.reject(xe)}},t.set=function(n,ie,fe){fe===void 0&&(fe=0);try{return Promise.resolve(this.client.getStore().set(n,{expiresAt:fe===0?0:Date.now()+fe,value:ie})).then(function(){})}catch(ae){return Promise.reject(ae)}},t.setAuthorizeRequest=function(n){try{return Promise.resolve(this.set("request",n,3e5)).then(function(){})}catch(ie){return Promise.reject(ie)}},t.getAuthorizeRequest=function(){return this.get("request",{mustExist:!0,deleteAfter:!0})},t.setLogoutRequest=function(n){try{return Promise.resolve(this.set("logout-request",n,3e5)).then(function(){})}catch(ie){return Promise.reject(ie)}},t.getLogoutRequest=function(){return this.get("logout-request",{mustExist:!0,deleteAfter:!0})},t.setVerifier=function(n,ie){try{return Promise.resolve(this.set("verifier:"+n,ie,3e5)).then(function(){})}catch(fe){return Promise.reject(fe)}},t.getVerifier=function(n){return this.get("verifier:"+n,{mustExist:!0,deleteAfter:!0})},t.setOpenIdConfiguration=function(n,ie,fe){try{return Promise.resolve(this.set("openidConfiguration:"+n,ie,fe)).then(function(){})}catch(ae){return Promise.reject(ae)}},t.getOpenIdConfiguration=function(n){return this.get("openidConfiguration:"+n)},t.setAuthorization=function(n){try{var ie=this,fe={clientID:n.idToken.aud,resource:n.resource,scope:n.scope,username:n.idToken.sub},ae=n.expiresAt-Date.now();return Promise.resolve(ie.set("username",fe.username,ae)).then(function(){var le=ie.set;return Promise.resolve(ie._getAuthorizationKey(fe)).then(function(he){return Promise.resolve(le.call(ie,he,n,ae)).then(function(){})})})}catch(le){return Promise.reject(le)}},t.deleteAuthorization=function(n){try{var ie=this;return Promise.resolve(ie.get("username")).then(function(fe){return Promise.resolve(ie._getUsername(n.username,fe)).then(function(ae){function le(){var ye=ie.client.getStore(),me=ye.delete;return Promise.resolve(ie._getAuthorizationKey(n)).then(function(xe){return me.call(ye,xe)})}n.username=ae;var he=function(){if(n.username===fe)return Promise.resolve(ie.client.getStore().delete("username")).then(function(){})}();return he&&he.then?he.then(le):le()})})}catch(fe){return Promise.reject(fe)}},t.getAuthorization=function(n){try{var ie=this,fe=ie.get;return Promise.resolve(ie._getAuthorizationKey(n)).then(function(ae){return fe.call(ie,ae,{mustExist:!0})})}catch(ae){return Promise.reject(ae)}},t._getAuthorizationKey=function(n){try{var ie=this,fe=q,ae=ie._getUsername,le=n.username;return Promise.resolve(ie.get("username")).then(function(he){return Promise.resolve(ae.call(ie,le,he)).then(function(ye){var me,xe,Ee;return"authorization?"+fe.call(N,{username:ye,clientID:(me=n.clientID)!=null?me:ie.client.fallbackLoginOptions.clientID,scope:C((xe=n.scope)!=null?xe:ie.client.fallbackLoginOptions.scope),resource:(Ee=n.resource)!=null?Ee:ie.client.fallbackLoginOptions.resource})})})}catch(he){return Promise.reject(he)}},t._getUsername=function(n,ie){try{if(n==null&&ie==null)throw new Error("no username given");return Promise.resolve(n??ie)}catch(fe){return Promise.reject(fe)}},c}(),$=function(){function c(n){this.storage=void 0,this.storage=n}var t=c.prototype;return t.get=function(n){var ie=this.storage.getItem(n);return ie!=null?JSON.parse(ie):null},t.delete=function(n){return this.storage.removeItem(n),!0},t.set=function(n,ie){return this.storage.setItem(n,JSON.stringify(ie)),this},c}();(function(c){c.openid="openid",c.wallet="wallet"})(K||(K={})),function(c){c.email="email",c.badges="badges",c.offline="offline",c.offline_access="offline_access",c.humanity_check="humanity_check",c.profile="profile",c.social="social"}(Q||(Q={})),function(c){c.twitter="social:twitter",c.reddit="social:reddit",c.youtube="social:youtube",c.discord="social:discord",c.telegram="social:telegram"}(G||(G={})),function(c){c.display_name="profile:name",c.profile_location="profile:location",c.profile_bio="profile:bio",c.ipfs_website="profile:ipfs_website",c.profile_picture="profile:picture",c.profile_uri="profile:uri",c.profile_phone="profile:phone"}(Y||(Y={}));var Z=((J={})[K.openid]={optional:!1},J[K.wallet]={optional:!1},J),ee=((H={})[Q.email]={optional:!0},H[Q.offline]={optional:!1},H[Q.offline_access]={optional:!1},H[Q.humanity_check]={optional:!0},H[Q.badges]={optional:!0},H[Q.profile]={optional:!0},H[Q.social]={optional:!0},H[Y.display_name]={optional:!0},H[Y.profile_location]={optional:!0},H[Y.profile_bio]={optional:!0},H[Y.profile_picture]={optional:!0},H[Y.profile_uri]={optional:!0},H[Y.profile_phone]={optional:!0},H[Y.ipfs_website]={optional:!0},H[G.twitter]={optional:!0},H[G.reddit]={optional:!0},H[G.youtube]={optional:!0},H[G.discord]={optional:!0},H[G.telegram]={optional:!0},H),te=function(c){var t=[],n=c.premium?ee:Z;return Object.keys(n).forEach(function(ie){t.push(ie),n[ie].optional&&t.push(ie+":optional")}),t},re=["clientID","username","scope","resource"];if(typeof window<"u"){var ne=window;ne.UAUTH_VERSION=ne.UAUTH_VERSION||{},ne.UAUTH_VERSION.JS="3.0.1"}var oe=function(){var c=t.prototype;function t(n){var ie,fe,ae,le,he,ye,me,xe,Ee,Se;this.util=N,this._clientStore=new X(this),this.api=void 0,this.fallbackIssuer=void 0,this.fallbackLoginOptions=void 0,this.fallbackLogoutOptions=void 0,this.cacheOptions=void 0,this.issuerResolver=void 0,this.resolution=void 0,this.store=void 0,this.storeOptions=void 0,this.fallbackIssuer=(ie=n.fallbackIssuer)!=null?ie:"https://auth.unstoppabledomains.com",this.resolution=(fe=n.resolution)!=null?fe:new build.Resolution({apiKey:process$1.env.RESOLUTION_API_KEY}),this.storeOptions={store:n.store,storeType:(ae=n.storeType)!=null?ae:"localstore"},this.cacheOptions=a({issuer:!1,userinfo:!0},(le=n.cacheOptions)!=null?le:{}),this.api=new V({headers:{}}),this.fallbackLoginOptions={clientID:n.clientID,clientSecret:n.clientSecret,clientAuthMethod:(he=n.clientAuthMethod)!=null?he:n.clientSecret?"client_secret_post":"none",maxAge:(ye=n.maxAge)!=null?ye:3e5,prompt:(me=n.prompt)!=null?me:"login",resource:n.resource,redirectUri:n.redirectUri,responseMode:(xe=n.responseMode)!=null?xe:"fragment",scope:(Ee=n.scope)!=null?Ee:"openid wallet"},this.fallbackLogoutOptions={rpInitiatedLogout:(Se=n.rpInitiatedLogout)!=null?Se:typeof n.postLogoutRedirectUri=="string",postLogoutRedirectUri:n.postLogoutRedirectUri};var Me=this;this.issuerResolver=new e({webfingerResolver:new u$1({ipfsResolver:new r(function(){return(n.createIpfsUrl||r.defaultCreateUrl).apply(void 0,[].slice.call(arguments))}),domainResolver:{records:function(Be,$e){try{return Promise.resolve(function(Ce,ke){try{var Pe=Promise.resolve(Me.resolution.records(Be,$e))}catch(Ue){return ke(Ue)}return Pe&&Pe.then?Pe.then(void 0,ke):Pe}(0,function(Ce){if(Ce instanceof build.ResolutionError&&Ce.code===build.ResolutionErrorCode.UnspecifiedResolver)return{};throw Ce}))}catch(Ce){return Promise.reject(Ce)}}}})})}return c.getStore=function(){if(this.store)return this.store;if(this.storeOptions.store)this.store=this.storeOptions.store;else switch(this.storeOptions.storeType){case"localstore":this.store=new $(window.localStorage);break;case"sessionstore":this.store=new $(window.sessionStorage);break;case"memory":this.store=new Map;break;default:throw new Error("Bad storeType provided")}return this.store},c.buildAuthorizeRequest=function(n){try{var ie=this,fe=a({},ie.fallbackLoginOptions,n),ae=n.username;return Promise.resolve(ie.getOpenIdConfiguration(ae)).then(function(le){return Promise.resolve(D.createCodeChallengeAndVerifier(43,"S256")).then(function(he){var ye,me=he.verifier,xe=he.challenge,Ee=F.toBase64(F.stringFromBuffer(D.getRandomBytes(32))),Se=F.encodeState(fe.state),Me={url:le.authorization_endpoint,code_challenge:xe,nonce:Ee,state:Se,flow_id:(ye=fe.flowId)!=null?ye:"login",login_hint:ae,client_id:fe.clientID,client_secret:fe.clientSecret,client_auth_method:fe.clientAuthMethod,max_age:fe.maxAge,prompt:fe.prompt,resource:fe.resource,redirect_uri:fe.redirectUri,response_mode:fe.responseMode,scope:fe.scope,code_challenge_method:"S256",response_type:"code",package_name:(fe==null?void 0:fe.packageName)||"@uauth/js",package_version:(fe==null?void 0:fe.packageVersion)||"3.0.1",signup_suggestion:fe.signupSuggestion};return Promise.resolve(ie._clientStore.setAuthorizeRequest(Me)).then(function(){return Promise.resolve(ie._clientStore.setVerifier(xe,me)).then(function(){return Me})})})})}catch(le){return Promise.reject(le)}},c.loginWithPopup=function(n,ie){n===void 0&&(n={});try{var fe=this;return n.responseMode="fragment",Promise.resolve(fe.buildAuthorizeRequest(n)).then(function(ae){return Promise.resolve(fe.api.authorizeWithPopup(ae,ie)).then(function(le){return Promise.resolve(fe.verifyAuthorizeResponse(ae,le))})})}catch(ae){return Promise.reject(ae)}},c.login=function(n){n===void 0&&(n={});try{var ie=this;return Promise.resolve(ie.buildAuthorizeRequest(n)).then(function(fe){function ae(){window.location.href=le}var le=ie.api.buildAuthorizeUrl(fe),he=function(){if(typeof n.beforeRedirect=="function")return Promise.resolve(n.beforeRedirect(le)).then(function(){})}();return he&&he.then?he.then(ae):ae()})}catch(fe){return Promise.reject(fe)}},c.loginCallback=function(n){try{var ie,fe=this,ae=(ie=n==null?void 0:n.url)!=null?ie:window.location.href;return Promise.resolve(fe._clientStore.getAuthorizeRequest()).then(function(le){var he;if(le.response_mode==="fragment")he=fe.api.parseAuthorizeResponseFromFragment(ae);else{if(le.response_mode!=="query")throw new Error("Unsupported response_mode");he=fe.api.parseAuthorizeResponseFromQuery(ae)}return Promise.resolve(fe.verifyAuthorizeResponse(le,he)).then(function(ye){return{authorization:ye,state:F.decodeState(le.state)}})})}catch(le){return Promise.reject(le)}},c.verifyAuthorizeResponse=function(n,ie){try{var fe=this;if(n.state!==ie.state)throw new Error("states don't match");return Promise.resolve(fe.getOpenIdConfiguration(n.login_hint)).then(function(ae){var le=ie.code,he=n.client_auth_method,ye=n.client_secret,me=n.client_id,xe=ae.token_endpoint;return Promise.resolve(fe._clientStore.getVerifier(n.code_challenge)).then(function(Ee){return Promise.resolve(fe.api.getTokenWithAuthorizationCode({url:xe,client_id:me,client_secret:ye,client_auth_method:he,grant_type:"authorization_code",code:le,code_verifier:Ee,redirect_uri:n.redirect_uri})).then(function(Se){return Promise.resolve(D.verifyIdToken(ae.jwks_uri,Se.id_token,n.nonce,n.client_id)).then(function(Me){var Be={accessToken:Se.access_token,expiresAt:Date.now()+1e3*Se.expires_in,idToken:Me,scope:C(n.scope),resource:n.resource};return Promise.resolve(fe._clientStore.setAuthorization(Be)).then(function(){return Be})})})})})}catch(ae){return Promise.reject(ae)}},c.getVerifiedAccounts=function(n,ie){ie===void 0&&(ie=[]);var fe=[];return n.idToken.verified_addresses&&n.idToken.verified_addresses.forEach(function(ae){ie.length>0&&!ie.includes(ae.symbol)||fe.push({address:ae.address,message:ae.proof.message,signature:ae.proof.signature,symbol:ae.symbol})}),fe},c.getAuthorizationAccount=function(n,ie,fe){var ae;ie===void 0&&(ie="sig"),fe===void 0&&(fe="v1");var le=(ae=n.idToken.amr)==null?void 0:ae.filter(function(Se){return Se.startsWith(fe+"."+ie)});if(le&&le.length!=0){var he=le[0].split(".")[3],ye=this.getVerifiedAccounts(n);if(ye)for(var me,xe=_(ye);!(me=xe()).done;){var Ee=me.value;if(Ee.address===he)return Ee}}},c.getOpenIdConfiguration=function(n){try{var ie,fe=function(he){return ie?he:Promise.resolve(n?ae.issuerResolver.resolve(n,ae.fallbackIssuer):fetch(ae.fallbackIssuer+"/.well-known/openid-configuration").then(function(ye){return ye.ok?ye.json():Promise.reject(new Error("bad openid-configuration response"))})).then(function(ye){return Promise.resolve(ae._clientStore.setOpenIdConfiguration(n??"",ye,typeof ae.cacheOptions.issuer=="number"?ae.cacheOptions.issuer:36e5)).then(function(){return ye})})},ae=this,le=function(){if(ae.cacheOptions.issuer)return Promise.resolve(ae._clientStore.getOpenIdConfiguration(n??"")).then(function(he){if(he)return ie=1,he})}();return Promise.resolve(le&&le.then?le.then(fe):fe(le))}catch(he){return Promise.reject(he)}},c.authorization=function(n){n===void 0&&(n={});try{var ie=this;return Promise.resolve(ie._clientStore.getAuthorization(n)).then(function(fe){return fe.scope&&!ie.checkPremiumScopes(fe.scope)&&(fe.upgrade={text:"Please contact Unstoppable Domains to upgrade your account to access premium scopes bd@unstoppabledomains.com",upgrade_for_premium:te({premium:!0}).join(" ")}),fe})}catch(fe){return Promise.reject(fe)}},c.checkPremiumScopes=function(n){return n.split(" ").filter(function(ie){return!te({premium:!1}).includes(ie)}).length>0},c.user=function(n){n===void 0&&(n={});try{var ie,fe=this,ae=(ie=n.claims)!=null?ie:["name","given_name","family_name","middle_name","nickname","preferred_username","profile","picture","website","email","email_verified","gender","birthdate","zoneinfo","locale","phone_number","phone_number_verified","address","updated_at","wallet_address","wallet_type_hint","eip4361_message","eip4361_signature","humanity_check_id"];return Promise.resolve(fe.authorization(n)).then(function(le){var he={sub:le.idToken.sub};if(le.upgrade&&(he.upgrade=le.upgrade,he.email="upgrade-for-premium",he.address={formatted:"upgrade-for-premium",street_address:"upgrade-for-premium",locality:"upgrade-for-premium",region:"upgrade-for-premium",postal_code:"upgrade-for-premium",country:"upgrade-for-premium"},he.phone_number="upgrade-for-premium",he.name="upgrade-for-premium",he.given_name="upgrade-for-premium",he.family_name="upgrade-for-premium",he.middle_name="upgrade-for-premium",he.nickname="upgrade-for-premium",he.preferred_username="upgrade-for-premium",he.profile="upgrade-for-premium",he.picture="https://storage.googleapis.com/unstoppable-client-assets/images/partners/avatar-placeholder.png",he.website="upgrade-for-premium",he.gender="upgrade-for-premium",he.birthdate="upgrade-for-premium",he.zoneinfo="upgrade-for-premium",he.locale="upgrade-for-premium",he.updated_at="upgrade-for-premium",he.humanity_check_id="upgrade-for-premium"),fe.cacheOptions.userinfo){for(var ye,me=_(ae);!(ye=me()).done;){var xe=ye.value;le.idToken[xe]&&(he[xe]=le.idToken[xe])}return he}return Promise.resolve(fe.getOpenIdConfiguration(le.idToken.sub)).then(function(Ee){return Promise.resolve(fe.api.userinfo({client_id:fe.fallbackLoginOptions.clientID,client_secret:fe.fallbackLoginOptions.clientSecret,client_auth_method:fe.fallbackLoginOptions.clientAuthMethod,access_token:le.accessToken,url:Ee.userinfo_endpoint})).then(function(Se){for(var Me,Be=_(ae);!(Me=Be()).done;){var $e=Me.value;Se[$e]&&(he[$e]=Se[$e])}return he})})})}catch(le){return Promise.reject(le)}},c.buildLogoutRequest=function(n){try{var ie=this;return Promise.resolve(ie.authorization(n)).then(function(fe){return Promise.resolve(ie.getOpenIdConfiguration(fe.idToken.sub)).then(function(ae){var le;if(ae.end_session_endpoint==null)throw new Error("end_session_endpoint must exist");var he=(le=n.postLogoutRedirectUri)!=null?le:ie.fallbackLogoutOptions.postLogoutRedirectUri;if(he==null)throw new Error("postLogoutRedirectUri must be supplied");var ye={client_id:ie.fallbackLoginOptions.clientID,client_secret:ie.fallbackLoginOptions.clientSecret,client_auth_method:ie.fallbackLoginOptions.clientAuthMethod,url:ae.end_session_endpoint,id_token_hint:fe.idToken.__raw,post_logout_redirect_uri:he,state:F.encodeState(n.state)};return Promise.resolve(ie._clientStore.setLogoutRequest(ye)).then(function(){return ye})})})}catch(fe){return Promise.reject(fe)}},c.logout=function(n){var ie=n===void 0?{}:n,fe=ie.clientID,ae=ie.username,le=ie.scope,he=ie.resource,ye=v(ie,re);try{var me,xe=function($e){return me?$e:Promise.resolve(Ee.buildLogoutRequest(Se)).then(function(Ce){function ke(){return Promise.resolve(Ee._clientStore.deleteAuthorization(Me)).then(function(){window.location.href=Pe})}var Pe=Ee.api.buildLogoutUrl(Ce),Ue=function(){if(typeof Se.beforeRedirect=="function")return Promise.resolve(Se.beforeRedirect(Pe)).then(function(){})}();return Ue&&Ue.then?Ue.then(ke):ke()})},Ee=this,Se=a({},Ee.fallbackLogoutOptions,ye),Me={clientID:fe,username:ae,scope:le,resource:he},Be=function(){if(!Se.rpInitiatedLogout)return Promise.resolve(Ee._clientStore.deleteAuthorization(Me)).then(function(){me=1})}();return Promise.resolve(Be&&Be.then?Be.then(xe):xe(Be))}catch($e){return Promise.reject($e)}},c.logoutCallback=function(n){n===void 0&&(n={});try{var ie,fe,ae=this,le=(ie=(fe=n)==null?void 0:fe.url)!=null?ie:window.location.href;return Promise.resolve(ae._clientStore.getLogoutRequest()).then(function(he){var ye=ae.api.parseAuthorizeResponseFromQuery(le);return Promise.resolve(ae.verifyLogoutResponse(he,ye)).then(function(){return F.decodeState(he.state)})})}catch(he){return Promise.reject(he)}},c.verifyLogoutResponse=function(n,ie){try{if(n.state!==ie.state)throw new Error("states don't match");return Promise.resolve()}catch(fe){return Promise.reject(fe)}},t}();class UnstoppableDomainsWallet extends Web3Wallet{constructor(t){super(Wallets.UnstoppableDomains,Groups.UD,t)}async login(t){if(t.chain!==Chains.UNSTOPPABLE)throw new ActionNotImplementedException(Actions.Login);if(!("udClientId"in t&&"redirectUri"in t))throw new InvalidParametersException(Chains.UNSTOPPABLE,"Missing udClientId for Unstoppable Domains login");const n=new oe({clientID:t.udClientId,redirectUri:t.redirectUri});try{const ie=await n.loginWithPopup();return{wallet:ie.idToken.sub,publicKey:ie.idToken.wallet_address||"",signature:ie.idToken.__raw,nonce:ie.idToken.nonce,signedDate:"",type:"UNSTOPPABLEDOMAIN",address:ie.idToken.wallet_address||""}}catch(ie){throw"name"in ie&&ie.name==="PopupClosedError"?(console.warn("Unstoppable Domains login popup was closed by the user."),new UserDeniedException(this.name)):ie}}async auth(t){if(t.chain!==Chains.UNSTOPPABLE)throw new ActionNotImplementedException(Actions.Login);if(!("udClientId"in t&&"redirectUri"in t))throw new InvalidParametersException(Chains.UNSTOPPABLE,"Missing udClientId for Unstoppable Domains login");const n=new oe({clientID:t.udClientId,redirectUri:t.redirectUri});try{const ie=await n.loginWithPopup();return{wallet:ie.idToken.sub,publicKey:ie.idToken.wallet_address||"",signature:ie.idToken.__raw,nonce:ie.idToken.nonce||"",signedDate:"",type:"UNSTOPPABLEDOMAIN",address:ie.idToken.wallet_address||""}}catch(ie){throw"name"in ie&&ie.name==="PopupClosedError"?(console.warn("Unstoppable Domains login popup was closed by the user."),new UserDeniedException(this.name)):ie}}payment(t){throw console.error("Payment is not supported for Unstoppable Domains Wallet. inputs:",t),new ActionNotImplementedException(Actions.Payment)}claimNFT(t){throw console.error("Claim NFT is not supported for Unstoppable Domains Wallet. inputs:",t),new ActionNotImplementedException(Actions.ClaimNFT)}recordProduct(t){throw console.error("Record Product is not supported for Unstoppable Domains Wallet. inputs:",t),new ActionNotImplementedException(Actions.Record)}async isWalletInstalled(){return!0}getInstallationLink(){return{chrome:"",firefox:"",website:""}}async isWalletConnected(){return!0}async getConnectedAccounts(){return[]}supportsToken(t,n){return console.log(`Checking token support for ${n} on ${t} in Unstoppable Domains Wallet`),!1}supportsChain(t){return t===Chains.UNSTOPPABLE}async initializeProvider(){}}class XionWallet extends Web3Wallet{constructor(t){super(Wallets.XION,Groups.XION,t)}async login(t){throw console.log("XionWallet login called with inputs:",t),new ActionNotImplementedException(Actions.Login)}async auth(t){throw console.log("XionWallet auth called with inputs:",t),new ActionNotImplementedException(Actions.Auth)}payment(t){throw console.error("Payment is not supported for Xion Wallet. inputs:",t),new ActionNotImplementedException(Actions.Payment)}claimNFT(t){throw console.error("Claim NFT is not supported for Xion Wallet. inputs:",t),new ActionNotImplementedException(Actions.ClaimNFT)}async recordProduct({axiosInstance:t,productId:n}){this.stepizer.changeStep("Recording product on Xion Wallet");const ie=(await t.post("web3/record/xion",{json:{productId:n}})).txId;return this.stepizer.changeStep("Product recorded on Xion Wallet"),{transactionHash:"",transactionHashUrl:"",transactionId:ie,productId:n}}async isWalletInstalled(){return!0}getInstallationLink(){return{chrome:"",firefox:"",website:""}}async isWalletConnected(){return!0}async getConnectedAccounts(){return[]}supportsToken(t,n){return console.log(`Checking token support for ${n} on ${t} in Xion Wallet`),!1}supportsChain(t){return t===Chains.XION}async initializeProvider(){}}class WalletRegistry{constructor(t){this.wallets=[],this.wallets.push(new MetamaskEVMWallet(t),new MetamaskSolanaWallet(t),new PhantomEVMWallet(t),new PhantomSolanaWallet(t),new TrustWalletEVMWallet(t),new UnstoppableDomainsWallet(t),new XionWallet(t))}async initializeAllProviders(){for(const t of this.wallets)await t.initializeProvider()}async getWallet(t,n){const ie=this.wallets.filter(ae=>ae.name.toLowerCase()===t.toLowerCase());if(ie.length==0)throw new WalletNotFoundException(t);const fe=ie.find(ae=>ae.group.toLowerCase()===n.toLowerCase());if(!fe)throw new NotSupportedException(t,n);if(!await fe.isWalletInstalled())throw new WalletNotInstalledException(t);return fe}getGroup(t){return getGroupOfChain(t)}async doAction(t,n,ie,fe,ae){let le;if(!("orderId"in ie)&&!("skuId"in ie)){if(console.log(`Calling wallet for action ${n} on ${ie.chain} ${fe} using ${t}`),le=await this.getWallet(t,this.getGroup(ie.chain)),!le.supportsChain(ie.chain))throw new ChainNotSupportedException(le.name,ie.chain)}else le=await this.getWallet(t,Groups.EVM);switch(n){case Actions.Login:return await le.login({axiosInstance:ae,network:fe,...ie});case Actions.Record:return await le.recordProduct({axiosInstance:ae,network:fe,...ie});case Actions.Auth:return await le.auth({axiosInstance:ae,network:fe,...ie});case Actions.ClaimNFT:return await le.claimNFT({axiosInstance:ae,network:fe,...ie});case Actions.Payment:return await le.payment({axiosInstance:ae,network:fe,...ie});default:throw new ActionNotImplementedException("")}}injectWallet(t){return this.wallets.push(t),this}}class Stepizer{constructor(t){this.name=t}}class ConsoleStepizer extends Stepizer{constructor(){super("Console")}async changeStep(t){console.log(t)}async error(t,n){console.error(t,n)}}class DropWeb3{constructor(t,n){this.network=Network.TESTNET,this.isInitialized=!1,this.stepizer=n||new ConsoleStepizer,this.walletRegistry=new WalletRegistry(this.stepizer),this.network=t,this.axiosInstance=ky.create({prefixUrl:t===Network.TESTNET?"https://apiv3dev.droplinked.com":t===Network.MAINNET?"https://apiv3.droplinked.com":"http://127.0.0.1"})}checkInitialization(){if(!this.isInitialized)throw new InitializationException}async getProvider(){return await this.walletRegistry.initializeAllProviders(),this.isInitialized=!0,this}getSupportedWallets(){return this.walletRegistry.wallets.map(t=>({walletName:t.name,group:t.group}))}getSupportedWalletsForGroup(t){return this.walletRegistry.wallets.filter(n=>n.group.toLowerCase()===t.toLowerCase()).map(n=>({walletName:n.name}))}async getConnectedWallets(){const t=await Promise.all(this.walletRegistry.wallets.map(n=>n.isWalletConnected()));return this.walletRegistry.wallets.filter((n,ie)=>t[ie])}async getAllWallets(){const t=this.walletRegistry.wallets,n=await Promise.all(t.map(le=>le.isWalletInstalled())),ie=await Promise.all(t.map(le=>le.isWalletConnected())),fe=await Promise.all(t.map(async le=>await le.isWalletConnected()?await le.getConnectedAccounts():null)),ae=await Promise.all(t.map(async le=>{if(await le.isWalletConnected()){const he=await le.getConnectedAccounts();return he.length>0?he[0]:null}return null}));return t.map((le,he)=>({walletName:le.name,group:le.group,isConnected:ie[he],isInstalled:n[he],installationLink:le.getInstallationLink(),currentAccount:ae[he]||void 0,connectedAccounts:fe[he]||void 0}))}async getAllWalletsSupportingChain(t){const n=this.walletRegistry.wallets.filter(he=>he.supportsChain(t)),ie=await Promise.all(n.map(he=>he.isWalletInstalled())),fe=await Promise.all(n.map(he=>he.isWalletConnected())),ae=await Promise.all(n.map(async he=>await he.isWalletConnected()?await he.getConnectedAccounts():null)),le=await Promise.all(n.map(async he=>{if(await he.isWalletConnected()){const ye=await he.getConnectedAccounts();return ye.length>0?ye[0]:null}return null}));return n.map((he,ye)=>({walletName:he.name,group:he.group,isConnected:fe[ye],isInstalled:ie[ye],installationLink:he.getInstallationLink(),currentAccount:le[ye]||void 0,connectedAccounts:ae[ye]||void 0}))}async recordProduct(t,n){return this.checkInitialization(),await this.walletRegistry.doAction(t,Actions.Record,n,this.network,this.axiosInstance)}async login(t,n){return this.checkInitialization(),await this.walletRegistry.doAction(t,Actions.Login,n,this.network,this.axiosInstance)}async payment(t,n){return this.checkInitialization(),await this.walletRegistry.doAction(t,Actions.Payment,n,this.network,this.axiosInstance)}async claimNFT(t,n){return this.checkInitialization(),await this.walletRegistry.doAction(t,Actions.ClaimNFT,n,this.network,this.axiosInstance)}async auth(t,n){return this.checkInitialization(),await this.walletRegistry.doAction(t,Actions.Auth,n,this.network,this.axiosInstance)}getWallet(t,n){return this.walletRegistry.wallets.find(ie=>ie.name.toLowerCase()===t.toLowerCase()&&ie.group===n)}}var PaymentTokens=(c=>(c.ETH="ETH",c.RBNT="RBNT",c.SOL="SOL",c.USDC="USDC",c.USDT="USDT",c.MEW="MEW",c.BNB="BNB",c.MATIC="MATIC",c.CSPR="CSPR",c.PARAM="PARAM",c.BDC="BDC",c.BTC="BTC",c))(PaymentTokens||{});exports.AccountAccessDeniedException=AccountAccessDeniedException;exports.ActionExceptions=ActionExceptions;exports.ActionNotImplementedException=ActionNotImplementedException;exports.Actions=Actions;exports.ChainException=ChainException;exports.ChainNotImplementedException=ChainNotImplementedException;exports.ChainNotSupportedException=ChainNotSupportedException;exports.Chains=Chains;exports.DROPLINKED_MANAGER=DROPLINKED_MANAGER;exports.DropWeb3=DropWeb3;exports.Groups=Groups;exports.InitializationException=InitializationException;exports.InsufficientBalanceException=InsufficientBalanceException;exports.InvalidParametersException=InvalidParametersException;exports.MetadataUploadFailedException=MetadataUploadFailedException;exports.MetamaskEVMWallet=MetamaskEVMWallet;exports.MetamaskSolanaWallet=MetamaskSolanaWallet;exports.NFTType=NFTType;exports.Network=Network;exports.NoAccountsFoundException=NoAccountsFoundException;exports.NotSupportedException=NotSupportedException;exports.PaymentTokens=PaymentTokens;exports.PhantomEVMWallet=PhantomEVMWallet;exports.PhantomSolanaWallet=PhantomSolanaWallet;exports.ProductType=ProductType;exports.ProviderException=ProviderException;exports.SkaleUsdcAddressForMainnet=SkaleUsdcAddressForMainnet;exports.SkaleUsdcAddressForTestnet=SkaleUsdcAddressForTestnet;exports.Stepizer=Stepizer;exports.TokenNotSupportedException=TokenNotSupportedException;exports.TrustWalletEVMWallet=TrustWalletEVMWallet;exports.Unauthorized=Unauthorized;exports.UnstoppableDomainsWallet=UnstoppableDomainsWallet;exports.UserDeniedException=UserDeniedException;exports.WalletException=WalletException;exports.WalletNotFoundException=WalletNotFoundException;exports.WalletNotInstalledException=WalletNotInstalledException;exports.WalletRegistry=WalletRegistry;exports.Wallets=Wallets;exports.Web3CallbackFailedException=Web3CallbackFailedException;exports.Web3Wallet=Web3Wallet;exports.XionWallet=XionWallet;exports.ZERO_ADDRESS=ZERO_ADDRESS;exports.chains=chains;exports.getChainByName=getChainByName;exports.getChainsByGroup=getChainsByGroup;exports.getGroupOfChain=getGroupOfChain;exports.isChainInGroup=isChainInGroup;
|
|
49
|
+
See more at `+fe+".":""))||this).code=void 0,ae.description=void 0,ae.uri=void 0,ae.code=n,ae.description=ie,ae.uri=fe,ae}return l(t,c),t.fromResponse=function(n){return new t(n.error,n.error_description,n.error_uri)},t}(m(Error)),M=["url"],W=["url","client_id","client_secret","client_auth_method"],V=function(){function c(n){this.options=void 0,this.options=n}var t=c.prototype;return t.buildAuthorizeUrl=function(n){return this._buildUrl(n)},t.buildLogoutUrl=function(n){return this._buildUrl(n)},t.parseAuthorizeResponseFromFragment=function(n){return this._validateResponse(x(new URLSearchParams(new URL(n).hash.substring(1))))},t.parseAuthorizeResponseFromQuery=function(n){return this._validateResponse(x(new URL(n).searchParams))},t.authorizeWithPopup=function(n,ie){ie===void 0&&(ie={});try{var fe,ae=this;if(!window)throw new Error("no window in options");var le=ae.buildAuthorizeUrl(n),he=ie.popup,ye=(fe=ie.timeout)!=null?fe:36e5;if(he)he.location.href=le;else{var me,xe,Ee=(me=ie.width)!=null?me:600,Se=(xe=ie.height)!=null?xe:800;if(!(he=window.open(le,"uauth:authorize:popup","left="+(window.screenX+(window.innerWidth-Ee)/2)+",top="+(window.screenY+(window.innerHeight-Se)/2)+",width="+Ee+",height="+Se+",resizable,scrollbars=yes,status=1")))throw new Error("popup failed to be constructed")}var Me=!1;return Promise.resolve(new Promise(function(Be,$e){var Ce=setTimeout(function(){Me||(clearInterval(ke),he.close(),$e(new y))},ye),ke=setInterval(function(){var Pe,Ue,qe,He;!Me&&(Pe=he)!=null&&Pe.closed&&(clearInterval(ke),clearTimeout(Ce),$e(new b));try{Ue=he.location.href,qe=new URL(Ue),He=new URL(n.redirect_uri)}catch{return}if(qe.hash="",qe.href===He.href){Me=!0,clearInterval(ke),clearTimeout(Ce),he.close();try{Be(ae.parseAuthorizeResponseFromFragment(Ue))}catch(Ve){$e(Ve)}}},10)}))}catch(Be){return Promise.reject(Be)}},t.authorizeWithDevice=function(n){return Promise.resolve({})},t.getToken=function(n){try{var ie=this._buildRequest(n,{method:"POST"});return Promise.resolve(this._fetchJSON(ie[0],ie[1]))}catch(fe){return Promise.reject(fe)}},t.introspect=function(n){var ie=this._buildRequest(n,{method:"POST"});return this._fetchJSON(ie[0],ie[1])},t.revoke=function(n){try{var ie=this._buildRequest(n,{method:"POST"});return Promise.resolve(this._fetchJSON(ie[0],ie[1])).then(function(){})}catch(fe){return Promise.reject(fe)}},t.userinfo=function(n){var ie=this._buildRequest(n,{method:"GET",headers:{Authorization:"Basic "+n.access_token}});return this._fetchJSON(ie[0],ie[1])},t.jwks=function(n){var ie=this._buildRequest(n,{method:"GET"});return this._fetchJSON(ie[0],ie[1])},t.getTokenWithAuthorizationCode=function(n){return this.getToken(n)},t.getTokenWithRefreshToken=function(n){return this.getToken(n)},t.getTokenWithDeviceCode=function(n){return this.getToken(n)},t.getTokenWithPassword=function(n){return this.getToken(n)},t.getTokenWithSAML=function(n){return this.getToken(n)},t.getTokenWithClientCredentials=function(n){return this.getToken(n)},t._buildUrl=function(n){for(var ie=n.url,fe=v(n,M),ae=new URL(ie),le=new URLSearchParams,he=0,ye=Object.entries(fe);he<ye.length;he++){var me=ye[he],xe=me[0],Ee=me[1];xe!=null&&Ee!=null&&le.append(xe,Ee)}return ae.search=le.toString(),ae.toString()},t._buildRequest=function(n,ie){var fe,ae=n.url,le=n.client_id,he=n.client_secret,ye=n.client_auth_method,me=v(n,W),xe=ie.headers,Ee=ie.method,Se=new Headers((fe=this.options.headers)!=null?fe:[]);new Headers(xe??[]).forEach(function(Be,$e){Se.set($e,Be)}),ie.method==="POST"&&Se.set("Content-Type","application/x-www-form-urlencoded");var Me=a({client_id:le},me);switch(ye){case"client_secret_basic":if(he==null)throw new Error("Client secret not present!");Se.set("Authorization","Basic "+O(le+":"+he));break;case"client_secret_post":if(he==null)throw new Error("Client secret not present!");Me.client_secret=he;break;case"none":case void 0:case null:break;default:throw new Error("Bad client_auth_method")}return[ae,{method:Ee,headers:Se,body:Ee==="POST"?new URLSearchParams(Object.entries(Me)):void 0}]},t._validateResponse=function(n){if(n.error)throw c.Error.fromResponse(n);return n},t._fetchJSON=function(n,ie){try{var fe,ae=this;if(ie.headers){var le=new Headers(ie.headers);le.set("Accept","application/json"),ie.headers=le}else ie.headers={Accept:"application/json"};return Promise.resolve((fe=window)==null?void 0:fe.fetch(n,ie)).then(function(he){return Promise.resolve(he.json()).then(function(ye){if(ae._validateResponse(ye),!he.ok)throw new Error(he.status+" "+he.statusText+": "+JSON.stringify(ye));return ye})})}catch(he){return Promise.reject(he)}},c}();V.Error=B;var J,H,K,Q,G,Y,X=function(){function c(n){this.client=void 0,this.client=n}var t=c.prototype;return t.get=function(n,ie){var fe=ie===void 0?{}:ie,ae=fe.mustExist,le=ae!==void 0&&ae,he=fe.deleteAfter,ye=he!==void 0&&he;try{var me=this;return Promise.resolve(me.client.getStore().get(n)).then(function(xe){var Ee;function Se(Ce){if(Ee)return Ce;var ke=function(){if(ye)return Promise.resolve(me.client.getStore().delete(n)).then(function(){})}();return ke&&ke.then?ke.then(function(){return Me}):Me}if(xe!=null){var Me=xe.value,Be=xe.expiresAt,$e=function(){if(Be!==0&&Be<Date.now())return Promise.resolve(me.client.getStore().delete(n)).then(function(){if(le)throw new Error(n+" does not exist in store");Ee=1})}();return $e&&$e.then?$e.then(Se):Se($e)}if(le)throw new Error(n+" does not exist in store")})}catch(xe){return Promise.reject(xe)}},t.set=function(n,ie,fe){fe===void 0&&(fe=0);try{return Promise.resolve(this.client.getStore().set(n,{expiresAt:fe===0?0:Date.now()+fe,value:ie})).then(function(){})}catch(ae){return Promise.reject(ae)}},t.setAuthorizeRequest=function(n){try{return Promise.resolve(this.set("request",n,3e5)).then(function(){})}catch(ie){return Promise.reject(ie)}},t.getAuthorizeRequest=function(){return this.get("request",{mustExist:!0,deleteAfter:!0})},t.setLogoutRequest=function(n){try{return Promise.resolve(this.set("logout-request",n,3e5)).then(function(){})}catch(ie){return Promise.reject(ie)}},t.getLogoutRequest=function(){return this.get("logout-request",{mustExist:!0,deleteAfter:!0})},t.setVerifier=function(n,ie){try{return Promise.resolve(this.set("verifier:"+n,ie,3e5)).then(function(){})}catch(fe){return Promise.reject(fe)}},t.getVerifier=function(n){return this.get("verifier:"+n,{mustExist:!0,deleteAfter:!0})},t.setOpenIdConfiguration=function(n,ie,fe){try{return Promise.resolve(this.set("openidConfiguration:"+n,ie,fe)).then(function(){})}catch(ae){return Promise.reject(ae)}},t.getOpenIdConfiguration=function(n){return this.get("openidConfiguration:"+n)},t.setAuthorization=function(n){try{var ie=this,fe={clientID:n.idToken.aud,resource:n.resource,scope:n.scope,username:n.idToken.sub},ae=n.expiresAt-Date.now();return Promise.resolve(ie.set("username",fe.username,ae)).then(function(){var le=ie.set;return Promise.resolve(ie._getAuthorizationKey(fe)).then(function(he){return Promise.resolve(le.call(ie,he,n,ae)).then(function(){})})})}catch(le){return Promise.reject(le)}},t.deleteAuthorization=function(n){try{var ie=this;return Promise.resolve(ie.get("username")).then(function(fe){return Promise.resolve(ie._getUsername(n.username,fe)).then(function(ae){function le(){var ye=ie.client.getStore(),me=ye.delete;return Promise.resolve(ie._getAuthorizationKey(n)).then(function(xe){return me.call(ye,xe)})}n.username=ae;var he=function(){if(n.username===fe)return Promise.resolve(ie.client.getStore().delete("username")).then(function(){})}();return he&&he.then?he.then(le):le()})})}catch(fe){return Promise.reject(fe)}},t.getAuthorization=function(n){try{var ie=this,fe=ie.get;return Promise.resolve(ie._getAuthorizationKey(n)).then(function(ae){return fe.call(ie,ae,{mustExist:!0})})}catch(ae){return Promise.reject(ae)}},t._getAuthorizationKey=function(n){try{var ie=this,fe=q,ae=ie._getUsername,le=n.username;return Promise.resolve(ie.get("username")).then(function(he){return Promise.resolve(ae.call(ie,le,he)).then(function(ye){var me,xe,Ee;return"authorization?"+fe.call(N,{username:ye,clientID:(me=n.clientID)!=null?me:ie.client.fallbackLoginOptions.clientID,scope:C((xe=n.scope)!=null?xe:ie.client.fallbackLoginOptions.scope),resource:(Ee=n.resource)!=null?Ee:ie.client.fallbackLoginOptions.resource})})})}catch(he){return Promise.reject(he)}},t._getUsername=function(n,ie){try{if(n==null&&ie==null)throw new Error("no username given");return Promise.resolve(n??ie)}catch(fe){return Promise.reject(fe)}},c}(),$=function(){function c(n){this.storage=void 0,this.storage=n}var t=c.prototype;return t.get=function(n){var ie=this.storage.getItem(n);return ie!=null?JSON.parse(ie):null},t.delete=function(n){return this.storage.removeItem(n),!0},t.set=function(n,ie){return this.storage.setItem(n,JSON.stringify(ie)),this},c}();(function(c){c.openid="openid",c.wallet="wallet"})(K||(K={})),function(c){c.email="email",c.badges="badges",c.offline="offline",c.offline_access="offline_access",c.humanity_check="humanity_check",c.profile="profile",c.social="social"}(Q||(Q={})),function(c){c.twitter="social:twitter",c.reddit="social:reddit",c.youtube="social:youtube",c.discord="social:discord",c.telegram="social:telegram"}(G||(G={})),function(c){c.display_name="profile:name",c.profile_location="profile:location",c.profile_bio="profile:bio",c.ipfs_website="profile:ipfs_website",c.profile_picture="profile:picture",c.profile_uri="profile:uri",c.profile_phone="profile:phone"}(Y||(Y={}));var Z=((J={})[K.openid]={optional:!1},J[K.wallet]={optional:!1},J),ee=((H={})[Q.email]={optional:!0},H[Q.offline]={optional:!1},H[Q.offline_access]={optional:!1},H[Q.humanity_check]={optional:!0},H[Q.badges]={optional:!0},H[Q.profile]={optional:!0},H[Q.social]={optional:!0},H[Y.display_name]={optional:!0},H[Y.profile_location]={optional:!0},H[Y.profile_bio]={optional:!0},H[Y.profile_picture]={optional:!0},H[Y.profile_uri]={optional:!0},H[Y.profile_phone]={optional:!0},H[Y.ipfs_website]={optional:!0},H[G.twitter]={optional:!0},H[G.reddit]={optional:!0},H[G.youtube]={optional:!0},H[G.discord]={optional:!0},H[G.telegram]={optional:!0},H),te=function(c){var t=[],n=c.premium?ee:Z;return Object.keys(n).forEach(function(ie){t.push(ie),n[ie].optional&&t.push(ie+":optional")}),t},re=["clientID","username","scope","resource"];if(typeof window<"u"){var ne=window;ne.UAUTH_VERSION=ne.UAUTH_VERSION||{},ne.UAUTH_VERSION.JS="3.0.1"}var oe=function(){var c=t.prototype;function t(n){var ie,fe,ae,le,he,ye,me,xe,Ee,Se;this.util=N,this._clientStore=new X(this),this.api=void 0,this.fallbackIssuer=void 0,this.fallbackLoginOptions=void 0,this.fallbackLogoutOptions=void 0,this.cacheOptions=void 0,this.issuerResolver=void 0,this.resolution=void 0,this.store=void 0,this.storeOptions=void 0,this.fallbackIssuer=(ie=n.fallbackIssuer)!=null?ie:"https://auth.unstoppabledomains.com",this.resolution=(fe=n.resolution)!=null?fe:new build.Resolution({apiKey:process$1.env.RESOLUTION_API_KEY}),this.storeOptions={store:n.store,storeType:(ae=n.storeType)!=null?ae:"localstore"},this.cacheOptions=a({issuer:!1,userinfo:!0},(le=n.cacheOptions)!=null?le:{}),this.api=new V({headers:{}}),this.fallbackLoginOptions={clientID:n.clientID,clientSecret:n.clientSecret,clientAuthMethod:(he=n.clientAuthMethod)!=null?he:n.clientSecret?"client_secret_post":"none",maxAge:(ye=n.maxAge)!=null?ye:3e5,prompt:(me=n.prompt)!=null?me:"login",resource:n.resource,redirectUri:n.redirectUri,responseMode:(xe=n.responseMode)!=null?xe:"fragment",scope:(Ee=n.scope)!=null?Ee:"openid wallet"},this.fallbackLogoutOptions={rpInitiatedLogout:(Se=n.rpInitiatedLogout)!=null?Se:typeof n.postLogoutRedirectUri=="string",postLogoutRedirectUri:n.postLogoutRedirectUri};var Me=this;this.issuerResolver=new e({webfingerResolver:new u$1({ipfsResolver:new r(function(){return(n.createIpfsUrl||r.defaultCreateUrl).apply(void 0,[].slice.call(arguments))}),domainResolver:{records:function(Be,$e){try{return Promise.resolve(function(Ce,ke){try{var Pe=Promise.resolve(Me.resolution.records(Be,$e))}catch(Ue){return ke(Ue)}return Pe&&Pe.then?Pe.then(void 0,ke):Pe}(0,function(Ce){if(Ce instanceof build.ResolutionError&&Ce.code===build.ResolutionErrorCode.UnspecifiedResolver)return{};throw Ce}))}catch(Ce){return Promise.reject(Ce)}}}})})}return c.getStore=function(){if(this.store)return this.store;if(this.storeOptions.store)this.store=this.storeOptions.store;else switch(this.storeOptions.storeType){case"localstore":this.store=new $(window.localStorage);break;case"sessionstore":this.store=new $(window.sessionStorage);break;case"memory":this.store=new Map;break;default:throw new Error("Bad storeType provided")}return this.store},c.buildAuthorizeRequest=function(n){try{var ie=this,fe=a({},ie.fallbackLoginOptions,n),ae=n.username;return Promise.resolve(ie.getOpenIdConfiguration(ae)).then(function(le){return Promise.resolve(D.createCodeChallengeAndVerifier(43,"S256")).then(function(he){var ye,me=he.verifier,xe=he.challenge,Ee=F.toBase64(F.stringFromBuffer(D.getRandomBytes(32))),Se=F.encodeState(fe.state),Me={url:le.authorization_endpoint,code_challenge:xe,nonce:Ee,state:Se,flow_id:(ye=fe.flowId)!=null?ye:"login",login_hint:ae,client_id:fe.clientID,client_secret:fe.clientSecret,client_auth_method:fe.clientAuthMethod,max_age:fe.maxAge,prompt:fe.prompt,resource:fe.resource,redirect_uri:fe.redirectUri,response_mode:fe.responseMode,scope:fe.scope,code_challenge_method:"S256",response_type:"code",package_name:(fe==null?void 0:fe.packageName)||"@uauth/js",package_version:(fe==null?void 0:fe.packageVersion)||"3.0.1",signup_suggestion:fe.signupSuggestion};return Promise.resolve(ie._clientStore.setAuthorizeRequest(Me)).then(function(){return Promise.resolve(ie._clientStore.setVerifier(xe,me)).then(function(){return Me})})})})}catch(le){return Promise.reject(le)}},c.loginWithPopup=function(n,ie){n===void 0&&(n={});try{var fe=this;return n.responseMode="fragment",Promise.resolve(fe.buildAuthorizeRequest(n)).then(function(ae){return Promise.resolve(fe.api.authorizeWithPopup(ae,ie)).then(function(le){return Promise.resolve(fe.verifyAuthorizeResponse(ae,le))})})}catch(ae){return Promise.reject(ae)}},c.login=function(n){n===void 0&&(n={});try{var ie=this;return Promise.resolve(ie.buildAuthorizeRequest(n)).then(function(fe){function ae(){window.location.href=le}var le=ie.api.buildAuthorizeUrl(fe),he=function(){if(typeof n.beforeRedirect=="function")return Promise.resolve(n.beforeRedirect(le)).then(function(){})}();return he&&he.then?he.then(ae):ae()})}catch(fe){return Promise.reject(fe)}},c.loginCallback=function(n){try{var ie,fe=this,ae=(ie=n==null?void 0:n.url)!=null?ie:window.location.href;return Promise.resolve(fe._clientStore.getAuthorizeRequest()).then(function(le){var he;if(le.response_mode==="fragment")he=fe.api.parseAuthorizeResponseFromFragment(ae);else{if(le.response_mode!=="query")throw new Error("Unsupported response_mode");he=fe.api.parseAuthorizeResponseFromQuery(ae)}return Promise.resolve(fe.verifyAuthorizeResponse(le,he)).then(function(ye){return{authorization:ye,state:F.decodeState(le.state)}})})}catch(le){return Promise.reject(le)}},c.verifyAuthorizeResponse=function(n,ie){try{var fe=this;if(n.state!==ie.state)throw new Error("states don't match");return Promise.resolve(fe.getOpenIdConfiguration(n.login_hint)).then(function(ae){var le=ie.code,he=n.client_auth_method,ye=n.client_secret,me=n.client_id,xe=ae.token_endpoint;return Promise.resolve(fe._clientStore.getVerifier(n.code_challenge)).then(function(Ee){return Promise.resolve(fe.api.getTokenWithAuthorizationCode({url:xe,client_id:me,client_secret:ye,client_auth_method:he,grant_type:"authorization_code",code:le,code_verifier:Ee,redirect_uri:n.redirect_uri})).then(function(Se){return Promise.resolve(D.verifyIdToken(ae.jwks_uri,Se.id_token,n.nonce,n.client_id)).then(function(Me){var Be={accessToken:Se.access_token,expiresAt:Date.now()+1e3*Se.expires_in,idToken:Me,scope:C(n.scope),resource:n.resource};return Promise.resolve(fe._clientStore.setAuthorization(Be)).then(function(){return Be})})})})})}catch(ae){return Promise.reject(ae)}},c.getVerifiedAccounts=function(n,ie){ie===void 0&&(ie=[]);var fe=[];return n.idToken.verified_addresses&&n.idToken.verified_addresses.forEach(function(ae){ie.length>0&&!ie.includes(ae.symbol)||fe.push({address:ae.address,message:ae.proof.message,signature:ae.proof.signature,symbol:ae.symbol})}),fe},c.getAuthorizationAccount=function(n,ie,fe){var ae;ie===void 0&&(ie="sig"),fe===void 0&&(fe="v1");var le=(ae=n.idToken.amr)==null?void 0:ae.filter(function(Se){return Se.startsWith(fe+"."+ie)});if(le&&le.length!=0){var he=le[0].split(".")[3],ye=this.getVerifiedAccounts(n);if(ye)for(var me,xe=_(ye);!(me=xe()).done;){var Ee=me.value;if(Ee.address===he)return Ee}}},c.getOpenIdConfiguration=function(n){try{var ie,fe=function(he){return ie?he:Promise.resolve(n?ae.issuerResolver.resolve(n,ae.fallbackIssuer):fetch(ae.fallbackIssuer+"/.well-known/openid-configuration").then(function(ye){return ye.ok?ye.json():Promise.reject(new Error("bad openid-configuration response"))})).then(function(ye){return Promise.resolve(ae._clientStore.setOpenIdConfiguration(n??"",ye,typeof ae.cacheOptions.issuer=="number"?ae.cacheOptions.issuer:36e5)).then(function(){return ye})})},ae=this,le=function(){if(ae.cacheOptions.issuer)return Promise.resolve(ae._clientStore.getOpenIdConfiguration(n??"")).then(function(he){if(he)return ie=1,he})}();return Promise.resolve(le&&le.then?le.then(fe):fe(le))}catch(he){return Promise.reject(he)}},c.authorization=function(n){n===void 0&&(n={});try{var ie=this;return Promise.resolve(ie._clientStore.getAuthorization(n)).then(function(fe){return fe.scope&&!ie.checkPremiumScopes(fe.scope)&&(fe.upgrade={text:"Please contact Unstoppable Domains to upgrade your account to access premium scopes bd@unstoppabledomains.com",upgrade_for_premium:te({premium:!0}).join(" ")}),fe})}catch(fe){return Promise.reject(fe)}},c.checkPremiumScopes=function(n){return n.split(" ").filter(function(ie){return!te({premium:!1}).includes(ie)}).length>0},c.user=function(n){n===void 0&&(n={});try{var ie,fe=this,ae=(ie=n.claims)!=null?ie:["name","given_name","family_name","middle_name","nickname","preferred_username","profile","picture","website","email","email_verified","gender","birthdate","zoneinfo","locale","phone_number","phone_number_verified","address","updated_at","wallet_address","wallet_type_hint","eip4361_message","eip4361_signature","humanity_check_id"];return Promise.resolve(fe.authorization(n)).then(function(le){var he={sub:le.idToken.sub};if(le.upgrade&&(he.upgrade=le.upgrade,he.email="upgrade-for-premium",he.address={formatted:"upgrade-for-premium",street_address:"upgrade-for-premium",locality:"upgrade-for-premium",region:"upgrade-for-premium",postal_code:"upgrade-for-premium",country:"upgrade-for-premium"},he.phone_number="upgrade-for-premium",he.name="upgrade-for-premium",he.given_name="upgrade-for-premium",he.family_name="upgrade-for-premium",he.middle_name="upgrade-for-premium",he.nickname="upgrade-for-premium",he.preferred_username="upgrade-for-premium",he.profile="upgrade-for-premium",he.picture="https://storage.googleapis.com/unstoppable-client-assets/images/partners/avatar-placeholder.png",he.website="upgrade-for-premium",he.gender="upgrade-for-premium",he.birthdate="upgrade-for-premium",he.zoneinfo="upgrade-for-premium",he.locale="upgrade-for-premium",he.updated_at="upgrade-for-premium",he.humanity_check_id="upgrade-for-premium"),fe.cacheOptions.userinfo){for(var ye,me=_(ae);!(ye=me()).done;){var xe=ye.value;le.idToken[xe]&&(he[xe]=le.idToken[xe])}return he}return Promise.resolve(fe.getOpenIdConfiguration(le.idToken.sub)).then(function(Ee){return Promise.resolve(fe.api.userinfo({client_id:fe.fallbackLoginOptions.clientID,client_secret:fe.fallbackLoginOptions.clientSecret,client_auth_method:fe.fallbackLoginOptions.clientAuthMethod,access_token:le.accessToken,url:Ee.userinfo_endpoint})).then(function(Se){for(var Me,Be=_(ae);!(Me=Be()).done;){var $e=Me.value;Se[$e]&&(he[$e]=Se[$e])}return he})})})}catch(le){return Promise.reject(le)}},c.buildLogoutRequest=function(n){try{var ie=this;return Promise.resolve(ie.authorization(n)).then(function(fe){return Promise.resolve(ie.getOpenIdConfiguration(fe.idToken.sub)).then(function(ae){var le;if(ae.end_session_endpoint==null)throw new Error("end_session_endpoint must exist");var he=(le=n.postLogoutRedirectUri)!=null?le:ie.fallbackLogoutOptions.postLogoutRedirectUri;if(he==null)throw new Error("postLogoutRedirectUri must be supplied");var ye={client_id:ie.fallbackLoginOptions.clientID,client_secret:ie.fallbackLoginOptions.clientSecret,client_auth_method:ie.fallbackLoginOptions.clientAuthMethod,url:ae.end_session_endpoint,id_token_hint:fe.idToken.__raw,post_logout_redirect_uri:he,state:F.encodeState(n.state)};return Promise.resolve(ie._clientStore.setLogoutRequest(ye)).then(function(){return ye})})})}catch(fe){return Promise.reject(fe)}},c.logout=function(n){var ie=n===void 0?{}:n,fe=ie.clientID,ae=ie.username,le=ie.scope,he=ie.resource,ye=v(ie,re);try{var me,xe=function($e){return me?$e:Promise.resolve(Ee.buildLogoutRequest(Se)).then(function(Ce){function ke(){return Promise.resolve(Ee._clientStore.deleteAuthorization(Me)).then(function(){window.location.href=Pe})}var Pe=Ee.api.buildLogoutUrl(Ce),Ue=function(){if(typeof Se.beforeRedirect=="function")return Promise.resolve(Se.beforeRedirect(Pe)).then(function(){})}();return Ue&&Ue.then?Ue.then(ke):ke()})},Ee=this,Se=a({},Ee.fallbackLogoutOptions,ye),Me={clientID:fe,username:ae,scope:le,resource:he},Be=function(){if(!Se.rpInitiatedLogout)return Promise.resolve(Ee._clientStore.deleteAuthorization(Me)).then(function(){me=1})}();return Promise.resolve(Be&&Be.then?Be.then(xe):xe(Be))}catch($e){return Promise.reject($e)}},c.logoutCallback=function(n){n===void 0&&(n={});try{var ie,fe,ae=this,le=(ie=(fe=n)==null?void 0:fe.url)!=null?ie:window.location.href;return Promise.resolve(ae._clientStore.getLogoutRequest()).then(function(he){var ye=ae.api.parseAuthorizeResponseFromQuery(le);return Promise.resolve(ae.verifyLogoutResponse(he,ye)).then(function(){return F.decodeState(he.state)})})}catch(he){return Promise.reject(he)}},c.verifyLogoutResponse=function(n,ie){try{if(n.state!==ie.state)throw new Error("states don't match");return Promise.resolve()}catch(fe){return Promise.reject(fe)}},t}();class UnstoppableDomainsWallet extends Web3Wallet{constructor(t){super(Wallets.UnstoppableDomains,Groups.UD,t)}async login(t){if(t.chain!==Chains.UNSTOPPABLE)throw new ActionNotImplementedException(Actions.Login);if(!("udClientId"in t&&"redirectUri"in t))throw new InvalidParametersException(Chains.UNSTOPPABLE,"Missing udClientId for Unstoppable Domains login");const n=new oe({clientID:t.udClientId,redirectUri:t.redirectUri});try{const ie=await n.loginWithPopup();return{wallet:ie.idToken.sub,publicKey:ie.idToken.wallet_address||"",signature:ie.idToken.__raw,nonce:ie.idToken.nonce,signedDate:"",type:"UNSTOPPABLEDOMAIN",address:ie.idToken.wallet_address||""}}catch(ie){throw"name"in ie&&ie.name==="PopupClosedError"?(console.warn("Unstoppable Domains login popup was closed by the user."),new UserDeniedException(this.name)):ie}}async auth(t){if(t.chain!==Chains.UNSTOPPABLE)throw new ActionNotImplementedException(Actions.Login);if(!("udClientId"in t&&"redirectUri"in t))throw new InvalidParametersException(Chains.UNSTOPPABLE,"Missing udClientId for Unstoppable Domains login");const n=new oe({clientID:t.udClientId,redirectUri:t.redirectUri});try{const ie=await n.loginWithPopup();return{wallet:ie.idToken.sub,publicKey:ie.idToken.wallet_address||"",signature:ie.idToken.__raw,nonce:ie.idToken.nonce||"",signedDate:"",type:"UNSTOPPABLEDOMAIN",address:ie.idToken.wallet_address||""}}catch(ie){throw"name"in ie&&ie.name==="PopupClosedError"?(console.warn("Unstoppable Domains login popup was closed by the user."),new UserDeniedException(this.name)):ie}}payment(t){throw console.error("Payment is not supported for Unstoppable Domains Wallet. inputs:",t),new ActionNotImplementedException(Actions.Payment)}claimNFT(t){throw console.error("Claim NFT is not supported for Unstoppable Domains Wallet. inputs:",t),new ActionNotImplementedException(Actions.ClaimNFT)}recordProduct(t){throw console.error("Record Product is not supported for Unstoppable Domains Wallet. inputs:",t),new ActionNotImplementedException(Actions.Record)}async isWalletInstalled(){return!0}getInstallationLink(){return{chrome:"",firefox:"",website:""}}async isWalletConnected(){return!0}async getConnectedAccounts(){return[]}supportsToken(t,n){return console.log(`Checking token support for ${n} on ${t} in Unstoppable Domains Wallet`),!1}supportsChain(t){return t===Chains.UNSTOPPABLE}async initializeProvider(){}}class XionWallet extends Web3Wallet{constructor(t){super(Wallets.XION,Groups.XION,t)}async login(t){throw console.log("XionWallet login called with inputs:",t),new ActionNotImplementedException(Actions.Login)}async auth(t){throw console.log("XionWallet auth called with inputs:",t),new ActionNotImplementedException(Actions.Auth)}payment(t){throw console.error("Payment is not supported for Xion Wallet. inputs:",t),new ActionNotImplementedException(Actions.Payment)}claimNFT(t){throw console.error("Claim NFT is not supported for Xion Wallet. inputs:",t),new ActionNotImplementedException(Actions.ClaimNFT)}async recordProduct({axiosInstance:t,productId:n}){this.stepizer.changeStep("Recording product on Xion Wallet");const ie=(await t.post("web3/record/xion",{json:{productId:n}})).txId;return this.stepizer.changeStep("Product recorded on Xion Wallet"),{transactionHash:"",transactionHashUrl:"",transactionId:ie,productId:n}}async isWalletInstalled(){return!0}getInstallationLink(){return{chrome:"",firefox:"",website:""}}async isWalletConnected(){return!0}async getConnectedAccounts(){return[]}supportsToken(t,n){return console.log(`Checking token support for ${n} on ${t} in Xion Wallet`),!1}supportsChain(t){return t===Chains.XION}async initializeProvider(){}}class WalletRegistry{constructor(t){this.wallets=[],this.wallets.push(new MetamaskEVMWallet(t),new MetamaskSolanaWallet(t),new PhantomEVMWallet(t),new PhantomSolanaWallet(t),new TrustWalletEVMWallet(t),new UnstoppableDomainsWallet(t),new XionWallet(t))}async initializeAllProviders(){for(const t of this.wallets)await t.initializeProvider()}async getWallet(t,n){const ie=this.wallets.filter(ae=>ae.name.toLowerCase()===t.toLowerCase());if(ie.length==0)throw new WalletNotFoundException(t);const fe=ie.find(ae=>ae.group.toLowerCase()===n.toLowerCase());if(!fe)throw new NotSupportedException(t,n);if(!await fe.isWalletInstalled())throw new WalletNotInstalledException(t);return fe}getGroup(t){return getGroupOfChain(t)}async doAction(t,n,ie,fe,ae){let le;if(!("orderId"in ie)&&!("skuId"in ie)){if(console.log(`Calling wallet for action ${n} on ${ie.chain} ${fe} using ${t}`),le=await this.getWallet(t,this.getGroup(ie.chain)),!le.supportsChain(ie.chain))throw new ChainNotSupportedException(le.name,ie.chain)}else le=await this.getWallet(t,Groups.EVM);switch(n){case Actions.Login:return await le.login({axiosInstance:ae,network:fe,...ie});case Actions.Record:return await le.recordProduct({axiosInstance:ae,network:fe,...ie});case Actions.Auth:return await le.auth({axiosInstance:ae,network:fe,...ie});case Actions.ClaimNFT:return await le.claimNFT({axiosInstance:ae,network:fe,...ie});case Actions.Payment:return await le.payment({axiosInstance:ae,network:fe,...ie});default:throw new ActionNotImplementedException("")}}injectWallet(t){return this.wallets.push(t),this}}class Stepizer{constructor(t){this.name=t}}class ConsoleStepizer extends Stepizer{constructor(){super("Console")}async changeStep(t){console.log(`Waiting: ${t}`)}async error(t,n){console.error(`Error: ${t}. details: ${n}`)}async success(t){console.log(`Success: ${t}`)}}class DropWeb3{constructor(t,n){this.network=Network.TESTNET,this.isInitialized=!1,this.stepizer=n||new ConsoleStepizer,this.walletRegistry=new WalletRegistry(this.stepizer),this.network=t,this.axiosInstance=ky.create({prefixUrl:t===Network.TESTNET?"https://apiv3dev.droplinked.com":t===Network.MAINNET?"https://apiv3.droplinked.com":"http://127.0.0.1"})}checkInitialization(){if(!this.isInitialized)throw new InitializationException}async getProvider(){return await this.walletRegistry.initializeAllProviders(),this.isInitialized=!0,this}getSupportedWallets(){return this.walletRegistry.wallets.map(t=>({walletName:t.name,group:t.group}))}getSupportedWalletsForGroup(t){return this.walletRegistry.wallets.filter(n=>n.group.toLowerCase()===t.toLowerCase()).map(n=>({walletName:n.name}))}async getConnectedWallets(){const t=await Promise.all(this.walletRegistry.wallets.map(n=>n.isWalletConnected()));return this.walletRegistry.wallets.filter((n,ie)=>t[ie])}async getAllWallets(){const t=this.walletRegistry.wallets,n=await Promise.all(t.map(le=>le.isWalletInstalled())),ie=await Promise.all(t.map(le=>le.isWalletConnected())),fe=await Promise.all(t.map(async le=>await le.isWalletConnected()?await le.getConnectedAccounts():null)),ae=await Promise.all(t.map(async le=>{if(await le.isWalletConnected()){const he=await le.getConnectedAccounts();return he.length>0?he[0]:null}return null}));return t.map((le,he)=>({walletName:le.name,group:le.group,isConnected:ie[he],isInstalled:n[he],installationLink:le.getInstallationLink(),currentAccount:ae[he]||void 0,connectedAccounts:fe[he]||void 0}))}async getAllWalletsSupportingChain(t){const n=this.walletRegistry.wallets.filter(he=>he.supportsChain(t)),ie=await Promise.all(n.map(he=>he.isWalletInstalled())),fe=await Promise.all(n.map(he=>he.isWalletConnected())),ae=await Promise.all(n.map(async he=>await he.isWalletConnected()?await he.getConnectedAccounts():null)),le=await Promise.all(n.map(async he=>{if(await he.isWalletConnected()){const ye=await he.getConnectedAccounts();return ye.length>0?ye[0]:null}return null}));return n.map((he,ye)=>({walletName:he.name,group:he.group,isConnected:fe[ye],isInstalled:ie[ye],installationLink:he.getInstallationLink(),currentAccount:le[ye]||void 0,connectedAccounts:ae[ye]||void 0}))}async getAllPaymentWallets(){const t=[Wallets.UnstoppableDomains,Wallets.XION];return(await this.getAllWallets()).filter(n=>!t.includes(n.walletName))}async recordProduct(t,n){return this.checkInitialization(),await this.walletRegistry.doAction(t,Actions.Record,n,this.network,this.axiosInstance)}async login(t,n){return this.checkInitialization(),await this.walletRegistry.doAction(t,Actions.Login,n,this.network,this.axiosInstance)}async payment(t,n){return this.checkInitialization(),await this.walletRegistry.doAction(t,Actions.Payment,n,this.network,this.axiosInstance)}async claimNFT(t,n){return this.checkInitialization(),await this.walletRegistry.doAction(t,Actions.ClaimNFT,n,this.network,this.axiosInstance)}async auth(t,n){return this.checkInitialization(),await this.walletRegistry.doAction(t,Actions.Auth,n,this.network,this.axiosInstance)}getWallet(t,n){return this.walletRegistry.wallets.find(ie=>ie.name.toLowerCase()===t.toLowerCase()&&ie.group===n)}}var PaymentTokens=(c=>(c.ETH="ETH",c.RBNT="RBNT",c.SOL="SOL",c.USDC="USDC",c.USDT="USDT",c.MEW="MEW",c.BNB="BNB",c.MATIC="MATIC",c.CSPR="CSPR",c.PARAM="PARAM",c.BDC="BDC",c.BTC="BTC",c))(PaymentTokens||{});exports.AccountAccessDeniedException=AccountAccessDeniedException;exports.ActionExceptions=ActionExceptions;exports.ActionNotImplementedException=ActionNotImplementedException;exports.Actions=Actions;exports.ChainException=ChainException;exports.ChainNotImplementedException=ChainNotImplementedException;exports.ChainNotSupportedException=ChainNotSupportedException;exports.Chains=Chains;exports.DROPLINKED_MANAGER=DROPLINKED_MANAGER;exports.DropWeb3=DropWeb3;exports.Groups=Groups;exports.InitializationException=InitializationException;exports.InsufficientBalanceException=InsufficientBalanceException;exports.InvalidParametersException=InvalidParametersException;exports.MetadataUploadFailedException=MetadataUploadFailedException;exports.MetamaskEVMWallet=MetamaskEVMWallet;exports.MetamaskSolanaWallet=MetamaskSolanaWallet;exports.NFTType=NFTType;exports.Network=Network;exports.NoAccountsFoundException=NoAccountsFoundException;exports.NotSupportedException=NotSupportedException;exports.PaymentTokens=PaymentTokens;exports.PhantomEVMWallet=PhantomEVMWallet;exports.PhantomSolanaWallet=PhantomSolanaWallet;exports.ProductType=ProductType;exports.ProviderException=ProviderException;exports.SkaleUsdcAddressForMainnet=SkaleUsdcAddressForMainnet;exports.SkaleUsdcAddressForTestnet=SkaleUsdcAddressForTestnet;exports.Stepizer=Stepizer;exports.TokenNotSupportedException=TokenNotSupportedException;exports.TrustWalletEVMWallet=TrustWalletEVMWallet;exports.Unauthorized=Unauthorized;exports.UnstoppableDomainsWallet=UnstoppableDomainsWallet;exports.UserDeniedException=UserDeniedException;exports.WalletException=WalletException;exports.WalletNotFoundException=WalletNotFoundException;exports.WalletNotInstalledException=WalletNotInstalledException;exports.WalletRegistry=WalletRegistry;exports.Wallets=Wallets;exports.Web3CallbackFailedException=Web3CallbackFailedException;exports.Web3Wallet=Web3Wallet;exports.XionWallet=XionWallet;exports.ZERO_ADDRESS=ZERO_ADDRESS;exports.chains=chains;exports.getChainByName=getChainByName;exports.getChainsByGroup=getChainsByGroup;exports.getGroupOfChain=getGroupOfChain;exports.isChainInGroup=isChainInGroup;
|