Files
to_session/web_process/MetaMask 12.16.1/background-0.js
Administrator a0720d80dc fefdwef
2025-11-12 12:54:37 +08:00

1 line
623 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

LavaPack.loadBundle([[10,{"../../../../shared/lib/trace":5773,"../../../../shared/modules/selectors":5798,"../../lib/transaction/metrics":183,"../../lib/transaction/smart-transactions":184,"../../lib/transaction/util":185,"@metamask/smart-transactions-controller/dist/types":2628,"@metamask/transaction-controller":2905},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.TransactionControllerInit=void 0;var n=e("@metamask/transaction-controller"),s=e("@metamask/smart-transactions-controller/dist/types"),i=e("../../../../shared/modules/selectors"),a=e("../../lib/transaction/smart-transactions"),o=e("../../lib/transaction/util"),c=e("../../../../shared/lib/trace"),u=e("../../lib/transaction/metrics");function l(e){const t=d(e);return{isSmartTransaction:(0,i.getIsSmartTransaction)(t),featureFlags:(0,i.getFeatureFlagsByChainId)(t),isHardwareWalletAccount:(0,i.isHardwareWallet)(t)}}function d(e){return{metamask:e}}r.TransactionControllerInit=e=>{const{controllerMessenger:t,initMessenger:r,getFlatState:h,getGlobalChainId:f,getPermittedAccounts:p,getTransactionMetricsRequest:m,persistedState:g}=e,{gasFeeController:y,keyringController:b,networkController:w,onboardingController:A,preferencesController:v,smartTransactionsController:E}=function(e){return{gasFeeController:()=>e.getController("GasFeeController"),keyringController:()=>e.getController("KeyringController"),networkController:()=>e.getController("NetworkController"),onboardingController:()=>e.getController("OnboardingController"),preferencesController:()=>e.getController("PreferencesController"),smartTransactionsController:()=>e.getController("SmartTransactionsController"),transactionUpdateController:()=>e.getController("TransactionUpdateController")}}(e),k=new n.TransactionController({getCurrentNetworkEIP1559Compatibility:()=>r.call("NetworkController:getEIP1559Compatibility"),getCurrentAccountEIP1559Compatibility:async()=>!0,getExternalPendingTransactions:e=>function(e,t){return e.getTransactions({addressFrom:t,status:s.SmartTransactionStatuses.PENDING})}(E(),e),getGasFeeEstimates:(...e)=>y().fetchGasFeeEstimates(...e),getNetworkClientRegistry:(...e)=>w().getNetworkClientRegistry(...e),getNetworkState:()=>w().state,getPermittedAccounts:p,getSavedGasFees:()=>{const e=f();return v().state.advancedGasFee[e]},incomingTransactions:{etherscanApiKeysByChainId:{[n.CHAIN_IDS.MAINNET]:"HF4132KPUFK3EA3AUYSAVWB9D1QSTIZWHJ",[n.CHAIN_IDS.SEPOLIA]:"HF4132KPUFK3EA3AUYSAVWB9D1QSTIZWHJ"},includeTokenTransfers:!1,isEnabled:()=>{var e;return(null===(e=v().state.incomingTransactionsPreferences)||void 0===e?void 0:e[f()])&&A().state.completedOnboarding},queryEntireHistory:!1,updateTransactions:!1},isFirstTimeInteractionEnabled:()=>v().state.securityAlertsEnabled,isSimulationEnabled:()=>v().state.useTransactionSimulations,messenger:t,pendingTransactions:{isResubmitEnabled:()=>{const e=d(h());return!((0,i.getSmartTransactionsPreferenceEnabled)(e)&&(0,i.getCurrentChainSupportsSmartTransactions)(e))}},publicKeyEIP7702:"0x3c7a1cCCe462e96D186B8ca9a1BCB2010C3dABa3",testGasFeeFlows:Boolean(!1),trace:c.trace,hooks:{publish:(e,t)=>function(e,t,r,n,s,i){const{isSmartTransaction:o,featureFlags:c,isHardwareWalletAccount:u}=l(n);if(!o)return{transactionHash:undefined};return(0,a.submitSmartTransactionHook)({transactionMeta:s,signedTransactionInHex:i,transactionController:e,smartTransactionsController:t,controllerMessenger:r,isSmartTransaction:o,isHardwareWallet:u,featureFlags:c})}(k,E(),r,h(),e,t),publishBatch:async e=>await function({transactionController:e,smartTransactionsController:t,hookControllerMessenger:r,flatState:n,transactions:s}){const{isSmartTransaction:i,featureFlags:c,isHardwareWalletAccount:u}=l(n);if(!i)throw new Error("publishBatchSmartTransactionHook: Smart Transaction is required for batch submissions");const d=s[s.length-1],h=(0,o.getTransactionById)(d.id??"",e);if(!h)throw new Error(`publishBatchSmartTransactionHook: Could not find transaction with id ${d.id}`);return(0,a.submitBatchSmartTransactionHook)({transactions:s,transactionController:e,smartTransactionsController:t,controllerMessenger:r,isSmartTransaction:i,isHardwareWallet:u,featureFlags:c,transactionMeta:h})}({transactionController:k,smartTransactionsController:E(),hookControllerMessenger:r,flatState:h(),transactions:e.transactions})},sign:(...e)=>b().signTransaction(...e),state:g.TransactionController});!function(e,t){const r=t();e.subscribe("TransactionController:postTransactionBalanceUpdated",u.handlePostTransactionBalanceUpdate.bind(null,r)),e.subscribe("TransactionController:unapprovedTransactionAdded",(e=>(0,u.handleTransactionAdded)(r,{transactionMeta:e}))),e.subscribe("TransactionController:transactionApproved",u.handleTransactionApproved.bind(null,r)),e.subscribe("TransactionController:transactionDropped",u.handleTransactionDropped.bind(null,r)),e.subscribe("TransactionController:transactionConfirmed",u.handleTransactionConfirmed.bind(null,r)),e.subscribe("TransactionController:transactionFailed",u.handleTransactionFailed.bind(null,r)),e.subscribe("TransactionController:transactionNewSwap",(({transactionMeta:t})=>e.call("SwapsController:setTradeTxId",t.id))),e.subscribe("TransactionController:transactionNewSwapApproval",(({transactionMeta:t})=>e.call("SwapsController:setApproveTxId",t.id))),e.subscribe("TransactionController:transactionRejected",u.handleTransactionRejected.bind(null,r)),e.subscribe("TransactionController:transactionSubmitted",u.handleTransactionSubmitted.bind(null,r))}(r,m);const T=function(e){return{abortTransactionSigning:e.abortTransactionSigning.bind(e),getLayer1GasFee:e.getLayer1GasFee.bind(e),getTransactions:e.getTransactions.bind(e),updateAtomicBatchData:e.updateAtomicBatchData.bind(e),updateBatchTransactions:e.updateBatchTransactions.bind(e),updateEditableParams:e.updateEditableParams.bind(e),updatePreviousGasParams:e.updatePreviousGasParams.bind(e),updateSelectedGasFeeToken:e.updateSelectedGasFeeToken.bind(e),updateTransactionGasFees:e.updateTransactionGasFees.bind(e),updateTransactionSendFlowHistory:e.updateTransactionSendFlowHistory.bind(e)}}(k);return{controller:k,api:T,memStateKey:"TxController"}}}}},{package:"$root$",file:"app/scripts/controller-init/confirmations/transaction-controller-init.ts"}],[100,{"../../../shared/modules/string-utils":5802},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("../../../shared/modules/string-utils");r.default=class{constructor(e={}){const{preferencesController:t,addressBookController:r,accountsController:n,networkController:s,trackMetaMetricsEvent:i}=e;this.preferencesController=t,this.accountsController=n,this.addressBookController=r,this.networkController=s,this._trackMetaMetricsEvent=i}async restoreUserData(e){const t=this.preferencesController.state,{preferences:r,addressBook:n,network:s,internalAccounts:i}=JSON.parse(e);r&&(r.identities=t.identities,r.lostIdentities=t.lostIdentities,r.selectedAddress=t.selectedAddress,this.preferencesController.update(r)),n&&this.addressBookController.update(n,!0),s&&this.networkController.loadBackup(s),i&&this.accountsController.loadBackup(i),(r||n||s||i)&&this._trackMetaMetricsEvent({event:"User Data Imported",category:"Backup"})}async backupUserData(){const e={preferences:{...this.preferencesController.state},internalAccounts:{internalAccounts:this.accountsController.state.internalAccounts},addressBook:{...this.addressBookController.state},network:{networkConfigurationsByChainId:this.networkController.state.networkConfigurationsByChainId}};delete e.preferences.identities,delete e.preferences.lostIdentities,delete e.preferences.selectedAddress;const t=JSON.stringify(e),r=new Date,s=e=>(0,n.prependZero)(e,2);return{fileName:`MetaMaskUserData.${r.getFullYear()}_${s(r.getMonth()+1)}_${s(r.getDay())}_${s(r.getHours())}_${s(r.getMinutes())}_${s(r.getDay())}.json`,data:t}}}}}},{package:"$root$",file:"app/scripts/lib/backup.js"}],[102,{"../../../../shared/constants/metametrics":5730,"../../../../shared/lib/bridge-status/metrics":5758,"../../../../shared/lib/transactions-controller-utils":5775,"../../../../shared/modules/conversion.utils":5782,"../../../../shared/types/bridge-status":5807,"./metrics-utils":101,"@metamask/bridge-controller":1390},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.handleTransactionFailedTypeBridge=r.handleBridgeTransactionFailed=r.handleBridgeTransactionComplete=void 0;var n=e("@metamask/bridge-controller"),s=e("../../../../shared/modules/conversion.utils"),i=e("../../../../shared/lib/transactions-controller-utils"),a=e("../../../../shared/constants/metametrics"),o=e("../../../../shared/types/bridge-status"),c=e("../../../../shared/lib/bridge-status/metrics"),u=e("./metrics-utils");r.handleBridgeTransactionComplete=async(e,{backgroundState:t,trackEvent:r})=>{var l;const{bridgeHistoryItem:d}=e,{hasApprovalTx:h,quote:f}=d,p={metamask:t},m=(0,c.getCommonProperties)(d,p),{chain_id_destination:g,usd_actual_gas:y,usd_quoted_return:b,usd_quoted_gas:w}=m,A=(null===(l=d.status.destChain)||void 0===l?void 0:l.amount)??"0",v=(0,i.calcTokenAmount)(A,d.quote.destAsset.decimals).toNumber(),E=await(0,u.getTokenUsdValue)({chainId:(0,n.formatChainIdToHex)(g),tokenAmount:v,tokenAddress:f.destAsset.address,state:p})??0,k=b&&E?b/E:0,T=w&&y?w/y:0,P=o.StatusTypes.COMPLETE,S=o.StatusTypes.COMPLETE,_=(0,n.isEthUsdt)((0,s.decimalToPrefixedHex)(f.srcChainId),f.srcAsset.address)&&h?{allowance_reset_transaction:o.StatusTypes.COMPLETE}:undefined,C=h?{approval_transaction:o.StatusTypes.COMPLETE}:undefined,I={...m,usd_actual_return:E,quote_vs_execution_ratio:k,quoted_vs_used_gas_ratio:T,..._,...C,source_transaction:P,destination_transaction:S};r({category:a.MetaMetricsEventCategory.CrossChainSwaps,event:a.MetaMetricsEventName.ActionCompleted,properties:I})};r.handleBridgeTransactionFailed=async(e,{backgroundState:t,trackEvent:r})=>{var i;const{bridgeHistoryItem:u}=e,{hasApprovalTx:l,quote:d,status:h}=u,f={metamask:t},p=(0,c.getCommonProperties)(u,f),m=h.srcChain.txHash?o.StatusTypes.COMPLETE:o.StatusTypes.FAILED,g=null!==(i=h.destChain)&&void 0!==i&&i.txHash?o.StatusTypes.COMPLETE:o.StatusTypes.FAILED,y={...p,allowance_reset_transaction:(0,n.isEthUsdt)((0,s.decimalToPrefixedHex)(d.srcChainId),d.srcAsset.address)&&l&&h.srcChain.txHash?o.StatusTypes.COMPLETE:o.StatusTypes.FAILED,approval_transaction:l&&h.srcChain.txHash?o.StatusTypes.COMPLETE:o.StatusTypes.FAILED,source_transaction:m,destination_transaction:g,error_message:""};r({category:a.MetaMetricsEventCategory.CrossChainSwaps,event:a.MetaMetricsEventName.ActionFailed,properties:y})};r.handleTransactionFailedTypeBridge=async(e,{backgroundState:t,trackEvent:r})=>{const i={metamask:t},{transactionMeta:u}=e,l=i.metamask.bridgeStatusState.txHistory[u.id],{quote:d,hasApprovalTx:h}=l,f=(0,c.getCommonProperties)(l,i),p=o.StatusTypes.FAILED,m={...f,...(0,n.isEthUsdt)((0,s.decimalToPrefixedHex)(d.srcChainId),d.srcAsset.address)&&h?{allowance_reset_transaction:o.StatusTypes.COMPLETE}:undefined,...h?{approval_transaction:o.StatusTypes.COMPLETE}:undefined,source_transaction:p,error_message:e.error};r({category:a.MetaMetricsEventCategory.CrossChainSwaps,event:a.MetaMetricsEventName.ActionFailed,properties:m})}}}},{package:"$root$",file:"app/scripts/lib/bridge-status/metrics.ts"}],[103,{"../../../shared/constants/time":5747,loglevel:4863,"readable-stream":5274},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.THREE_MINUTES=void 0,r.default=function(){const e=c();return new s.Transform({transform(t,r,n){const s=t.id===undefined,a=e.add(t.id);s||a?n(null,t):(i.default.debug(`RPC request with id "${t.id}" already seen.`),n())},objectMode:!0})};var n,s=e("readable-stream"),i=(n=e("loglevel"))&&n.__esModule?n:{default:n},a=e("../../../shared/constants/time");const o=r.THREE_MINUTES=3*a.MINUTE,c=()=>{const e=new Map;return setInterval((()=>{const t=Date.now()-o;for(const[r,n]of e.entries()){if(!(n<=t))break;e.delete(r)}}),o),{add:t=>!e.has(t)&&(e.set(t,Date.now()),!0)}}}}},{package:"$root$",file:"app/scripts/lib/createDupeReqFilterStream.ts"}],[104,{"../../../shared/constants/permissions":5738,"../controllers/permissions":72,"@metamask/keyring-api":1983},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function({messenger:e}){return function(t,r,s,i){const o=e.call("AccountsController:getSelectedAccount");if((0,n.isEvmAccountType)(o.type))return s();if(a.includes(t.method))return i(new Error(`Non-EVM account cannot request this method: ${t.method}`));if("wallet_requestPermissions"===t.method&&null!=t&&t.params&&Array.isArray(t.params)&&t.params.length>0&&t.params[0]){const e=Object.keys(t.params[0]);if(a.some((t=>e.includes(t))))return i(new Error(`Non-EVM account cannot request this method: ${e.toString()}`))}return s()}};var n=e("@metamask/keyring-api"),s=e("../../../shared/constants/permissions"),i=e("../controllers/permissions");const a=[...Object.values(s.RestrictedEthMethods),...i.unrestrictedEthSigningMethods]}}},{package:"$root$",file:"app/scripts/lib/createEvmMethodsToNonEvmAccountReqFilterMiddleware.ts"}],[105,{loglevel:4863},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return function(t,r,n){n((n=>{r.error&&s.default.debug("Error in RPC response:\n",r),t.isMetamaskInternal||(s.default.info(`RPC (${e.origin}): ${t.method} -> ${r.error?"error":"success"}`),n())}))}};var n,s=(n=e("loglevel"))&&n.__esModule?n:{default:n}}}},{package:"$root$",file:"app/scripts/lib/createLoggerMiddleware.js"}],[106,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function({mainFrameOrigin:e}){return function(t,r,n){t.mainFrameOrigin=e,n()}}}}},{package:"$root$",file:"app/scripts/lib/createMainFrameOriginMiddleware.ts"}],[107,{"./stream-utils":175,"@metamask/rpc-errors":2554},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("@metamask/rpc-errors"),s=e("./stream-utils");r.default=(e,t)=>async r=>{if(!(0,s.isStreamWritable)(t))return;if(!e[r.method])return void t.write({jsonrpc:"2.0",error:n.rpcErrors.methodNotFound({message:`${r.method} not found`}),id:r.id});let i,a;try{i=await e[r.method](...r.params)}catch(e){a=e}(0,s.isStreamWritable)(t)?a?t.write({jsonrpc:"2.0",error:(0,n.serializeError)(a,{shouldIncludeStack:!0}),id:r.id}):t.write({jsonrpc:"2.0",result:i,id:r.id}):a&&console.error(a)}}}},{package:"$root$",file:"app/scripts/lib/createMetaRPCHandler.js"}],[108,{"./middleware/pending":126,"@metamask/eth-json-rpc-middleware":1592,"@metamask/json-rpc-engine":1933},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function({version:e,getAccounts:t,getCallsStatus:r,getCapabilities:a,processTransaction:o,processTypedMessage:c,processTypedMessageV3:u,processTypedMessageV4:l,processPersonalMessage:d,processDecryptMessage:h,processEncryptionPublicKey:f,processSendCalls:p,getPendingNonce:m,getPendingTransactionByHash:g}){return(0,n.mergeMiddleware)([(0,n.createScaffoldMiddleware)({eth_syncing:!1,web3_clientVersion:`MetaMask/v${e}`}),(0,s.createWalletMiddleware)({getAccounts:t,getCallsStatus:r,getCapabilities:a,processTransaction:o,processTypedMessage:c,processTypedMessageV3:u,processTypedMessageV4:l,processPersonalMessage:d,processDecryptMessage:h,processEncryptionPublicKey:f,processSendCalls:p}),(0,i.createPendingNonceMiddleware)({getPendingNonce:m}),(0,i.createPendingTxMiddleware)({getPendingTransactionByHash:g})])};var n=e("@metamask/json-rpc-engine"),s=e("@metamask/eth-json-rpc-middleware"),i=e("./middleware/pending")}}},{package:"$root$",file:"app/scripts/lib/createMetamaskMiddleware.js"}],[109,{loglevel:4863,"webextension-polyfill":5696},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function({location:e,registerOnboarding:t}){return async function(r,i,a,o){try{if("wallet_registerOnboarding"!==r.method)return void a();r.tabId&&r.tabId!==s.default.tabs.TAB_ID_NONE?await t(e,r.tabId):n.default.debug(`'wallet_registerOnboarding' message from ${e} ignored due to missing tabId`),i.result=!0,o()}catch(e){o(e)}}};var n=i(e("loglevel")),s=i(e("webextension-polyfill"));function i(e){return e&&e.__esModule?e:{default:e}}}}},{package:"$root$",file:"app/scripts/lib/createOnboardingMiddleware.js"}],[11,{"@metamask/profile-sync-controller/auth":2433,"@metamask/profile-sync-controller/sdk":2461},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.AuthenticationControllerInit=void 0;var n=e("@metamask/profile-sync-controller/auth"),s=e("@metamask/profile-sync-controller/sdk");r.AuthenticationControllerInit=({controllerMessenger:e,persistedState:t,getMetaMetricsId:r})=>({controller:new n.Controller({messenger:e,state:t.AuthenticationController,metametrics:{getMetaMetricsId:r,agent:s.Platform.EXTENSION}})})}}},{package:"$root$",file:"app/scripts/controller-init/identity/authentication-controller-init.ts"}],[110,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return function(t,r,n){t.origin=e.origin,n()}}}}},{package:"$root$",file:"app/scripts/lib/createOriginMiddleware.js"}],[111,{"../../../shared/constants/app":5719,"@metamask/rpc-errors":2554},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.SPAM_FILTER_ACTIVATED_ERROR=r.REJECTION_THRESHOLD_IN_MS=r.NUMBER_OF_REJECTIONS_THRESHOLD=r.BLOCKING_THRESHOLD_IN_MS=r.BLOCKABLE_METHODS=void 0,r.default=function({getThrottledOriginState:e,updateThrottledOriginState:t}){return function(r,n,s,h){const{method:f,origin:p}=r;if(!c.has(f)||u.includes(p))return void s();!function(e){if(!e)return!1;const t=Date.now(),{rejections:r,lastRejection:n}=e,s=t-n<=o;return r>=i&&s}(e(p))?s((r=>{if("error"in n&&n.error&&d(n.error)){var s;const i=null===(s=n.error)||void 0===s?void 0:s.data;if("rejectAllApprovals"===(null==i?void 0:i.cause))return void r();const o=e(p)||{rejections:0,lastRejection:0},c=Date.now(),u=c-o.lastRejection<a?o.rejections+1:1;t(p,{rejections:u,lastRejection:c})}else{const r=e(p);Boolean(r)&&t(p,{rejections:0,lastRejection:0})}r()})):h(l)}};var n=e("@metamask/rpc-errors"),s=e("../../../shared/constants/app");const i=r.NUMBER_OF_REJECTIONS_THRESHOLD=3,a=r.REJECTION_THRESHOLD_IN_MS=3e4,o=r.BLOCKING_THRESHOLD_IN_MS=6e4,c=r.BLOCKABLE_METHODS=new Set([s.MESSAGE_TYPE.ETH_SEND_TRANSACTION,s.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA,s.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V1,s.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V3,s.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4,s.MESSAGE_TYPE.PERSONAL_SIGN,s.MESSAGE_TYPE.WATCH_ASSET,s.MESSAGE_TYPE.ADD_ETHEREUM_CHAIN,s.MESSAGE_TYPE.SWITCH_ETHEREUM_CHAIN]),u=["http://127.0.0.1:8080","http://127.0.0.1:8081","http://127.0.0.1:8082","http://localhost:8080","http://localhost:8081","http://localhost:8082"],l=r.SPAM_FILTER_ACTIVATED_ERROR=n.providerErrors.unauthorized("Request blocked due to spam filter."),d=e=>e.code===n.errorCodes.provider.userRejectedRequest}}},{package:"$root$",file:"app/scripts/lib/createOriginThrottlingMiddleware.ts"}],[112,{"../../../shared/constants/app":5719,"../../../shared/constants/metametrics":5730,"../../../shared/constants/security-provider":5741,"../../../shared/constants/signatures":5742,"../../../shared/constants/transaction":5749,"../../../shared/lib/confirmation.utils":5761,"../../../shared/modules/error":5784,"../../../shared/modules/transaction.utils":5804,"../../../ui/helpers/utils/metrics":6805,"./snap-keyring/metrics":164,"@metamask/controller-utils":1474,"@metamask/rpc-errors":2554,"ethereumjs-util":4327},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function({rateLimitTimeout:e=3e5,rateLimitSamplePercent:t=.001,globalRateLimitTimeout:r=3e5,globalRateLimitMaxAmount:P=10,getAccountType:S,getDeviceModel:_,getHardwareTypeForMetric:C,snapAndHardwareMessenger:I,appStateController:B,metaMetricsController:x,getHDEntropyIndex:M}){return async function(O,N,R){const{origin:j,method:L,params:D}=O,U=b[L];let H;switch(U){case g.TIMEOUT:H=void 0!==k[L];break;case g.NON_RATE_LIMITED:H=!1;break;case g.BLOCKED:H=!0;break;default:case g.RANDOM_SAMPLE:H=Math.random()>=t}const F=P>0&&T>=P,G=!0===x.state.participateInMetaMetrics,K=A[L],$={};let V;const q=j!==a.ORIGIN_METAMASK&&!H&&!F&&!0===G;if(q){var z;const t=K?K.REQUESTED:o.MetaMetricsEventName.ProviderMethodCalled;if(t===o.MetaMetricsEventName.SignatureRequested){var Q,J,W,Y,X;let e;var Z,ee;if($.signature_type=L,$.hd_entropy_index=M(),(0,i.isValidAddress)(null==O||null===(Q=O.params)||void 0===Q?void 0:Q[1]))e=null==O||null===(Z=O.params)||void 0===Z?void 0:Z[0];else e=null==O||null===(ee=O.params)||void 0===ee?void 0:ee[1];null!==(J=O.securityAlertResponse)&&void 0!==J&&J.providerRequestsCount&&Object.keys(O.securityAlertResponse.providerRequestsCount).forEach((e=>{$[`ppom_${e}_count`]=O.securityAlertResponse.providerRequestsCount[e]})),$.security_alert_response=(null===(W=O.securityAlertResponse)||void 0===W?void 0:W.result_type)??u.BlockaidResultType.NotApplicable,$.security_alert_reason=(null===(Y=O.securityAlertResponse)||void 0===Y?void 0:Y.reason)??u.BlockaidReason.notApplicable,null!==(X=O.securityAlertResponse)&&void 0!==X&&X.description&&($.security_alert_description=O.securityAlertResponse.description),(0,p.shouldUseRedesignForSignatures)({approvalType:w[L]})&&($.ui_customizations=[...$.ui_customizations||[],o.MetaMetricsEventUiCustomization.RedesignedConfirmation]);const t=await(0,m.getSnapAndHardwareInfoForMetrics)(S,_,C,I);Object.assign($,t);try{if(L===a.MESSAGE_TYPE.PERSONAL_SIGN){const{isSIWEMessage:t}=(0,n.detectSIWE)({data:e});t&&($.ui_customizations=[...$.ui_customizations||[],o.MetaMetricsEventUiCustomization.Siwe])}else if(L===a.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4){const t=(0,c.parseTypedDataMessage)(e);V={},$.eip712_primary_type=t.primaryType,V.eip712_verifyingContract=t.domain.verifyingContract,V.eip712_domain_version=t.domain.version,V.eip712_domain_name=t.domain.name,l.PRIMARY_TYPES_PERMIT.includes(t.primaryType)?$.ui_customizations=[...$.ui_customizations||[],o.MetaMetricsEventUiCustomization.Permit]:l.PRIMARY_TYPES_ORDER.includes(t.primaryType)&&($.ui_customizations=[...$.ui_customizations||[],o.MetaMetricsEventUiCustomization.Order])}}catch(e){console.warn(`createRPCMethodTrackingMiddleware: Errored - ${e}`)}}else $.method=L;const s=v[L];if(s&&($.params=s(D)),null===(z=E[L])||void 0===z||z.call(E,O,undefined,y.REQUESTED,$),t===o.MetaMetricsEventName.SignatureRequested){!function(e,t,r){e.createEventFragment({category:o.MetaMetricsEventCategory.InpageProvider,initialEvent:o.MetaMetricsEventName.SignatureRequested,successEvent:o.MetaMetricsEventName.SignatureApproved,failureEvent:o.MetaMetricsEventName.SignatureRejected,uniqueIdentifier:(0,f.generateSignatureUniqueId)(t.id),persist:!0,referrer:{url:t.origin},...r})}(x,O,{properties:$,sensitiveProperties:V})}else x.trackEvent({event:t,category:o.MetaMetricsEventCategory.InpageProvider,referrer:{url:j},properties:$});U===g.TIMEOUT&&(k[L]=setTimeout((()=>{delete k[L]}),e)),T+=1,setTimeout((()=>{T-=1}),r)}R((async e=>{var t,r,n,i;if(!1===q||void 0===K)return e();const a=null===(t=N.error)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.location;let c,u;const l=(0,h.getErrorMessage)(N.error);if((null===(r=N.error)||void 0===r?void 0:r.code)===s.errorCodes.provider.userRejectedRequest?(c=K.REJECTED,u=y.REJECTED):(null===(n=N.error)||void 0===n?void 0:n.code)===s.errorCodes.rpc.internal&&[l,N.error.message].includes("Request rejected by user or snap.")?(c=K.REJECTED,u=y.REJECTED,$.status=l):(c=K.APPROVED,u=y.APPROVED),!c)return e();null===(i=E[L])||void 0===i||i.call(E,O,N,u,$);let p={};if(d.SIGNING_METHODS.includes(L)){var m;const e=B.getSignatureSecurityAlertResponse(null===(m=O.securityAlertResponse)||void 0===m?void 0:m.securityAlertId);p=(0,f.getBlockaidMetricsProps)({securityAlertResponse:e})}const g={...$,...p,location:a};if(c===o.MetaMetricsEventName.SignatureRejected||c===o.MetaMetricsEventName.SignatureApproved){const e={abandoned:c===K.REJECTED},t={properties:{...g,hd_entropy_index:M()},sensitiveProperties:V};!function(e,t,r,n){const s=(0,f.generateSignatureUniqueId)(t.id);e.updateEventFragment(s,n),e.finalizeEventFragment(s,r)}(x,O,e,t)}else x.trackEvent({event:c,category:o.MetaMetricsEventCategory.InpageProvider,referrer:{url:j},properties:g});return e()}))}};var n=e("@metamask/controller-utils"),s=e("@metamask/rpc-errors"),i=e("ethereumjs-util"),a=e("../../../shared/constants/app"),o=e("../../../shared/constants/metametrics"),c=e("../../../shared/modules/transaction.utils"),u=e("../../../shared/constants/security-provider"),l=e("../../../shared/constants/signatures"),d=e("../../../shared/constants/transaction"),h=e("../../../shared/modules/error"),f=e("../../../ui/helpers/utils/metrics"),p=e("../../../shared/lib/confirmation.utils"),m=e("./snap-keyring/metrics");const g={TIMEOUT:"timeout",BLOCKED:"blocked",NON_RATE_LIMITED:"non_rate_limited",RANDOM_SAMPLE:"random_sample"},y={REQUESTED:"REQUESTED",APPROVED:"APPROVED",REJECTED:"REJECTED"},b={[a.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA]:g.NON_RATE_LIMITED,[a.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V3]:g.NON_RATE_LIMITED,[a.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4]:g.NON_RATE_LIMITED,[a.MESSAGE_TYPE.PERSONAL_SIGN]:g.NON_RATE_LIMITED,[a.MESSAGE_TYPE.ETH_DECRYPT]:g.NON_RATE_LIMITED,[a.MESSAGE_TYPE.ETH_GET_ENCRYPTION_PUBLIC_KEY]:g.NON_RATE_LIMITED,[a.MESSAGE_TYPE.ADD_ETHEREUM_CHAIN]:g.NON_RATE_LIMITED,[a.MESSAGE_TYPE.SWITCH_ETHEREUM_CHAIN]:g.NON_RATE_LIMITED,[a.MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS]:g.TIMEOUT,[a.MESSAGE_TYPE.WALLET_REQUEST_PERMISSIONS]:g.TIMEOUT,[a.MESSAGE_TYPE.SEND_METADATA]:g.BLOCKED,[a.MESSAGE_TYPE.ETH_CHAIN_ID]:g.BLOCKED,[a.MESSAGE_TYPE.ETH_ACCOUNTS]:g.BLOCKED,[a.MESSAGE_TYPE.LOG_WEB3_SHIM_USAGE]:g.BLOCKED,[a.MESSAGE_TYPE.GET_PROVIDER_STATE]:g.BLOCKED,[a.MESSAGE_TYPE.WALLET_GET_CALLS_STATUS]:g.NON_RATE_LIMITED,[a.MESSAGE_TYPE.WALLET_GET_CAPABILITIES]:g.NON_RATE_LIMITED,[a.MESSAGE_TYPE.WALLET_SEND_CALLS]:g.NON_RATE_LIMITED},w={[a.MESSAGE_TYPE.PERSONAL_SIGN]:n.ApprovalType.PersonalSign,[a.MESSAGE_TYPE.SIGN]:n.ApprovalType.SignTransaction,[a.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA]:n.ApprovalType.EthSignTypedData,[a.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V1]:n.ApprovalType.EthSignTypedData,[a.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V3]:n.ApprovalType.EthSignTypedData,[a.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4]:n.ApprovalType.EthSignTypedData},A={[a.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA]:{APPROVED:o.MetaMetricsEventName.SignatureApproved,REJECTED:o.MetaMetricsEventName.SignatureRejected,REQUESTED:o.MetaMetricsEventName.SignatureRequested},[a.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V3]:{APPROVED:o.MetaMetricsEventName.SignatureApproved,REJECTED:o.MetaMetricsEventName.SignatureRejected,REQUESTED:o.MetaMetricsEventName.SignatureRequested},[a.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4]:{APPROVED:o.MetaMetricsEventName.SignatureApproved,REJECTED:o.MetaMetricsEventName.SignatureRejected,REQUESTED:o.MetaMetricsEventName.SignatureRequested},[a.MESSAGE_TYPE.PERSONAL_SIGN]:{APPROVED:o.MetaMetricsEventName.SignatureApproved,REJECTED:o.MetaMetricsEventName.SignatureRejected,REQUESTED:o.MetaMetricsEventName.SignatureRequested},[a.MESSAGE_TYPE.ETH_DECRYPT]:{APPROVED:o.MetaMetricsEventName.DecryptionApproved,REJECTED:o.MetaMetricsEventName.DecryptionRejected,REQUESTED:o.MetaMetricsEventName.DecryptionRequested},[a.MESSAGE_TYPE.ETH_GET_ENCRYPTION_PUBLIC_KEY]:{APPROVED:o.MetaMetricsEventName.EncryptionPublicKeyApproved,REJECTED:o.MetaMetricsEventName.EncryptionPublicKeyRejected,REQUESTED:o.MetaMetricsEventName.EncryptionPublicKeyRequested},[a.MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS]:{APPROVED:o.MetaMetricsEventName.PermissionsApproved,REJECTED:o.MetaMetricsEventName.PermissionsRejected,REQUESTED:o.MetaMetricsEventName.PermissionsRequested},[a.MESSAGE_TYPE.WALLET_REQUEST_PERMISSIONS]:{APPROVED:o.MetaMetricsEventName.PermissionsApproved,REJECTED:o.MetaMetricsEventName.PermissionsRejected,REQUESTED:o.MetaMetricsEventName.PermissionsRequested},[a.MESSAGE_TYPE.WALLET_GET_CALLS_STATUS]:{REQUESTED:o.MetaMetricsEventName.Wallet5792Called},[a.MESSAGE_TYPE.WALLET_GET_CAPABILITIES]:{REQUESTED:o.MetaMetricsEventName.Wallet5792Called},[a.MESSAGE_TYPE.WALLET_SEND_CALLS]:{REQUESTED:o.MetaMetricsEventName.Wallet5792Called}},v={[a.MESSAGE_TYPE.WATCH_ASSET]:({type:e})=>({type:e}),[a.MESSAGE_TYPE.ADD_ETHEREUM_CHAIN]:([{chainId:e}])=>({chainId:e}),[a.MESSAGE_TYPE.SWITCH_ETHEREUM_CHAIN]:([{chainId:e}])=>({chainId:e})},E={[a.MESSAGE_TYPE.WALLET_SEND_CALLS]:function(e,t,r,n){var s;if(r!==y.REQUESTED)return;const{params:i}=e,a=null==i||null===(s=i[0])||void 0===s||null===(s=s.calls)||void 0===s?void 0:s.length;a&&(n.batch_transaction_count=a)}},k={};let T=0}}},{package:"$root$",file:"app/scripts/lib/createRPCMethodTrackingMiddleware.js"}],[113,{"promise-to-callback":5009,"readable-stream":5274},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){return new a(e,t)};var n,s=e("readable-stream"),i=(n=e("promise-to-callback"))&&n.__esModule?n:{default:n};class a extends s.Writable{constructor(e,t){super({objectMode:!0,...t}),this._asyncWriteFn=e}_write(e,t,r){(0,i.default)(this._asyncWriteFn(e,t))(r)}}}}},{package:"$root$",file:"app/scripts/lib/createStreamSink.js"}],[114,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return function(t,r,n){t.tabId=e.tabId,n()}}}}},{package:"$root$",file:"app/scripts/lib/createTabIdMiddleware.js"}],[115,{"../../../shared/constants/app":5719,"../../../shared/lib/trace":5773},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){return async function(e,t,r){const{id:n,method:o}=e,c=i[o];c&&(e.traceContext=await(0,s.trace)({name:c,id:n,tags:a[o]}),await(0,s.trace)({name:s.TraceName.Middleware,id:n,parentContext:e.traceContext})),r()}};var n=e("../../../shared/constants/app"),s=e("../../../shared/lib/trace");const i={[n.MESSAGE_TYPE.ETH_SEND_TRANSACTION]:s.TraceName.Transaction,[n.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA]:s.TraceName.Signature,[n.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V1]:s.TraceName.Signature,[n.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V3]:s.TraceName.Signature,[n.MESSAGE_TYPE.ETH_SIGN_TYPED_DATA_V4]:s.TraceName.Signature,[n.MESSAGE_TYPE.PERSONAL_SIGN]:s.TraceName.Signature},a={[n.MESSAGE_TYPE.ETH_SEND_TRANSACTION]:{source:"dapp"}}}}},{package:"$root$",file:"app/scripts/lib/createTracingMiddleware.ts"}],[116,{"@metamask/browser-passworder":1448},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.encryptorFactory=void 0;var n=e("@metamask/browser-passworder");const s=e=>async(t,r,s,i)=>(0,n.encrypt)(t,r,s,i,{algorithm:"PBKDF2",params:{iterations:e}}),i=e=>async(t,r,s)=>(0,n.encryptWithDetail)(t,r,s,{algorithm:"PBKDF2",params:{iterations:e}}),a=e=>async(t,r,s,i)=>(0,n.keyFromPassword)(t,r,s,i??{algorithm:"PBKDF2",params:{iterations:e}}),o=e=>t=>(0,n.isVaultUpdated)(t,{algorithm:"PBKDF2",params:{iterations:e}});r.encryptorFactory=e=>({encrypt:s(e),encryptWithKey:n.encryptWithKey,encryptWithDetail:i(e),decrypt:n.decrypt,decryptWithKey:n.decryptWithKey,decryptWithDetail:n.decryptWithDetail,keyFromPassword:a(e),isVaultUpdated:o(e),importKey:n.importKey,exportKey:n.exportKey,generateSalt:n.generateSalt})}}},{package:"$root$",file:"app/scripts/lib/encryptor-factory.ts"}],[117,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=[{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"resolver",outputs:[{name:"",type:"address"}],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"label",type:"bytes32"},{name:"owner",type:"address"}],name:"setSubnodeOwner",outputs:[],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"ttl",type:"uint64"}],name:"setTTL",outputs:[],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"ttl",outputs:[{name:"",type:"uint64"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"resolver",type:"address"}],name:"setResolver",outputs:[],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"owner",type:"address"}],name:"setOwner",outputs:[],payable:!1,type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"owner",type:"address"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!0,name:"label",type:"bytes32"},{indexed:!1,name:"owner",type:"address"}],name:"NewOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"resolver",type:"address"}],name:"NewResolver",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"ttl",type:"uint64"}],name:"NewTTL",type:"event"}]}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/contracts/registry.js"}],[118,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=[{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"hash",type:"bytes32"}],name:"setContent",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"pure",type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"key",type:"string"},{name:"value",type:"string"}],name:"setText",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"},{name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"setPubkey",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"},{name:"key",type:"string"}],name:"text",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],name:"setABI",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"name",type:"string"}],name:"setName",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"contenthash",outputs:[{name:"",type:"bytes"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"pubkey",outputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"addr",type:"address"}],name:"setAddr",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{inputs:[{name:"ensAddr",type:"address"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!0,name:"contentType",type:"uint256"}],name:"ABIChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"x",type:"bytes32"},{indexed:!1,name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"indexedKey",type:"string"},{indexed:!1,name:"key",type:"string"}],name:"TextChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"}]}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/contracts/resolver.js"}],[119,{"./contracts/registry":117,"./contracts/resolver":118,"@ensdomains/content-hash":417,"@ethersproject/contracts":507,"@ethersproject/providers":545,"eth-ens-namehash":4279},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=async function({provider:e,name:t}){const r=n.default.hash(t),u=Number.parseInt(await e.request({method:"net_version"}),10),d=function(e){switch(e){case 1:case 3:case 4:case 5:case 6:return"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";default:return null}}(u);if(!d)throw new Error(`EnsIpfsResolver - no known ens-ipfs registry for chainId "${u}"`);const h=new i.Web3Provider(e),f=new a.Contract(d,o.default,h),p=await f.resolver(r);if(l(p))throw new Error(`EnsIpfsResolver - no resolver found for name "${t}"`);const m=new a.Contract(p,c.default,h),g=await m.supportsInterface("0xbc1c58d1"),y=await m.supportsInterface("0xd8389dc5");if(g){const e=(await m.contenthash(r))[0];let t=s.default.decode(e);const n=s.default.getCodec(e);return"ipfs-ns"!==n&&"ipns-ns"!==n||(t=s.default.helpers.cidV0ToV1Base32(t)),{type:n,hash:t}}if(y){const e=(await m.content(r))[0];if(l(e))throw new Error(`EnsIpfsResolver - no content ID found for name "${t}"`);return{type:"swarm-ns",hash:e.slice(2)}}throw new Error(`EnsIpfsResolver - the resolver for name "${t}" is not standard, it should either supports contenthash() or content()`)};var n=u(e("eth-ens-namehash")),s=u(e("@ensdomains/content-hash")),i=e("@ethersproject/providers"),a=e("@ethersproject/contracts"),o=u(e("./contracts/registry")),c=u(e("./contracts/resolver"));function u(e){return e&&e.__esModule?e:{default:e}}function l(e){return[undefined,null,"0x","0x0","0x0000000000000000000000000000000000000000000000000000000000000000"].includes(e)}}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/resolver.js"}],[12,{"../../../../shared/constants/metametrics":5730,"../../../../shared/modules/environment":5783,"@metamask/profile-sync-controller/user-storage":2442,"@sentry/browser":3084},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.UserStorageControllerInit=void 0;var n=e("@metamask/profile-sync-controller/user-storage"),s=e("@sentry/browser"),i=e("../../../../shared/modules/environment"),a=e("../../../../shared/constants/metametrics");r.UserStorageControllerInit=e=>{const{controllerMessenger:t,persistedState:r,trackEvent:o}=e;return{controller:new n.Controller({messenger:t,state:r.UserStorageController,config:{accountSyncing:{maxNumberOfAccountsToAdd:(0,i.isProduction)()?undefined:100,onAccountAdded:e=>{o({category:a.MetaMetricsEventCategory.ProfileSyncing,event:a.MetaMetricsEventName.AccountsSyncAdded,properties:{profile_id:e}})},onAccountNameUpdated:e=>{o({category:a.MetaMetricsEventCategory.ProfileSyncing,event:a.MetaMetricsEventName.AccountsSyncNameUpdated,properties:{profile_id:e}})},onAccountSyncErroneousSituation:(e,t,r)=>{(0,s.captureException)(new Error(`Account sync - ${t}`),r),o({category:a.MetaMetricsEventCategory.ProfileSyncing,event:a.MetaMetricsEventName.AccountsSyncErroneousSituation,properties:{profile_id:e,situation_message:t}})}}},env:{isAccountSyncingEnabled:!0}})}}}}},{package:"$root$",file:"app/scripts/controller-init/identity/user-storage-controller-init.ts"}],[120,{"../../../../shared/modules/fetch-with-timeout":5786,"./resolver":119,"base32-encode":3975,"base64-js":3976,"webextension-polyfill":5696},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function({provider:e,getCurrentChainId:t,getIpfsGateway:r,getUseAddressBarEnsResolution:a}){const c=l.map((e=>`*://*.${e}/*`));return i.default.webRequest.onErrorOccurred.addListener(d,{urls:c,types:["main_frame"]}),{remove(){i.default.webRequest.onErrorOccurred.removeListener(d)}};async function d(c){const{tabId:d,url:h}=c;if(-1===d||"0x1"!==t())return;const{hostname:f,pathname:p,search:m,hash:g}=new URL(h),y=f.split("."),b=y[y.length-1];l.includes(b)&&async function({tabId:t,name:c,pathname:l,search:d,fragment:h}){const f=r(),p=a(),m=`https://app.ens.domains/name/${c}`;p&&f&&await i.default.tabs.update(t,{url:"loading.html"});let g=m;0;try{const{type:t,hash:r}=await(0,o.default)({provider:e,name:c});if("ipfs-ns"===t||"ipns-ns"===t){if(""===f)return void(g=null);const e=`https://${r}.${t.slice(0,4)}.${f}${l}${d||""}${h||""}`;try{200===(await u(e,{method:"HEAD"})).status&&(g=e)}catch(e){console.warn(e)}}else if("swarm-ns"===t)g=`https://swarm-gateways.net/bzz:/${r}${l}${d||""}${h||""}`;else if("onion"===t||"onion3"===t)g=`http://${r}.onion${l}${d||""}${h||""}`;else if("zeronet"===t)g=`http://127.0.0.1:43110/${r}${l}${d||""}${h||""}`;else if("skynet-ns"===t){const e=r.padEnd(r.length+4-r.length%4,"="),t=s.default.toByteArray(e),i={padding:!1};g=`https://${(0,n.default)(t,"RFC4648-HEX",i).toLowerCase()}.siasky.net${l}${d||""}${h||""}`}}catch(e){console.warn(e)}finally{g&&(p||!p&&g!==m)&&await i.default.tabs.update(t,{url:g})}}({tabId:d,name:f,pathname:p,search:m,fragment:g})}};var n=c(e("base32-encode")),s=c(e("base64-js")),i=c(e("webextension-polyfill")),a=c(e("../../../../shared/modules/fetch-with-timeout")),o=c(e("./resolver"));function c(e){return e&&e.__esModule?e:{default:e}}const u=(0,a.default)(),l=["eth"]}}},{package:"$root$",file:"app/scripts/lib/ens-ipfs/setup.js"}],[123,{lodash:4855},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return s((0,n.cloneDeep)(e),(e=>null===e?"null":typeof e))};var n=e("lodash");function s(e={},t){return Object.entries(e).forEach((([r,n])=>{e[r]="object"==typeof n&&null!==n?s(n,t):t(n)})),e}}}},{package:"$root$",file:"app/scripts/lib/getObjStructure.js"}],[124,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.hardwareKeyringBuilderFactory=function(e,t){const r=()=>new e({bridge:new t});return r.type=e.type,r}}}},{package:"$root$",file:"app/scripts/lib/hardware-keyring-builder-factory.ts"}],[126,{"../util":187,"@metamask/json-rpc-engine":1933},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createPendingNonceMiddleware=function({getPendingNonce:e}){return(0,n.createAsyncMiddleware)((async(t,r,n)=>{const{method:s,params:i}=t;if("eth_getTransactionCount"!==s)return void n();const[a,o]=i;"pending"===o?r.result=await e(a,t.networkClientId):n()}))},r.createPendingTxMiddleware=function({getPendingTransactionByHash:e}){return(0,n.createAsyncMiddleware)((async(t,r,n)=>{const{method:i,params:a}=t;if("eth_getTransactionByHash"!==i)return void n();const[o]=a,c=e(o);c?r.result=(0,s.formatTxMetaForRpcResult)(c):n()}))};var n=e("@metamask/json-rpc-engine"),s=e("../util")}}},{package:"$root$",file:"app/scripts/lib/middleware/pending.js"}],[127,{events:4399,loglevel:4863},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=i(e("events")),s=i(e("loglevel"));function i(e){return e&&e.__esModule?e:{default:e}}class a extends n.default{constructor(e={}){super();const t=e.migrations||[];this.migrations=t.sort(((e,t)=>e.version-t.version));const r=this.migrations.slice(-1)[0];this.defaultVersion=e.defaultVersion||r&&r.version||0}async migrateData(e=this.generateInitialState()){const t=this.migrations.filter((function(t){return t.version>e.meta.version}));for(const r of t)try{s.default.info(`Running migration ${r.version}...`);const t=await r.migrate(e);if(!t.data)throw new Error("Migrator - migration returned empty data");if(t.version!==undefined&&t.meta.version!==r.version)throw new Error("Migrator - Migration did not update version number correctly");e=t,s.default.info(`Migration ${r.version} complete`)}catch(t){const n=t.message;return t.message=`MetaMask Migration Error #${r.version}: ${n}`,this.emit("error",t),e}return e}generateInitialState(e){return{meta:{version:this.defaultVersion},data:e}}}r.default=a}}},{package:"$root$",file:"app/scripts/lib/migrator/index.js"}],[129,{"../../../shared/constants/notifications":5735,"../platforms/extension":363,"@metamask/safe-event-emitter":2556},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.NOTIFICATION_MANAGER_EVENTS=void 0;var n=a(e("@metamask/safe-event-emitter")),s=a(e("../platforms/extension")),i=e("../../../shared/constants/notifications");function a(e){return e&&e.__esModule?e:{default:e}}const o=r.NOTIFICATION_MANAGER_EVENTS={POPUP_CLOSED:"onPopupClosed"};class c extends n.default{constructor(){super(),this.platform=new s.default,this.platform.addOnRemovedListener(this._onWindowClosed.bind(this))}markAsAutomaticallyClosed(){this._popupAutomaticallyClosed=!0}async showPopup(e,t){this._popupId=t,this._setCurrentPopupId=e;const r=await this._getPopup(t);if(r)await this.platform.focusWindow(r.id);else{let e=0,t=0;try{const r=await this.platform.getLastFocusedWindow();t=r.top,e=Math.max(r.left+(r.width-i.NOTIFICATION_WIDTH),0)}catch(r){const{screenX:n,screenY:s,outerWidth:a}=window;t=Math.max(s,0),e=Math.max(n+(a-i.NOTIFICATION_WIDTH),0)}const r=await this.platform.openWindow({url:"notification.html",type:"popup",width:i.NOTIFICATION_WIDTH,height:i.NOTIFICATION_HEIGHT,left:e,top:t});r.left!==e&&"fullscreen"!==r.state&&await this.platform.updateWindowPosition(r.id,e,t),this._setCurrentPopupId(r.id),this._popupId=r.id}}_onWindowClosed(e){e===this._popupId&&(this._setCurrentPopupId(undefined),this._popupId=undefined,this.emit(o.POPUP_CLOSED,{automaticallyClosed:this._popupAutomaticallyClosed}),this._popupAutomaticallyClosed=undefined)}async _getPopup(){const e=await this.platform.getAllWindows();return this._getPopupIn(e)}_getPopupIn(e){return e?e.find((e=>e&&"popup"===e.type&&e.id===this._popupId)):null}}r.default=c}}},{package:"$root$",file:"app/scripts/lib/notification-manager.js"}],[1290,{"./utils.cjs":1292,"@metamask/base-controller":1383,"@metamask/eth-snap-keyring":1792,"@metamask/keyring-api":1983,"@metamask/keyring-controller":1990,"@metamask/keyring-utils":2064,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n,s,i,a,o,c,u,l,d,h,f,p,m,g,y,b,w,A=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};Object.defineProperty(r,"__esModule",{value:!0}),r.AccountsController=r.EMPTY_ACCOUNT=void 0;const v=e("@metamask/base-controller"),E=e("@metamask/eth-snap-keyring"),k=e("@metamask/keyring-api"),T=e("@metamask/keyring-controller"),P=e("@metamask/keyring-utils"),S=e("@metamask/utils"),_=e("./utils.cjs"),C="AccountsController",I={internalAccounts:{persist:!0,anonymous:!1}},B={internalAccounts:{accounts:{},selectedAccount:""}};r.EMPTY_ACCOUNT={id:"",address:"",options:{},methods:[],type:k.EthAccountType.Eoa,scopes:[k.EthScope.Eoa],metadata:{name:"",keyring:{type:""},importTime:0}};class x extends v.BaseController{constructor({messenger:e,state:t}){super({messenger:e,name:C,metadata:I,state:{...B,...t}}),n.add(this),A(this,n,"m",b).call(this),A(this,n,"m",w).call(this)}getAccount(e){return this.state.internalAccounts.accounts[e]}listAccounts(){return Object.values(this.state.internalAccounts.accounts).filter((e=>(0,k.isEvmAccountType)(e.type)))}listMultichainAccounts(e){const t=Object.values(this.state.internalAccounts.accounts);if(!e)return t;if(!(0,S.isCaipChainId)(e))throw new Error(`Invalid CAIP-2 chain ID: ${String(e)}`);return t.filter((t=>(0,P.isScopeEqualToAny)(e,t.scopes)))}getAccountExpect(e){const t=this.getAccount(e);if(t===undefined)throw new Error(`Account Id "${e}" not found`);return t}getSelectedAccount(){if(""===this.state.internalAccounts.selectedAccount)return r.EMPTY_ACCOUNT;const e=this.getAccountExpect(this.state.internalAccounts.selectedAccount);if((0,k.isEvmAccountType)(e.type))return e;const t=this.listAccounts();if(!t.length)throw new Error("No EVM accounts");return A(this,n,"m",d).call(this,t)}getSelectedMultichainAccount(e){if(""===this.state.internalAccounts.selectedAccount)return r.EMPTY_ACCOUNT;if(!e)return this.getAccountExpect(this.state.internalAccounts.selectedAccount);const t=this.listMultichainAccounts(e);return A(this,n,"m",d).call(this,t)}getAccountByAddress(e){return this.listMultichainAccounts().find((t=>t.address.toLowerCase()===e.toLowerCase()))}setSelectedAccount(e){const t=this.getAccountExpect(e);this.update((e=>{e.internalAccounts.accounts[t.id].metadata.lastSelected=Date.now(),e.internalAccounts.selectedAccount=t.id})),A(this,n,"m",p).call(this,t)}setAccountName(e,t){this.updateAccountMetadata(e,{name:t,nameLastUpdatedAt:Date.now()})}updateAccountMetadata(e,t){const r=this.getAccountExpect(e);if(t.name&&this.listMultichainAccounts().find((r=>r.metadata.name===t.name&&r.id!==e)))throw new Error("Account name already exists");this.update((n=>{const s={...r,metadata:{...r.metadata,...t}};n.internalAccounts.accounts[e]=s,t.name&&this.messagingSystem.publish("AccountsController:accountRenamed",s)}))}async updateAccounts(){const e=await A(this,n,"m",i).call(this),t=await A(this,n,"m",a).call(this),r=new Map,s=this.state.internalAccounts.accounts,o=[...t,...e].reduce(((e,t)=>{const i=(0,_.keyringTypeToName)(t.metadata.keyring.type),a=r.get(i)??0;a?r.set(i,a+1):r.set(i,1);const o=s[t.id];return e[t.id]={...t,metadata:{...t.metadata,name:A(this,n,"m",y).call(this,o?.id,"name")??`${i} ${a+1}`,importTime:A(this,n,"m",y).call(this,o?.id,"importTime")??Date.now(),lastSelected:A(this,n,"m",y).call(this,o?.id,"lastSelected")??0}},e}),{});this.update((e=>{if(e.internalAccounts.accounts=o,!e.internalAccounts.accounts[e.internalAccounts.selectedAccount]){const t=A(this,n,"m",d).call(this,Object.values(o));t?(e.internalAccounts.selectedAccount=t.id,e.internalAccounts.accounts[t.id].metadata.lastSelected=A(this,n,"m",h).call(this),A(this,n,"m",p).call(this,t)):e.internalAccounts.selectedAccount=""}}))}loadBackup(e){e.internalAccounts&&this.update((t=>{t.internalAccounts=e.internalAccounts}))}getNextAvailableAccountName(e=T.KeyringTypes.hd,t){const r=(0,_.keyringTypeToName)(e),s=A(this,n,"m",l).call(this,e,t),i=s.reduce(((e,t)=>{const n=new RegExp(`${r} ([0-9]+)$`,"u").exec(t.metadata.name);if(n){const t=parseInt(n[1],10);return Math.max(e,t)}return e}),0),a=Math.max(s.length+1,i+1);return`${r} ${a}`}}r.AccountsController=x,n=new WeakSet,s=function(e,t){return{id:(0,_.getUUIDFromAddressOfNormalAccount)(e),address:e,options:{},methods:[k.EthMethod.PersonalSign,k.EthMethod.Sign,k.EthMethod.SignTransaction,k.EthMethod.SignTypedDataV1,k.EthMethod.SignTypedDataV3,k.EthMethod.SignTypedDataV4],scopes:[k.EthScope.Eoa],type:k.EthAccountType.Eoa,metadata:{name:"",importTime:Date.now(),keyring:{type:t}}}},i=async function(){const[e]=this.messagingSystem.call("KeyringController:getKeyringsByType",E.SnapKeyring.type);if(!e)return[];return e.listAccounts()},a=async function(){const e=await this.messagingSystem.call("KeyringController:getAccounts"),t=[];for(const r of e){const e=await this.messagingSystem.call("KeyringController:getKeyringForAccount",r),s=e.type;if(!(0,_.isNormalKeyringType)(s))continue;const i=(0,_.getUUIDFromAddressOfNormalAccount)(r),a=A(this,n,"m",y).call(this,i,"nameLastUpdatedAt");t.push({id:i,address:r,options:{},methods:[k.EthMethod.PersonalSign,k.EthMethod.Sign,k.EthMethod.SignTransaction,k.EthMethod.SignTypedDataV1,k.EthMethod.SignTypedDataV3,k.EthMethod.SignTypedDataV4],scopes:[k.EthScope.Eoa],type:k.EthAccountType.Eoa,metadata:{name:A(this,n,"m",y).call(this,i,"name")??"",...a&&{nameLastUpdatedAt:a},importTime:A(this,n,"m",y).call(this,i,"importTime")??Date.now(),lastSelected:A(this,n,"m",y).call(this,i,"lastSelected")??0,keyring:{type:e.type}}})}return t},o=function(e,...t){this.messagingSystem.publish(e,...t)},c=function(e){if(e.isUnlocked&&e.keyrings.length>0){const t=[],r=[];for(const n of e.keyrings)n.type===T.KeyringTypes.snap?r.push(...n.accounts.map((e=>({address:e,type:n.type})))):t.push(...n.accounts.map((e=>({address:e,type:n.type}))));const{previousNormalInternalAccounts:s,previousSnapInternalAccounts:i}=this.listMultichainAccounts().reduce(((e,t)=>(t.metadata.keyring.type===T.KeyringTypes.snap?e.previousSnapInternalAccounts.push(t):e.previousNormalInternalAccounts.push(t),e)),{previousNormalInternalAccounts:[],previousSnapInternalAccounts:[]}),a=[],o=[];for(const e of t)this.state.internalAccounts.accounts[(0,_.getUUIDFromAddressOfNormalAccount)(e.address)]||a.push(e);for(const e of r)i.find((t=>t.address.toLowerCase()===e.address.toLowerCase()))||a.push(e);for(const e of s)t.find((({address:t})=>t.toLowerCase()===e.address.toLowerCase()))||o.push(e);for(const e of i)r.find((({address:t})=>t.toLowerCase()===e.address.toLowerCase()))||o.push(e);this.update((e=>{if(o.length>0)for(const t of o)e.internalAccounts.accounts=A(this,n,"m",m).call(this,e.internalAccounts.accounts,t.id);if(a.length>0)for(const t of a)e.internalAccounts.accounts=A(this,n,"m",f).call(this,e.internalAccounts.accounts,t);const t=Object.values(e.internalAccounts.accounts);if(!e.internalAccounts.accounts[this.state.internalAccounts.selectedAccount]){const r=A(this,n,"m",d).call(this,t);r?(e.internalAccounts.selectedAccount=r.id,e.internalAccounts.accounts[r.id].metadata.lastSelected=A(this,n,"m",h).call(this),A(this,n,"m",p).call(this,r)):e.internalAccounts.selectedAccount=""}}))}},u=function(e){const{snaps:t}=e,r=this.listMultichainAccounts().filter((e=>e.metadata.snap));this.update((e=>{r.forEach((r=>{const n=e.internalAccounts.accounts[r.id];if(n.metadata.snap){const e=n.metadata.snap.id,r=t[e];r&&(n.metadata.snap.enabled=r.enabled&&!r.blocked)}}))}))},l=function(e,t){return(t??this.listMultichainAccounts()).filter((t=>e===T.KeyringTypes.hd||e===T.KeyringTypes.simple?t.metadata.keyring.type===T.KeyringTypes.hd||t.metadata.keyring.type===T.KeyringTypes.simple:t.metadata.keyring.type===e))},d=function(e){const[t]=e.sort(((e,t)=>(t.metadata.lastSelected??0)-(e.metadata.lastSelected??0)));return t},h=function(){return Date.now()},f=function(e,t){let r;if(t.type!==T.KeyringTypes.snap)r=A(this,n,"m",s).call(this,t.address,t.type);else{const[n]=this.messagingSystem.call("KeyringController:getKeyringsByType",E.SnapKeyring.type);if(r=n.getAccountByAddress(t.address),!r)return e}const i=0===Object.keys(e).length,a=this.getNextAvailableAccountName(r.metadata.keyring.type,Object.values(e)),o={...r,metadata:{...r.metadata,name:a,importTime:Date.now(),lastSelected:i?A(this,n,"m",h).call(this):0}};return e[r.id]=o,this.messagingSystem.publish("AccountsController:accountAdded",o),e},p=function(e){(0,k.isEvmAccountType)(e.type)&&this.messagingSystem.publish("AccountsController:selectedEvmAccountChange",e),this.messagingSystem.publish("AccountsController:selectedAccountChange",e)},m=function(e,t){return delete e[t],this.messagingSystem.publish("AccountsController:accountRemoved",t),e},g=function(e){let t;if((0,S.isCaipChainId)(e)){const r=this.getSelectedMultichainAccount(e);t=r.id}else{const e=this.getSelectedAccount();t=e.id}this.update((e=>{e.internalAccounts.accounts[t].metadata.lastSelected=Date.now(),e.internalAccounts.selectedAccount=t}))},y=function(e,t,r){const n=r??this.getAccount(e);return n?n.metadata[t]:undefined},b=function(){this.messagingSystem.subscribe("SnapController:stateChange",(e=>A(this,n,"m",u).call(this,e))),this.messagingSystem.subscribe("KeyringController:stateChange",(e=>A(this,n,"m",c).call(this,e))),this.messagingSystem.subscribe("SnapKeyring:accountAssetListUpdated",(e=>A(this,n,"m",o).call(this,"AccountsController:accountAssetListUpdated",e))),this.messagingSystem.subscribe("SnapKeyring:accountBalancesUpdated",(e=>A(this,n,"m",o).call(this,"AccountsController:accountBalancesUpdated",e))),this.messagingSystem.subscribe("SnapKeyring:accountTransactionsUpdated",(e=>A(this,n,"m",o).call(this,"AccountsController:accountTransactionsUpdated",e))),this.messagingSystem.subscribe("MultichainNetworkController:networkDidChange",(e=>A(this,n,"m",g).call(this,e)))},w=function(){this.messagingSystem.registerActionHandler(`${C}:setSelectedAccount`,this.setSelectedAccount.bind(this)),this.messagingSystem.registerActionHandler(`${C}:listAccounts`,this.listAccounts.bind(this)),this.messagingSystem.registerActionHandler(`${C}:listMultichainAccounts`,this.listMultichainAccounts.bind(this)),this.messagingSystem.registerActionHandler(`${C}:setAccountName`,this.setAccountName.bind(this)),this.messagingSystem.registerActionHandler(`${C}:updateAccounts`,this.updateAccounts.bind(this)),this.messagingSystem.registerActionHandler(`${C}:getSelectedAccount`,this.getSelectedAccount.bind(this)),this.messagingSystem.registerActionHandler(`${C}:getSelectedMultichainAccount`,this.getSelectedMultichainAccount.bind(this)),this.messagingSystem.registerActionHandler(`${C}:getAccountByAddress`,this.getAccountByAddress.bind(this)),this.messagingSystem.registerActionHandler(`${C}:getNextAvailableAccountName`,this.getNextAvailableAccountName.bind(this)),this.messagingSystem.registerActionHandler("AccountsController:getAccount",this.getAccount.bind(this)),this.messagingSystem.registerActionHandler("AccountsController:updateAccountMetadata",this.updateAccountMetadata.bind(this))}}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/AccountsController.cjs"}],[1291,{"./AccountsController.cjs":1290,"./utils.cjs":1292},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.isNormalKeyringType=r.getUUIDFromAddressOfNormalAccount=r.getUUIDOptionsFromAddressOfNormalAccount=r.keyringTypeToName=r.AccountsController=r.EMPTY_ACCOUNT=void 0;var n=e("./AccountsController.cjs");Object.defineProperty(r,"EMPTY_ACCOUNT",{enumerable:!0,get:function(){return n.EMPTY_ACCOUNT}}),Object.defineProperty(r,"AccountsController",{enumerable:!0,get:function(){return n.AccountsController}});var s=e("./utils.cjs");Object.defineProperty(r,"keyringTypeToName",{enumerable:!0,get:function(){return s.keyringTypeToName}}),Object.defineProperty(r,"getUUIDOptionsFromAddressOfNormalAccount",{enumerable:!0,get:function(){return s.getUUIDOptionsFromAddressOfNormalAccount}}),Object.defineProperty(r,"getUUIDFromAddressOfNormalAccount",{enumerable:!0,get:function(){return s.getUUIDFromAddressOfNormalAccount}}),Object.defineProperty(r,"isNormalKeyringType",{enumerable:!0,get:function(){return s.isNormalKeyringType}})}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/index.cjs"}],[1292,{"@metamask/keyring-controller":1990,"@metamask/utils":2950,"ethereum-cryptography/sha256":4318,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.isNormalKeyringType=r.getUUIDFromAddressOfNormalAccount=r.getUUIDOptionsFromAddressOfNormalAccount=r.keyringTypeToName=void 0;const n=e("@metamask/keyring-controller"),s=e("@metamask/utils"),i=e("ethereum-cryptography/sha256"),a=e("uuid");function o(e){return{random:(0,i.sha256)((0,s.hexToBytes)(e)).slice(0,16)}}r.keyringTypeToName=function(e){if((0,n.isCustodyKeyring)(e))return"Custody";switch(e){case n.KeyringTypes.simple:case n.KeyringTypes.hd:return"Account";case n.KeyringTypes.trezor:return"Trezor";case n.KeyringTypes.oneKey:return"OneKey";case n.KeyringTypes.ledger:return"Ledger";case n.KeyringTypes.lattice:return"Lattice";case n.KeyringTypes.qr:return"QR";case n.KeyringTypes.snap:return"Snap Account";default:throw new Error(`Unknown keyring ${e}`)}},r.getUUIDOptionsFromAddressOfNormalAccount=o,r.getUUIDFromAddressOfNormalAccount=function(e){return(0,a.v4)(o(e))},r.isNormalKeyringType=function(e){return e!==n.KeyringTypes.snap}}}},{package:"@metamask/accounts-controller",file:"node_modules/@metamask/accounts-controller/dist/utils.cjs"}],[1293,{"@metamask/base-controller":1383,"@metamask/controller-utils":1474},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.AddressBookController=r.getDefaultAddressBookControllerState=r.controllerName=r.AddressType=void 0;const n=e("@metamask/base-controller"),s=e("@metamask/controller-utils");var i;!function(e){e.externallyOwnedAccounts="EXTERNALLY_OWNED_ACCOUNTS",e.contractAccounts="CONTRACT_ACCOUNTS",e.nonAccounts="NON_ACCOUNTS"}(i||(r.AddressType=i={})),r.controllerName="AddressBookController";const a={addressBook:{persist:!0,anonymous:!1}};r.getDefaultAddressBookControllerState=()=>({addressBook:{}});class o extends n.BaseController{constructor({messenger:e,state:t}){const n={...(0,r.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:a,name:r.controllerName,state:n})}clear(){this.update((e=>{e.addressBook={}}))}delete(e,t){return t=(0,s.toChecksumHexAddress)(t),!!([e,t].every((e=>(0,s.isSafeDynamicKey)(e)))&&(0,s.isValidHexAddress)(t)&&this.state.addressBook[e]&&this.state.addressBook[e][t])&&(this.update((r=>{delete r.addressBook[e][t],0===Object.keys(r.addressBook[e]).length&&delete r.addressBook[e]})),!0)}set(e,t,r=(0,s.toHex)(1),n="",i){if(e=(0,s.toChecksumHexAddress)(e),!(0,s.isValidHexAddress)(e))return!1;const a={address:e,chainId:r,isEns:!1,memo:n,name:t,addressType:i},o=(0,s.normalizeEnsName)(t);return o&&(a.name=o,a.isEns=!0),this.update((t=>{t.addressBook={...this.state.addressBook,[r]:{...this.state.addressBook[r],[e]:a}}})),!0}}r.AddressBookController=o,r.default=o}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs"}],[1294,{"./AddressBookController.cjs":1293},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.AddressBookController=r.getDefaultAddressBookControllerState=void 0;var n=e("./AddressBookController.cjs");Object.defineProperty(r,"getDefaultAddressBookControllerState",{enumerable:!0,get:function(){return n.getDefaultAddressBookControllerState}}),Object.defineProperty(r,"AddressBookController",{enumerable:!0,get:function(){return n.AddressBookController}})}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/index.cjs"}],[1295,{"@metamask/base-controller":1383},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n,s,i=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};Object.defineProperty(r,"__esModule",{value:!0}),r.AnnouncementController=void 0;const a=e("@metamask/base-controller"),o={announcements:{}},c={announcements:{persist:!0,anonymous:!0}};class u extends a.BaseController{constructor({messenger:e,state:t,allAnnouncements:r}){const a={...o,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:a}),n.add(this),i(this,n,"m",s).call(this,r)}resetViewed(){this.update((({announcements:e})=>{for(const t of Object.values(e))t.isShown=!1}))}updateViewed(e){this.update((({announcements:t})=>{for(const r of Object.keys(e).map(Number))t[r].isShown=e[r]}))}}r.AnnouncementController=u,n=new WeakSet,s=function(e){this.update((t=>{Object.values(e).forEach((e=>{t.announcements[e.id]=t.announcements[e.id]??{...e,isShown:!1}}))}))}}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs"}],[1296,{"./AnnouncementController.cjs":1295},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.AnnouncementController=void 0;var n=e("./AnnouncementController.cjs");Object.defineProperty(r,"AnnouncementController",{enumerable:!0,get:function(){return n.AnnouncementController}})}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/index.cjs"}],[13,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getAuthenticationControllerMessenger=function(e){return e.getRestricted({name:"AuthenticationController",allowedActions:["KeyringController:getState","SnapController:handleRequest"],allowedEvents:["KeyringController:lock","KeyringController:unlock"]})}}}},{package:"$root$",file:"app/scripts/controller-init/messengers/identity/authentication-controller-messenger.ts"}],[130,{"../../../../shared/constants/offscreen-communication":5736,"eth-lattice-keyring":4280},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.LatticeKeyringOffscreen=void 0;var n,s=(n=e("eth-lattice-keyring"))&&n.__esModule?n:{default:n},i=e("../../../../shared/constants/offscreen-communication");class a extends s.default{constructor(e={}){super(e)}async _getCreds(){try{const e=this.appName?this.appName:"Unknown",t=`${i.KnownOrigins.lattice}?keyring=${e}&forceLogin=true`;return await new Promise(((e,r)=>{chrome.runtime.sendMessage({target:i.OffscreenCommunicationTarget.latticeOffscreen,params:{url:t}},(t=>{t.error&&r(t.error),e(t.result)}))}))}catch(e){throw new Error(e)}}}r.LatticeKeyringOffscreen=a,function(e,t,r){(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(a,"type",void 0),a.type=s.default.type}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/lattice-offscreen-keyring.ts"}],[131,{"../../../../shared/constants/offscreen-communication":5736},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.LedgerOffscreenBridge=void 0;var n=e("../../../../shared/constants/offscreen-communication");function s(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.LedgerOffscreenBridge=class{constructor(){s(this,"isDeviceConnected",!1)}init(){return chrome.runtime.onMessage.addListener((e=>{e.target===n.OffscreenCommunicationTarget.extension&&e.event===n.OffscreenCommunicationEvents.ledgerDeviceConnect&&(this.isDeviceConnected=!0)})),Promise.resolve()}destroy(){return Promise.resolve()}getOptions(){return Promise.resolve({})}setOptions(){return Promise.resolve()}attemptMakeApp(){return new Promise(((e,t)=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.ledgerOffscreen,action:n.LedgerAction.makeApp},(r=>{r.success?e(!0):r.error?t(r.error):t(new Error("Unknown error occurred"))}))}))}updateTransportMethod(e){return new Promise(((t,r)=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.ledgerOffscreen,action:n.LedgerAction.updateTransport,params:{transportType:e}},(e=>{e.success?t(!0):r(new Error("Ledger transport could not be updated"))}))}))}getPublicKey(e){return new Promise(((t,r)=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.ledgerOffscreen,action:n.LedgerAction.getPublicKey,params:e},(e=>{e.success?t(e.payload):r(e.payload.error)}))}))}deviceSignTransaction(e){return new Promise(((t,r)=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.ledgerOffscreen,action:n.LedgerAction.signTransaction,params:e},(e=>{e.success?t(e.payload):r(e.payload.error)}))}))}deviceSignMessage(e){return new Promise(((t,r)=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.ledgerOffscreen,action:n.LedgerAction.signPersonalMessage,params:e},(e=>{e.success?t(e.payload):r(e.payload.error)}))}))}deviceSignTypedData(e){return new Promise(((t,r)=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.ledgerOffscreen,action:n.LedgerAction.signTypedData,params:e},(e=>{e.success?t(e.payload):r(e.payload.error)}))}))}}}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/ledger-offscreen-bridge.ts"}],[132,{"../../../../shared/constants/offscreen-communication":5736},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.TrezorOffscreenBridge=void 0;var n=e("../../../../shared/constants/offscreen-communication");function s(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.TrezorOffscreenBridge=class{constructor(){s(this,"model",void 0),s(this,"minorVersion",void 0)}init(e){return chrome.runtime.onMessage.addListener((e=>{e.target===n.OffscreenCommunicationTarget.extension&&e.event===n.OffscreenCommunicationEvents.trezorDeviceConnect&&(this.model=e.payload.model,this.minorVersion=e.payload.minorVersion)})),new Promise((t=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.trezorOffscreen,action:n.TrezorAction.init,params:e},(()=>{t()}))}))}dispose(){return new Promise((e=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.trezorOffscreen,action:n.TrezorAction.dispose},(()=>{e()}))}))}getPublicKey(e){return new Promise((t=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.trezorOffscreen,action:n.TrezorAction.getPublicKey,params:e},(e=>{t(e)}))}))}ethereumSignTransaction(e){return new Promise((t=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.trezorOffscreen,action:n.TrezorAction.signTransaction,params:e},(e=>{t(e)}))}))}ethereumSignMessage(e){return new Promise((t=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.trezorOffscreen,action:n.TrezorAction.signMessage,params:e},(e=>{t(e)}))}))}ethereumSignTypedData(e){return new Promise((t=>{chrome.runtime.sendMessage({target:n.OffscreenCommunicationTarget.trezorOffscreen,action:n.TrezorAction.signTypedData,params:e},(e=>{t(e)}))}))}}}}},{package:"$root$",file:"app/scripts/lib/offscreen-bridge/trezor-offscreen-bridge.ts"}],[133,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){function n(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function s(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(r,"__esModule",{value:!0}),r.IndexedDBPPOMStorage=void 0;const i=async(e,t,r)=>{const n=await crypto.subtle.digest("SHA-256",t);if(Array.from(new Uint8Array(n)).map((e=>e.toString(16).padStart(2,"0"))).join("")!==r)throw new Error(`Checksum mismatch for key ${e}`)};var a=new WeakSet;function o(e){return new Promise(((t,r)=>{const n=indexedDB.open(this.storeName,this.dbVersion);n.onerror=e=>{var t;r(new Error(`Failed to open database ${this.storeName}: ${null===(t=e.target)||void 0===t?void 0:t.error}`))},n.onupgradeneeded=e=>{const t=e.target.result;t.objectStoreNames.contains(this.storeName)||t.createObjectStore(this.storeName,{keyPath:["name","chainId"]})},n.onsuccess=r=>{const n=r.target.result.transaction([this.storeName],e).objectStore(this.storeName);t(n)}}))}r.IndexedDBPPOMStorage=class{constructor(e,t){n(this,a),s(this,"storeName",void 0),s(this,"dbVersion",void 0),this.storeName=e,this.dbVersion=t}async objectStoreAction(e,t,r="readonly"){return new Promise(((n,s)=>{(function(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")})(a,this,o).call(this,r).then((r=>{const i=r[e](t);i.onsuccess=async e=>{n(e)},i.onerror=t=>{var r;s(new Error(`Error in indexDB operation ${e}: ${null===(r=t.target)||void 0===r?void 0:r.error}`))}})).catch((e=>{s(e)}))}))}async read(e,t){var r;const n=null===(r=(await this.objectStoreAction("get",[e.name,e.chainId])).target)||void 0===r||null===(r=r.result)||void 0===r?void 0:r.data;return await i(e,n,t),n}async write(e,t,r){await i(e,t,r),await this.objectStoreAction("put",{...e,data:t},"readwrite")}async delete(e){await this.objectStoreAction("delete",[e.name,e.chainId],"readwrite")}async dir(){var e;return null===(e=(await this.objectStoreAction("getAllKeys")).target)||void 0===e?void 0:e.result.map((([e,t])=>({name:e,chainId:t})))}}}}},{package:"$root$",file:"app/scripts/lib/ppom/indexed-db-backend.ts"}],[134,{"../../../../shared/constants/app":5719,"../../../../shared/constants/security-provider":5741,"../../../../shared/constants/transaction":5749,"../../../../shared/lib/trace":5773,"../../../../shared/modules/selectors/networks":5799,"./ppom-util":135,"@metamask/controller-utils":1474},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createPPOMMiddleware=function(e,t,r,d,h,f){return async(p,m,g)=>{try{const{securityAlertsEnabled:m}=t.state,{chainId:g}=(0,a.getProviderConfig)({metamask:r.state})??{};if(!g)return;if(!m||!l.includes(p.method))return;const y=p.params[0];if("string"==typeof y){const{isSIWEMessage:e}=(0,n.detectSIWE)({data:y});if(e)return}else if(p.method===s.MESSAGE_TYPE.ETH_SEND_TRANSACTION){const{to:e}=y??{},t=h.listAccounts();if(t.some((({address:t})=>(null==t?void 0:t.toLowerCase())===(null==e?void 0:e.toLowerCase()))))return}const b=(0,u.generateSecurityAlertId)();(0,o.trace)({name:o.TraceName.PPOMValidation,parentContext:p.traceContext},(()=>(0,u.validateRequestWithPPOM)({ppomController:e,request:p,securityAlertId:b,chainId:g,updateSecurityAlertResponse:f})));const w={...c.LOADING_SECURITY_ALERT_RESPONSE,securityAlertId:b};i.SIGNING_METHODS.includes(p.method)&&d.addSignatureSecurityAlertResponse(w),p.securityAlertResponse=w}catch(e){p.securityAlertResponse=(0,u.handlePPOMError)(e,"Error createPPOMMiddleware: ")}finally{g()}}};var n=e("@metamask/controller-utils"),s=e("../../../../shared/constants/app"),i=e("../../../../shared/constants/transaction"),a=e("../../../../shared/modules/selectors/networks"),o=e("../../../../shared/lib/trace"),c=e("../../../../shared/constants/security-provider"),u=e("./ppom-util");const l=Object.freeze(["eth_sendRawTransaction","eth_sendTransaction",...i.SIGNING_METHODS])}}},{package:"$root$",file:"app/scripts/lib/ppom/ppom-middleware.ts"}],[135,{"../../../../shared/constants/security-provider":5741,"../../../../shared/constants/transaction":5749,"../../../../shared/modules/transaction.utils":5804,"../../../../shared/modules/typed-signature":5805,"./security-alerts-api":137,"@metamask/transaction-controller":2905,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.METHOD_SIGN_TYPED_DATA_V4=r.METHOD_SIGN_TYPED_DATA_V3=void 0,r.generateSecurityAlertId=function(){return(0,s.v4)()},r.handlePPOMError=m,r.updateSecurityAlertResponse=async function({appStateController:e,method:t,securityAlertId:r,securityAlertResponse:n,signatureController:s,transactionController:i}){const o=a.SIGNING_METHODS.includes(t),c=await async function(e,t,r,n){const s=a.SIGNING_METHODS.includes(t);for(;;){let t;if(t=s?Object.values(r.messages).find((t=>{var r;return(null===(r=t.securityAlertResponse)||void 0===r?void 0:r.securityAlertId)===e})):n.state.transactions.find((t=>{var r;return(null===(r=t.securityAlertResponse)||void 0===r?void 0:r.securityAlertId)===e})),t)return t;await new Promise((e=>setTimeout(e,100)))}}(r,t,s,i);o?e.addSignatureSecurityAlertResponse({...n,securityAlertId:r}):i.updateSecurityAlertResponse(c.id,{...n,securityAlertId:r})},r.validateRequestWithPPOM=async function({ppomController:e,request:t,securityAlertId:r,chainId:s,updateSecurityAlertResponse:a}){try{await a(t.method,r,i.LOADING_SECURITY_ALERT_RESPONSE);const l=function(e){if(t=e,t.method!==d)return function(e){if((e.method===f||e.method===h)&&Array.isArray(e.params)&&e.params[1]){const t=(0,c.parseTypedDataMessage)(e.params[1].toString()),r=(0,o.sanitizeMessageRecursively)(t.message,t.types,t.primaryType);return{...e,params:[e.params[0],JSON.stringify({...t,message:r})]}}return e}(e);var t;const r=e.params[0],s=(0,n.normalizeTransactionParams)(r);return{...e,params:[s]}}(t),p=(0,u.isSecurityAlertsAPIEnabled)()?await async function(e,t,r){try{return{...await(0,u.validateWithSecurityAlertsAPI)(t,r),source:i.SecurityAlertSource.API}}catch(n){return m(n,"Error validating request with security alerts API"),await g(e,r,t)}}(e,s,l):await g(e,l,s);await a(t.method,r,p)}catch(e){await a(t.method,r,m(e,"Error validating JSON RPC using PPOM: "))}};var n=e("@metamask/transaction-controller"),s=e("uuid"),i=e("../../../../shared/constants/security-provider"),a=e("../../../../shared/constants/transaction"),o=e("../../../../shared/modules/typed-signature"),c=e("../../../../shared/modules/transaction.utils"),u=e("./security-alerts-api");const{sentry:l}=global,d="eth_sendTransaction",h=r.METHOD_SIGN_TYPED_DATA_V3="eth_signTypedData_v3",f=r.METHOD_SIGN_TYPED_DATA_V4="eth_signTypedData_v4",p={result_type:i.BlockaidResultType.Errored,reason:i.BlockaidReason.errored};function m(e,t,r=i.SecurityAlertSource.API){const n=function(e){if("object"==typeof e||"string"==typeof e)return e;return JSON.stringify(e)}(e),s=function(e){if(e instanceof Error)return`${e.name}: ${e.message}`;return JSON.stringify(e)}(e);return r===i.SecurityAlertSource.Local&&(null==l||l.captureException(e)),console.error(t,n),{...p,description:s,source:r}}async function g(e,t,r){try{return{...await e.usePPOM((e=>e.validateJsonRpc(t)),r),source:i.SecurityAlertSource.Local}}catch(e){return m(e,"Error validating request with PPOM controller",i.SecurityAlertSource.Local)}}}}},{package:"$root$",file:"app/scripts/lib/ppom/ppom-util.ts"}],[136,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){let n;Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.PPOM=void 0,r.initSync=function(e){if(n!==undefined)return n;const t=S();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));const r=new WebAssembly.Instance(e,t);return _(r,e)},r.main=function(){n.main()};const s="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};"undefined"!=typeof TextDecoder&&s.decode();let i=null;function a(){return null!==i&&0!==i.byteLength||(i=new Uint8Array(n.memory.buffer)),i}function o(e,t){return e>>>=0,s.decode(a().subarray(e,e+t))}const c=new Array(128).fill(undefined);c.push(undefined,null,!0,!1);let u=c.length;function l(e){u===c.length&&c.push(c.length+1);const t=u;return u=c[t],c[t]=e,t}function d(e){return c[e]}function h(e){const t=d(e);return function(e){e<132||(c[e]=u,u=e)}(e),t}let f=0;const p="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},m="function"==typeof p.encodeInto?function(e,t){return p.encodeInto(e,t)}:function(e,t){const r=p.encode(e);return t.set(r),{read:e.length,written:r.length}};function g(e,t,r){if(r===undefined){const r=p.encode(e),n=t(r.length,1)>>>0;return a().subarray(n,n+r.length).set(r),f=r.length,n}let n=e.length,s=t(n,1)>>>0;const i=a();let o=0;for(;o<n;o++){const t=e.charCodeAt(o);if(t>127)break;i[s+o]=t}if(o!==n){0!==o&&(e=e.slice(o)),s=r(s,n,n=o+3*e.length,1)>>>0;const t=a().subarray(s+o,s+n);o+=m(e,t).written}return f=o,s}let y=null;function b(){return null!==y&&0!==y.byteLength||(y=new Int32Array(n.memory.buffer)),y}function w(e){const t=typeof e;if("number"==t||"boolean"==t||null==e)return`${e}`;if("string"==t)return`"${e}"`;if("symbol"==t){const t=e.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=e.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(e)){const t=e.length;let r="[";t>0&&(r+=w(e[0]));for(let n=1;n<t;n++)r+=", "+w(e[n]);return r+="]",r}const r=/\[object ([^\]]+)\]/.exec(toString.call(e));let n;if(!(r.length>1))return toString.call(e);if(n=r[1],"Object"==n)try{return"Object("+JSON.stringify(e)+")"}catch(e){return"Object"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:n}function A(e,t,r){n.wasm_bindgen__convert__closures__invoke1_mut(e,t,l(r))}function v(e,t){n._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__destroy(e,t)}let E=null;function k(e,t){const r=t(4*e.length,4)>>>0,s=(null!==E&&0!==E.byteLength||(E=new Uint32Array(n.memory.buffer)),E);for(let t=0;t<e.length;t++)s[r/4+t]=l(e[t]);return f=e.length,r}function T(e,t){try{return e.apply(this,t)}catch(e){n.__wbindgen_exn_store(l(e))}}class P{static __wrap(e){e>>>=0;const t=Object.create(P.prototype);return t.__wbg_ptr=e,t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();n.__wbg_ppom_free(e)}static new(e,t){const r=k(t,n.__wbindgen_malloc),s=f;return h(n.ppom_new(l(e),r,s))}validateJsonRpc(e){return h(n.ppom_validateJsonRpc(this.__wbg_ptr,l(e)))}static version(){return h(n.ppom_version())}}function S(){const e={wbg:{}};return e.wbg.__wbg_buffer_085ec1f694018c4f=function(e){return l(d(e).buffer)},e.wbg.__wbg_call_01734de55d61e11d=function(){return T((function(e,t,r){return l(d(e).call(d(t),d(r)))}),arguments)},e.wbg.__wbg_call_4c92f6aec1e1d6e6=function(){return T((function(e,t,r,n){return l(d(e).call(d(t),d(r),d(n)))}),arguments)},e.wbg.__wbg_from_d7c216d4616bb368=function(e){return l(Array.from(d(e)))},e.wbg.__wbg_get_44be0491f933a435=function(e,t){return l(d(e)[t>>>0])},e.wbg.__wbg_length_72e2208bbc0efc61=function(e){return d(e).length},e.wbg.__wbg_length_d813e535247d427e=function(e){return d(e).length},e.wbg.__wbg_length_fff51ee6522a1a18=function(e){return d(e).length},e.wbg.__wbg_new_43f1b47c28813cbd=function(e,t){try{var r={a:e,b:t};const s=new Promise(((e,t)=>{const s=r.a;r.a=0;try{return function(e,t,r,s){n.wasm_bindgen__convert__closures__invoke2_mut(e,t,l(r),l(s))}(s,r.b,e,t)}finally{r.a=s}}));return l(s)}finally{r.a=r.b=0}},e.wbg.__wbg_new_8125e318e6245eed=function(e){return l(new Uint8Array(d(e)))},e.wbg.__wbg_parse_670c19d4e984792e=function(){return T((function(e,t){return l(JSON.parse(o(e,t)))}),arguments)},e.wbg.__wbg_ppom_new=function(e){return l(P.__wrap(e))},e.wbg.__wbg_resolve_53698b95aaf7fcf8=function(e){return l(Promise.resolve(d(e)))},e.wbg.__wbg_set_5cf90238115182c3=function(e,t,r){d(e).set(d(t),r>>>0)},e.wbg.__wbg_stringify_e25465938f3f611f=function(){return T((function(e){return l(JSON.stringify(d(e)))}),arguments)},e.wbg.__wbg_then_b2267541e2a73865=function(e,t,r){return l(d(e).then(d(t),d(r)))},e.wbg.__wbg_then_f7e06ee3c11698eb=function(e,t){return l(d(e).then(d(t)))},e.wbg.__wbindgen_cb_drop=function(e){const t=h(e).original;if(1==t.cnt--)return t.a=0,!0;return!1},e.wbg.__wbindgen_closure_wrapper_wasm_bindgen__closure__Closure_T___wrap__breaks_if_inlined=function(e,t,r){const n=function(e,t,r,n){const s={a:e,b:t,cnt:1},i=(...e)=>{s.cnt++;const t=s.a;s.a=0;try{return n(t,s.b,...e)}finally{0==--s.cnt?r(t,s.b):s.a=t}};return i.original=s,i}(e,t,v,A);return l(n)},e.wbg.__wbindgen_debug_string=function(e,t){const r=g(w(d(t)),n.__wbindgen_malloc,n.__wbindgen_realloc),s=f;b()[e/4+1]=s,b()[e/4+0]=r},e.wbg.__wbindgen_error_new=function(e,t){return l(new Error(o(e,t)))},e.wbg.__wbindgen_is_undefined=function(e){return d(e)===undefined},e.wbg.__wbindgen_memory=function(){return l(n.memory)},e.wbg.__wbindgen_object_drop_ref=function(e){h(e)},e.wbg.__wbindgen_string_get=function(e,t){const r=d(t),s="string"==typeof r?r:undefined;var i,a=(i=s)===undefined||null===i?0:g(s,n.__wbindgen_malloc,n.__wbindgen_realloc),o=f;b()[e/4+1]=o,b()[e/4+0]=a},e.wbg.__wbindgen_string_new=function(e,t){return l(o(e,t))},e.wbg.__wbindgen_throw=function(e,t){throw new Error(o(e,t))},e}function _(e,t){return n=e.exports,C.__wbindgen_wasm_module=t,y=null,E=null,i=null,n.__wbindgen_start(),n}async function C(e){if(n!==undefined)return n;const t=S();("string"==typeof e||"function"==typeof Request&&e instanceof Request||"function"==typeof URL&&e instanceof URL)&&(e=fetch(e));const{instance:r,module:s}=await async function(e,t){if("function"==typeof Response&&e instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}{const r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}(await e,t);return _(r,s)}r.PPOM=P;r.default=C}}},{package:"$root$",file:"app/scripts/lib/ppom/ppom.js"}],[137,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.isSecurityAlertsAPIEnabled=function(){const e="true";return"true"===e.toString()},r.validateWithSecurityAlertsAPI=async function(e,t){return async function(e,t){const r=function(e){const t="https://security-alerts.api.cx.metamask.io";if(!t)throw new Error("Security alerts API URL is not set");return`${t}/${e}`}(e),n=await fetch(r,t);if(!n.ok)throw new Error(`Security alerts API request failed with status: ${n.status}`);return await n.json()}(`${n}/${e}`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})};const n="validate"}}},{package:"$root$",file:"app/scripts/lib/ppom/security-alerts-api.ts"}],[138,{"./handlers":144,"./handlers/wallet-getPermissions":151,"./handlers/wallet-requestPermissions":152,"./handlers/wallet-revokePermissions":153,"@metamask/rpc-errors":2554,"@metamask/snaps-rpc-methods":2700,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createMultichainMethodMiddleware=r.createEthAccountsMethodMiddleware=r.createEip1193MethodMiddleware=void 0,r.makeMethodMiddlewareMaker=l;var n=e("@metamask/rpc-errors"),s=e("@metamask/snaps-rpc-methods"),i=e("@metamask/utils"),a=e("./handlers"),o=e("./handlers/wallet-getPermissions"),c=e("./handlers/wallet-requestPermissions"),u=e("./handlers/wallet-revokePermissions");r.createEip1193MethodMiddleware=l([...a.handlers,...a.eip1193OnlyHandlers,o.getPermissionsHandler,c.requestPermissionsHandler,u.revokePermissionsHandler]),r.createEthAccountsMethodMiddleware=l([a.ethAccountsHandler]),r.createMultichainMethodMiddleware=l(a.handlers);function l(e){const t=e.reduce(((e,t)=>{for(const r of t.methodNames)e[r]=t;return e}),{}),r=new Set(e.flatMap((({hookNames:e})=>Object.getOwnPropertyNames(e))));return e=>{!function(e,t){const r=[];if(t.forEach((t=>{(0,i.hasProperty)(e,t)||r.push(t)})),r.length>0)throw new Error(`Missing expected hooks:\n\n${r.join("\n")}\n`);const n=Object.getOwnPropertyNames(e).filter((e=>!t.has(e)));if(n.length>0)throw new Error(`Received unexpected hooks:\n\n${n.join("\n")}\n`)}(e,r);return async(r,i,a,o)=>{const c=t[r.method];if(c){const{implementation:t,hookNames:u}=c;try{return await t(r,i,a,o,(0,s.selectHooks)(e,u))}catch(e){return o(e instanceof Error?e:n.rpcErrors.internal({data:e}))}}return a()}}}}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/createMethodMiddleware.js"}],[139,{"../../../../shared/constants/network":5734,"@metamask/rpc-errors":2554},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createUnsupportedMethodMiddleware=function(e=s.UNSUPPORTED_RPC_METHODS){return async function(t,r,s,i){return e.has(t.method)?i(n.rpcErrors.methodNotSupported()):s()}};var n=e("@metamask/rpc-errors"),s=e("../../../../shared/constants/network")}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/createUnsupportedMethodMiddleware.ts"}],[14,{"./authentication-controller-messenger":13,"./user-storage-controller-messenger":15},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getAuthenticationControllerMessenger",{enumerable:!0,get:function(){return n.getAuthenticationControllerMessenger}}),Object.defineProperty(r,"getUserStorageControllerMessenger",{enumerable:!0,get:function(){return s.getUserStorageControllerMessenger}});var n=e("./authentication-controller-messenger"),s=e("./user-storage-controller-messenger")}}},{package:"$root$",file:"app/scripts/controller-init/messengers/identity/index.ts"}],[140,{"../../../../../shared/constants/app":5719,"./ethereum-chain-utils":142,"@metamask/controller-utils":1474,"@metamask/network-controller":2176,"@metamask/rpc-errors":2554,lodash:4855,"uri-js":5638},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=l(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var a=s?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,r&&r.set(e,n),n}(e("uri-js")),s=e("@metamask/controller-utils"),i=e("@metamask/network-controller"),a=e("@metamask/rpc-errors"),o=e("lodash"),c=e("../../../../../shared/constants/app"),u=e("./ethereum-chain-utils");function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(l=function(e){return e?r:t})(e)}const d={methodNames:[c.MESSAGE_TYPE.ADD_ETHEREUM_CHAIN],implementation:async function(e,t,r,c,{addNetwork:l,updateNetwork:d,getNetworkConfigurationByChainId:h,setActiveNetwork:f,requestUserApproval:p,getCurrentChainIdForDomain:m,getCaveat:g,requestPermittedChainsPermissionIncrementalForOrigin:y,rejectApprovalRequestsForOrigin:b}){let w;try{w=(0,u.validateAddEthereumChainParams)(e.params[0])}catch(e){return c(e)}const{chainId:A,chainName:v,firstValidBlockExplorerUrl:E,firstValidRPCUrl:k,ticker:T}=w,{origin:P}=e,S=m(P),_=h(A);if(_&&_.chainId===A&&_.nativeCurrency!==T)return c(a.rpcErrors.invalidParams({message:`nativeCurrency.symbol does not match currency symbol for a network the user already has added with the same chainId. Received:\n${T}`}));let C=_,I=null==_?void 0:_.rpcEndpoints.findIndex((({url:e})=>n.equal(e,k))),B=E?null==_?void 0:_.blockExplorerUrls.findIndex((e=>n.equal(e,E))):undefined;const x=!_||I!==_.defaultRpcEndpointIndex||E&&B!==_.defaultBlockExplorerUrlIndex;if(x)try{if(await p({origin:P,type:s.ApprovalType.AddEthereumChain,requestData:{chainId:A,rpcPrefs:{blockExplorerUrl:E},chainName:v,rpcUrl:k,ticker:T}}),_){const e=(0,o.cloneDeep)(_);-1===I&&(e.rpcEndpoints=[...e.rpcEndpoints,{url:k,type:i.RpcEndpointType.Custom,name:v}],I=e.rpcEndpoints.length-1),e.defaultRpcEndpointIndex=I,E&&(-1===B&&(e.blockExplorerUrls=[...e.blockExplorerUrls,E],B=e.blockExplorerUrls.length-1),e.defaultBlockExplorerUrlIndex=B),C=await d(e.chainId,e,S===A?{replacementSelectedRpcEndpointIndex:e.defaultRpcEndpointIndex}:undefined)}else C=await l({blockExplorerUrls:E?[E]:[],defaultBlockExplorerUrlIndex:E?0:undefined,chainId:A,defaultRpcEndpointIndex:0,name:v,nativeCurrency:T,rpcEndpoints:[{url:k,name:v,type:i.RpcEndpointType.Custom}]})}catch(e){return c(e)}const{networkClientId:M}=C.rpcEndpoints[C.defaultRpcEndpointIndex];return(0,u.switchChain)(t,c,A,M,{isAddFlow:!0,autoApprove:x,setActiveNetwork:f,getCaveat:g,requestPermittedChainsPermissionIncrementalForOrigin:y,rejectApprovalRequestsForOrigin:b})},hookNames:{addNetwork:!0,updateNetwork:!0,getNetworkConfigurationByChainId:!0,setActiveNetwork:!0,requestUserApproval:!0,getCurrentChainIdForDomain:!0,getCaveat:!0,requestPermittedChainsPermissionIncrementalForOrigin:!0,rejectApprovalRequestsForOrigin:!0}};r.default=d}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.js"}],[141,{"../../../../../shared/constants/app":5719},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;const n={methodNames:[e("../../../../../shared/constants/app").MESSAGE_TYPE.ETH_ACCOUNTS],implementation:async function(e,t,r,n,{getAccounts:s}){return t.result=s(),n()},hookNames:{getAccounts:!0}};r.default=n}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/eth-accounts.ts"}],[142,{"../../../../../shared/constants/app":5719,"../../../../../shared/modules/network.utils":5792,"../../util":187,"@metamask/controller-utils":1474,"@metamask/multichain":2146,"@metamask/rpc-errors":2554},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.switchChain=async function(e,t,r,s,{origin:a,isAddFlow:o,isSwitchFlow:c,autoApprove:u,setActiveNetwork:l,getCaveat:d,requestPermittedChainsPermissionIncrementalForOrigin:h,setTokenNetworkFilter:f,rejectApprovalRequestsForOrigin:p,requestUserApproval:m,hasApprovalRequestsForOrigin:g,toNetworkConfiguration:y,fromNetworkConfiguration:b}){try{const w=d({target:i.Caip25EndowmentPermissionName,caveatType:i.Caip25CaveatType});if(w){if((0,i.getPermittedEthChainIds)(w.value).includes(r))null!=g&&g()&&!o&&await m({origin:a,type:n.ApprovalType.SwitchEthereumChain,requestData:{toNetworkConfiguration:y,fromNetworkConfiguration:b}});else{let e;c&&(e={isSwitchEthereumChain:!0}),await h({chainId:r,autoApprove:u,metadata:e})}}else await h({chainId:r,autoApprove:u});return null==p||p(),await l(s),f(r),e.result=null,t()}catch(e){return t(e)}},r.validateAddEthereumChainParams=function(e){if(!e||"object"!=typeof e)throw s.rpcErrors.invalidParams({message:`Expected single, object parameter. Received:\n${JSON.stringify(e)}`});const{chainId:t,chainName:r,blockExplorerUrls:n,nativeCurrency:i,rpcUrls:a,...l}=e,d=Object.keys(l).filter((e=>!["iconUrls"].includes(e)));if(d.length>0)throw s.rpcErrors.invalidParams({message:`Received unexpected keys on object parameter. Unsupported keys:\n${d}`});const h=u(t);if(!a||!Array.isArray(a)||0===a.length)throw s.rpcErrors.invalidParams({message:`Expected an array with at least one valid string HTTPS url 'rpcUrls', Received:\n${a}`});const f=e=>{const t=(0,c.getValidUrl)(e);return null!==t&&("localhost"===t.hostname||"127.0.0.1"===t.hostname||"https:"===t.protocol)},p=a.find((e=>f(e))),m=Array.isArray(n)?n.find((e=>f(e))):null;if(!p)throw s.rpcErrors.invalidParams({message:`Expected an array with at least one valid string HTTPS url 'rpcUrls', Received:\n${a}`});if("string"!=typeof r||!r)throw s.rpcErrors.invalidParams({message:`Expected non-empty string 'chainName'. Received:\n${r}`});const g=r.length>100?r.substring(0,100):r;if(null!==i){if("object"!=typeof i||Array.isArray(i))throw s.rpcErrors.invalidParams({message:`Expected null or object 'nativeCurrency'. Received:\n${i}`});if(18!==i.decimals)throw s.rpcErrors.invalidParams({message:`Expected the number 18 for 'nativeCurrency.decimals' when 'nativeCurrency' is provided. Received: ${i.decimals}`});if(!i.symbol||"string"!=typeof i.symbol)throw s.rpcErrors.invalidParams({message:`Expected a string 'nativeCurrency.symbol'. Received: ${i.symbol}`})}const y=(null==i?void 0:i.symbol)||o.UNKNOWN_TICKER_SYMBOL;if(y!==o.UNKNOWN_TICKER_SYMBOL&&("string"!=typeof y||y.length<1||y.length>6))throw s.rpcErrors.invalidParams({message:`Expected 1-6 character string 'nativeCurrency.symbol'. Received:\n${y}`});return{chainId:h,chainName:g,firstValidBlockExplorerUrl:m,firstValidRPCUrl:p,ticker:y}},r.validateChainId=u,r.validateSwitchEthereumChainParams=function(e){var t;if(null===(t=e.params)||void 0===t||!t[0]||"object"!=typeof e.params[0])throw s.rpcErrors.invalidParams({message:`Expected single, object parameter. Received:\n${JSON.stringify(e.params)}`});const{chainId:r,...n}=e.params[0];if(Object.keys(n).length>0)throw s.rpcErrors.invalidParams({message:`Received unexpected keys on object parameter. Unsupported keys:\n${Object.keys(n)}`});return u(r)};var n=e("@metamask/controller-utils"),s=e("@metamask/rpc-errors"),i=e("@metamask/multichain"),a=e("../../../../../shared/modules/network.utils"),o=e("../../../../../shared/constants/app"),c=e("../../util");function u(e){const t="string"==typeof e?e.toLowerCase():null;if(!(0,a.isPrefixedFormattedHexString)(t))throw s.rpcErrors.invalidParams({message:`Expected 0x-prefixed, unpadded, non-zero hexadecimal string 'chainId'. Received:\n${e}`});if(!(0,a.isSafeChainId)(parseInt(e,16)))throw s.rpcErrors.invalidParams({message:`Invalid chain ID "${t}": numerical value greater than max safe value. Received:\n${e}`});return t}}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/ethereum-chain-utils.js"}],[143,{"../../../../../shared/constants/app":5719},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;const n={methodNames:[e("../../../../../shared/constants/app").MESSAGE_TYPE.GET_PROVIDER_STATE],implementation:async function(e,t,r,n,{getProviderState:s}){return t.result={...await s(e.origin)},n()},hookNames:{getProviderState:!0}};r.default=n}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/get-provider-state.ts"}],[144,{"./add-ethereum-chain":140,"./eth-accounts":141,"./get-provider-state":143,"./log-web3-shim-usage":145,"./request-accounts":146,"./send-metadata":147,"./switch-ethereum-chain":148,"./watch-asset":154},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.handlers=r.ethAccountsHandler=r.eip1193OnlyHandlers=void 0;var n=d(e("./add-ethereum-chain")),s=d(e("./eth-accounts")),i=d(e("./get-provider-state")),a=d(e("./log-web3-shim-usage")),o=d(e("./request-accounts")),c=d(e("./send-metadata")),u=d(e("./switch-ethereum-chain")),l=d(e("./watch-asset"));function d(e){return e&&e.__esModule?e:{default:e}}r.handlers=[n.default,i.default,a.default,c.default,l.default],r.eip1193OnlyHandlers=[u.default,s.default,o.default],r.ethAccountsHandler=s.default}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/index.ts"}],[145,{"../../../../../shared/constants/app":5719},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;const n={methodNames:[e("../../../../../shared/constants/app").MESSAGE_TYPE.LOG_WEB3_SHIM_USAGE],implementation:function(e,t,r,n,{getWeb3ShimUsageState:s,setWeb3ShimUsageRecorded:i}){const{origin:a}=e;s(a)===undefined&&i(a);return t.result=!0,n()},hookNames:{getWeb3ShimUsageState:!0,setWeb3ShimUsageRecorded:!0}};r.default=n}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/log-web3-shim-usage.ts"}],[146,{"../../../../../shared/constants/app":5719,"../../../../../shared/constants/metametrics":5730,"../../util":187,"@metamask/rpc-errors":2554},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("@metamask/rpc-errors"),s=e("../../../../../shared/constants/app"),i=e("../../../../../shared/constants/metametrics"),a=e("../../util");const o={methodNames:[s.MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS],implementation:async function(e,t,r,o,{getAccounts:u,getUnlockPromise:l,sendMetrics:d,metamaskState:h,getCaip25PermissionFromLegacyPermissionsForOrigin:f,requestPermissionsForOrigin:p}){const{origin:m}=e;if(c.has(m))return t.error=n.rpcErrors.resourceUnavailable(`Already processing ${s.MESSAGE_TYPE.ETH_REQUEST_ACCOUNTS}. Please wait.`),o();let g=u({ignoreLock:!0});if(g.length>0){try{c.add(m),await l(!0),t.result=g,o()}catch(e){o(e)}finally{c.delete(m)}return undefined}try{const e=f();await p(e)}catch(e){return o(e)}if(g=u({ignoreLock:!0}),(0,a.shouldEmitDappViewedEvent)(h.metaMetricsId)){const e=!Object.keys(h.permissionHistory).includes(m);d({event:i.MetaMetricsEventName.DappViewed,category:i.MetaMetricsEventCategory.InpageProvider,referrer:{url:m},properties:{is_first_visit:e,number_of_accounts:Object.keys(h.accounts).length,number_of_accounts_connected:g.length}})}return t.result=g,o()},hookNames:{getAccounts:!0,getUnlockPromise:!0,sendMetrics:!0,metamaskState:!0,getCaip25PermissionFromLegacyPermissionsForOrigin:!0,requestPermissionsForOrigin:!0}};r.default=o;const c=new Set}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/request-accounts.js"}],[147,{"../../../../../shared/constants/app":5719,"@metamask/rpc-errors":2554},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("@metamask/rpc-errors");const s={methodNames:[e("../../../../../shared/constants/app").MESSAGE_TYPE.SEND_METADATA],implementation:function(e,t,r,s,{addSubjectMetadata:i,subjectType:a}){const{origin:o,params:c}=e;if(!c||"object"!=typeof c||Array.isArray(c))return s(n.rpcErrors.invalidParams({data:c}));{const{icon:e=null,name:t=null,...r}=c;i({...r,iconUrl:e,name:t,subjectType:a,origin:o})}return t.result=!0,s()},hookNames:{addSubjectMetadata:!0,subjectType:!0}};r.default=s}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/send-metadata.js"}],[148,{"../../../../../shared/constants/app":5719,"./ethereum-chain-utils":142,"@metamask/rpc-errors":2554},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("@metamask/rpc-errors"),s=e("../../../../../shared/constants/app"),i=e("./ethereum-chain-utils");const a={methodNames:[s.MESSAGE_TYPE.SWITCH_ETHEREUM_CHAIN],implementation:async function(e,t,r,a,{getNetworkConfigurationByChainId:o,setActiveNetwork:c,requestUserApproval:u,getCaveat:l,getCurrentChainIdForDomain:d,requestPermittedChainsPermissionIncrementalForOrigin:h,setTokenNetworkFilter:f,hasApprovalRequestsForOrigin:p}){let m;try{m=(0,i.validateSwitchEthereumChainParams)(e)}catch(e){return a(e)}const{origin:g}=e,y=d(g);if(y===m)return t.result=null,a();const b=o(m),w=null==b?void 0:b.rpcEndpoints[b.defaultRpcEndpointIndex].networkClientId;if(!w)return a(n.providerErrors.custom({code:4902,message:`Unrecognized chain ID "${m}". Try adding the chain using ${s.MESSAGE_TYPE.ADD_ETHEREUM_CHAIN} first.`}));const A=o(y),v=o(m);return(0,i.switchChain)(t,a,m,w,{origin:g,isSwitchFlow:!0,setActiveNetwork:c,getCaveat:l,requestPermittedChainsPermissionIncrementalForOrigin:h,setTokenNetworkFilter:f,requestUserApproval:u,hasApprovalRequestsForOrigin:p,toNetworkConfiguration:v,fromNetworkConfiguration:A})},hookNames:{getNetworkConfigurationByChainId:!0,setActiveNetwork:!0,requestUserApproval:!0,getCaveat:!0,getCurrentChainIdForDomain:!0,requestPermittedChainsPermissionIncrementalForOrigin:!0,setTokenNetworkFilter:!0,hasApprovalRequestsForOrigin:!0}};r.default=a}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js"}],[149,{"../../../../../../shared/constants/app":5719,"../../../../../../shared/constants/metametrics":5730,"../../../util":187,"@metamask/multichain":2146,"@metamask/permission-controller":2393,"@metamask/rpc-errors":2554,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.walletCreateSession=void 0;var n=e("@metamask/rpc-errors"),s=e("@metamask/multichain"),i=e("@metamask/permission-controller"),a=e("@metamask/utils"),o=e("../../../../../../shared/constants/metametrics"),c=e("../../../util"),u=e("../../../../../../shared/constants/app");r.walletCreateSession={methodNames:[u.MESSAGE_TYPE.WALLET_CREATE_SESSION],implementation:async function(e,t,r,u,l){const{origin:d}=e;if(!(0,a.isPlainObject)(e.params))return u((0,i.invalidParams)({data:{request:e}}));const{requiredScopes:h,optionalScopes:f,sessionProperties:p}=e.params;if(p&&0===Object.keys(p).length)return u(new n.JsonRpcError(5302,"Invalid sessionProperties requested"));try{var m;const{normalizedRequiredScopes:e,normalizedOptionalScopes:r}=(0,s.validateAndNormalizeScopes)(h||{},f||{}),i=(0,s.getSupportedScopeObjects)(e),a=(0,s.getSupportedScopeObjects)(r),g=e=>{try{return l.findNetworkClientIdByChainId(e),!0}catch(e){return!1}},{supportedScopes:y}=(0,s.bucketScopes)(i,{isChainIdSupported:g,isChainIdSupportable:()=>!1}),{supportedScopes:b}=(0,s.bucketScopes)(a,{isChainIdSupported:g,isChainIdSupportable:()=>!1}),w=l.listAccounts().map((e=>e.address)),A=(0,s.getEthAccounts)({requiredScopes:y,optionalScopes:b}).map((e=>e.toLowerCase())).filter((e=>w.includes(e))),v={requiredScopes:(0,s.getInternalScopesObject)(y),optionalScopes:(0,s.getInternalScopesObject)(b),isMultichainOrigin:!0},E=(0,s.setEthAccounts)(v,A),[k]=await l.requestPermissionsForOrigin({[s.Caip25EndowmentPermissionName]:{caveats:[{type:s.Caip25CaveatType,value:E}]}}),T=k[s.Caip25EndowmentPermissionName],P=null==T||null===(m=T.caveats)||void 0===m||null===(m=m.find((e=>e.type===s.Caip25CaveatType)))||void 0===m?void 0:m.value;if(!P)throw n.rpcErrors.internal();const S=(0,s.getSessionScopes)(P);if((0,c.shouldEmitDappViewedEvent)(l.metamaskState.metaMetricsId)){const e=!Object.keys(l.metamaskState.permissionHistory).includes(d),t=(0,s.getEthAccounts)(P);l.sendMetrics({event:o.MetaMetricsEventName.DappViewed,category:o.MetaMetricsEventCategory.InpageProvider,referrer:{url:d},properties:{is_first_visit:e,number_of_accounts:Object.keys(l.metamaskState.accounts).length,number_of_accounts_connected:t.length}})}return t.result={sessionScopes:S,sessionProperties:p},u()}catch(e){return u(e)}},hookNames:{findNetworkClientIdByChainId:!0,listAccounts:!0,requestPermissionsForOrigin:!0,sendMetrics:!0,metamaskState:!0}}}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-createSession/handler.ts"}],[15,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getUserStorageControllerMessenger=function(e){return e.getRestricted({name:"UserStorageController",allowedActions:["KeyringController:getState","KeyringController:withKeyring","SnapController:handleRequest","AuthenticationController:getBearerToken","AuthenticationController:getSessionProfile","AuthenticationController:isSignedIn","AuthenticationController:performSignIn","AccountsController:listAccounts","AccountsController:updateAccountMetadata","NetworkController:getState","NetworkController:addNetwork","NetworkController:removeNetwork","NetworkController:updateNetwork"],allowedEvents:["KeyringController:lock","KeyringController:unlock","AccountsController:accountAdded","AccountsController:accountRenamed","NetworkController:networkRemoved"]})}}}},{package:"$root$",file:"app/scripts/controller-init/messengers/identity/user-storage-controller-messenger.ts"}],[150,{"./handler":149},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./handler");Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}))}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-createSession/index.ts"}],[1501,{"@ethersproject/providers":545,"@metamask/base-controller":1383,"@metamask/controller-utils":1474,"@metamask/utils":2950,"punycode/punycode.js":5071},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n,s,i,a,o,c=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},u=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r};Object.defineProperty(r,"__esModule",{value:!0}),r.EnsController=r.DEFAULT_ENS_NETWORK_MAP=void 0;const l=e("@ethersproject/providers"),d=e("@metamask/base-controller"),h=e("@metamask/controller-utils"),f=e("@metamask/utils"),p=e("punycode/punycode.js"),m=(0,f.createProjectLogger)("ens-controller");r.DEFAULT_ENS_NETWORK_MAP={1:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",3:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",4:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",5:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",17e3:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",11155111:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"};const g={ensEntries:{persist:!0,anonymous:!1},ensResolutionsByAddress:{persist:!0,anonymous:!1}},y={ensEntries:{},ensResolutionsByAddress:{}};class b extends d.BaseController{constructor({registriesByChainId:e=r.DEFAULT_ENS_NETWORK_MAP,messenger:t,state:o={},onNetworkDidChange:u}){super({name:"EnsController",metadata:g,messenger:t,state:{...y,ensEntries:Object.fromEntries(Object.entries(e).map((([e,t])=>[(0,h.toHex)(e),{".":{address:t,chainId:(0,h.toHex)(e),ensName:"."}}]))),...o}}),n.add(this),s.set(this,null),c(this,n,"m",i).call(this,e),u&&u((({selectedNetworkClientId:t})=>{this.resetState(),c(this,n,"m",a).call(this,t,e)}))}resetState(){this.update((e=>{e.ensResolutionsByAddress={}}))}clear(){this.update((e=>{e.ensEntries={}}))}delete(e,t){const r=(0,h.normalizeEnsName)(t);return!!((0,h.isSafeDynamicKey)(e)&&r&&this.state.ensEntries[e]&&this.state.ensEntries[e][r])&&(this.update((t=>{delete t.ensEntries[e][r],0===Object.keys(t.ensEntries[e]).length&&delete t.ensEntries[e]})),!0)}get(e,t){const r=(0,h.normalizeEnsName)(t);return r&&this.state.ensEntries[e]&&this.state.ensEntries[e][r]||null}set(e,t,r){if(!Number.isInteger(Number.parseInt(e,10))||!t||"string"!=typeof t||r&&!(0,h.isValidHexAddress)(r))throw new Error(`Invalid ENS entry: { chainId:${e}, ensName:${t}, address:${r}}`);const n=(0,h.normalizeEnsName)(t);if(!n)throw new Error(`Invalid ENS name: ${t}`);const s=r?(0,h.toChecksumHexAddress)(r):null,i=this.state.ensEntries[e];return(!i?.[n]||i[n].address!==s)&&(this.update((t=>{t.ensEntries={...this.state.ensEntries,[e]:{...this.state.ensEntries[e],[n]:{address:s,chainId:e,ensName:n}}}})),!0)}async reverseResolveAddress(e){if(!c(this,s,"f"))return undefined;const t=(0,h.toChecksumHexAddress)(e);if(this.state.ensResolutionsByAddress[t])return this.state.ensResolutionsByAddress[t];let r,n;try{r=await c(this,s,"f").lookupAddress(t)}catch(e){return m(e),undefined}if(!r)return undefined;try{n=await c(this,s,"f").resolveName(r)}catch(e){return m(e),undefined}return n?"0x0000000000000000000000000000000000000000"===n||"0x"===n||(0,h.toChecksumHexAddress)(n)!==t?undefined:(this.update((e=>{e.ensResolutionsByAddress[t]=(0,p.toASCII)(r)})),r):undefined}}r.EnsController=b,s=new WeakMap,n=new WeakSet,i=function(e){const{selectedNetworkClientId:t}=this.messagingSystem.call("NetworkController:getState");c(this,n,"m",a).call(this,t,e)},a=function(e,t){const{configuration:{chainId:r},provider:i}=this.messagingSystem.call("NetworkController:getNetworkClientById",e);t&&t[parseInt(r,16)]&&c(this,n,"m",o).call(this,r)?u(this,s,new l.Web3Provider(i,{chainId:(0,h.convertHexToDecimal)(r),name:h.CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP[r],ensAddress:t[parseInt(r,16)]}),"f"):u(this,s,null,"f")},o=function(e){return Boolean(this.state.ensEntries[e])},r.default=b}}},{package:"@metamask/ens-controller",file:"node_modules/@metamask/ens-controller/dist/EnsController.cjs"}],[1502,{"./EnsController.cjs":1501},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),s(e("./EnsController.cjs"),r)}}},{package:"@metamask/ens-controller",file:"node_modules/@metamask/ens-controller/dist/index.cjs"}],[1503,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){t.exports={snapId:"npm:@metamask/ens-resolver-snap",manifest:{version:"0.1.2",description:"A Snap used for ENS name resolution",proposedName:"Ethereum Name Service resolver",repository:{type:"git",url:"https://github.com/MetaMask/ens-resolver-snap.git"},source:{shasum:"BizRmzfV+oKEIlvph12McsIqzzDECIw/Td7Lx+/cios=",location:{npm:{filePath:"dist/bundle.js",iconPath:"images/icon.svg",packageName:"@metamask/ens-resolver-snap",registry:"https://registry.npmjs.org/"}}},initialPermissions:{"endowment:name-lookup":{},"endowment:network-access":{},"endowment:ethereum-provider":{}},manifestVersion:"0.1"},files:[{path:"images/icon.svg",value:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" height="3rem">\n <path fill="url(#ENSWithGradient_svg__a)"\n d="M4.049 5.663a2.9 2.9 0 0 1 .942-1.038L11.611 0 4.828 11.222s-.592-1.002-.823-1.51a4.8 4.8 0 0 1 .044-4.05m-2.732 7.74a7.55 7.55 0 0 0 2.963 5.489L11.602 24s-4.58-6.606-8.445-13.178a6.6 6.6 0 0 1-.776-2.242 3.6 3.6 0 0 1 0-1.076c-.101.187-.297.57-.297.57a8.7 8.7 0 0 0-.79 2.534c-.077.93-.07 1.867.023 2.796m18.668.89c-.237-.507-.824-1.509-.824-1.509L12.391 24l6.62-4.622c.394-.263.717-.62.942-1.038a4.8 4.8 0 0 0 .044-4.05zm2.688-3.694a7.55 7.55 0 0 0-2.963-5.488L12.4 0s4.577 6.606 8.445 13.179a6.6 6.6 0 0 1 .773 2.24c.054.358.054.72 0 1.077.1-.187.296-.57.296-.57.392-.799.659-1.654.791-2.534.078-.93.07-1.866-.02-2.796z"/>\n <defs>\n <linearGradient id="ENSWithGradient_svg__a" x1="15.574" x2="-8.982" y1="26.845" y2="-11.906"\n gradientUnits="userSpaceOnUse">\n <stop stop-color="#44BCF0"/>\n <stop offset="0.428" stop-color="#628BF3"/>\n <stop offset="1" stop-color="#A099FF"/>\n </linearGradient>\n </defs>\n</svg>\n'},{path:"dist/bundle.js",value:'(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{onNameLookup:()=>ol});var n={};t.r(n),t.d(n,{OG:()=>po,My:()=>so,bytesToNumberBE:()=>ao,lX:()=>co,Id:()=>fo,fg:()=>yo,qj:()=>ho,hexToBytes:()=>oo,lq:()=>lo,z:()=>uo,Q5:()=>bo});const r="6.13.1";function s(t,e,n){const r=e.split("|").map((t=>t.trim()));for(let n=0;n<r.length;n++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${n}`,s.value=t,s}async function i(t){const e=Object.keys(t);return(await Promise.all(e.map((e=>Promise.resolve(t[e]))))).reduce(((t,n,r)=>(t[e[r]]=n,t)),{})}function o(t,e,n){for(let r in e){let i=e[r];const o=n?n[r]:null;o&&s(i,o,r),Object.defineProperty(t,r,{enumerable:!0,value:i,writable:!1})}}function a(t){if(null==t)return"null";if(Array.isArray(t))return"[ "+t.map(a).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let n="0x";for(let r=0;r<t.length;r++)n+=e[t[r]>>4],n+=e[15&t[r]];return n}if("object"==typeof t&&"function"==typeof t.toJSON)return a(t.toJSON());switch(typeof t){case"boolean":case"symbol":case"number":return t.toString();case"bigint":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map((e=>`${a(e)}: ${a(t[e])}`)).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function c(t,e){return t&&t.code===e}function l(t){return c(t,"CALL_EXCEPTION")}function u(t,e,n){let s,i=t;{const s=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${a(n)}`);for(const t in n){if("shortMessage"===t)continue;const e=n[t];s.push(t+"="+a(e))}}s.push(`code=${e}`),s.push(`version=${r}`),s.length&&(t+=" ("+s.join(", ")+")")}switch(e){case"INVALID_ARGUMENT":s=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(t);break;default:s=new Error(t)}return o(s,{code:e}),n&&Object.assign(s,n),null==s.shortMessage&&o(s,{shortMessage:i}),s}function h(t,e,n,r){if(!t)throw u(e,n,r)}function f(t,e,n,r){h(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function d(t,e,n){null==n&&(n=""),n&&(n=": "+n),h(t>=e,"missing arguemnt"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),h(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const p=["NFD","NFC","NFKD","NFKC"].reduce(((t,e)=>{try{if("test"!=="test".normalize(e))throw new Error("bad");if("NFD"===e){const t=String.fromCharCode(233).normalize("NFD");if(t!==String.fromCharCode(101,769))throw new Error("broken")}t.push(e)}catch(t){}return t}),[]);function g(t,e,n){if(null==n&&(n=""),t!==e){let t=n,e="new";n&&(t+=".",e+=" "+n),h(!1,`private constructor; use ${t}from* methods`,"UNSUPPORTED_OPERATION",{operation:e})}}function m(t,e,n){if(t instanceof Uint8Array)return n?new Uint8Array(t):t;if("string"==typeof t&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const e=new Uint8Array((t.length-2)/2);let n=2;for(let r=0;r<e.length;r++)e[r]=parseInt(t.substring(n,n+2),16),n+=2;return e}f(!1,"invalid BytesLike value",e||"value",t)}function y(t,e){return m(t,e,!1)}function w(t,e){return m(t,e,!0)}function b(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(("number"!=typeof e||t.length===2+2*e)&&(!0!==e||t.length%2==0))}function A(t){return b(t,!0)||t instanceof Uint8Array}const v="0123456789abcdef";function E(t){const e=y(t);let n="0x";for(let t=0;t<e.length;t++){const r=e[t];n+=v[(240&r)>>4]+v[15&r]}return n}function k(t){return"0x"+t.map((t=>E(t).substring(2))).join("")}function P(t){return b(t,!0)?(t.length-2)/2:y(t).length}function x(t,e,n){const r=y(t);return null!=n&&n>r.length&&h(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),E(r.slice(null==e?0:e,null==n?r.length:n))}function N(t,e,n){const r=y(t);h(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),n?s.set(r,e-r.length):s.set(r,0),E(s)}function B(t,e){return N(t,e,!0)}const I=BigInt(0),C=BigInt(1),O=9007199254740991;function R(t,e){let n=S(t,"value");const r=BigInt(L(e,"width")),s=C<<r-C;if(n<I){n=-n,h(n<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return(~n&(C<<r)-C)+C}return h(n<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t}),n}function T(t,e){const n=F(t,"value"),r=BigInt(L(e,"bits"));return n&(C<<r)-C}function S(t,e){switch(typeof t){case"bigint":return t;case"number":return f(Number.isInteger(t),"underflow",e||"value",t),f(t>=-O&&t<=O,"overflow",e||"value",t),BigInt(t);case"string":try{if(""===t)throw new Error("empty string");return"-"===t[0]&&"-"!==t[1]?-BigInt(t.substring(1)):BigInt(t)}catch(n){f(!1,`invalid BigNumberish string: ${n.message}`,e||"value",t)}}f(!1,"invalid BigNumberish value",e||"value",t)}function F(t,e){const n=S(t,e);return h(n>=I,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const U="0123456789abcdef";function D(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=U[n>>4],e+=U[15&n];return BigInt(e)}return S(t)}function L(t,e){switch(typeof t){case"bigint":return f(t>=-O&&t<=O,"overflow",e||"value",t),Number(t);case"number":return f(Number.isInteger(t),"underflow",e||"value",t),f(t>=-O&&t<=O,"overflow",e||"value",t),t;case"string":try{if(""===t)throw new Error("empty string");return L(BigInt(t),e)}catch(n){f(!1,`invalid numeric string: ${n.message}`,e||"value",t)}}f(!1,"invalid numeric value",e||"value",t)}function M(t,e){let n=F(t,"value").toString(16);if(null==e)n.length%2&&(n="0"+n);else{const r=L(e,"width");for(h(2*r>=n.length,`value exceeds width (${r} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});n.length<2*r;)n="0"+n}return"0x"+n}function G(t){const e=F(t,"value");if(e===I)return new Uint8Array([]);let n=e.toString(16);n.length%2&&(n="0"+n);const r=new Uint8Array(n.length/2);for(let t=0;t<r.length;t++){const e=2*t;r[t]=parseInt(n.substring(e,e+2),16)}return r}function H(t){let e=E(A(t)?t:G(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return""===e&&(e="0"),"0x"+e}const Q=32,j=new Uint8Array(Q),V=["then"],J={},z=new WeakMap;function K(t){return z.get(t)}function q(t,e){z.set(t,e)}function _(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw n.error=e,n}function Z(t,e,n){return t.indexOf(null)>=0?e.map(((t,e)=>t instanceof W?Z(K(t),t,n):t)):t.reduce(((t,r,s)=>{let i=e.getValue(r);return r in t||(n&&i instanceof W&&(i=Z(K(i),i,n)),t[r]=i),t}),{})}class W extends Array{#t;constructor(...t){const e=t[0];let n=t[1],r=(t[2]||[]).slice(),s=!0;e!==J&&(n=t,r=[],s=!1),super(n.length),n.forEach(((t,e)=>{this[e]=t}));const i=r.reduce(((t,e)=>("string"==typeof e&&t.set(e,(t.get(e)||0)+1),t)),new Map);if(q(this,Object.freeze(n.map(((t,e)=>{const n=r[e];return null!=n&&1===i.get(n)?n:null})))),this.#t=[],null==this.#t&&this.#t,!s)return;Object.freeze(this);const o=new Proxy(this,{get:(t,e,n)=>{if("string"==typeof e){if(e.match(/^[0-9]+$/)){const n=L(e,"%index");if(n<0||n>=this.length)throw new RangeError("out of result range");const r=t[n];return r instanceof Error&&_(`index ${n}`,r),r}if(V.indexOf(e)>=0)return Reflect.get(t,e,n);const r=t[e];if(r instanceof Function)return function(...e){return r.apply(this===n?t:this,e)};if(!(e in t))return t.getValue.apply(this===n?t:this,[e])}return Reflect.get(t,e,n)}});return q(o,K(this)),o}toArray(t){const e=[];return this.forEach(((n,r)=>{n instanceof Error&&_(`index ${r}`,n),t&&n instanceof W&&(n=n.toArray(t)),e.push(n)})),e}toObject(t){const e=K(this);return e.reduce(((n,r,s)=>(h(null!=r,`value at index ${s} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Z(e,this,t))),{})}slice(t,e){null==t&&(t=0),t<0&&(t+=this.length)<0&&(t=0),null==e&&(e=this.length),e<0&&(e+=this.length)<0&&(e=0),e>this.length&&(e=this.length);const n=K(this),r=[],s=[];for(let i=t;i<e;i++)r.push(this[i]),s.push(n[i]);return new W(J,r,s)}filter(t,e){const n=K(this),r=[],s=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&_(`index ${i}`,o),t.call(e,o,i,this)&&(r.push(o),s.push(n[i]))}return new W(J,r,s)}map(t,e){const n=[];for(let r=0;r<this.length;r++){const s=this[r];s instanceof Error&&_(`index ${r}`,s),n.push(t.call(e,s,r,this))}return n}getValue(t){const e=K(this).indexOf(t);if(-1===e)return;const n=this[e];return n instanceof Error&&_(`property ${JSON.stringify(t)}`,n.error),n}static fromItems(t,e){return new W(J,t,e)}}function Y(t){let e=G(t);return h(e.length<=Q,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:Q,offset:e.length}),e.length!==Q&&(e=w(k([j.slice(e.length%Q),e]))),e}class X{name;type;localName;dynamic;constructor(t,e,n,r){o(this,{name:t,type:e,localName:n,dynamic:r},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(t,e){f(!1,t,this.localName,e)}}class ${#e;#n;constructor(){this.#e=[],this.#n=0}get data(){return k(this.#e)}get length(){return this.#n}#r(t){return this.#e.push(t),this.#n+=t.length,t.length}appendWriter(t){return this.#r(w(t.data))}writeBytes(t){let e=w(t);const n=e.length%Q;return n&&(e=w(k([e,j.slice(n)]))),this.#r(e)}writeValue(t){return this.#r(Y(t))}writeUpdatableValue(){const t=this.#e.length;return this.#e.push(j),this.#n+=Q,e=>{this.#e[t]=Y(e)}}}class tt{allowLoose;#e;#s;#i;#o;#a;constructor(t,e,n){o(this,{allowLoose:!!e}),this.#e=w(t),this.#i=0,this.#o=null,this.#a=null!=n?n:1024,this.#s=0}get data(){return E(this.#e)}get dataLength(){return this.#e.length}get consumed(){return this.#s}get bytes(){return new Uint8Array(this.#e)}#c(t){if(this.#o)return this.#o.#c(t);this.#i+=t,h(this.#a<1||this.#i<=this.#a*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#a} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:w(this.#e),offset:this.#s,length:t,info:{bytesRead:this.#i,dataLength:this.dataLength}})}#l(t,e,n){let r=Math.ceil(e/Q)*Q;return this.#s+r>this.#e.length&&(this.allowLoose&&n&&this.#s+e<=this.#e.length?r=e:h(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:w(this.#e),length:this.#e.length,offset:this.#s+r})),this.#e.slice(this.#s,this.#s+r)}subReader(t){const e=new tt(this.#e.slice(this.#s+t),this.allowLoose,this.#a);return e.#o=this,e}readBytes(t,e){let n=this.#l(0,t,!!e);return this.#c(t),this.#s+=n.length,n.slice(0,t)}readValue(){return D(this.readBytes(Q))}readIndex(){return L(D(this.readBytes(Q)))}}function et(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function nt(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function rt(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");et(t.outputLen),et(t.blockLen)}function st(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function it(t,e){nt(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const ot=BigInt(2**32-1),at=BigInt(32);function ct(t,e=!1){return e?{h:Number(t&ot),l:Number(t>>at&ot)}:{h:0|Number(t>>at&ot),l:0|Number(t&ot)}}function lt(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:i,l:o}=ct(t[s],e);[n[s],r[s]]=[i,o]}return[n,r]}const ut=(t,e,n)=>t<<n|e>>>32-n,ht=(t,e,n)=>e<<n|t>>>32-n,ft=(t,e,n)=>e<<n-32|t>>>64-n,dt=(t,e,n)=>t<<n-32|e>>>64-n;const pt={fromBig:ct,split:lt,toBig:(t,e)=>BigInt(t>>>0)<<at|BigInt(e>>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:ut,rotlSL:ht,rotlBH:ft,rotlBL:dt,add:function(t,e,n,r){const s=(e>>>0)+(r>>>0);return{h:t+n+(s/2**32|0)|0,l:0|s}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,s)=>e+n+r+s+(t/2**32|0)|0,add5H:(t,e,n,r,s,i)=>e+n+r+s+i+(t/2**32|0)|0,add5L:(t,e,n,r,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(s>>>0)},gt="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,mt=t=>t instanceof Uint8Array,yt=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),wt=(t,e)=>t<<32-e|t>>>e;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function bt(t){if("string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),!mt(t))throw new Error("expected Uint8Array, got "+typeof t);return t}class At{clone(){return this._cloneInto()}}function vt(t){const e=e=>t().update(bt(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Et(t=32){if(gt&&"function"==typeof gt.getRandomValues)return gt.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}const[kt,Pt,xt]=[[],[],[]],Nt=BigInt(0),Bt=BigInt(1),It=BigInt(2),Ct=BigInt(7),Ot=BigInt(256),Rt=BigInt(113);for(let t=0,e=Bt,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],kt.push(2*(5*r+n)),Pt.push((t+1)*(t+2)/2%64);let s=Nt;for(let t=0;t<7;t++)e=(e<<Bt^(e>>Ct)*Rt)%Ot,e&It&&(s^=Bt<<(Bt<<BigInt(t))-Bt);xt.push(s)}const[Tt,St]=lt(xt,!0),Ft=(t,e,n)=>n>32?ft(t,e,n):ut(t,e,n),Ut=(t,e,n)=>n>32?dt(t,e,n):ht(t,e,n);class Dt extends At{constructor(t,e,n,r=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,et(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var i;this.state=new Uint8Array(200),this.state32=(i=this.state,new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4)))}keccak(){!function(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const r=(e+8)%10,s=(e+2)%10,i=n[s],o=n[s+1],a=Ft(i,o,1)^n[r],c=Ut(i,o,1)^n[r+1];for(let n=0;n<50;n+=10)t[e+n]^=a,t[e+n+1]^=c}let e=t[2],s=t[3];for(let n=0;n<24;n++){const r=Pt[n],i=Ft(e,s,r),o=Ut(e,s,r),a=kt[n];e=t[a],s=t[a+1],t[a]=i,t[a+1]=o}for(let e=0;e<50;e+=10){for(let r=0;r<10;r++)n[r]=t[e+r];for(let r=0;r<10;r++)t[e+r]^=~n[(r+2)%10]&n[(r+4)%10]}t[0]^=Tt[r],t[1]^=St[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){st(this);const{blockLen:e,state:n}=this,r=(t=bt(t)).length;for(let s=0;s<r;){const i=Math.min(e-this.pos,r-s);for(let e=0;e<i;e++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:r}=this;t[n]^=e,0!=(128&e)&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){st(this,!1),nt(t),this.finish();const e=this.state,{blockLen:n}=this;for(let r=0,s=t.length;r<s;){this.posOut>=n&&this.keccak();const i=Math.min(n-this.posOut,s-r);t.set(e.subarray(this.posOut,this.posOut+i),r),this.posOut+=i,r+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return et(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(it(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:s,enableXOF:i}=this;return t||(t=new Dt(e,n,r,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=r,t.enableXOF=i,t.destroyed=this.destroyed,t}}const Lt=(t,e,n)=>vt((()=>new Dt(e,t,n))),Mt=Lt(1,136,32);let Gt=!1;const Ht=function(t){return Mt(t)};let Qt=Ht;function jt(t){const e=y(t,"data");return E(Qt(e))}jt._=Ht,jt.lock=function(){Gt=!0},jt.register=function(t){if(Gt)throw new TypeError("keccak256 is locked");Qt=t},Object.freeze(jt);const Vt=BigInt(0),Jt=BigInt(36);function zt(t){const e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let t=0;t<40;t++)n[t]=e[t].charCodeAt(0);const r=y(jt(n));for(let t=0;t<40;t+=2)r[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&r[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Kt={};for(let t=0;t<10;t++)Kt[String(t)]=String(t);for(let t=0;t<26;t++)Kt[String.fromCharCode(65+t)]=String(10+t);const qt=15;function _t(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Kt[t])).join("");for(;e.length>=qt;){let t=e.substring(0,qt);e=parseInt(t,10)%97+e.substring(t.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}const Zt=function(){const t={};for(let e=0;e<36;e++){t["0123456789abcdefghijklmnopqrstuvwxyz"[e]]=BigInt(e)}return t}();function Wt(t){if(f("string"==typeof t,"invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=zt(t);return f(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t),e}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){f(t.substring(2,4)===_t(t),"bad icap checksum","address",t);let e=function(t){t=t.toLowerCase();let e=Vt;for(let n=0;n<t.length;n++)e=e*Jt+Zt[t[n]];return e}(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return zt("0x"+e)}f(!1,"invalid address","address",t)}const Yt={};function Xt(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new ee(Yt,`${n?"":"u"}int${e}`,t,{signed:n,width:e})}function $t(t,e){return new ee(Yt,`bytes${e||""}`,t,{size:e})}const te=Symbol.for("_ethers_typed");class ee{type;value;#u;_typedSymbol;constructor(t,e,n,r){null==r&&(r=null),g(Yt,t,"Typed"),o(this,{_typedSymbol:te,type:e,value:n}),this.#u=r,this.format()}format(){if("array"===this.type)throw new Error("");if("dynamicArray"===this.type)throw new Error("");return"tuple"===this.type?`tuple(${this.value.map((t=>t.format())).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return"string"===this.type}get tupleName(){if("tuple"!==this.type)throw TypeError("not a tuple");return this.#u}get arrayLength(){if("array"!==this.type)throw TypeError("not an array");return!0===this.#u?-1:!1===this.#u?this.value.length:null}static from(t,e){return new ee(Yt,t,e)}static uint8(t){return Xt(t,8)}static uint16(t){return Xt(t,16)}static uint24(t){return Xt(t,24)}static uint32(t){return Xt(t,32)}static uint40(t){return Xt(t,40)}static uint48(t){return Xt(t,48)}static uint56(t){return Xt(t,56)}static uint64(t){return Xt(t,64)}static uint72(t){return Xt(t,72)}static uint80(t){return Xt(t,80)}static uint88(t){return Xt(t,88)}static uint96(t){return Xt(t,96)}static uint104(t){return Xt(t,104)}static uint112(t){return Xt(t,112)}static uint120(t){return Xt(t,120)}static uint128(t){return Xt(t,128)}static uint136(t){return Xt(t,136)}static uint144(t){return Xt(t,144)}static uint152(t){return Xt(t,152)}static uint160(t){return Xt(t,160)}static uint168(t){return Xt(t,168)}static uint176(t){return Xt(t,176)}static uint184(t){return Xt(t,184)}static uint192(t){return Xt(t,192)}static uint200(t){return Xt(t,200)}static uint208(t){return Xt(t,208)}static uint216(t){return Xt(t,216)}static uint224(t){return Xt(t,224)}static uint232(t){return Xt(t,232)}static uint240(t){return Xt(t,240)}static uint248(t){return Xt(t,248)}static uint256(t){return Xt(t,256)}static uint(t){return Xt(t,256)}static int8(t){return Xt(t,-8)}static int16(t){return Xt(t,-16)}static int24(t){return Xt(t,-24)}static int32(t){return Xt(t,-32)}static int40(t){return Xt(t,-40)}static int48(t){return Xt(t,-48)}static int56(t){return Xt(t,-56)}static int64(t){return Xt(t,-64)}static int72(t){return Xt(t,-72)}static int80(t){return Xt(t,-80)}static int88(t){return Xt(t,-88)}static int96(t){return Xt(t,-96)}static int104(t){return Xt(t,-104)}static int112(t){return Xt(t,-112)}static int120(t){return Xt(t,-120)}static int128(t){return Xt(t,-128)}static int136(t){return Xt(t,-136)}static int144(t){return Xt(t,-144)}static int152(t){return Xt(t,-152)}static int160(t){return Xt(t,-160)}static int168(t){return Xt(t,-168)}static int176(t){return Xt(t,-176)}static int184(t){return Xt(t,-184)}static int192(t){return Xt(t,-192)}static int200(t){return Xt(t,-200)}static int208(t){return Xt(t,-208)}static int216(t){return Xt(t,-216)}static int224(t){return Xt(t,-224)}static int232(t){return Xt(t,-232)}static int240(t){return Xt(t,-240)}static int248(t){return Xt(t,-248)}static int256(t){return Xt(t,-256)}static int(t){return Xt(t,-256)}static bytes1(t){return $t(t,1)}static bytes2(t){return $t(t,2)}static bytes3(t){return $t(t,3)}static bytes4(t){return $t(t,4)}static bytes5(t){return $t(t,5)}static bytes6(t){return $t(t,6)}static bytes7(t){return $t(t,7)}static bytes8(t){return $t(t,8)}static bytes9(t){return $t(t,9)}static bytes10(t){return $t(t,10)}static bytes11(t){return $t(t,11)}static bytes12(t){return $t(t,12)}static bytes13(t){return $t(t,13)}static bytes14(t){return $t(t,14)}static bytes15(t){return $t(t,15)}static bytes16(t){return $t(t,16)}static bytes17(t){return $t(t,17)}static bytes18(t){return $t(t,18)}static bytes19(t){return $t(t,19)}static bytes20(t){return $t(t,20)}static bytes21(t){return $t(t,21)}static bytes22(t){return $t(t,22)}static bytes23(t){return $t(t,23)}static bytes24(t){return $t(t,24)}static bytes25(t){return $t(t,25)}static bytes26(t){return $t(t,26)}static bytes27(t){return $t(t,27)}static bytes28(t){return $t(t,28)}static bytes29(t){return $t(t,29)}static bytes30(t){return $t(t,30)}static bytes31(t){return $t(t,31)}static bytes32(t){return $t(t,32)}static address(t){return new ee(Yt,"address",t)}static bool(t){return new ee(Yt,"bool",!!t)}static bytes(t){return new ee(Yt,"bytes",t)}static string(t){return new ee(Yt,"string",t)}static array(t,e){throw new Error("not implemented yet")}static tuple(t,e){throw new Error("not implemented yet")}static overrides(t){return new ee(Yt,"overrides",Object.assign({},t))}static isTyped(t){return t&&"object"==typeof t&&"_typedSymbol"in t&&t._typedSymbol===te}static dereference(t,e){if(ee.isTyped(t)){if(t.type!==e)throw new Error(`invalid type: expecetd ${e}, got ${t.type}`);return t.value}return t}}class ne extends X{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){let n=ee.dereference(e,"string");try{n=Wt(n)}catch(t){return this._throwError(t.message,e)}return t.writeValue(n)}decode(t){return Wt(M(t.readValue(),20))}}class re extends X{coder;constructor(t){super(t.name,t.type,"_",t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}function se(t,e,n){let r=[];if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let t={};r=e.map((e=>{const r=e.localName;return h(r,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:e},value:n}),h(!t[r],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:e},value:n}),t[r]=!0,n[r]}))}else f(!1,"invalid tuple value","tuple",n);f(e.length===r.length,"types/value length mismatch","tuple",n);let s=new $,i=new $,o=[];e.forEach(((t,e)=>{let n=r[e];if(t.dynamic){let e=i.length;t.encode(i,n);let r=s.writeUpdatableValue();o.push((t=>{r(t+e)}))}else t.encode(s,n)})),o.forEach((t=>{t(s.length)}));let a=t.appendWriter(s);return a+=t.appendWriter(i),a}function ie(t,e){let n=[],r=[],s=t.subReader(0);return e.forEach((e=>{let i=null;if(e.dynamic){let n=t.readIndex(),r=s.subReader(n);try{i=e.decode(r)}catch(t){if(c(t,"BUFFER_OVERRUN"))throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(c(t,"BUFFER_OVERRUN"))throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}if(null==i)throw new Error("investigate");n.push(i),r.push(e.localName||null)})),W.fromItems(n,r)}class oe extends X{coder;length;constructor(t,e,n){super("array",t.type+"["+(e>=0?e:"")+"]",n,-1===e||t.dynamic),o(this,{coder:t,length:e})}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let n=0;n<this.length;n++)e.push(t);return e}encode(t,e){const n=ee.dereference(e,"array");Array.isArray(n)||this._throwError("expected array value",n);let r=this.length;-1===r&&(r=n.length,t.writeValue(n.length)),d(n.length,r,"coder array"+(this.localName?" "+this.localName:""));let s=[];for(let t=0;t<n.length;t++)s.push(this.coder);return se(t,s,n)}decode(t){let e=this.length;-1===e&&(e=t.readIndex(),h(e*Q<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:e*Q,length:t.dataLength}));let n=[];for(let t=0;t<e;t++)n.push(new re(this.coder));return ie(t,n)}}class ae extends X{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){const n=ee.dereference(e,"bool");return t.writeValue(n?1:0)}decode(t){return!!t.readValue()}}class ce extends X{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=w(e);let n=t.writeValue(e.length);return n+=t.writeBytes(e),n}decode(t){return t.readBytes(t.readIndex(),!0)}}class le extends ce{constructor(t){super("bytes",t)}decode(t){return E(super.decode(t))}}class ue extends X{size;constructor(t,e){let n="bytes"+String(t);super(n,n,e,!1),o(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(t,e){let n=w(ee.dereference(e,this.type));return n.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(n)}decode(t){return E(t.readBytes(this.size))}}const he=new Uint8Array([]);class fe extends X{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes(he)}decode(t){return t.readBytes(0),null}}const de=BigInt(0),pe=BigInt(1),ge=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class me extends X{size;signed;constructor(t,e,n){const r=(e?"int":"uint")+8*t;super(r,r,n,!1),o(this,{size:t,signed:e},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,e){let n=S(ee.dereference(e,this.type)),r=T(ge,256);if(this.signed){let t=T(r,8*this.size-1);(n>t||n<-(t+pe))&&this._throwError("value out-of-bounds",e),n=R(n,256)}else(n<de||n>T(r,8*this.size))&&this._throwError("value out-of-bounds",e);return t.writeValue(n)}decode(t){let e=T(t.readValue(),8*this.size);return this.signed&&(e=function(t,e){const n=F(t,"value"),r=BigInt(L(e,"width"));if(h(n>>r===I,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-C)return-((~n&(C<<r)-C)+C);return n}(e,8*this.size)),e}}function ye(t,e,n,r,s){if("BAD_PREFIX"===t||"UNEXPECTED_CONTINUE"===t){let t=0;for(let r=e+1;r<n.length&&n[r]>>6==2;r++)t++;return t}return"OVERRUN"===t?n.length-e-1:0}const we=Object.freeze({error:function(t,e,n,r,s){f(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",n)},ignore:ye,replace:function(t,e,n,r,s){return"OVERLONG"===t?(f("number"==typeof s,"invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),ye(t,e,n))}});function be(t,e){null==e&&(e=we.error);const n=y(t,"bytes"),r=[];let s=0;for(;s<n.length;){const t=n[s++];if(t>>7==0){r.push(t);continue}let i=null,o=null;if(192==(224&t))i=1,o=127;else if(224==(240&t))i=2,o=2047;else{if(240!=(248&t)){s+=e(128==(192&t)?"UNEXPECTED_CONTINUE":"BAD_PREFIX",s-1,n,r);continue}i=3,o=65535}if(s-1+i>=n.length){s+=e("OVERRUN",s-1,n,r);continue}let a=t&(1<<8-i-1)-1;for(let t=0;t<i;t++){let t=n[s];if(128!=(192&t)){s+=e("MISSING_CONTINUE",s,n,r),a=null;break}a=a<<6|63&t,s++}null!==a&&(a>1114111?s+=e("OUT_OF_RANGE",s-1-i,n,r,a):a>=55296&&a<=57343?s+=e("UTF16_SURROGATE",s-1-i,n,r,a):a<=o?s+=e("OVERLONG",s-1-i,n,r,a):r.push(a))}return r}function Ae(t,e){f("string"==typeof t,"invalid string value","str",t),null!=e&&(!function(t){h(p.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}(e),t=t.normalize(e));let n=[];for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){e++;const s=t.charCodeAt(e);f(e<t.length&&56320==(64512&s),"invalid surrogate pair","str",t);const i=65536+((1023&r)<<10)+(1023&s);n.push(i>>18|240),n.push(i>>12&63|128),n.push(i>>6&63|128),n.push(63&i|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return new Uint8Array(n)}function ve(t,e){return be(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}class Ee extends ce{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Ae(ee.dereference(e,"string")))}decode(t){return ve(super.decode(t))}}class ke extends X{coders;constructor(t,e){let n=!1;const r=[];t.forEach((t=>{t.dynamic&&(n=!0),r.push(t.type)}));super("tuple","tuple("+r.join(",")+")",e,n),o(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});return this.coders.forEach(((n,r)=>{let s=n.localName;s&&1===e[s]&&("length"===s&&(s="_length"),null==t[s]&&(t[s]=t[r]))})),Object.freeze(t)}encode(t,e){const n=ee.dereference(e,"tuple");return se(t,this.coders,n)}decode(t){return ie(t,this.coders)}}function Pe(t){return jt(Ae(t))}function xe(t){const e=new Set;return t.forEach((t=>e.add(t))),Object.freeze(e)}const Ne=xe("external public payable override".split(" ")),Be="constant external internal payable private public pure view override",Ie=xe(Be.split(" ")),Ce="constructor error event fallback function receive struct",Oe=xe(Ce.split(" ")),Re="calldata memory storage payable indexed",Te=xe(Re.split(" ")),Se=xe([Ce,Re,"tuple returns",Be].join(" ").split(" ")),Fe={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Ue=new RegExp("^(\\\\s*)"),De=new RegExp("^([0-9]+)"),Le=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),Me=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),Ge=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class He{#s;#h;get offset(){return this.#s}get length(){return this.#h.length-this.#s}constructor(t){this.#s=0,this.#h=t.slice()}clone(){return new He(this.#h)}reset(){this.#s=0}#f(t=0,e=0){return new He(this.#h.slice(t,e).map((e=>Object.freeze(Object.assign({},e,{match:e.match-t,linkBack:e.linkBack-t,linkNext:e.linkNext-t})))))}popKeyword(t){const e=this.peek();if("KEYWORD"!==e.type||!t.has(e.text))throw new Error(`expected keyword ${e.text}`);return this.pop().text}popType(t){if(this.peek().type!==t){const e=this.peek();throw new Error(`expected ${t}; got ${e.type} ${JSON.stringify(e.text)}`)}return this.pop().text}popParen(){const t=this.peek();if("OPEN_PAREN"!==t.type)throw new Error("bad start");const e=this.#f(this.#s+1,t.match+1);return this.#s=t.match+1,e}popParams(){const t=this.peek();if("OPEN_PAREN"!==t.type)throw new Error("bad start");const e=[];for(;this.#s<t.match-1;){const t=this.peek().linkNext;e.push(this.#f(this.#s+1,t)),this.#s=t}return this.#s=t.match+1,e}peek(){if(this.#s>=this.#h.length)throw new Error("out-of-bounds");return this.#h[this.#s]}peekKeyword(t){const e=this.peekType("KEYWORD");return null!=e&&t.has(e)?e:null}peekType(t){if(0===this.length)return null;const e=this.peek();return e.type===t?e.text:null}pop(){const t=this.peek();return this.#s++,t}toString(){const t=[];for(let e=this.#s;e<this.#h.length;e++){const n=this.#h[e];t.push(`${n.type}:${n.text}`)}return`<TokenString ${t.join(" ")}>`}}function Qe(t){const e=[],n=e=>{const n=i<t.length?JSON.stringify(t[i]):"$EOI";throw new Error(`invalid token ${n} at ${i}: ${e}`)};let r=[],s=[],i=0;for(;i<t.length;){let o=t.substring(i),a=o.match(Ue);a&&(i+=a[1].length,o=t.substring(i));const c={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(c);let l=Fe[o[0]]||"";if(l){if(c.type=l,c.text=o[0],i++,"OPEN_PAREN"===l)r.push(e.length-1),s.push(e.length-1);else if("CLOSE_PAREN"==l)0===r.length&&n("no matching open bracket"),c.match=r.pop(),e[c.match].match=e.length-1,c.depth--,c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1;else if("COMMA"===l)c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1,s.push(e.length-1);else if("OPEN_BRACKET"===l)c.type="BRACKET";else if("CLOSE_BRACKET"===l){let t=e.pop().text;if(e.length>0&&"NUMBER"===e[e.length-1].type){const n=e.pop().text;t=n+t,e[e.length-1].value=L(n)}if(0===e.length||"BRACKET"!==e[e.length-1].type)throw new Error("missing opening bracket");e[e.length-1].text+=t}}else if(a=o.match(Le),a){if(c.text=a[1],i+=c.text.length,Se.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(Ge)){c.type="TYPE";continue}c.type="ID"}else{if(a=o.match(De),!a)throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${i}`);c.text=a[1],c.type="NUMBER",i+=c.text.length}}return new He(e.map((t=>Object.freeze(t))))}function je(t,e){let n=[];for(const r in e.keys())t.has(r)&&n.push(r);if(n.length>1)throw new Error(`conflicting types: ${n.join(", ")}`)}function Ve(t,e){if(e.peekKeyword(Oe)){const n=e.pop().text;if(n!==t)throw new Error(`expected ${t}, got ${n}`)}return e.popType("ID")}function Je(t,e){const n=new Set;for(;;){const r=t.peekType("KEYWORD");if(null==r||e&&!e.has(r))break;if(t.pop(),n.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}function ze(t){let e=Je(t,Ie);return je(e,xe("constant payable nonpayable".split(" "))),je(e,xe("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function Ke(t,e){return t.popParams().map((t=>an.from(t,e)))}function qe(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return S(t.pop().text);throw new Error("invalid gas")}return null}function _e(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const Ze=new RegExp(/^(.*)\\[([0-9]*)\\]$/);function We(t){const e=t.match(Ge);if(f(e,"invalid type","type",t),"uint"===t)return"uint256";if("int"===t)return"int256";if(e[2]){const n=parseInt(e[2]);f(0!==n&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);f(0!==n&&n<=256&&n%8==0,"invalid numeric width","type",t)}return t}const Ye={},Xe=Symbol.for("_ethers_internal"),$e="_ParamTypeInternal",tn="_ErrorInternal",en="_EventInternal",nn="_ConstructorInternal",rn="_FallbackInternal",sn="_FunctionInternal",on="_StructInternal";class an{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(t,e,n,r,s,i,a,c){if(g(t,Ye,"ParamType"),Object.defineProperty(this,Xe,{value:$e}),i&&(i=Object.freeze(i.slice())),"array"===r){if(null==a||null==c)throw new Error("")}else if(null!=a||null!=c)throw new Error("");if("tuple"===r){if(null==i)throw new Error("")}else if(null!=i)throw new Error("");o(this,{name:e,type:n,baseType:r,indexed:s,components:i,arrayLength:a,arrayChildren:c})}format(t){if(null==t&&(t="sighash"),"json"===t){const e=this.name||"";if(this.isArray()){const t=JSON.parse(this.arrayChildren.format("json"));return t.name=e,t.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(t)}const n={type:"tuple"===this.baseType?"tuple":this.type,name:e};return"boolean"==typeof this.indexed&&(n.indexed=this.indexed),this.isTuple()&&(n.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(n)}let e="";return this.isArray()?(e+=this.arrayChildren.format(t),e+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?e+="("+this.components.map((e=>e.format(t))).join("full"===t?", ":",")+")":e+=this.type,"sighash"!==t&&(!0===this.indexed&&(e+=" indexed"),"full"===t&&this.name&&(e+=" "+this.name)),e}isArray(){return"array"===this.baseType}isTuple(){return"tuple"===this.baseType}isIndexable(){return null!=this.indexed}walk(t,e){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(-1!==this.arrayLength&&t.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return t.map((t=>n.arrayChildren.walk(t,e)))}if(this.isTuple()){if(!Array.isArray(t))throw new Error("invalid tuple value");if(t.length!==this.components.length)throw new Error("array is wrong length");const n=this;return t.map(((t,r)=>n.components[r].walk(t,e)))}return e(this.type,t)}#d(t,e,n,r){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(-1!==this.arrayLength&&e.length!==this.arrayLength)throw new Error("array is wrong length");const s=this.arrayChildren,i=e.slice();return i.forEach(((e,r)=>{s.#d(t,e,n,(t=>{i[r]=t}))})),void r(i)}if(this.isTuple()){const s=this.components;let i;if(Array.isArray(e))i=e.slice();else{if(null==e||"object"!=typeof e)throw new Error("invalid tuple value");i=s.map((t=>{if(!t.name)throw new Error("cannot use object value with unnamed components");if(!(t.name in e))throw new Error(`missing value for component ${t.name}`);return e[t.name]}))}if(i.length!==this.components.length)throw new Error("array is wrong length");return i.forEach(((e,r)=>{s[r].#d(t,e,n,(t=>{i[r]=t}))})),void r(i)}const s=n(this.type,e);s.then?t.push(async function(){r(await s)}()):r(s)}async walkAsync(t,e){const n=[],r=[t];return this.#d(n,t,e,(t=>{r[0]=t})),n.length&&await Promise.all(n),r[0]}static from(t,e){if(an.isParamType(t))return t;if("string"==typeof t)try{return an.from(Qe(t),e)}catch(e){f(!1,"invalid param type","obj",t)}else if(t instanceof He){let n="",r="",s=null;Je(t,xe(["tuple"])).has("tuple")||t.peekType("OPEN_PAREN")?(r="tuple",s=t.popParams().map((t=>an.from(t))),n=`tuple(${s.map((t=>t.format())).join(",")})`):(n=We(t.popType("TYPE")),r=n);let i=null,o=null;for(;t.length&&t.peekType("BRACKET");){const e=t.pop();i=new an(Ye,"",n,r,null,s,o,i),o=e.value,n+=e.text,r="array",s=null}let a=null;if(Je(t,Te).has("indexed")){if(!e)throw new Error("");a=!0}const c=t.peekType("ID")?t.pop().text:"";if(t.length)throw new Error("leftover tokens");return new an(Ye,c,n,r,a,s,o,i)}const n=t.name;f(!n||"string"==typeof n&&n.match(Me),"invalid name","obj.name",n);let r=t.indexed;null!=r&&(f(e,"parameter cannot be indexed","obj.indexed",t.indexed),r=!!r);let s=t.type,i=s.match(Ze);if(i){const e=parseInt(i[2]||"-1"),o=an.from({type:i[1],components:t.components});return new an(Ye,n||"",s,"array",r,null,e,o)}if("tuple"===s||s.startsWith("tuple(")||s.startsWith("(")){const e=null!=t.components?t.components.map((t=>an.from(t))):null;return new an(Ye,n||"",s,"tuple",r,e,null,null)}return s=We(t.type),new an(Ye,n||"",s,s,r,null,null,null)}static isParamType(t){return t&&t[Xe]===$e}}class cn{type;inputs;constructor(t,e,n){g(t,Ye,"Fragment"),o(this,{type:e,inputs:n=Object.freeze(n.slice())})}static from(t){if("string"==typeof t){try{cn.from(JSON.parse(t))}catch(t){}return cn.from(Qe(t))}if(t instanceof He){switch(t.peekKeyword(Oe)){case"constructor":return dn.from(t);case"error":return hn.from(t);case"event":return fn.from(t);case"fallback":case"receive":return pn.from(t);case"function":return gn.from(t);case"struct":return mn.from(t)}}else if("object"==typeof t){switch(t.type){case"constructor":return dn.from(t);case"error":return hn.from(t);case"event":return fn.from(t);case"fallback":case"receive":return pn.from(t);case"function":return gn.from(t);case"struct":return mn.from(t)}h(!1,`unsupported type: ${t.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}f(!1,"unsupported frgament object","obj",t)}static isConstructor(t){return dn.isFragment(t)}static isError(t){return hn.isFragment(t)}static isEvent(t){return fn.isFragment(t)}static isFunction(t){return gn.isFragment(t)}static isStruct(t){return mn.isFragment(t)}}class ln extends cn{name;constructor(t,e,n,r){super(t,e,r),f("string"==typeof n&&n.match(Me),"invalid identifier","name",n),r=Object.freeze(r.slice()),o(this,{name:n})}}function un(t,e){return"("+e.map((e=>e.format(t))).join("full"===t?", ":",")+")"}class hn extends ln{constructor(t,e,n){super(t,"error",e,n),Object.defineProperty(this,Xe,{value:tn})}get selector(){return Pe(this.format("sighash")).substring(0,10)}format(t){if(null==t&&(t="sighash"),"json"===t)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});const e=[];return"sighash"!==t&&e.push("error"),e.push(this.name+un(t,this.inputs)),e.join(" ")}static from(t){if(hn.isFragment(t))return t;if("string"==typeof t)return hn.from(Qe(t));if(t instanceof He){const e=Ve("error",t),n=Ke(t);return _e(t),new hn(Ye,e,n)}return new hn(Ye,t.name,t.inputs?t.inputs.map(an.from):[])}static isFragment(t){return t&&t[Xe]===tn}}class fn extends ln{anonymous;constructor(t,e,n,r){super(t,"event",e,n),Object.defineProperty(this,Xe,{value:en}),o(this,{anonymous:r})}get topicHash(){return Pe(this.format("sighash"))}format(t){if(null==t&&(t="sighash"),"json"===t)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});const e=[];return"sighash"!==t&&e.push("event"),e.push(this.name+un(t,this.inputs)),"sighash"!==t&&this.anonymous&&e.push("anonymous"),e.join(" ")}static getTopicHash(t,e){e=(e||[]).map((t=>an.from(t)));return new fn(Ye,t,e,!1).topicHash}static from(t){if(fn.isFragment(t))return t;if("string"==typeof t)try{return fn.from(Qe(t))}catch(e){f(!1,"invalid event fragment","obj",t)}else if(t instanceof He){const e=Ve("event",t),n=Ke(t,!0),r=!!Je(t,xe(["anonymous"])).has("anonymous");return _e(t),new fn(Ye,e,n,r)}return new fn(Ye,t.name,t.inputs?t.inputs.map((t=>an.from(t,!0))):[],!!t.anonymous)}static isFragment(t){return t&&t[Xe]===en}}class dn extends cn{payable;gas;constructor(t,e,n,r,s){super(t,e,n),Object.defineProperty(this,Xe,{value:nn}),o(this,{payable:r,gas:s})}format(t){if(h(null!=t&&"sighash"!==t,"cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),"json"===t)return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:null!=this.gas?this.gas:void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});const e=[`constructor${un(t,this.inputs)}`];return this.payable&&e.push("payable"),null!=this.gas&&e.push(`@${this.gas.toString()}`),e.join(" ")}static from(t){if(dn.isFragment(t))return t;if("string"==typeof t)try{return dn.from(Qe(t))}catch(e){f(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof He){Je(t,xe(["constructor"]));const e=Ke(t),n=!!Je(t,Ne).has("payable"),r=qe(t);return _e(t),new dn(Ye,"constructor",e,n,r)}return new dn(Ye,"constructor",t.inputs?t.inputs.map(an.from):[],!!t.payable,null!=t.gas?t.gas:null)}static isFragment(t){return t&&t[Xe]===nn}}class pn extends cn{payable;constructor(t,e,n){super(t,"fallback",e),Object.defineProperty(this,Xe,{value:rn}),o(this,{payable:n})}format(t){const e=0===this.inputs.length?"receive":"fallback";if("json"===t){const t=this.payable?"payable":"nonpayable";return JSON.stringify({type:e,stateMutability:t})}return`${e}()${this.payable?" payable":""}`}static from(t){if(pn.isFragment(t))return t;if("string"==typeof t)try{return pn.from(Qe(t))}catch(e){f(!1,"invalid fallback fragment","obj",t)}else if(t instanceof He){const e=t.toString();f(t.peekKeyword(xe(["fallback","receive"])),"type must be fallback or receive","obj",e);if("receive"===t.popKeyword(xe(["fallback","receive"]))){const e=Ke(t);return f(0===e.length,"receive cannot have arguments","obj.inputs",e),Je(t,xe(["payable"])),_e(t),new pn(Ye,[],!0)}let n=Ke(t);n.length?f(1===n.length&&"bytes"===n[0].type,"invalid fallback inputs","obj.inputs",n.map((t=>t.format("minimal"))).join(", ")):n=[an.from("bytes")];const r=ze(t);if(f("nonpayable"===r||"payable"===r,"fallback cannot be constants","obj.stateMutability",r),Je(t,xe(["returns"])).has("returns")){const e=Ke(t);f(1===e.length&&"bytes"===e[0].type,"invalid fallback outputs","obj.outputs",e.map((t=>t.format("minimal"))).join(", "))}return _e(t),new pn(Ye,n,"payable"===r)}if("receive"===t.type)return new pn(Ye,[],!0);if("fallback"===t.type){const e=[an.from("bytes")],n="payable"===t.stateMutability;return new pn(Ye,e,n)}f(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[Xe]===rn}}class gn extends ln{constant;outputs;stateMutability;payable;gas;constructor(t,e,n,r,s,i){super(t,"function",e,r),Object.defineProperty(this,Xe,{value:sn});o(this,{constant:"view"===n||"pure"===n,gas:i,outputs:s=Object.freeze(s.slice()),payable:"payable"===n,stateMutability:n})}get selector(){return Pe(this.format("sighash")).substring(0,10)}format(t){if(null==t&&(t="sighash"),"json"===t)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:null!=this.gas?this.gas:void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});const e=[];return"sighash"!==t&&e.push("function"),e.push(this.name+un(t,this.inputs)),"sighash"!==t&&("nonpayable"!==this.stateMutability&&e.push(this.stateMutability),this.outputs&&this.outputs.length&&(e.push("returns"),e.push(un(t,this.outputs))),null!=this.gas&&e.push(`@${this.gas.toString()}`)),e.join(" ")}static getSelector(t,e){e=(e||[]).map((t=>an.from(t)));return new gn(Ye,t,"view",e,[],null).selector}static from(t){if(gn.isFragment(t))return t;if("string"==typeof t)try{return gn.from(Qe(t))}catch(e){f(!1,"invalid function fragment","obj",t)}else if(t instanceof He){const e=Ve("function",t),n=Ke(t),r=ze(t);let s=[];Je(t,xe(["returns"])).has("returns")&&(s=Ke(t));const i=qe(t);return _e(t),new gn(Ye,e,r,n,s,i)}let e=t.stateMutability;return null==e&&(e="payable","boolean"==typeof t.constant?(e="view",t.constant||(e="payable","boolean"!=typeof t.payable||t.payable||(e="nonpayable"))):"boolean"!=typeof t.payable||t.payable||(e="nonpayable")),new gn(Ye,t.name,e,t.inputs?t.inputs.map(an.from):[],t.outputs?t.outputs.map(an.from):[],null!=t.gas?t.gas:null)}static isFragment(t){return t&&t[Xe]===sn}}class mn extends ln{constructor(t,e,n){super(t,"struct",e,n),Object.defineProperty(this,Xe,{value:on})}format(){throw new Error("@TODO")}static from(t){if("string"==typeof t)try{return mn.from(Qe(t))}catch(e){f(!1,"invalid struct fragment","obj",t)}else if(t instanceof He){const e=Ve("struct",t),n=Ke(t);return _e(t),new mn(Ye,e,n)}return new mn(Ye,t.name,t.inputs?t.inputs.map(an.from):[])}static isFragment(t){return t&&t[Xe]===on}}const yn=new Map;yn.set(0,"GENERIC_PANIC"),yn.set(1,"ASSERT_FALSE"),yn.set(17,"OVERFLOW"),yn.set(18,"DIVIDE_BY_ZERO"),yn.set(33,"ENUM_RANGE_ERROR"),yn.set(34,"BAD_STORAGE_DATA"),yn.set(49,"STACK_UNDERFLOW"),yn.set(50,"ARRAY_RANGE_ERROR"),yn.set(65,"OUT_OF_MEMORY"),yn.set(81,"UNINITIALIZED_FUNCTION_CALL");const wn=new RegExp(/^bytes([0-9]*)$/),bn=new RegExp(/^(u?int)([0-9]*)$/);let An=null,vn=1024;class En{#p(t){if(t.isArray())return new oe(this.#p(t.arrayChildren),t.arrayLength,t.name);if(t.isTuple())return new ke(t.components.map((t=>this.#p(t))),t.name);switch(t.baseType){case"address":return new ne(t.name);case"bool":return new ae(t.name);case"string":return new Ee(t.name);case"bytes":return new le(t.name);case"":return new fe(t.name)}let e=t.type.match(bn);if(e){let n=parseInt(e[2]||"256");return f(0!==n&&n<=256&&n%8==0,"invalid "+e[1]+" bit length","param",t),new me(n/8,"int"===e[1],t.name)}if(e=t.type.match(wn),e){let n=parseInt(e[1]);return f(0!==n&&n<=32,"invalid bytes length","param",t),new ue(n,t.name)}f(!1,"invalid type","type",t.type)}getDefaultValue(t){const e=t.map((t=>this.#p(an.from(t))));return new ke(e,"_").defaultValue()}encode(t,e){d(e.length,t.length,"types/values length mismatch");const n=t.map((t=>this.#p(an.from(t)))),r=new ke(n,"_"),s=new $;return r.encode(s,e),s.data}decode(t,e,n){const r=t.map((t=>this.#p(an.from(t))));return new ke(r,"_").decode(new tt(e,n,vn))}static _setDefaultMaxInflation(t){f("number"==typeof t&&Number.isInteger(t),"invalid defaultMaxInflation factor","value",t),vn=t}static defaultAbiCoder(){return null==An&&(An=new En),An}static getBuiltinCallException(t,e,n){return function(t,e,n,r){let s="missing revert data",i=null,o=null;if(n){s="execution reverted";const t=y(n);if(n=E(n),0===t.length)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(t.length%32!=4)s+=" (could not decode reason; invalid data length)";else if("0x08c379a0"===E(t.slice(0,4)))try{i=r.decode(["string"],t.slice(4))[0],o={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch(t){s+=" (could not decode reason; invalid string data)"}else if("0x4e487b71"===E(t.slice(0,4)))try{const e=Number(r.decode(["uint256"],t.slice(4))[0]);o={signature:"Panic(uint256)",name:"Panic",args:[e]},i=`Panic due to ${yn.get(e)||"UNKNOWN"}(${e})`,s+=`: ${i}`}catch(t){s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const a={to:e.to?Wt(e.to):null,data:e.data||"0x"};return e.from&&(a.from=Wt(e.from)),u(s,"CALL_EXCEPTION",{action:t,data:n,reason:i,transaction:a,invocation:null,revert:o})}(t,e,n,En.defaultAbiCoder())}}function kn(t){return t&&"function"==typeof t.getAddress}async function Pn(t,e){const n=await e;return null!=n&&"0x0000000000000000000000000000000000000000"!==n||(h("string"!=typeof t,"unconfigured name","UNCONFIGURED_NAME",{value:t}),f(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),Wt(n)}function xn(t,e){return"string"==typeof t?t.match(/^0x[0-9a-f]{40}$/i)?Wt(t):(h(null!=e,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Pn(t,e.resolveName(t))):kn(t)?Pn(t,t.getAddress()):t&&"function"==typeof t.then?Pn(t,t):void f(!1,"unsupported addressable value","target",t)}const Nn=new Uint8Array(32);Nn.fill(0);const Bn=BigInt(-1),In=BigInt(0),Cn=BigInt(1),On=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Rn=M(Cn,32),Tn=M(In,32),Sn={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Fn=["name","version","chainId","verifyingContract","salt"];function Un(t){return function(e){return f("string"==typeof e,`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Dn={name:Un("name"),version:Un("version"),chainId:function(t){const e=S(t,"domain.chainId");return f(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):H(e)},verifyingContract:function(t){try{return Wt(t).toLowerCase()}catch(t){}f(!1,\'invalid domain value "verifyingContract"\',"domain.verifyingContract",t)},salt:function(t){const e=y(t,"domain.salt");return f(32===e.length,\'invalid domain value "salt"\',"domain.salt",t),E(e)}};function Ln(t){{const e=t.match(/^(u?)int(\\d+)$/);if(e){const n=""===e[1],r=parseInt(e[2]);f(r%8==0&&0!==r&&r<=256&&e[2]===String(r),"invalid numeric width","type",t);const s=T(On,n?r-1:r),i=n?(s+Cn)*Bn:In;return function(e){const r=S(e,"value");return f(r>=i&&r<=s,`value out-of-bounds for ${t}`,"value",r),M(n?R(r,256):r,32)}}}{const e=t.match(/^bytes(\\d+)$/);if(e){const n=parseInt(e[1]);return f(0!==n&&n<=32&&e[1]===String(n),"invalid bytes width","type",t),function(e){return f(y(e).length===n,`invalid length for ${t}`,"value",e),function(t){const e=y(t),n=e.length%32;return n?k([e,Nn.slice(n)]):E(e)}(e)}}}switch(t){case"address":return function(t){return B(Wt(t),32)};case"bool":return function(t){return t?Rn:Tn};case"bytes":return function(t){return jt(t)};case"string":return function(t){return Pe(t)}}return null}function Mn(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}function Gn(t){const e=t.match(/^([^\\x5b]*)((\\x5b\\d*\\x5d)*)(\\x5b(\\d*)\\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}class Hn{primaryType;#g;get types(){return JSON.parse(this.#g)}#m;#y;constructor(t){this.#m=new Map,this.#y=new Map;const e=new Map,n=new Map,r=new Map,s={};Object.keys(t).forEach((i=>{s[i]=t[i].map((({name:e,type:n})=>{let{base:r,index:s}=Gn(n);return"int"!==r||t.int||(r="int256"),"uint"!==r||t.uint||(r="uint256"),{name:e,type:r+(s||"")}})),e.set(i,new Set),n.set(i,[]),r.set(i,new Set)})),this.#g=JSON.stringify(s);for(const r in s){const i=new Set;for(const o of s[r]){f(!i.has(o.name),`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(r)}`,"types",t),i.add(o.name);const s=Gn(o.type).base;f(s!==r,`circular type reference to ${JSON.stringify(s)}`,"types",t);Ln(s)||(f(n.has(s),`unknown type ${JSON.stringify(s)}`,"types",t),n.get(s).push(r),e.get(r).add(s))}}const i=Array.from(n.keys()).filter((t=>0===n.get(t).length));f(0!==i.length,"missing primary type","types",t),f(1===i.length,`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),o(this,{primaryType:i[0]}),function s(i,o){f(!o.has(i),`circular type reference to ${JSON.stringify(i)}`,"types",t),o.add(i);for(const t of e.get(i))if(n.has(t)){s(t,o);for(const e of o)r.get(e).add(t)}o.delete(i)}(this.primaryType,new Set);for(const[t,e]of r){const n=Array.from(e);n.sort(),this.#m.set(t,Mn(t,s[t])+n.map((t=>Mn(t,s[t]))).join(""))}}getEncoder(t){let e=this.#y.get(t);return e||(e=this.#w(t),this.#y.set(t,e)),e}#w(t){{const e=Ln(t);if(e)return e}const e=Gn(t).array;if(e){const t=e.prefix,n=this.getEncoder(t);return r=>{f(-1===e.count||e.count===r.length,`array length mismatch; expected length ${e.count}`,"value",r);let s=r.map(n);return this.#m.has(t)&&(s=s.map(jt)),jt(k(s))}}const n=this.types[t];if(n){const e=Pe(this.#m.get(t));return t=>{const r=n.map((({name:e,type:n})=>{const r=this.getEncoder(n)(t[e]);return this.#m.has(n)?jt(r):r}));return r.unshift(e),k(r)}}f(!1,`unknown type: ${t}`,"type",t)}encodeType(t){const e=this.#m.get(t);return f(e,`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return jt(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,n){if(Ln(t))return n(t,e);const r=Gn(t).array;if(r)return f(-1===r.count||r.count===e.length,`array length mismatch; expected length ${r.count}`,"value",e),e.map((t=>this._visit(r.prefix,t,n)));const s=this.types[t];if(s)return s.reduce(((t,{name:r,type:s})=>(t[r]=this._visit(s,e[r],n),t)),{});f(!1,`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new Hn(t)}static getPrimaryType(t){return Hn.from(t).primaryType}static hashStruct(t,e,n){return Hn.from(e).hashStruct(t,n)}static hashDomain(t){const e=[];for(const n in t){if(null==t[n])continue;const r=Sn[n];f(r,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),e.push({name:n,type:r})}return e.sort(((t,e)=>Fn.indexOf(t.name)-Fn.indexOf(e.name))),Hn.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,n){return k(["0x1901",Hn.hashDomain(t),Hn.from(e).hash(n)])}static hash(t,e,n){return jt(Hn.encode(t,e,n))}static async resolveNames(t,e,n,r){t=Object.assign({},t);for(const e in t)null==t[e]&&delete t[e];const s={};t.verifyingContract&&!b(t.verifyingContract,20)&&(s[t.verifyingContract]="0x");const i=Hn.from(e);i.visit(n,((t,e)=>("address"!==t||b(e,20)||(s[e]="0x"),e)));for(const t in s)s[t]=await r(t);return t.verifyingContract&&s[t.verifyingContract]&&(t.verifyingContract=s[t.verifyingContract]),{domain:t,value:n=i.visit(n,((t,e)=>"address"===t&&s[e]?s[e]:e))}}static getPayload(t,e,n){Hn.hashDomain(t);const r={},s=[];Fn.forEach((e=>{const n=t[e];null!=n&&(r[e]=Dn[e](n),s.push({name:e,type:Sn[e]}))}));const i=Hn.from(e);e=i.types;const o=Object.assign({},e);return f(null==o.EIP712Domain,"types must not contain EIP712Domain type","types.EIP712Domain",e),o.EIP712Domain=s,i.encode(n),{types:o,domain:r,primaryType:i.primaryType,message:i.visit(n,((t,e)=>{if(t.match(/^bytes(\\d*)/))return E(y(e));if(t.match(/^u?int/))return S(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return f("string"==typeof e,"invalid string","value",e),e}f(!1,"unsupported type","type",t)}))}}}function Qn(t,e){return{address:Wt(t),storageKeys:e.map(((t,e)=>(f(b(t,32),"invalid slot",`storageKeys[${e}]`,t),t.toLowerCase())))}}function jn(t){if(Array.isArray(t))return t.map(((e,n)=>Array.isArray(e)?(f(2===e.length,"invalid slot set",`value[${n}]`,e),Qn(e[0],e[1])):(f(null!=e&&"object"==typeof e,"invalid address-slot set","value",t),Qn(e.address,e.storageKeys))));f(null!=t&&"object"==typeof t,"invalid access list","value",t);const e=Object.keys(t).map((e=>{const n=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return Qn(e,Object.keys(n).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function Vn(t){return async function(t,e){h(null==e||!e.cancelled,"request cancelled before sending","CANCELLED");const n=t.url.split(":")[0].toLowerCase();h("http"===n||"https"===n,`unsupported protocol ${n}`,"UNSUPPORTED_OPERATION",{info:{protocol:n},operation:"request"}),h("https"===n||!t.credentials||t.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let r=null;const s=new AbortController,i=setTimeout((()=>{r=u("request timeout","TIMEOUT"),s.abort()}),t.timeout);e&&e.addListener((()=>{r=u("request cancelled","CANCELLED"),s.abort()}));const o={method:t.method,headers:new Headers(Array.from(t)),body:t.body||void 0,signal:s.signal};let a;try{a=await fetch(t.url,o)}catch(t){if(clearTimeout(i),r)throw r;throw t}clearTimeout(i);const c={};a.headers.forEach(((t,e)=>{c[e.toLowerCase()]=t}));const l=await a.arrayBuffer(),f=null==l?null:new Uint8Array(l);return{statusCode:a.status,statusMessage:a.statusText,headers:c,body:f}}}Vn();let Jn=Vn();const zn=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),Kn=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let qn=!1;async function _n(t,e){try{const e=t.match(zn);if(!e)throw new Error("invalid data");return new er(200,"OK",{"content-type":e[1]||"text/plain"},e[2]?function(t){t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return y(e)}(e[3]):Ae(e[3].replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))}catch(e){return new er(599,"BAD REQUEST (invalid data: URI)",{},null,new tr(t))}}function Zn(t){return async function(e,n){try{const n=e.match(Kn);if(!n)throw new Error("invalid link");return new tr(`${t}${n[2]}`)}catch(t){return new er(599,"BAD REQUEST (invalid IPFS URI)",{},null,new tr(e))}}}const Wn={data:_n,ipfs:Zn("https://gateway.ipfs.io/ipfs/")},Yn=new WeakMap;class Xn{#b;#A;constructor(t){this.#b=[],this.#A=!1,Yn.set(t,(()=>{if(!this.#A){this.#A=!0;for(const t of this.#b)setTimeout((()=>{t()}),0);this.#b=[]}}))}addListener(t){h(!this.#A,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),this.#b.push(t)}get cancelled(){return this.#A}checkSignal(){h(!this.cancelled,"cancelled","CANCELLED",{})}}function $n(t){if(null==t)throw new Error("missing signal; should not happen");return t.checkSignal(),t}class tr{#v;#E;#k;#P;#x;#N;#B;#I;#C;#O;#R;#T;#S;#F;#U;get url(){return this.#N}set url(t){this.#N=String(t)}get body(){return null==this.#B?null:new Uint8Array(this.#B)}set body(t){if(null==t)this.#B=void 0,this.#I=void 0;else if("string"==typeof t)this.#B=Ae(t),this.#I="text/plain";else if(t instanceof Uint8Array)this.#B=t,this.#I="application/octet-stream";else{if("object"!=typeof t)throw new Error("invalid body");this.#B=Ae(JSON.stringify(t)),this.#I="application/json"}}hasBody(){return null!=this.#B}get method(){return this.#P?this.#P:this.hasBody()?"POST":"GET"}set method(t){null==t&&(t=""),this.#P=String(t).toUpperCase()}get headers(){const t=Object.assign({},this.#k);return this.#C&&(t.authorization=`Basic ${function(t){const e=y(t);let n="";for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return btoa(n)}(Ae(this.#C))}`),this.allowGzip&&(t["accept-encoding"]="gzip"),null==t["content-type"]&&this.#I&&(t["content-type"]=this.#I),this.body&&(t["content-length"]=String(this.body.length)),t}getHeader(t){return this.headers[t.toLowerCase()]}setHeader(t,e){this.#k[String(t).toLowerCase()]=String(e)}clearHeaders(){this.#k={}}[Symbol.iterator](){const t=this.headers,e=Object.keys(t);let n=0;return{next:()=>{if(n<e.length){const r=e[n++];return{value:[r,t[r]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return this.#C||null}setCredentials(t,e){f(!t.match(/:/),"invalid basic authentication username","username","[REDACTED]"),this.#C=`${t}:${e}`}get allowGzip(){return this.#E}set allowGzip(t){this.#E=!!t}get allowInsecureAuthentication(){return!!this.#v}set allowInsecureAuthentication(t){this.#v=!!t}get timeout(){return this.#x}set timeout(t){f(t>=0,"timeout must be non-zero","timeout",t),this.#x=t}get preflightFunc(){return this.#O||null}set preflightFunc(t){this.#O=t}get processFunc(){return this.#R||null}set processFunc(t){this.#R=t}get retryFunc(){return this.#T||null}set retryFunc(t){this.#T=t}get getUrlFunc(){return this.#U||Jn}set getUrlFunc(t){this.#U=t}constructor(t){this.#N=String(t),this.#v=!1,this.#E=!0,this.#k={},this.#P="",this.#x=3e5,this.#F={slotInterval:250,maxAttempts:12},this.#U=null}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#B?E(this.#B):"null"}>`}setThrottleParams(t){null!=t.slotInterval&&(this.#F.slotInterval=t.slotInterval),null!=t.maxAttempts&&(this.#F.maxAttempts=t.maxAttempts)}async#D(t,e,n,r,s){if(t>=this.#F.maxAttempts)return s.makeServerError("exceeded maximum retry limit");h(nr()<=e,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:r}),n>0&&await function(t){return new Promise((e=>setTimeout(e,t)))}(n);let i=this.clone();const o=(i.url.split(":")[0]||"").toLowerCase();if(o in Wn){const t=await Wn[o](i.url,$n(r.#S));if(t instanceof er){let e=t;if(this.processFunc){$n(r.#S);try{e=await this.processFunc(i,e)}catch(t){null!=t.throttle&&"number"==typeof t.stall||e.makeServerError("error in post-processing function",t).assertOk()}}return e}i=t}this.preflightFunc&&(i=await this.preflightFunc(i));const a=await this.getUrlFunc(i,$n(r.#S));let c=new er(a.statusCode,a.statusMessage,a.headers,a.body,r);if(301===c.statusCode||302===c.statusCode){try{const n=c.headers.location||"";return i.redirect(n).#D(t+1,e,0,r,c)}catch(t){}return c}if(429===c.statusCode&&(null==this.retryFunc||await this.retryFunc(i,c,t))){const n=c.headers["retry-after"];let s=this.#F.slotInterval*Math.trunc(Math.random()*Math.pow(2,t));return"string"==typeof n&&n.match(/^[1-9][0-9]*$/)&&(s=parseInt(n)),i.clone().#D(t+1,e,s,r,c)}if(this.processFunc){$n(r.#S);try{c=await this.processFunc(i,c)}catch(n){null!=n.throttle&&"number"==typeof n.stall||c.makeServerError("error in post-processing function",n).assertOk();let s=this.#F.slotInterval*Math.trunc(Math.random()*Math.pow(2,t));return n.stall>=0&&(s=n.stall),i.clone().#D(t+1,e,s,r,c)}}return c}send(){return h(null==this.#S,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),this.#S=new Xn(this),this.#D(0,nr()+this.timeout,0,this,new er(0,"",{},null,this))}cancel(){h(null!=this.#S,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const t=Yn.get(this);if(!t)throw new Error("missing signal; should not happen");t()}redirect(t){const e=this.url.split(":")[0].toLowerCase(),n=t.split(":")[0].toLowerCase();h("GET"===this.method&&("https"!==e||"http"!==n)&&t.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(t)})`});const r=new tr(t);return r.method="GET",r.allowGzip=this.allowGzip,r.timeout=this.timeout,r.#k=Object.assign({},this.#k),this.#B&&(r.#B=new Uint8Array(this.#B)),r.#I=this.#I,r}clone(){const t=new tr(this.url);return t.#P=this.#P,this.#B&&(t.#B=this.#B),t.#I=this.#I,t.#k=Object.assign({},this.#k),t.#C=this.#C,this.allowGzip&&(t.allowGzip=!0),t.timeout=this.timeout,this.allowInsecureAuthentication&&(t.allowInsecureAuthentication=!0),t.#O=this.#O,t.#R=this.#R,t.#T=this.#T,t.#F=Object.assign({},this.#F),t.#U=this.#U,t}static lockConfig(){qn=!0}static getGateway(t){return Wn[t.toLowerCase()]||null}static registerGateway(t,e){if("http"===(t=t.toLowerCase())||"https"===t)throw new Error(`cannot intercept ${t}; use registerGetUrl`);if(qn)throw new Error("gateways locked");Wn[t]=e}static registerGetUrl(t){if(qn)throw new Error("gateways locked");Jn=t}static createGetUrlFunc(t){return Vn()}static createDataGateway(){return _n}static createIpfsGatewayFunc(t){return Zn(t)}}class er{#L;#M;#k;#B;#G;#H;toString(){return`<FetchResponse status=${this.statusCode} body=${this.#B?E(this.#B):"null"}>`}get statusCode(){return this.#L}get statusMessage(){return this.#M}get headers(){return Object.assign({},this.#k)}get body(){return null==this.#B?null:new Uint8Array(this.#B)}get bodyText(){try{return null==this.#B?"":ve(this.#B)}catch(t){h(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch(t){h(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const t=this.headers,e=Object.keys(t);let n=0;return{next:()=>{if(n<e.length){const r=e[n++];return{value:[r,t[r]],done:!1}}return{value:void 0,done:!0}}}}constructor(t,e,n,r,s){this.#L=t,this.#M=e,this.#k=Object.keys(n).reduce(((t,e)=>(t[e.toLowerCase()]=String(n[e]),t)),{}),this.#B=null==r?null:new Uint8Array(r),this.#G=s||null,this.#H={message:""}}makeServerError(t,e){let n;n=t?`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${t})`:`CLIENT ESCALATED SERVER ERROR (${t=`${this.statusCode} ${this.statusMessage}`})`;const r=new er(599,n,this.headers,this.body,this.#G||void 0);return r.#H={message:t,error:e},r}throwThrottleError(t,e){null==e?e=-1:f(Number.isInteger(e)&&e>=0,"invalid stall timeout","stall",e);const n=new Error(t||"throttling requests");throw o(n,{stall:e,throttle:!0}),n}getHeader(t){return this.headers[t.toLowerCase()]}hasBody(){return null!=this.#B}get request(){return this.#G}ok(){return""===this.#H.message&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:t,error:e}=this.#H;""===t&&(t=`server response ${this.statusCode} ${this.statusMessage}`);let n=null;this.request&&(n=this.request.url);let r=null;try{this.#B&&(r=ve(this.#B))}catch(t){}h(!1,t,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:e,info:{requestUrl:n,responseBody:r,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function nr(){return(new Date).getTime()}const rr="0x0000000000000000000000000000000000000000";class sr{fragment;name;signature;topic;args;constructor(t,e,n){const r=t.name,s=t.format();o(this,{fragment:t,name:r,signature:s,topic:e,args:n})}}class ir{fragment;name;args;signature;selector;value;constructor(t,e,n,r){const s=t.name,i=t.format();o(this,{fragment:t,name:s,args:n,signature:i,selector:e,value:r})}}class or{fragment;name;args;signature;selector;constructor(t,e,n){const r=t.name,s=t.format();o(this,{fragment:t,name:r,args:n,signature:s,selector:e})}}class ar{hash;_isIndexed;static isIndexed(t){return!(!t||!t._isIndexed)}constructor(t){o(this,{hash:t,_isIndexed:!0})}}const cr={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},lr={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&cr[t.toString()]&&(e=cr[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};class ur{fragments;deploy;fallback;receive;#Q;#j;#V;#J;constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,this.#V=new Map,this.#Q=new Map,this.#j=new Map;const n=[];for(const t of e)try{n.push(cn.from(t))}catch(e){console.log(`[Warning] Invalid Fragment ${JSON.stringify(t)}:`,e.message)}o(this,{fragments:Object.freeze(n)});let r=null,s=!1;this.#J=this.getAbiCoder(),this.fragments.forEach(((t,e)=>{let n;switch(t.type){case"constructor":return this.deploy?void console.log("duplicate definition - constructor"):void o(this,{deploy:t});case"fallback":return void(0===t.inputs.length?s=!0:(f(!r||t.payable!==r.payable,"conflicting fallback fragments",`fragments[${e}]`,t),r=t,s=r.payable));case"function":n=this.#V;break;case"event":n=this.#j;break;case"error":n=this.#Q;break;default:return}const i=t.format();n.has(i)||n.set(i,t)})),this.deploy||o(this,{deploy:dn.from("constructor()")}),o(this,{fallback:r,receive:s})}format(t){const e=t?"minimal":"full";return this.fragments.map((t=>t.format(e)))}formatJson(){const t=this.fragments.map((t=>t.format("json")));return JSON.stringify(t.map((t=>JSON.parse(t))))}getAbiCoder(){return En.defaultAbiCoder()}#z(t,e,n){if(b(t)){const e=t.toLowerCase();for(const t of this.#V.values())if(e===t.selector)return t;return null}if(-1===t.indexOf("(")){const r=[];for(const[e,n]of this.#V)e.split("(")[0]===t&&r.push(n);if(e){const t=e.length>0?e[e.length-1]:null;let n=e.length,s=!0;ee.isTyped(t)&&"overrides"===t.type&&(s=!1,n--);for(let t=r.length-1;t>=0;t--){const e=r[t].inputs.length;e===n||s&&e===n-1||r.splice(t,1)}for(let t=r.length-1;t>=0;t--){const n=r[t].inputs;for(let s=0;s<e.length;s++)if(ee.isTyped(e[s])){if(s>=n.length){if("overrides"===e[s].type)continue;r.splice(t,1);break}if(e[s].type!==n[s].baseType){r.splice(t,1);break}}}}if(1===r.length&&e&&e.length!==r[0].inputs.length){const t=e[e.length-1];(null==t||Array.isArray(t)||"object"!=typeof t)&&r.splice(0,1)}if(0===r.length)return null;if(r.length>1&&n){f(!1,`ambiguous function description (i.e. matches ${r.map((t=>JSON.stringify(t.format()))).join(", ")})`,"key",t)}return r[0]}const r=this.#V.get(gn.from(t).format());return r||null}getFunctionName(t){const e=this.#z(t,null,!1);return f(e,"no matching function","key",t),e.name}hasFunction(t){return!!this.#z(t,null,!1)}getFunction(t,e){return this.#z(t,e||null,!0)}forEachFunction(t){const e=Array.from(this.#V.keys());e.sort(((t,e)=>t.localeCompare(e)));for(let n=0;n<e.length;n++){const r=e[n];t(this.#V.get(r),n)}}#K(t,e,n){if(b(t)){const e=t.toLowerCase();for(const t of this.#j.values())if(e===t.topicHash)return t;return null}if(-1===t.indexOf("(")){const r=[];for(const[e,n]of this.#j)e.split("(")[0]===t&&r.push(n);if(e){for(let t=r.length-1;t>=0;t--)r[t].inputs.length<e.length&&r.splice(t,1);for(let t=r.length-1;t>=0;t--){const n=r[t].inputs;for(let s=0;s<e.length;s++)if(ee.isTyped(e[s])&&e[s].type!==n[s].baseType){r.splice(t,1);break}}}if(0===r.length)return null;if(r.length>1&&n){f(!1,`ambiguous event description (i.e. matches ${r.map((t=>JSON.stringify(t.format()))).join(", ")})`,"key",t)}return r[0]}const r=this.#j.get(fn.from(t).format());return r||null}getEventName(t){const e=this.#K(t,null,!1);return f(e,"no matching event","key",t),e.name}hasEvent(t){return!!this.#K(t,null,!1)}getEvent(t,e){return this.#K(t,e||null,!0)}forEachEvent(t){const e=Array.from(this.#j.keys());e.sort(((t,e)=>t.localeCompare(e)));for(let n=0;n<e.length;n++){const r=e[n];t(this.#j.get(r),n)}}getError(t,e){if(b(t)){const e=t.toLowerCase();if(lr[e])return hn.from(lr[e].signature);for(const t of this.#Q.values())if(e===t.selector)return t;return null}if(-1===t.indexOf("(")){const e=[];for(const[n,r]of this.#Q)n.split("(")[0]===t&&e.push(r);if(0===e.length)return"Error"===t?hn.from("error Error(string)"):"Panic"===t?hn.from("error Panic(uint256)"):null;if(e.length>1){f(!1,`ambiguous error description (i.e. ${e.map((t=>JSON.stringify(t.format()))).join(", ")})`,"name",t)}return e[0]}if("Error(string)"===(t=hn.from(t).format()))return hn.from("error Error(string)");if("Panic(uint256)"===t)return hn.from("error Panic(uint256)");const n=this.#Q.get(t);return n||null}forEachError(t){const e=Array.from(this.#Q.keys());e.sort(((t,e)=>t.localeCompare(e)));for(let n=0;n<e.length;n++){const r=e[n];t(this.#Q.get(r),n)}}_decodeParams(t,e){return this.#J.decode(t,e)}_encodeParams(t,e){return this.#J.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){if("string"==typeof t){const e=this.getError(t);f(e,"unknown error","fragment",t),t=e}return f(x(e,0,4)===t.selector,`data signature does not match error ${t.name}.`,"data",e),this._decodeParams(t.inputs,x(e,4))}encodeErrorResult(t,e){if("string"==typeof t){const e=this.getError(t);f(e,"unknown error","fragment",t),t=e}return k([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionData(t,e){if("string"==typeof t){const e=this.getFunction(t);f(e,"unknown function","fragment",t),t=e}return f(x(e,0,4)===t.selector,`data signature does not match function ${t.name}.`,"data",e),this._decodeParams(t.inputs,x(e,4))}encodeFunctionData(t,e){if("string"==typeof t){const e=this.getFunction(t);f(e,"unknown function","fragment",t),t=e}return k([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionResult(t,e){if("string"==typeof t){const e=this.getFunction(t);f(e,"unknown function","fragment",t),t=e}let n="invalid length for result data";const r=w(e);if(r.length%32==0)try{return this.#J.decode(t.outputs,r)}catch(t){n="could not decode result data"}h(!1,n,"BAD_DATA",{value:E(r),info:{method:t.name,signature:t.format()}})}makeError(t,e){const n=y(t,"data"),r=En.getBuiltinCallException("call",e,n);if(r.message.startsWith("execution reverted (unknown custom error)")){const t=E(n.slice(0,4)),e=this.getError(t);if(e)try{const t=this.#J.decode(e.inputs,n.slice(4));r.revert={name:e.name,signature:e.format(),args:t},r.reason=r.revert.signature,r.message=`execution reverted: ${r.reason}`}catch(t){r.message="execution reverted (coult not decode custom error)"}}const s=this.parseTransaction(e);return s&&(r.invocation={method:s.name,signature:s.signature,args:s.args}),r}encodeFunctionResult(t,e){if("string"==typeof t){const e=this.getFunction(t);f(e,"unknown function","fragment",t),t=e}return E(this.#J.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){if("string"==typeof t){const e=this.getEvent(t);f(e,"unknown event","eventFragment",t),t=e}h(e.length<=t.inputs.length,`too many arguments for ${t.format()}`,"UNEXPECTED_ARGUMENT",{count:e.length,expectedCount:t.inputs.length});const n=[];t.anonymous||n.push(t.topicHash);const r=(t,e)=>"string"===t.type?Pe(e):"bytes"===t.type?jt(E(e)):("bool"===t.type&&"boolean"==typeof e?e=e?"0x01":"0x00":t.type.match(/^u?int/)?e=M(e):t.type.match(/^bytes/)?e=N(e,32,!1):"address"===t.type&&this.#J.encode(["address"],[e]),B(E(e),32));for(e.forEach(((e,s)=>{const i=t.inputs[s];i.indexed?null==e?n.push(null):"array"===i.baseType||"tuple"===i.baseType?f(!1,"filtering with tuples or arrays not supported","contract."+i.name,e):Array.isArray(e)?n.push(e.map((t=>r(i,t)))):n.push(r(i,e)):f(null==e,"cannot filter non-indexed parameters; must be null","contract."+i.name,e)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(t,e){if("string"==typeof t){const e=this.getEvent(t);f(e,"unknown event","eventFragment",t),t=e}const n=[],r=[],s=[];return t.anonymous||n.push(t.topicHash),f(e.length===t.inputs.length,"event arguments/values mismatch","values",e),t.inputs.forEach(((t,i)=>{const o=e[i];if(t.indexed)if("string"===t.type)n.push(Pe(o));else if("bytes"===t.type)n.push(jt(o));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");n.push(this.#J.encode([t.type],[o]))}else r.push(t),s.push(o)})),{data:this.#J.encode(r,s),topics:n}}decodeEventLog(t,e,n){if("string"==typeof t){const e=this.getEvent(t);f(e,"unknown event","eventFragment",t),t=e}if(null!=n&&!t.anonymous){const e=t.topicHash;f(b(n[0],32)&&n[0].toLowerCase()===e,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const r=[],s=[],i=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(r.push(an.from({type:"bytes32",name:t.name})),i.push(!0)):(r.push(t),i.push(!1)):(s.push(t),i.push(!1))}));const o=null!=n?this.#J.decode(r,k(n)):null,a=this.#J.decode(s,e,!0),c=[],l=[];let u=0,h=0;return t.inputs.forEach(((t,e)=>{let n=null;if(t.indexed)if(null==o)n=new ar(null);else if(i[e])n=new ar(o[h++]);else try{n=o[h++]}catch(t){n=t}else try{n=a[u++]}catch(t){n=t}c.push(n),l.push(t.name||null)})),W.fromItems(c,l)}parseTransaction(t){const e=y(t.data,"tx.data"),n=S(null!=t.value?t.value:0,"tx.value"),r=this.getFunction(E(e.slice(0,4)));if(!r)return null;const s=this.#J.decode(r.inputs,e.slice(4));return new ir(r,r.selector,s,n)}parseCallResult(t){throw new Error("@TODO")}parseLog(t){const e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new sr(e,e.topicHash,this.decodeEventLog(e,t.data,t.topics))}parseError(t){const e=E(t),n=this.getError(x(e,0,4));if(!n)return null;const r=this.#J.decode(n.inputs,x(e,4));return new or(n,n.selector,r)}static from(t){return t instanceof ur?t:"string"==typeof t?new ur(JSON.parse(t)):"function"==typeof t.formatJson?new ur(t.formatJson()):"function"==typeof t.format?new ur(t.format("json")):new ur(t)}}const hr=BigInt(0);function fr(t){return null==t?null:t}function dr(t){return null==t?null:t.toString()}class pr{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(t,e,n){o(this,{gasPrice:fr(t),maxFeePerGas:fr(e),maxPriorityFeePerGas:fr(n)})}toJSON(){const{gasPrice:t,maxFeePerGas:e,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:dr(t),maxFeePerGas:dr(e),maxPriorityFeePerGas:dr(n)}}}function gr(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=E(t.data));const n="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const r of n)r in t&&null!=t[r]&&(e[r]=S(t[r],`request.${r}`));const r="type,nonce".split(/,/);for(const n of r)n in t&&null!=t[n]&&(e[n]=L(t[n],`request.${n}`));return t.accessList&&(e.accessList=jn(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map((t=>A(t)?E(t):Object.assign({},t)))),e}class mr{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#q;constructor(t,e){this.#q=t.transactions.map((t=>"string"!=typeof t?new br(t,e):t)),o(this,{provider:e,hash:fr(t.hash),number:t.number,timestamp:t.timestamp,parentHash:t.parentHash,parentBeaconBlockRoot:t.parentBeaconBlockRoot,nonce:t.nonce,difficulty:t.difficulty,gasLimit:t.gasLimit,gasUsed:t.gasUsed,blobGasUsed:t.blobGasUsed,excessBlobGas:t.excessBlobGas,miner:t.miner,prevRandao:fr(t.prevRandao),extraData:t.extraData,baseFeePerGas:fr(t.baseFeePerGas),stateRoot:t.stateRoot,receiptsRoot:t.receiptsRoot})}get transactions(){return this.#q.map((t=>"string"==typeof t?t:t.hash))}get prefetchedTransactions(){const t=this.#q.slice();return 0===t.length?[]:(h("object"==typeof t[0],"transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),t)}toJSON(){const{baseFeePerGas:t,difficulty:e,extraData:n,gasLimit:r,gasUsed:s,hash:i,miner:o,prevRandao:a,nonce:c,number:l,parentHash:u,parentBeaconBlockRoot:h,stateRoot:f,receiptsRoot:d,timestamp:p,transactions:g}=this;return{_type:"Block",baseFeePerGas:dr(t),difficulty:dr(e),extraData:n,gasLimit:dr(r),gasUsed:dr(s),blobGasUsed:dr(this.blobGasUsed),excessBlobGas:dr(this.excessBlobGas),hash:i,miner:o,prevRandao:a,nonce:c,number:l,parentHash:u,timestamp:p,parentBeaconBlockRoot:h,stateRoot:f,receiptsRoot:d,transactions:g}}[Symbol.iterator](){let t=0;const e=this.transactions;return{next:()=>t<this.length?{value:e[t++],done:!1}:{value:void 0,done:!0}}}get length(){return this.#q.length}get date(){return null==this.timestamp?null:new Date(1e3*this.timestamp)}async getTransaction(t){let e;if("number"==typeof t)e=this.#q[t];else{const n=t.toLowerCase();for(const t of this.#q){if("string"==typeof t){if(t!==n)continue;e=t;break}if(t.hash!==n){e=t;break}}}if(null==e)throw new Error("no such tx");return"string"==typeof e?await this.provider.getTransaction(e):e}getPrefetchedTransaction(t){const e=this.prefetchedTransactions;if("number"==typeof t)return e[t];t=t.toLowerCase();for(const n of e)if(n.hash===t)return n;f(!1,"no matching transaction","indexOrHash",t)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return{orphan:"drop-block",hash:(t=this).hash,number:t.number};var t}}class yr{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(t,e){this.provider=e;const n=Object.freeze(t.topics.slice());o(this,{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,removed:t.removed,address:t.address,data:t.data,topics:n,index:t.index,transactionIndex:t.transactionIndex})}toJSON(){const{address:t,blockHash:e,blockNumber:n,data:r,index:s,removed:i,topics:o,transactionHash:a,transactionIndex:c}=this;return{_type:"log",address:t,blockHash:e,blockNumber:n,data:r,index:s,removed:i,topics:o,transactionHash:a,transactionIndex:c}}async getBlock(){const t=await this.provider.getBlock(this.blockHash);return h(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransaction(){const t=await this.provider.getTransaction(this.transactionHash);return h(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransactionReceipt(){const t=await this.provider.getTransactionReceipt(this.transactionHash);return h(!!t,"failed to find transaction receipt","UNKNOWN_ERROR",{}),t}removedEvent(){return{orphan:"drop-log",log:{transactionHash:(t=this).transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}};var t}}class wr{provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#_;constructor(t,e){this.#_=Object.freeze(t.logs.map((t=>new yr(t,e))));let n=hr;null!=t.effectiveGasPrice?n=t.effectiveGasPrice:null!=t.gasPrice&&(n=t.gasPrice),o(this,{provider:e,to:t.to,from:t.from,contractAddress:t.contractAddress,hash:t.hash,index:t.index,blockHash:t.blockHash,blockNumber:t.blockNumber,logsBloom:t.logsBloom,gasUsed:t.gasUsed,cumulativeGasUsed:t.cumulativeGasUsed,blobGasUsed:t.blobGasUsed,gasPrice:n,blobGasPrice:t.blobGasPrice,type:t.type,status:t.status,root:t.root})}get logs(){return this.#_}toJSON(){const{to:t,from:e,contractAddress:n,hash:r,index:s,blockHash:i,blockNumber:o,logsBloom:a,logs:c,status:l,root:u}=this;return{_type:"TransactionReceipt",blockHash:i,blockNumber:o,contractAddress:n,cumulativeGasUsed:dr(this.cumulativeGasUsed),from:e,gasPrice:dr(this.gasPrice),blobGasUsed:dr(this.blobGasUsed),blobGasPrice:dr(this.blobGasPrice),gasUsed:dr(this.gasUsed),hash:r,index:s,logs:c,logsBloom:a,root:u,status:l,to:t}}get length(){return this.logs.length}[Symbol.iterator](){let t=0;return{next:()=>t<this.length?{value:this.logs[t++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const t=await this.provider.getBlock(this.blockHash);if(null==t)throw new Error("TODO");return t}async getTransaction(){const t=await this.provider.getTransaction(this.hash);if(null==t)throw new Error("TODO");return t}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return vr(this)}reorderedEvent(t){return h(!t||t.isMined(),"unmined \'other\' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),Ar(this,t)}}class br{provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;maxFeePerBlobGas;data;value;chainId;signature;accessList;blobVersionedHashes;#Z;constructor(t,e){this.provider=e,this.blockNumber=null!=t.blockNumber?t.blockNumber:null,this.blockHash=null!=t.blockHash?t.blockHash:null,this.hash=t.hash,this.index=t.index,this.type=t.type,this.from=t.from,this.to=t.to||null,this.gasLimit=t.gasLimit,this.nonce=t.nonce,this.data=t.data,this.value=t.value,this.gasPrice=t.gasPrice,this.maxPriorityFeePerGas=null!=t.maxPriorityFeePerGas?t.maxPriorityFeePerGas:null,this.maxFeePerGas=null!=t.maxFeePerGas?t.maxFeePerGas:null,this.maxFeePerBlobGas=null!=t.maxFeePerBlobGas?t.maxFeePerBlobGas:null,this.chainId=t.chainId,this.signature=t.signature,this.accessList=null!=t.accessList?t.accessList:null,this.blobVersionedHashes=null!=t.blobVersionedHashes?t.blobVersionedHashes:null,this.#Z=-1}toJSON(){const{blockNumber:t,blockHash:e,index:n,hash:r,type:s,to:i,from:o,nonce:a,data:c,signature:l,accessList:u,blobVersionedHashes:h}=this;return{_type:"TransactionResponse",accessList:u,blockNumber:t,blockHash:e,blobVersionedHashes:h,chainId:dr(this.chainId),data:c,from:o,gasLimit:dr(this.gasLimit),gasPrice:dr(this.gasPrice),hash:r,maxFeePerGas:dr(this.maxFeePerGas),maxPriorityFeePerGas:dr(this.maxPriorityFeePerGas),maxFeePerBlobGas:dr(this.maxFeePerBlobGas),nonce:a,signature:l,to:i,index:n,type:s,value:dr(this.value)}}async getBlock(){let t=this.blockNumber;if(null==t){const e=await this.getTransaction();e&&(t=e.blockNumber)}if(null==t)return null;const e=this.provider.getBlock(t);if(null==e)throw new Error("TODO");return e}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(null==this.blockNumber){const{tx:t,blockNumber:e}=await i({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return null==t||null==t.blockNumber?0:e-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(t,e){const n=null==t?1:t,r=null==e?0:e;let s=this.#Z,o=-1,a=-1===s;const l=async()=>{if(a)return null;const{blockNumber:t,nonce:e}=await i({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(e<this.nonce)return void(s=t);if(a)return null;const r=await this.getTransaction();if(!r||null==r.blockNumber)for(-1===o&&(o=s-3,o<this.#Z&&(o=this.#Z));o<=t;){if(a)return null;const e=await this.provider.getBlock(o,!0);if(null==e)return;for(const t of e)if(t===this.hash)return;for(let r=0;r<e.length;r++){const i=await e.getTransaction(r);if(i.from===this.from&&i.nonce===this.nonce){if(a)return null;const e=await this.provider.getTransactionReceipt(i.hash);if(null==e)return;if(t-e.blockNumber+1<n)return;let r="replaced";i.data===this.data&&i.to===this.to&&i.value===this.value?r="repriced":"0x"===i.data&&i.from===i.to&&i.value===hr&&(r="cancelled"),h(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:"replaced"===r||"cancelled"===r,reason:r,replacement:i.replaceableTransaction(s),hash:i.hash,receipt:e})}}o++}},f=t=>{if(null==t||0!==t.status)return t;h(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:t.to,from:t.from,data:""},receipt:t})},d=await this.provider.getTransactionReceipt(this.hash);if(0===n)return f(d);if(d){if(await d.confirmations()>=n)return f(d)}else if(await l(),0===n)return null;const p=new Promise(((t,e)=>{const i=[],o=()=>{i.forEach((t=>t()))};if(i.push((()=>{a=!0})),r>0){const t=setTimeout((()=>{o(),e(u("wait for transaction timeout","TIMEOUT"))}),r);i.push((()=>{clearTimeout(t)}))}const h=async r=>{if(await r.confirmations()>=n){o();try{t(f(r))}catch(t){e(t)}}};if(i.push((()=>{this.provider.off(this.hash,h)})),this.provider.on(this.hash,h),s>=0){const t=async()=>{try{await l()}catch(t){if(c(t,"TRANSACTION_REPLACED"))return o(),void e(t)}a||this.provider.once("block",t)};i.push((()=>{this.provider.off("block",t)})),this.provider.once("block",t)}}));return await p}isMined(){return null!=this.blockHash}isLegacy(){return 0===this.type}isBerlin(){return 1===this.type}isLondon(){return 2===this.type}isCancun(){return 3===this.type}removedEvent(){return h(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),vr(this)}reorderedEvent(t){return h(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),h(!t||t.isMined(),"unmined \'other\' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Ar(this,t)}replaceableTransaction(t){f(Number.isInteger(t)&&t>=0,"invalid startBlock","startBlock",t);const e=new br(this,this.provider);return e.#Z=t,e}}function Ar(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function vr(t){return{orphan:"drop-transaction",tx:t}}class Er{filter;emitter;#W;constructor(t,e,n){this.#W=e,o(this,{emitter:t,filter:n})}async removeListener(){null!=this.#W&&await this.emitter.off(this.filter,this.#W)}}class kr extends yr{interface;fragment;args;constructor(t,e,n){super(t,t.provider);o(this,{args:e.decodeEventLog(n,t.data,t.topics),fragment:n,interface:e})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class Pr extends yr{error;constructor(t,e){super(t,t.provider),o(this,{error:e})}}class xr extends wr{#Y;constructor(t,e,n){super(n,e),this.#Y=t}get logs(){return super.logs.map((t=>{const e=t.topics.length?this.#Y.getEvent(t.topics[0]):null;if(e)try{return new kr(t,this.#Y,e)}catch(e){return new Pr(t,e)}return t}))}}class Nr extends br{#Y;constructor(t,e,n){super(n,e),this.#Y=t}async wait(t,e){const n=await super.wait(t,e);return null==n?null:new xr(this.#Y,this.provider,n)}}class Br extends Er{log;constructor(t,e,n,r){super(t,e,n),o(this,{log:r})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Ir extends Br{constructor(t,e,n,r,s){super(t,e,n,new kr(s,t.interface,r));o(this,{args:t.interface.decodeEventLog(r,this.log.data,this.log.topics),fragment:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const Cr=BigInt(0);function Or(t){return t&&"function"==typeof t.call}function Rr(t){return t&&"function"==typeof t.estimateGas}function Tr(t){return t&&"function"==typeof t.resolveName}function Sr(t){return t&&"function"==typeof t.sendTransaction}function Fr(t){if(null!=t){if(Tr(t))return t;if(t.provider)return t.provider}}class Ur{#X;fragment;constructor(t,e,n){if(o(this,{fragment:e}),e.inputs.length<n.length)throw new Error("too many arguments");const r=Dr(t.runner,"resolveName"),s=Tr(r)?r:null;this.#X=async function(){const r=await Promise.all(e.inputs.map(((t,e)=>null==n[e]?null:t.walkAsync(n[e],((t,e)=>"address"===t?Array.isArray(e)?Promise.all(e.map((t=>xn(t,s)))):xn(e,s):e)))));return t.interface.encodeFilterTopics(e,r)}()}getTopicFilter(){return this.#X}}function Dr(t,e){return null==t?null:"function"==typeof t[e]?t:t.provider&&"function"==typeof t.provider[e]?t.provider:null}function Lr(t){return null==t?null:t.provider||null}async function Mr(t,e){const n=ee.dereference(t,"overrides");f("object"==typeof n,"invalid overrides parameter","overrides",t);const r=gr(n);return f(null==r.to||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),f(null==r.data||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}function Gr(t){const e=async function(e){const n=await Mr(e,["data"]);n.to=await t.getAddress(),n.from&&(n.from=await xn(n.from,Fr(t.runner)));const r=t.interface,s=S(n.value||Cr,"overrides.value")===Cr,i="0x"===(n.data||"0x");!r.fallback||r.fallback.payable||!r.receive||i||s||f(!1,"cannot send data to receive or send value to non-payable fallback","overrides",e),f(r.fallback||i,"cannot send data to receive-only contract","overrides.data",n.data);return f(r.receive||r.fallback&&r.fallback.payable||s,"cannot send value to non-payable fallback","overrides.value",n.value),f(r.fallback||i,"cannot send data to receive-only contract","overrides.data",n.data),n},n=async function(n){const r=t.runner;h(Sr(r),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const s=await r.sendTransaction(await e(n)),i=Lr(t.runner);return new Nr(t.interface,i,s)},r=async t=>await n(t);return o(r,{_contract:t,estimateGas:async function(n){const r=Dr(t.runner,"estimateGas");return h(Rr(r),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await r.estimateGas(await e(n))},populateTransaction:e,send:n,staticCall:async function(n){const r=Dr(t.runner,"call");h(Or(r),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const s=await e(n);try{return await r.call(s)}catch(e){if(l(e)&&e.data)throw t.interface.makeError(e.data,s);throw e}}}),r}function Hr(t,e){const n=function(...n){const r=t.interface.getFunction(e,n);return h(r,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:n}}),r},r=async function(...e){const r=n(...e);let s={};if(r.inputs.length+1===e.length&&(s=await Mr(e.pop()),s.from&&(s.from=await xn(s.from,Fr(t.runner)))),r.inputs.length!==e.length)throw new Error("internal error: fragment inputs doesn\'t match arguments; should not happen");const o=await async function(t,e,n){const r=Dr(t,"resolveName"),s=Tr(r)?r:null;return await Promise.all(e.map(((t,e)=>t.walkAsync(n[e],((t,e)=>(e=ee.dereference(e,t),"address"===t?xn(e,s):e))))))}(t.runner,r.inputs,e);return Object.assign({},s,await i({to:t.getAddress(),data:t.interface.encodeFunctionData(r,o)}))},s=async function(...t){const e=await c(...t);return 1===e.length?e[0]:e},a=async function(...e){const n=t.runner;h(Sr(n),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const s=await n.sendTransaction(await r(...e)),i=Lr(t.runner);return new Nr(t.interface,i,s)},c=async function(...e){const s=Dr(t.runner,"call");h(Or(s),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const i=await r(...e);let o="0x";try{o=await s.call(i)}catch(e){if(l(e)&&e.data)throw t.interface.makeError(e.data,i);throw e}const a=n(...e);return t.interface.decodeFunctionResult(a,o)},u=async(...t)=>n(...t).constant?await s(...t):await a(...t);return o(u,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:n,estimateGas:async function(...e){const n=Dr(t.runner,"estimateGas");return h(Rr(n),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await n.estimateGas(await r(...e))},populateTransaction:r,send:a,staticCall:s,staticCallResult:c}),Object.defineProperty(u,"fragment",{configurable:!1,enumerable:!0,get:()=>{const n=t.interface.getFunction(e);return h(n,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),n}}),u}const Qr=Symbol.for("_ethersInternal_contract"),jr=new WeakMap;function Vr(t){return jr.get(t[Qr])}async function Jr(t,e){let n,r=null;if(Array.isArray(e)){const r=function(e){if(b(e,32))return e;const n=t.interface.getEvent(e);return f(n,"unknown fragment","name",e),n.topicHash};n=e.map((t=>null==t?null:Array.isArray(t)?t.map(r):r(t)))}else"*"===e?n=[null]:"string"==typeof e?b(e,32)?n=[e]:(r=t.interface.getEvent(e),f(r,"unknown fragment","event",e),n=[r.topicHash]):(s=e)&&"object"==typeof s&&"getTopicFilter"in s&&"function"==typeof s.getTopicFilter&&s.fragment?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):f(!1,"unknown event name","event",e);var s;n=n.map((t=>{if(null==t)return null;if(Array.isArray(t)){const e=Array.from(new Set(t.map((t=>t.toLowerCase()))).values());return 1===e.length?e[0]:(e.sort(),e)}return t.toLowerCase()}));return{fragment:r,tag:n.map((t=>null==t?"null":Array.isArray(t)?t.join("|"):t)).join("&"),topics:n}}async function zr(t,e){const{subs:n}=Vr(t);return n.get((await Jr(t,e)).tag)||null}async function Kr(t,e,n){const r=Lr(t.runner);h(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await Jr(t,n),{addr:a,subs:c}=Vr(t);let l=c.get(i);if(!l){const e={address:a||t,topics:o},u=e=>{let r=s;if(null==r)try{r=t.interface.getEvent(e.topics[0])}catch(t){}if(r){const i=r,o=s?t.interface.decodeEventLog(s,e.data,e.topics):[];_r(t,n,o,(r=>new Ir(t,r,n,i,e)))}else _r(t,n,[],(r=>new Br(t,r,n,e)))};let h=[];l={tag:i,listeners:[],start:()=>{h.length||h.push(r.on(e,u))},stop:async()=>{if(0==h.length)return;let t=h;h=[],await Promise.all(t),r.off(e,u)}},c.set(i,l)}return l}let qr=Promise.resolve();async function _r(t,e,n,r){try{await qr}catch(t){}const s=async function(t,e,n,r){await qr;const s=await zr(t,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter((({listener:e,once:s})=>{const i=Array.from(n);r&&i.push(r(s?null:e));try{e.call(t,...i)}catch(t){}return!s})),0===s.listeners.length&&(s.stop(),Vr(t).subs.delete(s.tag)),i>0}(t,e,n,r);return qr=s,await s}const Zr=["then"];class Wr{target;interface;runner;filters;[Qr];fallback;constructor(t,e,n,r){f("string"==typeof t||kn(t),"invalid value for Contract target","target",t),null==n&&(n=null);const s=ur.from(e);let i;o(this,{target:t,runner:n,interface:s}),Object.defineProperty(this,Qr,{value:{}});let a=null,l=null;if(r){const t=Lr(n);l=new Nr(this.interface,t,r)}let h=new Map;if("string"==typeof t)if(b(t))a=t,i=Promise.resolve(t);else{const e=Dr(n,"resolveName");if(!Tr(e))throw u("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});i=e.resolveName(t).then((e=>{if(null==e)throw u("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:t});return Vr(this).addr=e,e}))}else i=t.getAddress().then((t=>{if(null==t)throw new Error("TODO");return Vr(this).addr=t,t}));var d,p;d=this,p={addrPromise:i,addr:a,deployTx:l,subs:h},jr.set(d[Qr],p);const g=new Proxy({},{get:(t,e,n)=>{if("symbol"==typeof e||Zr.indexOf(e)>=0)return Reflect.get(t,e,n);try{return this.getEvent(e)}catch(t){if(!c(t,"INVALID_ARGUMENT")||"key"!==t.argument)throw t}},has:(t,e)=>Zr.indexOf(e)>=0?Reflect.has(t,e):Reflect.has(t,e)||this.interface.hasEvent(String(e))});return o(this,{filters:g}),o(this,{fallback:s.receive||s.fallback?Gr(this):null}),new Proxy(this,{get:(t,e,n)=>{if("symbol"==typeof e||e in t||Zr.indexOf(e)>=0)return Reflect.get(t,e,n);try{return t.getFunction(e)}catch(t){if(!c(t,"INVALID_ARGUMENT")||"key"!==t.argument)throw t}},has:(t,e)=>"symbol"==typeof e||e in t||Zr.indexOf(e)>=0?Reflect.has(t,e):t.interface.hasFunction(e)})}connect(t){return new Wr(this.target,this.interface,t)}attach(t){return new Wr(t,this.interface,this.runner)}async getAddress(){return await Vr(this).addrPromise}async getDeployedCode(){const t=Lr(this.runner);h(t,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const e=await t.getCode(await this.getAddress());return"0x"===e?null:e}async waitForDeployment(){const t=this.deploymentTransaction();if(t)return await t.wait(),this;if(null!=await this.getDeployedCode())return this;const e=Lr(this.runner);return h(null!=e,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise(((t,n)=>{const r=async()=>{try{if(null!=await this.getDeployedCode())return t(this);e.once("block",r)}catch(t){n(t)}};r()}))}deploymentTransaction(){return Vr(this).deployTx}getFunction(t){"string"!=typeof t&&(t=t.format());return Hr(this,t)}getEvent(t){return"string"!=typeof t&&(t=t.format()),function(t,e){const n=function(...n){const r=t.interface.getEvent(e,n);return h(r,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:n}}),r},r=function(...e){return new Ur(t,n(...e),e)};return o(r,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:n}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const n=t.interface.getEvent(e);return h(n,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),n}}),r}(this,t)}async queryTransaction(t){throw new Error("@TODO")}async queryFilter(t,e,n){null==e&&(e=0),null==n&&(n="latest");const{addr:r,addrPromise:s}=Vr(this),i=r||await s,{fragment:o,topics:a}=await Jr(this,t),c={address:i,topics:a,fromBlock:e,toBlock:n},l=Lr(this.runner);return h(l,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await l.getLogs(c)).map((t=>{let e=o;if(null==e)try{e=this.interface.getEvent(t.topics[0])}catch(t){}if(e)try{return new kr(t,this.interface,e)}catch(e){return new Pr(t,e)}return new yr(t,l)}))}async on(t,e){const n=await Kr(this,"on",t);return n.listeners.push({listener:e,once:!1}),n.start(),this}async once(t,e){const n=await Kr(this,"once",t);return n.listeners.push({listener:e,once:!0}),n.start(),this}async emit(t,...e){return await _r(this,t,e,null)}async listenerCount(t){if(t){const e=await zr(this,t);return e?e.listeners.length:0}const{subs:e}=Vr(this);let n=0;for(const{listeners:t}of e.values())n+=t.length;return n}async listeners(t){if(t){const e=await zr(this,t);return e?e.listeners.map((({listener:t})=>t)):[]}const{subs:e}=Vr(this);let n=[];for(const{listeners:t}of e.values())n=n.concat(t.map((({listener:t})=>t)));return n}async off(t,e){const n=await zr(this,t);if(!n)return this;if(e){const t=n.listeners.map((({listener:t})=>t)).indexOf(e);t>=0&&n.listeners.splice(t,1)}return null!=e&&0!==n.listeners.length||(n.stop(),Vr(this).subs.delete(n.tag)),this}async removeAllListeners(t){if(t){const e=await zr(this,t);if(!e)return this;e.stop(),Vr(this).subs.delete(e.tag)}else{const{subs:t}=Vr(this);for(const{tag:e,stop:n}of t.values())n(),t.delete(e)}return this}async addListener(t,e){return await this.on(t,e)}async removeListener(t,e){return await this.off(t,e)}static buildClass(t){return class extends Wr{constructor(e,n=null){super(e,t,n)}}}static from(t,e,n){null==n&&(n=null);return new this(t,e,n)}}class Yr extends(function(){return Wr}()){}var Xr="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";const $r=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),ts=4;function es(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),s=1,i=[0,1];for(let t=1;t<r;t++)i.push(s+=n());let o=n(),a=e;e+=o;let c=0,l=0;function u(){return 0==c&&(l=l<<8|t[e++],c=8),l>>--c&1}const h=2**31,f=h>>>1,d=h-1;let p=0;for(let t=0;t<31;t++)p=p<<1|u();let g=[],m=0,y=h;for(;;){let t=Math.floor(((p-m+1)*s-1)/y),e=0,n=r;for(;n-e>1;){let r=e+n>>>1;t<i[r]?n=r:e=r}if(0==e)break;g.push(e);let o=m+Math.floor(y*i[e]/s),a=m+Math.floor(y*i[e+1]/s)-1;for(;0==((o^a)&f);)p=p<<1&d|u(),o=o<<1&d,a=a<<1&d|1;for(;o&~a&536870912;)p=p&f|p<<1&d>>>1|u(),o=o<<1^f,a=(a^f)<<1|f|1;m=o,y=1+a-o}let w=r-4;return g.map((e=>{switch(e-w){case 3:return w+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return w+256+(t[a++]<<8|t[a++]);case 1:return w+t[a++];default:return e-1}}))}(function(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach(((t,n)=>e[t.charCodeAt(0)]=n));let n=t.length,r=new Uint8Array(6*n>>3);for(let s=0,i=0,o=0,a=0;s<n;s++)a=a<<6|e[t.charCodeAt(s)],o+=6,o>=8&&(r[i++]=a>>(o-=8));return r}(t)))}function ns(t){return 1&t?~t>>1:t>>1}function rs(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=ns(e());return n}function ss(t,e=0){let n=[];for(;;){let r=t(),s=t();if(!s)break;e+=r;for(let t=0;t<s;t++)n.push(e+t);e+=s+1}return n}function is(t){return as((()=>{let e=ss(t);if(e.length)return e}))}function os(t){let e=[];for(;;){let n=t();if(0==n)break;e.push(ls(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(us(n,t))}return e.flat()}function as(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function cs(t,e,n){let r=Array(t).fill().map((()=>[]));for(let s=0;s<e;s++)rs(t,n).forEach(((t,e)=>r[e].push(t)));return r}function ls(t,e){let n=1+e(),r=e(),s=as(e);return cs(s.length,1+t,e).flatMap(((t,e)=>{let[i,...o]=t;return Array(s[e]).fill().map(((t,e)=>{let s=e*r;return[i+e*n,o.map((t=>t+s))]}))}))}function us(t,e){return cs(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}function hs(t){return`{${function(t){return t.toString(16).toUpperCase().padStart(2,"0")}(t)}}`}function fs(t){let e=[];for(let n=0,r=t.length;n<r;){let r=t.codePointAt(n);n+=r<65536?1:2,e.push(r)}return e}function ds(t){let e=t.length;if(e<4096)return String.fromCodePoint(...t);let n=[];for(let r=0;r<e;)n.push(String.fromCodePoint(...t.slice(r,r+=4096)));return n.join("")}function ps(t,e){let n=t.length,r=n-e.length;for(let s=0;0==r&&s<n;s++)r=t[s]-e[s];return r}var gs="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";const ms=44032,ys=4352,ws=4449,bs=4519,As=28,vs=21*As,Es=ms+19*vs,ks=ys+19,Ps=ws+21,xs=bs+As;function Ns(t){return t>>24&255}function Bs(t){return 16777215&t}let Is,Cs,Os,Rs;function Ts(t){return t>=ms&&t<Es}function Ss(t,e){if(t>=ys&&t<ks&&e>=ws&&e<Ps)return ms+(t-ys)*vs+(e-ws)*As;if(Ts(t)&&e>bs&&e<xs&&(t-ms)%As==0)return t+(e-bs);{let n=Rs.get(t);return n&&(n=n.get(e),n)?n:-1}}function Fs(t){Is||function(){let t=es(gs);Is=new Map(is(t).flatMap(((t,e)=>t.map((t=>[t,e+1<<24]))))),Cs=new Set(ss(t)),Os=new Map,Rs=new Map;for(let[e,n]of os(t)){if(!Cs.has(e)&&2==n.length){let[t,r]=n,s=Rs.get(t);s||(s=new Map,Rs.set(t,s)),s.set(r,e)}Os.set(e,n.reverse())}}();let e=[],n=[],r=!1;function s(t){let n=Is.get(t);n&&(r=!0,t|=n),e.push(t)}for(let r of t)for(;;){if(r<128)e.push(r);else if(Ts(r)){let t=r-ms,e=t%vs/As|0,n=t%As;s(ys+(t/vs|0)),s(ws+e),n>0&&s(bs+n)}else{let t=Os.get(r);t?n.push(...t):s(r)}if(!n.length)break;r=n.pop()}if(r&&e.length>1){let t=Ns(e[0]);for(let n=1;n<e.length;n++){let r=Ns(e[n]);if(0==r||t<=r){t=r;continue}let s=n-1;for(;;){let n=e[s+1];if(e[s+1]=e[s],e[s]=n,!s)break;if(t=Ns(e[--s]),t<=r)break}t=Ns(e[n])}}return e}function Us(t){return Fs(t).map(Bs)}function Ds(t){return function(t){let e=[],n=[],r=-1,s=0;for(let i of t){let t=Ns(i),o=Bs(i);if(-1==r)0==t?r=o:e.push(o);else if(s>0&&s>=t)0==t?(e.push(r,...n),n.length=0,r=o):n.push(o),s=t;else{let i=Ss(r,o);i>=0?r=i:0==s&&0==t?(e.push(r),r=o):(n.push(o),s=t)}}return r>=0&&e.push(r,...n),e}(Fs(t))}const Ls=45,Ms=".",Gs=65039,Hs=1,Qs=t=>Array.from(t);function js(t,e){return t.P.has(e)||t.Q.has(e)}class Vs extends Array{get is_emoji(){return!0}}let Js,zs,Ks,qs,_s,Zs,Ws,Ys,Xs,$s,ti,ei;function ni(){if(Js)return;let t=es(Xr);const e=()=>ss(t),n=()=>new Set(e()),r=(t,e)=>e.forEach((e=>t.add(e)));Js=new Map(os(t)),zs=n(),Ks=e(),qs=new Set(e().map((t=>Ks[t]))),Ks=new Set(Ks),_s=n(),Zs=n();let s=is(t),i=t();const o=()=>{let t=new Set;return e().forEach((e=>r(t,s[e]))),r(t,e()),t};Ws=as((e=>{let n=as(t).map((t=>t+96));if(n.length){let r=e>=i;return n[0]-=32,n=ds(n),r&&(n=`Restricted[${n}]`),{N:n,P:o(),Q:o(),M:!t(),R:r}}})),Ys=n(),Xs=new Map;let a=e().concat(Qs(Ys)).sort(((t,e)=>t-e));a.forEach(((e,n)=>{let r=t(),s=a[n]=r?a[n-r]:{V:[],M:new Map};s.V.push(e),Ys.has(e)||Xs.set(e,s)}));for(let{V:t,M:e}of new Set(Xs.values())){let n=[];for(let e of t){let t=Ws.filter((t=>js(t,e))),s=n.find((({G:e})=>t.some((t=>e.has(t)))));s||(s={G:new Set,V:[]},n.push(s)),s.V.push(e),r(s.G,t)}let s=n.flatMap((t=>Qs(t.G)));for(let{G:t,V:r}of n){let n=new Set(s.filter((e=>!t.has(e))));for(let t of r)e.set(t,n)}}$s=new Set;let c=new Set;const l=t=>$s.has(t)?c.add(t):$s.add(t);for(let t of Ws){for(let e of t.P)l(e);for(let e of t.Q)l(e)}for(let t of $s)Xs.has(t)||c.has(t)||Xs.set(t,Hs);r($s,Us($s)),ti=function(t){let e=[],n=ss(t);return function t({S:n,B:r},s,i){if(!(4&n&&i===s[s.length-1])){2&n&&(i=s[s.length-1]),1&n&&e.push(s);for(let e of r)for(let n of e.Q)t(e,[...s,n],i)}}(function e(r){let s=t(),i=as((()=>{let r=ss(t).map((t=>n[t]));if(r.length)return e(r)}));return{S:s,B:i,Q:r}}([]),[]),e}(t).map((t=>Vs.from(t))).sort(ps),ei=new Map;for(let t of ti){let e=[ei];for(let n of t){let t=e.map((t=>{let e=t.get(n);return e||(e=new Map,t.set(n,e)),e}));n===Gs?e.push(...t):e=t}for(let n of e)n.V=t}}function ri(t){return(oi(t)?"":`${si(ii([t]))} `)+hs(t)}function si(t){return`"${t}"`}function ii(t,e=1/0,n=hs){let r=[];var s;s=t[0],ni(),Ks.has(s)&&r.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let i=0,o=t.length;for(let e=0;e<o;e++){let s=t[e];oi(s)&&(r.push(ds(t.slice(i,e))),r.push(n(s)),i=e+1)}return r.push(ds(t.slice(i,o))),r.join("")}function oi(t){return ni(),_s.has(t)}function ai(t,e,n){if(!t)return[];ni();let r=0;return t.split(Ms).map((t=>{let s=fs(t),i={input:s,offset:r};r+=s.length+1;try{let t,r=i.tokens=fi(s,e,n),o=r.length;if(!o)throw new Error("empty label");let a=i.output=r.flat();if(function(t){for(let e=t.lastIndexOf(95);e>0;)if(95!==t[--e])throw new Error("underscore allowed only at start")}(a),!(i.emoji=o>1||r[0].is_emoji)&&a.every((t=>t<128)))!function(t){if(t.length>=4&&t[2]==Ls&&t[3]==Ls)throw new Error(`invalid label extension: "${ds(t.slice(0,4))}"`)}(a),t="ASCII";else{let e=r.flatMap((t=>t.is_emoji?[]:t));if(e.length){if(Ks.has(a[0]))throw hi("leading combining mark");for(let t=1;t<o;t++){let e=r[t];if(!e.is_emoji&&Ks.has(e[0]))throw hi(`emoji + combining mark: "${ds(r[t-1])} + ${ii([e[0]])}"`)}!function(t){let e=t[0],n=$r.get(e);if(n)throw hi(`leading ${n}`);let r=t.length,s=-1;for(let i=1;i<r;i++){e=t[i];let r=$r.get(e);if(r){if(s==i)throw hi(`${n} + ${r}`);s=i+1,n=r}}if(s==r)throw hi(`trailing ${n}`)}(a);let n=Qs(new Set(e)),[s]=function(t){let e=Ws;for(let n of t){let t=e.filter((t=>js(t,n)));if(!t.length)throw Ws.some((t=>js(t,n)))?ui(e[0],n):li(n);if(e=t,1==t.length)break}return e}(n);!function(t,e){for(let n of e)if(!js(t,n))throw ui(t,n);if(t.M){let t=Us(e);for(let e=1,n=t.length;e<n;e++)if(qs.has(t[e])){let r=e+1;for(let s;r<n&&qs.has(s=t[r]);r++)for(let n=e;n<r;n++)if(t[n]==s)throw new Error(`duplicate non-spacing marks: ${ri(s)}`);if(r-e>ts)throw new Error(`excessive non-spacing marks: ${si(ii(t.slice(e-1,r)))} (${r-e}/${ts})`);e=r}}}(s,e),function(t,e){let n,r=[];for(let t of e){let e=Xs.get(t);if(e===Hs)return;if(e){let r=e.M.get(t);if(n=n?n.filter((t=>r.has(t))):Qs(r),!n.length)return}else r.push(t)}if(n)for(let e of n)if(r.every((t=>js(e,t))))throw new Error(`whole-script confusable: ${t.N}/${e.N}`)}(s,n),t=s.N}else t="Emoji"}i.type=t}catch(t){i.error=t}return i}))}function ci(t){return t.map((({input:e,error:n,output:r})=>{if(n){let r=n.message;throw new Error(1==t.length?r:`Invalid label ${si(ii(e,63))}: ${r}`)}return ds(r)})).join(Ms)}function li(t){return new Error(`disallowed character: ${ri(t)}`)}function ui(t,e){let n=ri(e),r=Ws.find((t=>t.P.has(e)));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function hi(t){return new Error(`illegal placement: ${t}`)}function fi(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let i=pi(t);if(i)s.length&&(r.push(e(s)),s=[]),r.push(n(i));else{let e=t.pop();if($s.has(e))s.push(e);else{let t=Js.get(e);if(t)s.push(...t);else if(!zs.has(e))throw li(e)}}}return s.length&&r.push(e(s)),r}function di(t){return t.filter((t=>t!=Gs))}function pi(t,e){let n,r=ei,s=t.length;for(;s&&(r=r.get(t[--s]),r);){let{V:i}=r;i&&(n=i,e&&e.push(...t.slice(s).reverse()),t.length=s)}return n}const gi=new Uint8Array(32);function mi(t){return f(0!==t.length,"invalid ENS name; empty component","comp",t),t}function yi(t){const e=Ae(function(t){try{if(0===t.length)throw new Error("empty label");return function(t){return ci(ai(t,Ds,di))}(t)}catch(e){f(!1,`invalid ENS name (${e.message})`,"name",t)}}(t)),n=[];if(0===t.length)return n;let r=0;for(let t=0;t<e.length;t++){46===e[t]&&(n.push(mi(e.slice(r,t))),r=t+1)}return f(r<e.length,"invalid ENS name; empty component","name",t),n.push(mi(e.slice(r))),n}function wi(t){f("string"==typeof t,"invalid ENS name; not a string","name",t),f(t.length,"invalid ENS name (empty label)","name",t);let e=gi;const n=yi(t);for(;n.length;)e=jt(k([e,jt(n.pop())]));return E(e)}function bi(t,e){const n=null!=e?e:63;return f(n<=255,"DNS encoded label cannot exceed 255","length",n),E(k(yi(t).map((e=>{f(e.length<=n,`label ${JSON.stringify(t)} exceeds ${n} bytes`,"name",t);const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r}))))+"00"}gi.fill(0);class Ai extends At{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=yt(this.buffer)}update(t){st(this);const{view:e,buffer:n,blockLen:r}=this,s=(t=bt(t)).length;for(let i=0;i<s;){const o=Math.min(r-this.pos,s-i);if(o!==r)n.set(t.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===r&&(this.process(e,0),this.pos=0);else{const e=yt(t);for(;r<=s-i;i+=r)this.process(e,i)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){st(this),it(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:s}=this;let{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>r-i&&(this.process(n,0),i=0);for(let t=i;t<r;t++)e[t]=0;!function(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,l=r?0:4;t.setUint32(e+c,o,r),t.setUint32(e+l,a,r)}(n,r-8,BigInt(8*this.length),s),this.process(n,0);const o=yt(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<c;t++)o.setUint32(4*t,l[t],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:s,destroyed:i,pos:o}=this;return t.length=r,t.pos=o,t.finished=s,t.destroyed=i,r%e&&t.buffer.set(n),t}}const vi=(t,e,n)=>t&e^~t&n,Ei=(t,e,n)=>t&e^t&n^e&n,ki=new Uint32Array([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]),Pi=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),xi=new Uint32Array(64);class Ni extends Ai{constructor(){super(64,32,8,!1),this.A=0|Pi[0],this.B=0|Pi[1],this.C=0|Pi[2],this.D=0|Pi[3],this.E=0|Pi[4],this.F=0|Pi[5],this.G=0|Pi[6],this.H=0|Pi[7]}get(){const{A:t,B:e,C:n,D:r,E:s,F:i,G:o,H:a}=this;return[t,e,n,r,s,i,o,a]}set(t,e,n,r,s,i,o,a){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|s,this.F=0|i,this.G=0|o,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)xi[n]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=xi[t-15],n=xi[t-2],r=wt(e,7)^wt(e,18)^e>>>3,s=wt(n,17)^wt(n,19)^n>>>10;xi[t]=s+xi[t-7]+r+xi[t-16]|0}let{A:n,B:r,C:s,D:i,E:o,F:a,G:c,H:l}=this;for(let t=0;t<64;t++){const e=l+(wt(o,6)^wt(o,11)^wt(o,25))+vi(o,a,c)+ki[t]+xi[t]|0,u=(wt(n,2)^wt(n,13)^wt(n,22))+Ei(n,r,s)|0;l=c,c=a,a=o,o=i+e|0,i=s,s=r,r=n,n=e+u|0}n=n+this.A|0,r=r+this.B|0,s=s+this.C|0,i=i+this.D|0,o=o+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,s,i,o,a,c,l)}roundClean(){xi.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Bi=vt((()=>new Ni)),[Ii,Ci]=pt.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((t=>BigInt(t)))),Oi=new Uint32Array(80),Ri=new Uint32Array(80);class Ti extends Ai{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:s,Cl:i,Dh:o,Dl:a,Eh:c,El:l,Fh:u,Fl:h,Gh:f,Gl:d,Hh:p,Hl:g}=this;return[t,e,n,r,s,i,o,a,c,l,u,h,f,d,p,g]}set(t,e,n,r,s,i,o,a,c,l,u,h,f,d,p,g){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|r,this.Ch=0|s,this.Cl=0|i,this.Dh=0|o,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|h,this.Gh=0|f,this.Gl=0|d,this.Hh=0|p,this.Hl=0|g}process(t,e){for(let n=0;n<16;n++,e+=4)Oi[n]=t.getUint32(e),Ri[n]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|Oi[t-15],n=0|Ri[t-15],r=pt.rotrSH(e,n,1)^pt.rotrSH(e,n,8)^pt.shrSH(e,n,7),s=pt.rotrSL(e,n,1)^pt.rotrSL(e,n,8)^pt.shrSL(e,n,7),i=0|Oi[t-2],o=0|Ri[t-2],a=pt.rotrSH(i,o,19)^pt.rotrBH(i,o,61)^pt.shrSH(i,o,6),c=pt.rotrSL(i,o,19)^pt.rotrBL(i,o,61)^pt.shrSL(i,o,6),l=pt.add4L(s,c,Ri[t-7],Ri[t-16]),u=pt.add4H(l,r,a,Oi[t-7],Oi[t-16]);Oi[t]=0|u,Ri[t]=0|l}let{Ah:n,Al:r,Bh:s,Bl:i,Ch:o,Cl:a,Dh:c,Dl:l,Eh:u,El:h,Fh:f,Fl:d,Gh:p,Gl:g,Hh:m,Hl:y}=this;for(let t=0;t<80;t++){const e=pt.rotrSH(u,h,14)^pt.rotrSH(u,h,18)^pt.rotrBH(u,h,41),w=pt.rotrSL(u,h,14)^pt.rotrSL(u,h,18)^pt.rotrBL(u,h,41),b=u&f^~u&p,A=h&d^~h&g,v=pt.add5L(y,w,A,Ci[t],Ri[t]),E=pt.add5H(v,m,e,b,Ii[t],Oi[t]),k=0|v,P=pt.rotrSH(n,r,28)^pt.rotrBH(n,r,34)^pt.rotrBH(n,r,39),x=pt.rotrSL(n,r,28)^pt.rotrBL(n,r,34)^pt.rotrBL(n,r,39),N=n&s^n&o^s&o,B=r&i^r&a^i&a;m=0|p,y=0|g,p=0|f,g=0|d,f=0|u,d=0|h,({h:u,l:h}=pt.add(0|c,0|l,0|E,0|k)),c=0|o,l=0|a,o=0|s,a=0|i,s=0|n,i=0|r;const I=pt.add3L(k,x,B);n=pt.add3H(I,E,P,N),r=0|I}({h:n,l:r}=pt.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:s,l:i}=pt.add(0|this.Bh,0|this.Bl,0|s,0|i)),({h:o,l:a}=pt.add(0|this.Ch,0|this.Cl,0|o,0|a)),({h:c,l}=pt.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:h}=pt.add(0|this.Eh,0|this.El,0|u,0|h)),({h:f,l:d}=pt.add(0|this.Fh,0|this.Fl,0|f,0|d)),({h:p,l:g}=pt.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:m,l:y}=pt.add(0|this.Hh,0|this.Hl,0|m,0|y)),this.set(n,r,s,i,o,a,c,l,u,h,f,d,p,g,m,y)}roundClean(){Oi.fill(0),Ri.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Si=vt((()=>new Ti));const Fi=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();Fi.crypto||Fi.msCrypto;function Ui(t){switch(t){case"sha256":return Bi.create();case"sha512":return Si.create()}f(!1,"invalid hashing algorithm name","algorithm",t)}const Di=function(t){return Ui("sha256").update(t).digest()},Li=function(t){return Ui("sha512").update(t).digest()};let Mi=Di,Gi=Li,Hi=!1,Qi=!1;function ji(t){const e=y(t,"data");return E(Mi(e))}function Vi(t){const e=y(t,"data");return E(Gi(e))}ji._=Di,ji.lock=function(){Hi=!0},ji.register=function(t){if(Hi)throw new Error("sha256 is locked");Mi=t},Object.freeze(ji),Vi._=Li,Vi.lock=function(){Qi=!0},Vi.register=function(t){if(Qi)throw new Error("sha512 is locked");Gi=t},Object.freeze(ji);const Ji="0x0000000000000000000000000000000000000000000000000000000000000000",zi=BigInt(0),Ki=BigInt(1),qi=BigInt(2),_i=BigInt(27),Zi=BigInt(28),Wi=BigInt(35),Yi={};function Xi(t){return B(G(t),32)}class $i{#$;#tt;#et;#nt;get r(){return this.#$}set r(t){f(32===P(t),"invalid r","value",t),this.#$=E(t)}get s(){return this.#tt}set s(t){f(32===P(t),"invalid s","value",t);const e=E(t);f(parseInt(e.substring(0,3))<8,"non-canonical s","value",e),this.#tt=e}get v(){return this.#et}set v(t){const e=L(t,"value");f(27===e||28===e,"invalid v","v",t),this.#et=e}get networkV(){return this.#nt}get legacyChainId(){const t=this.networkV;return null==t?null:$i.getChainId(t)}get yParity(){return 27===this.v?0:1}get yParityAndS(){const t=y(this.s);return this.yParity&&(t[0]|=128),E(t)}get compactSerialized(){return k([this.r,this.yParityAndS])}get serialized(){return k([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(t,e,n,r){g(t,Yi,"Signature"),this.#$=e,this.#tt=n,this.#et=r,this.#nt=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const t=new $i(Yi,this.r,this.s,this.v);return this.networkV&&(t.#nt=this.networkV),t}toJSON(){const t=this.networkV;return{_type:"signature",networkV:null!=t?t.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(t){const e=S(t,"v");return e==_i||e==Zi?zi:(f(e>=Wi,"invalid EIP-155 v","v",t),(e-Wi)/qi)}static getChainIdV(t,e){return S(t)*qi+BigInt(35+e-27)}static getNormalizedV(t){const e=S(t);return e===zi||e===_i?27:e===Ki||e===Zi?28:(f(e>=Wi,"invalid v","v",t),e&Ki?27:28)}static from(t){function e(e,n){f(e,n,"signature",t)}if(null==t)return new $i(Yi,Ji,Ji,27);if("string"==typeof t){const n=y(t,"signature");if(64===n.length){const t=E(n.slice(0,32)),e=n.slice(32,64),r=128&e[0]?28:27;return e[0]&=127,new $i(Yi,t,E(e),r)}if(65===n.length){const t=E(n.slice(0,32)),r=n.slice(32,64);e(0==(128&r[0]),"non-canonical s");const s=$i.getNormalizedV(n[64]);return new $i(Yi,t,E(r),s)}e(!1,"invalid raw signature length")}if(t instanceof $i)return t.clone();const n=t.r;e(null!=n,"missing r");const r=Xi(n),s=function(t,n){if(null!=t)return Xi(t);if(null!=n){e(b(n,32),"invalid yParityAndS");const t=y(n);return t[0]&=127,E(t)}e(!1,"missing s")}(t.s,t.yParityAndS);e(0==(128&y(s)[0]),"non-canonical s");const{networkV:i,v:o}=function(t,n,r){if(null!=t){const e=S(t);return{networkV:e>=Wi?e:void 0,v:$i.getNormalizedV(e)}}if(null!=n)return e(b(n,32),"invalid yParityAndS"),{v:128&y(n)[0]?28:27};if(null!=r){switch(L(r,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}e(!1,"invalid yParity")}e(!1,"missing v")}(t.v,t.yParityAndS,t.yParity),a=new $i(Yi,r,s,o);return i&&(a.#nt=i),e(null==t.yParity||L(t.yParity,"sig.yParity")===a.yParity,"yParity mismatch"),e(null==t.yParityAndS||t.yParityAndS===a.yParityAndS,"yParityAndS mismatch"),a}}BigInt(0);const to=BigInt(1),eo=BigInt(2),no=t=>t instanceof Uint8Array,ro=Array.from({length:256},((t,e)=>e.toString(16).padStart(2,"0")));function so(t){if(!no(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=ro[t[n]];return e}function io(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return BigInt(""===t?"0":`0x${t}`)}function oo(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let e=0;e<n.length;e++){const r=2*e,s=t.slice(r,r+2),i=Number.parseInt(s,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");n[e]=i}return n}function ao(t){return io(so(t))}function co(t){if(!no(t))throw new Error("Uint8Array expected");return io(so(Uint8Array.from(t).reverse()))}function lo(t,e){return oo(t.toString(16).padStart(2*e,"0"))}function uo(t,e){return lo(t,e).reverse()}function ho(t,e,n){let r;if("string"==typeof e)try{r=oo(e)}catch(n){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${n}`)}else{if(!no(e))throw new Error(`${t} must be hex string or Uint8Array`);r=Uint8Array.from(e)}const s=r.length;if("number"==typeof n&&s!==n)throw new Error(`${t} expected ${n} bytes, got ${s}`);return r}function fo(...t){const e=new Uint8Array(t.reduce(((t,e)=>t+e.length),0));let n=0;return t.forEach((t=>{if(!no(t))throw new Error("Uint8Array expected");e.set(t,n),n+=t.length})),e}const po=t=>(eo<<BigInt(t-1))-to,go=t=>new Uint8Array(t),mo=t=>Uint8Array.from(t);function yo(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=go(t),s=go(t),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...t)=>n(s,r,...t),c=(t=go())=>{s=a(mo([0]),t),r=a(),0!==t.length&&(s=a(mo([1]),t),r=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let t=0;const n=[];for(;t<e;){r=a();const e=r.slice();n.push(e),t+=r.length}return fo(...n)};return(t,e)=>{let n;for(o(),c(t);!(n=e(l()));)c();return o(),n}}const wo={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function bo(t,e,n={}){const r=(e,n,r)=>{const s=wo[n];if("function"!=typeof s)throw new Error(`Invalid validator "${n}", expected function`);const i=t[e];if(!(r&&void 0===i||s(i,t)))throw new Error(`Invalid param ${String(e)}=${i} (${typeof i}), expected ${n}`)};for(const[t,n]of Object.entries(e))r(t,n,!1);for(const[t,e]of Object.entries(n))r(t,e,!0);return t}const Ao=BigInt(0),vo=BigInt(1),Eo=BigInt(2),ko=BigInt(3),Po=BigInt(4),xo=BigInt(5),No=BigInt(8);BigInt(9),BigInt(16);function Bo(t,e){const n=t%e;return n>=Ao?n:e+n}function Io(t,e,n){if(n<=Ao||e<Ao)throw new Error("Expected power/modulo > 0");if(n===vo)return Ao;let r=vo;for(;e>Ao;)e&vo&&(r=r*t%n),t=t*t%n,e>>=vo;return r}function Co(t,e,n){let r=t;for(;e-- >Ao;)r*=r,r%=n;return r}function Oo(t,e){if(t===Ao||e<=Ao)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=Bo(t,e),r=e,s=Ao,i=vo,o=vo,a=Ao;for(;n!==Ao;){const t=r/n,e=r%n,c=s-o*t,l=i-a*t;r=n,n=e,s=o,i=a,o=c,a=l}if(r!==vo)throw new Error("invert: does not exist");return Bo(s,e)}function Ro(t){if(t%Po===ko){const e=(t+vo)/Po;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}if(t%No===xo){const e=(t-xo)/No;return function(t,n){const r=t.mul(n,Eo),s=t.pow(r,e),i=t.mul(n,s),o=t.mul(t.mul(i,Eo),s),a=t.mul(i,t.sub(o,t.ONE));if(!t.eql(t.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(t){const e=(t-vo)/Eo;let n,r,s;for(n=t-vo,r=0;n%Eo===Ao;n/=Eo,r++);for(s=Eo;s<t&&Io(s,e,t)!==t-vo;s++);if(1===r){const e=(t+vo)/Po;return function(t,n){const r=t.pow(n,e);if(!t.eql(t.sqr(r),n))throw new Error("Cannot find square root");return r}}const i=(n+vo)/Eo;return function(t,o){if(t.pow(o,e)===t.neg(t.ONE))throw new Error("Cannot find square root");let a=r,c=t.pow(t.mul(t.ONE,s),n),l=t.pow(o,i),u=t.pow(o,n);for(;!t.eql(u,t.ONE);){if(t.eql(u,t.ZERO))return t.ZERO;let e=1;for(let n=t.sqr(u);e<a&&!t.eql(n,t.ONE);e++)n=t.sqr(n);const n=t.pow(c,vo<<BigInt(a-e-1));c=t.sqr(n),l=t.mul(l,n),u=t.mul(u,c),a=e}return l}}(t)}const To=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function So(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Fo(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function Uo(t){const e=Fo(t);return e+Math.ceil(e/2)}class Do extends At{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,rt(t);const n=bt(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,s=new Uint8Array(r);s.set(n.length>r?t.create().update(n).digest():n);for(let t=0;t<s.length;t++)s[t]^=54;this.iHash.update(s),this.oHash=t.create();for(let t=0;t<s.length;t++)s[t]^=106;this.oHash.update(s),s.fill(0)}update(t){return st(this),this.iHash.update(t),this}digestInto(t){st(this),nt(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:e,iHash:n,finished:r,destroyed:s,blockLen:i,outputLen:o}=this;return t.finished=r,t.destroyed=s,t.blockLen=i,t.outputLen=o,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Lo=(t,e,n)=>new Do(t,e).update(n).digest();Lo.create=(t,e)=>new Do(t,e);const Mo=BigInt(0),Go=BigInt(1);function Ho(t){return bo(t.Fp,To.reduce(((t,e)=>(t[e]="function",t)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),bo(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...So(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const{bytesToNumberBE:Qo,hexToBytes:jo}=n,Vo={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(t){const{Err:e}=Vo;if(t.length<2||2!==t[0])throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(128&r[0])throw new e("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Qo(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=Vo,n="string"==typeof t?jo(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:i}=Vo._parseInt(n.subarray(2)),{d:o,l:a}=Vo._parseInt(i);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(t){const e=t=>8&Number.parseInt(t[0],16)?"00"+t:t,n=t=>{const e=t.toString(16);return 1&e.length?`0${e}`:e},r=e(n(t.s)),s=e(n(t.r)),i=r.length/2,o=s.length/2,a=n(i),c=n(o);return`30${n(o+i+4)}02${c}${s}02${a}${r}`}},Jo=BigInt(0),zo=BigInt(1),Ko=(BigInt(2),BigInt(3));BigInt(4);function qo(t){const e=function(t){const e=Ho(t);bo(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=e;if(n){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=e,r=e.toBytes||((t,e,r)=>{const s=e.toAffine();return fo(Uint8Array.from([4]),n.toBytes(s.x),n.toBytes(s.y))}),s=e.fromBytes||(t=>{const e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function i(t){const{a:r,b:s}=e,i=n.sqr(t),o=n.mul(i,t);return n.add(n.add(o,n.mul(t,r)),s)}if(!n.eql(n.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function o(t){return"bigint"==typeof t&&Jo<t&&t<e.n}function a(t){if(!o(t))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(t){const{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:s,n:i}=e;if(n&&"bigint"!=typeof t){if(t instanceof Uint8Array&&(t=so(t)),"string"!=typeof t||!n.includes(t.length))throw new Error("Invalid key");t=t.padStart(2*r,"0")}let o;try{o="bigint"==typeof t?t:ao(ho("private key",t,r))}catch(e){throw new Error(`private key must be ${r} bytes, hex or bigint, not ${typeof t}`)}return s&&(o=Bo(o,i)),a(o),o}const l=new Map;function u(t){if(!(t instanceof h))throw new Error("ProjectivePoint expected")}class h{constructor(t,e,r){if(this.px=t,this.py=e,this.pz=r,null==t||!n.isValid(t))throw new Error("x required");if(null==e||!n.isValid(e))throw new Error("y required");if(null==r||!n.isValid(r))throw new Error("z required")}static fromAffine(t){const{x:e,y:r}=t||{};if(!t||!n.isValid(e)||!n.isValid(r))throw new Error("invalid affine point");if(t instanceof h)throw new Error("projective point not allowed");const s=t=>n.eql(t,n.ZERO);return s(e)&&s(r)?h.ZERO:new h(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(h.fromAffine)}static fromHex(t){const e=h.fromAffine(s(ho("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return h.BASE.multiply(c(t))}_setWindowSize(t){this._WINDOW_SIZE=t,l.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:t,y:r}=this.toAffine();if(!n.isValid(t)||!n.isValid(r))throw new Error("bad point: x or y not FE");const s=n.sqr(r),o=i(t);if(!n.eql(s,o))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw new Error("Field doesn\'t support isOdd")}equals(t){u(t);const{px:e,py:r,pz:s}=this,{px:i,py:o,pz:a}=t,c=n.eql(n.mul(e,a),n.mul(i,s)),l=n.eql(n.mul(r,a),n.mul(o,s));return c&&l}negate(){return new h(this.px,n.neg(this.py),this.pz)}double(){const{a:t,b:r}=e,s=n.mul(r,Ko),{px:i,py:o,pz:a}=this;let c=n.ZERO,l=n.ZERO,u=n.ZERO,f=n.mul(i,i),d=n.mul(o,o),p=n.mul(a,a),g=n.mul(i,o);return g=n.add(g,g),u=n.mul(i,a),u=n.add(u,u),c=n.mul(t,u),l=n.mul(s,p),l=n.add(c,l),c=n.sub(d,l),l=n.add(d,l),l=n.mul(c,l),c=n.mul(g,c),u=n.mul(s,u),p=n.mul(t,p),g=n.sub(f,p),g=n.mul(t,g),g=n.add(g,u),u=n.add(f,f),f=n.add(u,f),f=n.add(f,p),f=n.mul(f,g),l=n.add(l,f),p=n.mul(o,a),p=n.add(p,p),f=n.mul(p,g),c=n.sub(c,f),u=n.mul(p,d),u=n.add(u,u),u=n.add(u,u),new h(c,l,u)}add(t){u(t);const{px:r,py:s,pz:i}=this,{px:o,py:a,pz:c}=t;let l=n.ZERO,f=n.ZERO,d=n.ZERO;const p=e.a,g=n.mul(e.b,Ko);let m=n.mul(r,o),y=n.mul(s,a),w=n.mul(i,c),b=n.add(r,s),A=n.add(o,a);b=n.mul(b,A),A=n.add(m,y),b=n.sub(b,A),A=n.add(r,i);let v=n.add(o,c);return A=n.mul(A,v),v=n.add(m,w),A=n.sub(A,v),v=n.add(s,i),l=n.add(a,c),v=n.mul(v,l),l=n.add(y,w),v=n.sub(v,l),d=n.mul(p,A),l=n.mul(g,w),d=n.add(l,d),l=n.sub(y,d),d=n.add(y,d),f=n.mul(l,d),y=n.add(m,m),y=n.add(y,m),w=n.mul(p,w),A=n.mul(g,A),y=n.add(y,w),w=n.sub(m,w),w=n.mul(p,w),A=n.add(A,w),m=n.mul(y,A),f=n.add(f,m),m=n.mul(v,A),l=n.mul(b,l),l=n.sub(l,m),m=n.mul(b,y),d=n.mul(v,d),d=n.add(d,m),new h(l,f,d)}subtract(t){return this.add(t.negate())}is0(){return this.equals(h.ZERO)}wNAF(t){return d.wNAFCached(this,l,t,(t=>{const e=n.invertBatch(t.map((t=>t.pz)));return t.map(((t,n)=>t.toAffine(e[n]))).map(h.fromAffine)}))}multiplyUnsafe(t){const r=h.ZERO;if(t===Jo)return r;if(a(t),t===zo)return this;const{endo:s}=e;if(!s)return d.unsafeLadder(this,t);let{k1neg:i,k1:o,k2neg:c,k2:l}=s.splitScalar(t),u=r,f=r,p=this;for(;o>Jo||l>Jo;)o&zo&&(u=u.add(p)),l&zo&&(f=f.add(p)),p=p.double(),o>>=zo,l>>=zo;return i&&(u=u.negate()),c&&(f=f.negate()),f=new h(n.mul(f.px,s.beta),f.py,f.pz),u.add(f)}multiply(t){a(t);let r,s,i=t;const{endo:o}=e;if(o){const{k1neg:t,k1:e,k2neg:a,k2:c}=o.splitScalar(i);let{p:l,f:u}=this.wNAF(e),{p:f,f:p}=this.wNAF(c);l=d.constTimeNegate(t,l),f=d.constTimeNegate(a,f),f=new h(n.mul(f.px,o.beta),f.py,f.pz),r=l.add(f),s=u.add(p)}else{const{p:t,f:e}=this.wNAF(i);r=t,s=e}return h.normalizeZ([r,s])[0]}multiplyAndAddUnsafe(t,e,n){const r=h.BASE,s=(t,e)=>e!==Jo&&e!==zo&&t.equals(r)?t.multiply(e):t.multiplyUnsafe(e),i=s(this,e).add(s(t,n));return i.is0()?void 0:i}toAffine(t){const{px:e,py:r,pz:s}=this,i=this.is0();null==t&&(t=i?n.ONE:n.inv(s));const o=n.mul(e,t),a=n.mul(r,t),c=n.mul(s,t);if(i)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw new Error("invZ was invalid");return{x:o,y:a}}isTorsionFree(){const{h:t,isTorsionFree:n}=e;if(t===zo)return!0;if(n)return n(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:t,clearCofactor:n}=e;return t===zo?this:n?n(h,this):this.multiplyUnsafe(e.h)}toRawBytes(t=!0){return this.assertValidity(),r(h,this,t)}toHex(t=!0){return so(this.toRawBytes(t))}}h.BASE=new h(e.Gx,e.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);const f=e.nBitLength,d=function(t,e){const n=(t,e)=>{const n=e.negate();return t?n:e},r=t=>({windows:Math.ceil(e/t)+1,windowSize:2**(t-1)});return{constTimeNegate:n,unsafeLadder(e,n){let r=t.ZERO,s=e;for(;n>Mo;)n&Go&&(r=r.add(s)),s=s.double(),n>>=Go;return r},precomputeWindow(t,e){const{windows:n,windowSize:s}=r(e),i=[];let o=t,a=o;for(let t=0;t<n;t++){a=o,i.push(a);for(let t=1;t<s;t++)a=a.add(o),i.push(a);o=a.double()}return i},wNAF(e,s,i){const{windows:o,windowSize:a}=r(e);let c=t.ZERO,l=t.BASE;const u=BigInt(2**e-1),h=2**e,f=BigInt(e);for(let t=0;t<o;t++){const e=t*a;let r=Number(i&u);i>>=f,r>a&&(r-=h,i+=Go);const o=e,d=e+Math.abs(r)-1,p=t%2!=0,g=r<0;0===r?l=l.add(n(p,s[o])):c=c.add(n(g,s[d]))}return{p:c,f:l}},wNAFCached(t,e,n,r){const s=t._WINDOW_SIZE||1;let i=e.get(t);return i||(i=this.precomputeWindow(t,s),1!==s&&e.set(t,r(i))),this.wNAF(s,i,n)}}}(h,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:c,weierstrassEquation:i,isWithinCurveOrder:o}}function _o(t){const e=function(t){const e=Ho(t);return bo(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r}=e,s=n.BYTES+1,i=2*n.BYTES+1;function o(t){return Bo(t,r)}function a(t){return Oo(t,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:l,weierstrassEquation:u,isWithinCurveOrder:h}=qo({...e,toBytes(t,e,r){const s=e.toAffine(),i=n.toBytes(s.x),o=fo;return r?o(Uint8Array.from([e.hasEvenY()?2:3]),i):o(Uint8Array.from([4]),i,n.toBytes(s.y))},fromBytes(t){const e=t.length,r=t[0],o=t.subarray(1);if(e!==s||2!==r&&3!==r){if(e===i&&4===r){return{x:n.fromBytes(o.subarray(0,n.BYTES)),y:n.fromBytes(o.subarray(n.BYTES,2*n.BYTES))}}throw new Error(`Point of length ${e} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}{const t=ao(o);if(!(Jo<(a=t)&&a<n.ORDER))throw new Error("Point is not on curve");const e=u(t);let s=n.sqrt(e);return 1==(1&r)!==((s&zo)===zo)&&(s=n.neg(s)),{x:t,y:s}}var a}}),f=t=>so(lo(t,e.nByteLength));function d(t){return t>r>>zo}const p=(t,e,n)=>ao(t.slice(e,n));class g{constructor(t,e,n){this.r=t,this.s=e,this.recovery=n,this.assertValidity()}static fromCompact(t){const n=e.nByteLength;return t=ho("compactSignature",t,2*n),new g(p(t,0,n),p(t,n,2*n))}static fromDER(t){const{r:e,s:n}=Vo.toSig(ho("DER",t));return new g(e,n)}assertValidity(){if(!h(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!h(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(t){return new g(this.r,this.s,t)}recoverPublicKey(t){const{r,s,recovery:i}=this,l=b(ho("msgHash",t));if(null==i||![0,1,2,3].includes(i))throw new Error("recovery id invalid");const u=2===i||3===i?r+e.n:r;if(u>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const h=0==(1&i)?"02":"03",d=c.fromHex(h+f(u)),p=a(u),g=o(-l*p),m=o(s*p),y=c.BASE.multiplyAndAddUnsafe(d,g,m);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return d(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return oo(this.toDERHex())}toDERHex(){return Vo.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return oo(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const m={isValidPrivateKey(t){try{return l(t),!0}catch(t){return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const t=Uo(e.n);return function(t,e,n=!1){const r=t.length,s=Fo(e),i=Uo(e);if(r<16||r<i||r>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const o=Bo(n?ao(t):co(t),e-vo)+vo;return n?uo(o,s):lo(o,s)}(e.randomBytes(t),e.n)},precompute:(t=8,e=c.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)};function y(t){const e=t instanceof Uint8Array,n="string"==typeof t,r=(e||n)&&t.length;return e?r===s||r===i:n?r===2*s||r===2*i:t instanceof c}const w=e.bits2int||function(t){const n=ao(t),r=8*t.length-e.nBitLength;return r>0?n>>BigInt(r):n},b=e.bits2int_modN||function(t){return o(w(t))},A=po(e.nBitLength);function v(t){if("bigint"!=typeof t)throw new Error("bigint expected");if(!(Jo<=t&&t<A))throw new Error(`bigint expected < 2^${e.nBitLength}`);return lo(t,e.nByteLength)}function E(t,r,s=k){if(["recovered","canonical"].some((t=>t in s)))throw new Error("sign() legacy options not supported");const{hash:i,randomBytes:u}=e;let{lowS:f,prehash:p,extraEntropy:m}=s;null==f&&(f=!0),t=ho("msgHash",t),p&&(t=ho("prehashed msgHash",i(t)));const y=b(t),A=l(r),E=[v(A),v(y)];if(null!=m){const t=!0===m?u(n.BYTES):m;E.push(ho("extraEntropy",t))}const P=fo(...E),x=y;return{seed:P,k2sig:function(t){const e=w(t);if(!h(e))return;const n=a(e),r=c.BASE.multiply(e).toAffine(),s=o(r.x);if(s===Jo)return;const i=o(n*o(x+s*A));if(i===Jo)return;let l=(r.x===s?0:2)|Number(r.y&zo),u=i;return f&&d(i)&&(u=function(t){return d(t)?o(-t):t}(i),l^=1),new g(s,u,l)}}}const k={lowS:e.lowS,prehash:!1},P={lowS:e.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return c.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,n=!0){if(y(t))throw new Error("first arg must be private key");if(!y(e))throw new Error("second arg must be public key");return c.fromHex(e).multiply(l(t)).toRawBytes(n)},sign:function(t,n,r=k){const{seed:s,k2sig:i}=E(t,n,r),o=e;return yo(o.hash.outputLen,o.nByteLength,o.hmac)(s,i)},verify:function(t,n,r,s=P){const i=t;if(n=ho("msgHash",n),r=ho("publicKey",r),"strict"in s)throw new Error("options.strict was renamed to lowS");const{lowS:l,prehash:u}=s;let h,f;try{if("string"==typeof i||i instanceof Uint8Array)try{h=g.fromDER(i)}catch(t){if(!(t instanceof Vo.Err))throw t;h=g.fromCompact(i)}else{if("object"!=typeof i||"bigint"!=typeof i.r||"bigint"!=typeof i.s)throw new Error("PARSE");{const{r:t,s:e}=i;h=new g(t,e)}}f=c.fromHex(r)}catch(t){if("PARSE"===t.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(l&&h.hasHighS())return!1;u&&(n=e.hash(n));const{r:d,s:p}=h,m=b(n),y=a(p),w=o(m*y),A=o(d*y),v=c.BASE.multiplyAndAddUnsafe(f,w,A)?.toAffine();return!!v&&o(v.x)===d},ProjectivePoint:c,Signature:g,utils:m}}function Zo(t){return{hash:t,hmac:(e,...n)=>Lo(t,e,function(...t){const e=new Uint8Array(t.reduce(((t,e)=>t+e.length),0));let n=0;return t.forEach((t=>{if(!mt(t))throw new Error("Uint8Array expected");e.set(t,n),n+=t.length})),e}(...n)),randomBytes:Et}}const Wo=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Yo=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Xo=BigInt(1),$o=BigInt(2),ta=(t,e)=>(t+e/$o)/e;function ea(t){const e=Wo,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=t*t*t%e,u=l*l*t%e,h=Co(u,n,e)*u%e,f=Co(h,n,e)*u%e,d=Co(f,$o,e)*l%e,p=Co(d,s,e)*d%e,g=Co(p,i,e)*p%e,m=Co(g,a,e)*g%e,y=Co(m,c,e)*m%e,w=Co(y,a,e)*g%e,b=Co(w,n,e)*u%e,A=Co(b,o,e)*p%e,v=Co(A,r,e)*l%e,E=Co(v,$o,e);if(!na.eql(na.sqr(E),t))throw new Error("Cannot find square root");return E}const na=function(t,e,n=!1,r={}){if(t<=Ao)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:i}=So(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=Ro(t),a=Object.freeze({ORDER:t,BITS:s,BYTES:i,MASK:po(s),ZERO:Ao,ONE:vo,create:e=>Bo(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("Invalid field element: expected bigint, got "+typeof e);return Ao<=e&&e<t},is0:t=>t===Ao,isOdd:t=>(t&vo)===vo,neg:e=>Bo(-e,t),eql:(t,e)=>t===e,sqr:e=>Bo(e*e,t),add:(e,n)=>Bo(e+n,t),sub:(e,n)=>Bo(e-n,t),mul:(e,n)=>Bo(e*n,t),pow:(t,e)=>function(t,e,n){if(n<Ao)throw new Error("Expected power > 0");if(n===Ao)return t.ONE;if(n===vo)return e;let r=t.ONE,s=e;for(;n>Ao;)n&vo&&(r=t.mul(r,s)),s=t.sqr(s),n>>=vo;return r}(a,t,e),div:(e,n)=>Bo(e*Oo(n,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>Oo(e,t),sqrt:r.sqrt||(t=>o(a,t)),invertBatch:t=>function(t,e){const n=new Array(e.length),r=e.reduce(((e,r,s)=>t.is0(r)?e:(n[s]=e,t.mul(e,r))),t.ONE),s=t.inv(r);return e.reduceRight(((e,r,s)=>t.is0(r)?e:(n[s]=t.mul(e,n[s]),t.mul(e,r))),s),n}(a,t),cmov:(t,e,n)=>n?e:t,toBytes:t=>n?uo(t,i):lo(t,i),fromBytes:t=>{if(t.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${t.length}`);return n?co(t):ao(t)}});return Object.freeze(a)}(Wo,void 0,void 0,{sqrt:ea}),ra=function(t,e){const n=e=>_o({...t,...Zo(e)});return Object.freeze({...n(e),create:n})}({a:BigInt(0),b:BigInt(7),Fp:na,n:Yo,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Yo,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Xo*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=ta(i*t,e),c=ta(-r*t,e);let l=Bo(t-a*n-c*s,e),u=Bo(-a*r-c*i,e);const h=l>o,f=u>o;if(h&&(l=e-l),f&&(u=e-u),l>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:h,k1:l,k2neg:f,k2:u}}}},Bi);BigInt(0);ra.ProjectivePoint;class sa{#rt;constructor(t){f(32===P(t),"invalid private key","privateKey","[REDACTED]"),this.#rt=E(t)}get privateKey(){return this.#rt}get publicKey(){return sa.computePublicKey(this.#rt)}get compressedPublicKey(){return sa.computePublicKey(this.#rt,!0)}sign(t){f(32===P(t),"invalid digest length","digest",t);const e=ra.sign(w(t),w(this.#rt),{lowS:!0});return $i.from({r:M(e.r,32),s:M(e.s,32),v:e.recovery?28:27})}computeSharedSecret(t){const e=sa.computePublicKey(t);return E(ra.getSharedSecret(w(this.#rt),y(e),!1))}static computePublicKey(t,e){let n=y(t,"key");if(32===n.length){return E(ra.getPublicKey(n,!!e))}if(64===n.length){const t=new Uint8Array(65);t[0]=4,t.set(n,1),n=t}return E(ra.ProjectivePoint.fromHex(n).toRawBytes(e))}static recoverPublicKey(t,e){f(32===P(t),"invalid digest length","digest",t);const n=$i.from(e);let r=ra.Signature.fromCompact(w(k([n.r,n.s])));r=r.addRecoveryBit(n.yParity);const s=r.recoverPublicKey(w(t));return f(null!=s,"invalid signautre for digest","signature",e),"0x"+s.toHex(!1)}static addPoints(t,e,n){const r=ra.ProjectivePoint.fromHex(sa.computePublicKey(t).substring(2)),s=ra.ProjectivePoint.fromHex(sa.computePublicKey(e).substring(2));return"0x"+r.add(s).toHex(!!n)}}function ia(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function oa(t,e,n){let r=0;for(let s=0;s<n;s++)r=256*r+t[e+s];return r}function aa(t,e,n,r){const s=[];for(;n<e+1+r;){const i=ca(t,n);s.push(i.result),h((n+=i.consumed)<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:t,length:r,offset:e})}return{consumed:1+r,result:s}}function ca(t,e){h(0!==t.length,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const n=e=>{h(e<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:e})};if(t[e]>=248){const r=t[e]-247;n(e+1+r);const s=oa(t,e+1,r);return n(e+1+r+s),aa(t,e,e+1+r,r+s)}if(t[e]>=192){const r=t[e]-192;return n(e+1+r),aa(t,e,e+1,r)}if(t[e]>=184){const r=t[e]-183;n(e+1+r);const s=oa(t,e+1,r);n(e+1+r+s);return{consumed:1+r+s,result:E(t.slice(e+1+r,e+1+r+s))}}if(t[e]>=128){const r=t[e]-128;n(e+1+r);return{consumed:1+r,result:E(t.slice(e+1,e+1+r))}}return{consumed:1,result:ia(t[e])}}function la(t){const e=y(t,"data"),n=ca(e,0);return f(n.consumed===e.length,"unexpected junk after rlp payload","data",t),n.result}function ua(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function ha(t){if(Array.isArray(t)){let e=[];if(t.forEach((function(t){e=e.concat(ha(t))})),e.length<=55)return e.unshift(192+e.length),e;const n=ua(e.length);return n.unshift(247+n.length),n.concat(e)}const e=Array.prototype.slice.call(y(t,"object"));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=ua(e.length);return n.unshift(183+n.length),n.concat(e)}const fa="0123456789abcdef";function da(t){let e="0x";for(const n of ha(t))e+=fa[n>>4],e+=fa[15&n];return e}function pa(t,e){return function(t){let e;return e="string"==typeof t?sa.computePublicKey(t,!1):t.publicKey,Wt(jt("0x"+e.substring(4)).substring(26))}(sa.recoverPublicKey(t,e))}const ga=BigInt(0),ma=BigInt(2),ya=BigInt(27),wa=BigInt(28),ba=BigInt(35),Aa=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),va=131072;function Ea(t,e){let n=t.toString(16);for(;n.length<2;)n="0"+n;return n+=ji(e).substring(4),"0x"+n}function ka(t){return"0x"===t?null:Wt(t)}function Pa(t,e){try{return jn(t)}catch(n){f(!1,n.message,e,t)}}function xa(t,e){return"0x"===t?0:L(t,e)}function Na(t,e){if("0x"===t)return ga;const n=S(t,e);return f(n<=Aa,"value exceeds uint size",e,n),n}function Ba(t,e){const n=S(t,"value"),r=G(n);return f(r.length<=32,"value too large",`tx.${e}`,n),r}function Ia(t){return jn(t).map((t=>[t.address,t.storageKeys]))}function Ca(t,e){f(Array.isArray(t),`invalid ${e}`,"value",t);for(let e=0;e<t.length;e++)f(b(t[e],32),"invalid ${ param } hash",`value[${e}]`,t[e]);return t}function Oa(t,e){let n;try{if(n=xa(e[0],"yParity"),0!==n&&1!==n)throw new Error("bad yParity")}catch(t){f(!1,"invalid yParity","yParity",e[0])}const r=B(e[1],32),s=B(e[2],32),i=$i.from({r,s,yParity:n});t.signature=i}class Ra{#st;#it;#e;#ot;#at;#ct;#lt;#ut;#ht;#ft;#dt;#pt;#gt;#mt;#yt;#wt;get type(){return this.#st}set type(t){switch(t){case null:this.#st=null;break;case 0:case"legacy":this.#st=0;break;case 1:case"berlin":case"eip-2930":this.#st=1;break;case 2:case"london":case"eip-1559":this.#st=2;break;case 3:case"cancun":case"eip-4844":this.#st=3;break;default:f(!1,"unsupported transaction type","type",t)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const t=this.#it;return null==t&&3===this.type?rr:t}set to(t){this.#it=null==t?null:Wt(t)}get nonce(){return this.#ot}set nonce(t){this.#ot=L(t,"value")}get gasLimit(){return this.#at}set gasLimit(t){this.#at=S(t)}get gasPrice(){const t=this.#ct;return null!=t||0!==this.type&&1!==this.type?t:ga}set gasPrice(t){this.#ct=null==t?null:S(t,"gasPrice")}get maxPriorityFeePerGas(){const t=this.#lt;return null==t?2===this.type||3===this.type?ga:null:t}set maxPriorityFeePerGas(t){this.#lt=null==t?null:S(t,"maxPriorityFeePerGas")}get maxFeePerGas(){const t=this.#ut;return null==t?2===this.type||3===this.type?ga:null:t}set maxFeePerGas(t){this.#ut=null==t?null:S(t,"maxFeePerGas")}get data(){return this.#e}set data(t){this.#e=E(t)}get value(){return this.#ht}set value(t){this.#ht=S(t,"value")}get chainId(){return this.#ft}set chainId(t){this.#ft=S(t)}get signature(){return this.#dt||null}set signature(t){this.#dt=null==t?null:$i.from(t)}get accessList(){const t=this.#pt||null;return null==t?1===this.type||2===this.type||3===this.type?[]:null:t}set accessList(t){this.#pt=null==t?null:jn(t)}get maxFeePerBlobGas(){const t=this.#gt;return null==t&&3===this.type?ga:t}set maxFeePerBlobGas(t){this.#gt=null==t?null:S(t,"maxFeePerBlobGas")}get blobVersionedHashes(){let t=this.#mt;return null==t&&3===this.type?[]:t}set blobVersionedHashes(t){if(null!=t){f(Array.isArray(t),"blobVersionedHashes must be an Array","value",t),t=t.slice();for(let e=0;e<t.length;e++)f(b(t[e],32),"invalid blobVersionedHash",`value[${e}]`,t[e])}this.#mt=t}get blobs(){return null==this.#wt?null:this.#wt.map((t=>Object.assign({},t)))}set blobs(t){if(null==t)return void(this.#wt=null);const e=[],n=[];for(let r=0;r<t.length;r++){const s=t[r];if(A(s)){h(this.#yt,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let t=y(s);if(f(t.length<=va,"blob is too large",`blobs[${r}]`,s),t.length!==va){const e=new Uint8Array(va);e.set(t),t=e}const i=this.#yt.blobToKzgCommitment(t),o=E(this.#yt.computeBlobKzgProof(t,i));e.push({data:E(t),commitment:E(i),proof:o}),n.push(Ea(1,i))}else{const t=E(s.commitment);e.push({data:E(s.data),commitment:t,proof:E(s.proof)}),n.push(Ea(1,t))}}this.#wt=e,this.#mt=n}get kzg(){return this.#yt}set kzg(t){this.#yt=t}constructor(){this.#st=null,this.#it=null,this.#ot=0,this.#at=ga,this.#ct=null,this.#lt=null,this.#ut=null,this.#e="0x",this.#ht=ga,this.#ft=ga,this.#dt=null,this.#pt=null,this.#gt=null,this.#mt=null,this.#wt=null,this.#yt=null}get hash(){return null==this.signature?null:jt(this.#bt(!0,!1))}get unsignedHash(){return jt(this.unsignedSerialized)}get from(){return null==this.signature?null:pa(this.unsignedHash,this.signature)}get fromPublicKey(){return null==this.signature?null:sa.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return null!=this.signature}#bt(t,e){h(!t||null!=this.signature,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const n=t?this.signature:null;switch(this.inferType()){case 0:return function(t,e){const n=[Ba(t.nonce,"nonce"),Ba(t.gasPrice||0,"gasPrice"),Ba(t.gasLimit,"gasLimit"),t.to||"0x",Ba(t.value,"value"),t.data];let r=ga;if(t.chainId!=ga)r=S(t.chainId,"tx.chainId"),f(!e||null==e.networkV||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(t.signature){const e=t.signature.legacyChainId;null!=e&&(r=e)}if(!e)return r!==ga&&(n.push(G(r)),n.push("0x"),n.push("0x")),da(n);let s=BigInt(27+e.yParity);return r!==ga?s=$i.getChainIdV(r,e.v):BigInt(e.v)!==s&&f(!1,"tx.chainId/sig.v mismatch","sig",e),n.push(G(s)),n.push(G(e.r)),n.push(G(e.s)),da(n)}(this,n);case 1:return function(t,e){const n=[Ba(t.chainId,"chainId"),Ba(t.nonce,"nonce"),Ba(t.gasPrice||0,"gasPrice"),Ba(t.gasLimit,"gasLimit"),t.to||"0x",Ba(t.value,"value"),t.data,Ia(t.accessList||[])];return e&&(n.push(Ba(e.yParity,"recoveryParam")),n.push(G(e.r)),n.push(G(e.s))),k(["0x01",da(n)])}(this,n);case 2:return function(t,e){const n=[Ba(t.chainId,"chainId"),Ba(t.nonce,"nonce"),Ba(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ba(t.maxFeePerGas||0,"maxFeePerGas"),Ba(t.gasLimit,"gasLimit"),t.to||"0x",Ba(t.value,"value"),t.data,Ia(t.accessList||[])];return e&&(n.push(Ba(e.yParity,"yParity")),n.push(G(e.r)),n.push(G(e.s))),k(["0x02",da(n)])}(this,n);case 3:return function(t,e,n){const r=[Ba(t.chainId,"chainId"),Ba(t.nonce,"nonce"),Ba(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ba(t.maxFeePerGas||0,"maxFeePerGas"),Ba(t.gasLimit,"gasLimit"),t.to||rr,Ba(t.value,"value"),t.data,Ia(t.accessList||[]),Ba(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),Ca(t.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(Ba(e.yParity,"yParity")),r.push(G(e.r)),r.push(G(e.s)),n)?k(["0x03",da([r,n.map((t=>t.data)),n.map((t=>t.commitment)),n.map((t=>t.proof))])]):k(["0x03",da(r)])}(this,n,e?this.blobs:null)}h(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#bt(!0,!0)}get unsignedSerialized(){return this.#bt(!1,!1)}inferType(){const t=this.inferTypes();return t.indexOf(2)>=0?2:t.pop()}inferTypes(){const t=null!=this.gasPrice,e=null!=this.maxFeePerGas||null!=this.maxPriorityFeePerGas,n=null!=this.accessList,r=null!=this.#gt||this.#mt;null!=this.maxFeePerGas&&null!=this.maxPriorityFeePerGas&&h(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),h(!e||0!==this.type&&1!==this.type,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),h(0!==this.type||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const s=[];return null!=this.type?s.push(this.type):e?s.push(2):t?(s.push(1),n||s.push(0)):n?(s.push(1),s.push(2)):(r&&this.to||(s.push(0),s.push(1),s.push(2)),s.push(3)),s.sort(),s}isLegacy(){return 0===this.type}isBerlin(){return 1===this.type}isLondon(){return 2===this.type}isCancun(){return 3===this.type}clone(){return Ra.from(this)}toJSON(){const t=t=>null==t?null:t.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:t(this.gasLimit),gasPrice:t(this.gasPrice),maxPriorityFeePerGas:t(this.maxPriorityFeePerGas),maxFeePerGas:t(this.maxFeePerGas),value:t(this.value),chainId:t(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(t){if(null==t)return new Ra;if("string"==typeof t){const e=y(t);if(e[0]>=127)return Ra.from(function(t){const e=la(t);f(Array.isArray(e)&&(9===e.length||6===e.length),"invalid field count for legacy transaction","data",t);const n={type:0,nonce:xa(e[0],"nonce"),gasPrice:Na(e[1],"gasPrice"),gasLimit:Na(e[2],"gasLimit"),to:ka(e[3]),value:Na(e[4],"value"),data:E(e[5]),chainId:ga};if(6===e.length)return n;const r=Na(e[6],"v"),s=Na(e[7],"r"),i=Na(e[8],"s");if(s===ga&&i===ga)n.chainId=r;else{let t=(r-ba)/ma;t<ga&&(t=ga),n.chainId=t,f(t!==ga||r===ya||r===wa,"non-canonical legacy v","v",e[6]),n.signature=$i.from({r:B(e[7],32),s:B(e[8],32),v:r})}return n}(e));switch(e[0]){case 1:return Ra.from(function(t){const e=la(y(t).slice(1));f(Array.isArray(e)&&(8===e.length||11===e.length),"invalid field count for transaction type: 1","data",E(t));const n={type:1,chainId:Na(e[0],"chainId"),nonce:xa(e[1],"nonce"),gasPrice:Na(e[2],"gasPrice"),gasLimit:Na(e[3],"gasLimit"),to:ka(e[4]),value:Na(e[5],"value"),data:E(e[6]),accessList:Pa(e[7],"accessList")};return 8===e.length||Oa(n,e.slice(8)),n}(e));case 2:return Ra.from(function(t){const e=la(y(t).slice(1));f(Array.isArray(e)&&(9===e.length||12===e.length),"invalid field count for transaction type: 2","data",E(t));const n={type:2,chainId:Na(e[0],"chainId"),nonce:xa(e[1],"nonce"),maxPriorityFeePerGas:Na(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Na(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Na(e[4],"gasLimit"),to:ka(e[5]),value:Na(e[6],"value"),data:E(e[7]),accessList:Pa(e[8],"accessList")};return 9===e.length||Oa(n,e.slice(9)),n}(e));case 3:return Ra.from(function(t){let e=la(y(t).slice(1)),n="3",r=null;if(4===e.length&&Array.isArray(e[0])){n="3 (network format)";const t=e[1],s=e[2],i=e[3];f(Array.isArray(t),"invalid network format: blobs not an array","fields[1]",t),f(Array.isArray(s),"invalid network format: commitments not an array","fields[2]",s),f(Array.isArray(i),"invalid network format: proofs not an array","fields[3]",i),f(t.length===s.length,"invalid network format: blobs/commitments length mismatch","fields",e),f(t.length===i.length,"invalid network format: blobs/proofs length mismatch","fields",e),r=[];for(let n=0;n<e[1].length;n++)r.push({data:t[n],commitment:s[n],proof:i[n]});e=e[0]}f(Array.isArray(e)&&(11===e.length||14===e.length),`invalid field count for transaction type: ${n}`,"data",E(t));const s={type:3,chainId:Na(e[0],"chainId"),nonce:xa(e[1],"nonce"),maxPriorityFeePerGas:Na(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Na(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Na(e[4],"gasLimit"),to:ka(e[5]),value:Na(e[6],"value"),data:E(e[7]),accessList:Pa(e[8],"accessList"),maxFeePerBlobGas:Na(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),f(null!=s.to,`invalid address for transaction type: ${n}`,"data",t),f(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let e=0;e<s.blobVersionedHashes.length;e++)f(b(s.blobVersionedHashes[e],32),`invalid blobVersionedHash at index ${e}: must be length 32`,"data",t);return 11===e.length||Oa(s,e.slice(11)),s}(e))}h(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const e=new Ra;return null!=t.type&&(e.type=t.type),null!=t.to&&(e.to=t.to),null!=t.nonce&&(e.nonce=t.nonce),null!=t.gasLimit&&(e.gasLimit=t.gasLimit),null!=t.gasPrice&&(e.gasPrice=t.gasPrice),null!=t.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas),null!=t.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null!=t.maxFeePerBlobGas&&(e.maxFeePerBlobGas=t.maxFeePerBlobGas),null!=t.data&&(e.data=t.data),null!=t.value&&(e.value=t.value),null!=t.chainId&&(e.chainId=t.chainId),null!=t.signature&&(e.signature=$i.from(t.signature)),null!=t.accessList&&(e.accessList=t.accessList),null!=t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes),null!=t.kzg&&(e.kzg=t.kzg),null!=t.blobs&&(e.blobs=t.blobs),null!=t.hash&&(f(e.isSigned(),"unsigned transaction cannot define \'.hash\'","tx",t),f(e.hash===t.hash,"hash mismatch","tx",t)),null!=t.from&&(f(e.isSigned(),"unsigned transaction cannot define \'.from\'","tx",t),f(e.from.toLowerCase()===(t.from||"").toLowerCase(),"from mismatch","tx",t)),e}}const Ta="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const Sa=BigInt(58);function Fa(t){return t.match(/^ipfs:\\/\\/ipfs\\//i)?t=t.substring(12):t.match(/^ipfs:\\/\\//i)?t=t.substring(7):f(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class Ua{name;constructor(t){o(this,{name:t})}connect(t){return this}supportsCoinType(t){return!1}async encodeAddress(t,e){throw new Error("unsupported coin")}async decodeAddress(t,e){throw new Error("unsupported coin")}}const Da=new RegExp("^(ipfs)://(.*)$","i"),La=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),Da,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];class Ma{provider;address;name;#At;#vt;constructor(t,e,n){o(this,{provider:t,address:e,name:n}),this.#At=null,this.#vt=new Yr(e,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],t)}async supportsWildcard(){return null==this.#At&&(this.#At=(async()=>{try{return await this.#vt.supportsInterface("0x9061b923")}catch(t){if(c(t,"CALL_EXCEPTION"))return!1;throw this.#At=null,t}})()),await this.#At}async#Et(t,e){e=(e||[]).slice();const n=this.#vt.interface;e.unshift(wi(this.name));let r=null;await this.supportsWildcard()&&(r=n.getFunction(t),h(r,"missing fragment","UNKNOWN_ERROR",{info:{funcName:t}}),e=[bi(this.name,255),n.encodeFunctionData(r,e)],t="resolve(bytes,bytes)"),e.push({enableCcipRead:!0});try{const s=await this.#vt[t](...e);return r?n.decodeFunctionResult(r,s)[0]:s}catch(t){if(!c(t,"CALL_EXCEPTION"))throw t}return null}async getAddress(t){if(null==t&&(t=60),60===t)try{const t=await this.#Et("addr(bytes32)");return null==t||t===rr?null:t}catch(t){if(c(t,"CALL_EXCEPTION"))return null;throw t}if(t>=0&&t<2147483648){let e=t+2147483648;const n=await this.#Et("addr(bytes32,uint)",[e]);if(b(n,20))return Wt(n)}let e=null;for(const n of this.provider.plugins)if(n instanceof Ua&&n.supportsCoinType(t)){e=n;break}if(null==e)return null;const n=await this.#Et("addr(bytes32,uint)",[t]);if(null==n||"0x"===n)return null;const r=await e.decodeAddress(t,n);if(null!=r)return r;h(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${t})`,info:{coinType:t,data:n}})}async getText(t){const e=await this.#Et("text(bytes32,string)",[t]);return null==e||"0x"===e?null:e}async getContentHash(){const t=await this.#Et("contenthash(bytes32)");if(null==t||"0x"===t)return null;const e=t.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(e){const t="e3010170"===e[1]?"ipfs":"ipns",n=parseInt(e[4],16);if(e[5].length===2*n)return`${t}://${function(t){const e=y(t);let n=D(e),r="";for(;n;)r=Ta[Number(n%Sa)]+r,n/=Sa;for(let t=0;t<e.length&&!e[t];t++)r=Ta[0]+r;return r}("0x"+e[2])}`}const n=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&64===n[1].length)return`bzz://${n[1]}`;h(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:t}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const t=[{type:"name",value:this.name}];try{const e=await this.getText("avatar");if(null==e)return t.push({type:"!avatar",value:""}),{url:null,linkage:t};t.push({type:"avatar",value:e});for(let n=0;n<La.length;n++){const r=e.match(La[n]);if(null==r)continue;const s=r[1].toLowerCase();switch(s){case"https":case"data":return t.push({type:"url",value:e}),{linkage:t,url:e};case"ipfs":{const n=Fa(e);return t.push({type:"ipfs",value:e}),t.push({type:"url",value:n}),{linkage:t,url:n}}case"erc721":case"erc1155":{const n="erc721"===s?"tokenURI(uint256)":"uri(uint256)";t.push({type:s,value:e});const i=await this.getAddress();if(null==i)return t.push({type:"!owner",value:""}),{url:null,linkage:t};const o=(r[2]||"").split("/");if(2!==o.length)return t.push({type:`!${s}caip`,value:r[2]||""}),{url:null,linkage:t};const a=o[1],c=new Yr(o[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if("erc721"===s){const e=await c.ownerOf(a);if(i!==e)return t.push({type:"!owner",value:e}),{url:null,linkage:t};t.push({type:"owner",value:e})}else if("erc1155"===s){const e=await c.balanceOf(i,a);if(!e)return t.push({type:"!balance",value:"0"}),{url:null,linkage:t};t.push({type:"balance",value:e.toString()})}let l=await c[n](a);if(null==l||"0x"===l)return t.push({type:"!metadata-url",value:""}),{url:null,linkage:t};t.push({type:"metadata-url-base",value:l}),"erc1155"===s&&(l=l.replace("{id}",M(a,32).substring(2)),t.push({type:"metadata-url-expanded",value:l})),l.match(/^ipfs:/i)&&(l=Fa(l)),t.push({type:"metadata-url",value:l});let u={};const h=await new tr(l).send();h.assertOk();try{u=h.bodyJson}catch(e){try{t.push({type:"!metadata",value:h.bodyText})}catch(e){const n=h.body;return n&&t.push({type:"!metadata",value:E(n)}),{url:null,linkage:t}}return{url:null,linkage:t}}if(!u)return t.push({type:"!metadata",value:""}),{url:null,linkage:t};t.push({type:"metadata",value:JSON.stringify(u)});let f=u.image;if("string"!=typeof f)return t.push({type:"!imageUrl",value:""}),{url:null,linkage:t};if(f.match(/^(https:\\/\\/|data:)/i));else{if(null==f.match(Da))return t.push({type:"!imageUrl-ipfs",value:f}),{url:null,linkage:t};t.push({type:"imageUrl-ipfs",value:f}),f=Fa(f)}return t.push({type:"url",value:f}),{linkage:t,url:f}}}}}catch(t){}return{linkage:t,url:null}}static async getEnsAddress(t){const e=await t.getNetwork(),n=e.getPlugin("org.ethers.plugins.network.Ens");return h(n,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:e}}),n.address}static async#kt(t,e){const n=await Ma.getEnsAddress(t);try{const r=new Yr(n,["function resolver(bytes32) view returns (address)"],t),s=await r.resolver(wi(e),{enableCcipRead:!0});return s===rr?null:s}catch(t){throw t}return null}static async fromName(t,e){let n=e;for(;;){if(""===n||"."===n)return null;if("eth"!==e&&"eth"===n)return null;const r=await Ma.#kt(t,n);if(null!=r){const s=new Ma(t,r,e);return n===e||await s.supportsWildcard()?s:null}n=n.split(".").slice(1).join(".")}}}const Ga=BigInt(0);function Ha(t,e){return function(n){return null==n?e:t(n)}}function Qa(t,e){return n=>{if(e&&null==n)return null;if(!Array.isArray(n))throw new Error("not an array");return n.map((e=>t(e)))}}function ja(t,e){return n=>{const r={};for(const s in t){let i=s;if(e&&s in e&&!(i in n))for(const t of e[s])if(t in n){i=t;break}try{const e=t[s](n[i]);void 0!==e&&(r[s]=e)}catch(t){h(!1,`invalid value for value.${s} (${t instanceof Error?t.message:"not-an-error"})`,"BAD_DATA",{value:n})}}return r}}function Va(t){return f(b(t,!0),"invalid data","value",t),t}function Ja(t){return f(b(t,32),"invalid hash","value",t),t}const za=ja({address:Wt,blockHash:Ja,blockNumber:L,data:Va,index:L,removed:Ha((function(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}f(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}),!1),topics:Qa(Ja),transactionHash:Ja,transactionIndex:L},{index:["logIndex"]});const Ka=ja({hash:Ha(Ja),parentHash:Ja,parentBeaconBlockRoot:Ha(Ja,null),number:L,timestamp:L,nonce:Ha(Va),difficulty:S,gasLimit:S,gasUsed:S,stateRoot:Ha(Ja,null),receiptsRoot:Ha(Ja,null),blobGasUsed:Ha(S,null),excessBlobGas:Ha(S,null),miner:Ha(Wt),prevRandao:Ha(Ja,null),extraData:Va,baseFeePerGas:Ha(S)},{prevRandao:["mixHash"]});const qa=ja({transactionIndex:L,blockNumber:L,transactionHash:Ja,address:Wt,topics:Qa(Ja),data:Va,index:L,blockHash:Ja},{index:["logIndex"]});const _a=ja({to:Ha(Wt,null),from:Ha(Wt,null),contractAddress:Ha(Wt,null),index:L,root:Ha(E),gasUsed:S,blobGasUsed:Ha(S,null),logsBloom:Ha(Va),blockHash:Ja,hash:Ja,logs:Qa((function(t){return qa(t)})),blockNumber:L,cumulativeGasUsed:S,effectiveGasPrice:Ha(S),blobGasPrice:Ha(S,null),status:Ha(L),type:Ha(L,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function Za(t){t.to&&S(t.to)===Ga&&(t.to="0x0000000000000000000000000000000000000000");const e=ja({hash:Ja,index:Ha(L,void 0),type:t=>"0x"===t||null==t?0:L(t),accessList:Ha(jn,null),blobVersionedHashes:Ha(Qa(Ja,!0),null),blockHash:Ha(Ja,null),blockNumber:Ha(L,null),transactionIndex:Ha(L,null),from:Wt,gasPrice:Ha(S),maxPriorityFeePerGas:Ha(S),maxFeePerGas:Ha(S),maxFeePerBlobGas:Ha(S,null),gasLimit:S,to:Ha(Wt,null),value:S,nonce:L,data:Va,creates:Ha(Wt,null),chainId:Ha(S,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(null==e.to&&null==e.creates&&(e.creates=function(t){const e=Wt(t.from);let n=S(t.nonce,"tx.nonce").toString(16);return n="0"===n?"0x":n.length%2?"0x0"+n:"0x"+n,Wt(x(jt(da([e,n])),12))}(e)),1!==t.type&&2!==t.type||null!=t.accessList||(e.accessList=[]),t.signature?e.signature=$i.from(t.signature):e.signature=$i.from(t),null==e.chainId){const t=e.signature.legacyChainId;null!=t&&(e.chainId=t)}return e.blockHash&&S(e.blockHash)===Ga&&(e.blockHash=null),e}class Wa{name;constructor(t){o(this,{name:t})}clone(){return new Wa(this.name)}}class Ya extends Wa{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(t,e){null==t&&(t=0),super(`org.ethers.network.plugins.GasCost#${t||0}`);const n={effectiveBlock:t};function r(t,r){let s=(e||{})[t];null==s&&(s=r),f("number"==typeof s,`invalud value for ${t}`,"costs",e),n[t]=s}r("txBase",21e3),r("txCreate",32e3),r("txDataZero",4),r("txDataNonzero",16),r("txAccessListStorageKey",1900),r("txAccessListAddress",2400),o(this,n)}clone(){return new Ya(this.effectiveBlock,this)}}class Xa extends Wa{address;targetNetwork;constructor(t,e){super("org.ethers.plugins.network.Ens"),o(this,{address:t||"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",targetNetwork:null==e?1:e})}clone(){return new Xa(this.address,this.targetNetwork)}}class $a extends Wa{#N;#Pt;get url(){return this.#N}get processFunc(){return this.#Pt}constructor(t,e){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"),this.#N=t,this.#Pt=e}clone(){return this}}const tc=new Map;class ec{#xt;#ft;#Nt;constructor(t,e){this.#xt=t,this.#ft=S(e),this.#Nt=new Map}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return this.#xt}set name(t){this.#xt=t}get chainId(){return this.#ft}set chainId(t){this.#ft=S(t,"chainId")}matches(t){if(null==t)return!1;if("string"==typeof t){try{return this.chainId===S(t)}catch(t){}return this.name===t}if("number"==typeof t||"bigint"==typeof t){try{return this.chainId===S(t)}catch(t){}return!1}if("object"==typeof t){if(null!=t.chainId){try{return this.chainId===S(t.chainId)}catch(t){}return!1}return null!=t.name&&this.name===t.name}return!1}get plugins(){return Array.from(this.#Nt.values())}attachPlugin(t){if(this.#Nt.get(t.name))throw new Error(`cannot replace existing plugin: ${t.name} `);return this.#Nt.set(t.name,t.clone()),this}getPlugin(t){return this.#Nt.get(t)||null}getPlugins(t){return this.plugins.filter((e=>e.name.split("#")[0]===t))}clone(){const t=new ec(this.name,this.chainId);return this.plugins.forEach((e=>{t.attachPlugin(e.clone())})),t}computeIntrinsicGas(t){const e=this.getPlugin("org.ethers.plugins.network.GasCost")||new Ya;let n=e.txBase;if(null==t.to&&(n+=e.txCreate),t.data)for(let r=2;r<t.data.length;r+=2)"00"===t.data.substring(r,r+2)?n+=e.txDataZero:n+=e.txDataNonzero;if(t.accessList){const r=jn(t.accessList);for(const t in r)n+=e.txAccessListAddress+e.txAccessListStorageKey*r[t].storageKeys.length}return n}static from(t){if(function(){if(sc)return;function t(t,e,n){const r=function(){const r=new ec(t,e);return null!=n.ensNetwork&&r.attachPlugin(new Xa(null,n.ensNetwork)),r.attachPlugin(new Ya),(n.plugins||[]).forEach((t=>{r.attachPlugin(t)})),r};ec.register(t,r),ec.register(e,r),n.altNames&&n.altNames.forEach((t=>{ec.register(t,r)}))}sc=!0,t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[rc("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[rc("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}(),null==t)return ec.from("mainnet");if("number"==typeof t&&(t=BigInt(t)),"string"==typeof t||"bigint"==typeof t){const e=tc.get(t);if(e)return e();if("bigint"==typeof t)return new ec("unknown",t);f(!1,"unknown network","network",t)}if("function"==typeof t.clone){return t.clone()}if("object"==typeof t){f("string"==typeof t.name&&"number"==typeof t.chainId,"invalid network object name or chainId","network",t);const e=new ec(t.name,t.chainId);return(t.ensAddress||null!=t.ensNetwork)&&e.attachPlugin(new Xa(t.ensAddress,t.ensNetwork)),e}f(!1,"invalid network","network",t)}static register(t,e){"number"==typeof t&&(t=BigInt(t));const n=tc.get(t);n&&f(!1,`conflicting network for ${JSON.stringify(n.name)}`,"nameOrChainId",t),tc.set(t,e)}}function nc(t,e){const n=String(t);if(!n.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${t}`);const r=n.split(".");if(1===r.length&&r.push(""),2!==r.length)throw new Error(`invalid gwei value: ${t}`);for(;r[1].length<e;)r[1]+="0";if(r[1].length>9){let t=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||t++,r[1]=t.toString()}return BigInt(r[0]+r[1])}function rc(t){return new $a(t,(async(t,e,n)=>{let r;n.setHeader("User-Agent","ethers");try{const[e,s]=await Promise.all([n.send(),t()]);r=e;const i=r.bodyJson.standard;return{gasPrice:s.gasPrice,maxFeePerGas:nc(i.maxFee,9),maxPriorityFeePerGas:nc(i.maxPriorityFee,9)}}catch(t){h(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:r,error:t})}}))}let sc=!1;function ic(t){return JSON.parse(JSON.stringify(t))}class oc{#Bt;#It;#Ct;#Ot;constructor(t){this.#Bt=t,this.#It=null,this.#Ct=4e3,this.#Ot=-2}get pollingInterval(){return this.#Ct}set pollingInterval(t){this.#Ct=t}async#Rt(){try{const t=await this.#Bt.getBlockNumber();if(-2===this.#Ot)return void(this.#Ot=t);if(t!==this.#Ot){for(let e=this.#Ot+1;e<=t;e++){if(null==this.#It)return;await this.#Bt.emit("block",e)}this.#Ot=t}}catch(t){}null!=this.#It&&(this.#It=this.#Bt._setTimeout(this.#Rt.bind(this),this.#Ct))}start(){this.#It||(this.#It=this.#Bt._setTimeout(this.#Rt.bind(this),this.#Ct),this.#Rt())}stop(){this.#It&&(this.#Bt._clearTimeout(this.#It),this.#It=null)}pause(t){this.stop(),t&&(this.#Ot=-2)}resume(){this.start()}}class ac{#Bt;#Rt;#Tt;constructor(t){this.#Bt=t,this.#Tt=!1,this.#Rt=t=>{this._poll(t,this.#Bt)}}async _poll(t,e){throw new Error("sub-classes must override this")}start(){this.#Tt||(this.#Tt=!0,this.#Rt(-2),this.#Bt.on("block",this.#Rt))}stop(){this.#Tt&&(this.#Tt=!1,this.#Bt.off("block",this.#Rt))}pause(t){this.stop()}resume(){this.start()}}class cc extends ac{#St;#Ft;constructor(t,e){super(t),this.#St=e,this.#Ft=-2}pause(t){t&&(this.#Ft=-2),super.pause(t)}async _poll(t,e){const n=await e.getBlock(this.#St);null!=n&&(-2===this.#Ft?this.#Ft=n.number:n.number>this.#Ft&&(e.emit(this.#St,n.number),this.#Ft=n.number))}}class lc extends ac{#X;constructor(t,e){super(t),this.#X=ic(e)}async _poll(t,e){throw new Error("@TODO")}}class uc extends ac{#Ut;constructor(t,e){super(t),this.#Ut=e}async _poll(t,e){const n=await e.getTransactionReceipt(this.#Ut);n&&e.emit(this.#Ut,n)}}class hc{#Bt;#X;#It;#Tt;#Ot;constructor(t,e){this.#Bt=t,this.#X=ic(e),this.#It=this.#Rt.bind(this),this.#Tt=!1,this.#Ot=-2}async#Rt(t){if(-2===this.#Ot)return;const e=ic(this.#X);e.fromBlock=this.#Ot+1,e.toBlock=t;const n=await this.#Bt.getLogs(e);if(0!==n.length)for(const t of n)this.#Bt.emit(this.#X,t),this.#Ot=t.blockNumber;else this.#Ot<t-60&&(this.#Ot=t-60)}start(){this.#Tt||(this.#Tt=!0,-2===this.#Ot&&this.#Bt.getBlockNumber().then((t=>{this.#Ot=t})),this.#Bt.on("block",this.#It))}stop(){this.#Tt&&(this.#Tt=!1,this.#Bt.off("block",this.#It))}pause(t){this.stop(),t&&(this.#Ot=-2)}resume(){this.start()}}const fc=BigInt(2);function dc(t){return t&&"function"==typeof t.then}function pc(t,e){return t+":"+JSON.stringify(e,((t,e)=>{if(null==e)return"null";if("bigint"==typeof e)return`bigint:${e.toString()}`;if("string"==typeof e)return e.toLowerCase();if("object"==typeof e&&!Array.isArray(e)){const t=Object.keys(e);return t.sort(),t.reduce(((t,n)=>(t[n]=e[n],t)),{})}return e}))}class gc{name;constructor(t){o(this,{name:t})}start(){}stop(){}pause(t){}resume(){}}function mc(t){return(t=Array.from(new Set(t).values())).sort(),t}async function yc(t,e){if(null==t)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),"string"==typeof t)switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(b(t,32)){const e=t.toLowerCase();return{type:"transaction",tag:pc("tx",{hash:e}),hash:e}}if(t.orphan){const e=t;return{type:"orphan",tag:pc("orphan",e),filter:(n=e,JSON.parse(JSON.stringify(n)))}}var n;if(t.address||t.topics){const n=t,r={topics:(n.topics||[]).map((t=>null==t?null:Array.isArray(t)?mc(t.map((t=>t.toLowerCase()))):t.toLowerCase()))};if(n.address){const t=[],s=[],i=n=>{b(n)?t.push(n):s.push((async()=>{t.push(await xn(n,e))})())};Array.isArray(n.address)?n.address.forEach(i):i(n.address),s.length&&await Promise.all(s),r.address=mc(t.map((t=>t.toLowerCase())))}return{filter:r,tag:pc("event",r),type:"event"}}f(!1,"unknown ProviderEvent","event",t)}function wc(){return(new Date).getTime()}const bc={cacheTimeout:250,pollingInterval:4e3};class Ac{#Dt;#Nt;#Lt;#Mt;#Gt;#Ht;#Qt;#jt;#Vt;#Jt;#zt;#u;constructor(t,e){if(this.#u=Object.assign({},bc,e||{}),"any"===t)this.#Ht=!0,this.#Gt=null;else if(t){const e=ec.from(t);this.#Ht=!1,this.#Gt=Promise.resolve(e),setTimeout((()=>{this.emit("network",e,null)}),0)}else this.#Ht=!1,this.#Gt=null;this.#jt=-1,this.#Qt=new Map,this.#Dt=new Map,this.#Nt=new Map,this.#Lt=null,this.#Mt=!1,this.#Vt=1,this.#Jt=new Map,this.#zt=!1}get pollingInterval(){return this.#u.pollingInterval}get provider(){return this}get plugins(){return Array.from(this.#Nt.values())}attachPlugin(t){if(this.#Nt.get(t.name))throw new Error(`cannot replace existing plugin: ${t.name} `);return this.#Nt.set(t.name,t.connect(this)),this}getPlugin(t){return this.#Nt.get(t)||null}get disableCcipRead(){return this.#zt}set disableCcipRead(t){this.#zt=!!t}async#Kt(t){const e=this.#u.cacheTimeout;if(e<0)return await this._perform(t);const n=pc(t.method,t);let r=this.#Qt.get(n);return r||(r=this._perform(t),this.#Qt.set(n,r),setTimeout((()=>{this.#Qt.get(n)===r&&this.#Qt.delete(n)}),e)),await r}async ccipReadFetch(t,e,n){if(this.disableCcipRead||0===n.length||null==t.to)return null;const r=t.to.toLowerCase(),s=e.toLowerCase(),i=[];for(let e=0;e<n.length;e++){const o=n[e],a=o.replace("{sender}",r).replace("{data}",s),c=new tr(a);-1===o.indexOf("{data}")&&(c.body={data:s,sender:r}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:c,index:e,urls:n});let l="unknown error";const u=await c.send();try{const t=u.bodyJson;if(t.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:c,result:t}),t.data;t.message&&(l=t.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:c,result:t})}catch(t){}h(u.statusCode<400||u.statusCode>=500,`response not found during CCIP fetch: ${l}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:t,info:{url:o,errorMessage:l}}),i.push(l)}h(!1,`error encountered during CCIP fetch: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:t,info:{urls:n,errorMessages:i}})}_wrapBlock(t,e){return new mr(function(t){const e=Ka(t);return e.transactions=t.transactions.map((t=>"string"==typeof t?t:Za(t))),e}(t),this)}_wrapLog(t,e){return new yr(function(t){return za(t)}(t),this)}_wrapTransactionReceipt(t,e){return new wr(function(t){return _a(t)}(t),this)}_wrapTransactionResponse(t,e){return new br(Za(t),this)}_detectNetwork(){h(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(t){h(!1,`unsupported method: ${t.method}`,"UNSUPPORTED_OPERATION",{operation:t.method,info:t})}async getBlockNumber(){const t=L(await this.#Kt({method:"getBlockNumber"}),"%response");return this.#jt>=0&&(this.#jt=t),t}_getAddress(t){return xn(t,this)}_getBlockTag(t){if(null==t)return"latest";switch(t){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return t}return b(t)?b(t,32)?t:H(t):("bigint"==typeof t&&(t=L(t,"blockTag")),"number"==typeof t?t>=0?H(t):this.#jt>=0?H(this.#jt+t):this.getBlockNumber().then((e=>H(e+t))):void f(!1,"invalid blockTag","blockTag",t))}_getFilter(t){const e=(t.topics||[]).map((t=>null==t?null:Array.isArray(t)?mc(t.map((t=>t.toLowerCase()))):t.toLowerCase())),n="blockHash"in t?t.blockHash:void 0,r=(t,r,s)=>{let i;switch(t.length){case 0:break;case 1:i=t[0];break;default:t.sort(),i=t}if(n&&(null!=r||null!=s))throw new Error("invalid filter");const o={};return i&&(o.address=i),e.length&&(o.topics=e),r&&(o.fromBlock=r),s&&(o.toBlock=s),n&&(o.blockHash=n),o};let s,i,o=[];if(t.address)if(Array.isArray(t.address))for(const e of t.address)o.push(this._getAddress(e));else o.push(this._getAddress(t.address));return"fromBlock"in t&&(s=this._getBlockTag(t.fromBlock)),"toBlock"in t&&(i=this._getBlockTag(t.toBlock)),o.filter((t=>"string"!=typeof t)).length||null!=s&&"string"!=typeof s||null!=i&&"string"!=typeof i?Promise.all([Promise.all(o),s,i]).then((t=>r(t[0],t[1],t[2]))):r(o,s,i)}_getTransactionRequest(t){const e=gr(t),n=[];if(["to","from"].forEach((t=>{if(null==e[t])return;const r=xn(e[t],this);dc(r)?n.push(async function(){e[t]=await r}()):e[t]=r})),null!=e.blockTag){const t=this._getBlockTag(e.blockTag);dc(t)?n.push(async function(){e.blockTag=await t}()):e.blockTag=t}return n.length?async function(){return await Promise.all(n),e}():e}async getNetwork(){if(null==this.#Gt){const t=(async()=>{try{const t=await this._detectNetwork();return this.emit("network",t,null),t}catch(e){throw this.#Gt===t&&(this.#Gt=null),e}})();return this.#Gt=t,(await t).clone()}const t=this.#Gt,[e,n]=await Promise.all([t,this._detectNetwork()]);return e.chainId!==n.chainId&&(this.#Ht?(this.emit("network",n,e),this.#Gt===t&&(this.#Gt=Promise.resolve(n))):h(!1,`network changed: ${e.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),e.clone()}async getFeeData(){const t=await this.getNetwork(),e=async()=>{const{_block:e,gasPrice:n,priorityFee:r}=await i({_block:this.#qt("latest",!1),gasPrice:(async()=>{try{return S(await this.#Kt({method:"getGasPrice"}),"%response")}catch(t){}return null})(),priorityFee:(async()=>{try{return S(await this.#Kt({method:"getPriorityFee"}),"%response")}catch(t){}return null})()});let s=null,o=null;const a=this._wrapBlock(e,t);return a&&a.baseFeePerGas&&(o=null!=r?r:BigInt("1000000000"),s=a.baseFeePerGas*fc+o),new pr(n,s,o)},n=t.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const t=new tr(n.url),r=await n.processFunc(e,this,t);return new pr(r.gasPrice,r.maxFeePerGas,r.maxPriorityFeePerGas)}return await e()}async estimateGas(t){let e=this._getTransactionRequest(t);return dc(e)&&(e=await e),S(await this.#Kt({method:"estimateGas",transaction:e}),"%response")}async#_t(t,e,n){h(n<10,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},t,{blockTag:e,enableCcipRead:!0})});const r=gr(t);try{return E(await this._perform({method:"call",transaction:r,blockTag:e}))}catch(t){if(!this.disableCcipRead&&l(t)&&t.data&&n>=0&&"latest"===e&&null!=r.to&&"0x556f1830"===x(t.data,0,4)){const s=t.data,i=await xn(r.to,this);let o;try{o=function(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};h(P(t)>=160,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const n=x(t,0,32);h(x(n,0,12)===x(Bc,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=x(n,12);try{const n=[],r=L(x(t,32,64)),s=L(x(t,r,r+32)),i=x(t,r+32);for(let t=0;t<s;t++){const e=vc(i,32*t);if(null==e)throw new Error("abort");n.push(e)}e.urls=n}catch(t){h(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const n=Ec(t,64);if(null==n)throw new Error("abort");e.calldata=n}catch(t){h(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}h(x(t,100,128)===x(Bc,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=x(t,96,100);try{const n=Ec(t,128);if(null==n)throw new Error("abort");e.extraData=n}catch(t){h(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map((t=>e[t])),e}(x(t.data,4))}catch(t){h(!1,t.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:r,info:{data:s}})}h(o.sender.toLowerCase()===i.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:s,reason:"OffchainLookup",transaction:r,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:o.errorArgs}});const a=await this.ccipReadFetch(r,o.calldata,o.urls);h(null!=a,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:r,info:{data:t.data,errorArgs:o.errorArgs}});const c={to:i,data:k([o.selector,Nc([a,o.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:c});try{const t=await this.#_t(c,e,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},c),result:t}),t}catch(t){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},c),error:t}),t}}throw t}}async#Zt(t){const{value:e}=await i({network:this.getNetwork(),value:t});return e}async call(t){const{tx:e,blockTag:n}=await i({tx:this._getTransactionRequest(t),blockTag:this._getBlockTag(t.blockTag)});return await this.#Zt(this.#_t(e,n,t.enableCcipRead?0:-1))}async#Wt(t,e,n){let r=this._getAddress(e),s=this._getBlockTag(n);return"string"==typeof r&&"string"==typeof s||([r,s]=await Promise.all([r,s])),await this.#Zt(this.#Kt(Object.assign(t,{address:r,blockTag:s})))}async getBalance(t,e){return S(await this.#Wt({method:"getBalance"},t,e),"%response")}async getTransactionCount(t,e){return L(await this.#Wt({method:"getTransactionCount"},t,e),"%response")}async getCode(t,e){return E(await this.#Wt({method:"getCode"},t,e))}async getStorage(t,e,n){const r=S(e,"position");return E(await this.#Wt({method:"getStorage",position:r},t,n))}async broadcastTransaction(t){const{blockNumber:e,hash:n,network:r}=await i({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:t}),network:this.getNetwork()}),s=Ra.from(t);if(s.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(s,r).replaceableTransaction(e)}async#qt(t,e){if(b(t,32))return await this.#Kt({method:"getBlock",blockHash:t,includeTransactions:e});let n=this._getBlockTag(t);return"string"!=typeof n&&(n=await n),await this.#Kt({method:"getBlock",blockTag:n,includeTransactions:e})}async getBlock(t,e){const{network:n,params:r}=await i({network:this.getNetwork(),params:this.#qt(t,!!e)});return null==r?null:this._wrapBlock(r,n)}async getTransaction(t){const{network:e,params:n}=await i({network:this.getNetwork(),params:this.#Kt({method:"getTransaction",hash:t})});return null==n?null:this._wrapTransactionResponse(n,e)}async getTransactionReceipt(t){const{network:e,params:n}=await i({network:this.getNetwork(),params:this.#Kt({method:"getTransactionReceipt",hash:t})});if(null==n)return null;if(null==n.gasPrice&&null==n.effectiveGasPrice){const e=await this.#Kt({method:"getTransaction",hash:t});if(null==e)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=e.gasPrice}return this._wrapTransactionReceipt(n,e)}async getTransactionResult(t){const{result:e}=await i({network:this.getNetwork(),result:this.#Kt({method:"getTransactionResult",hash:t})});return null==e?null:E(e)}async getLogs(t){let e=this._getFilter(t);dc(e)&&(e=await e);const{network:n,params:r}=await i({network:this.getNetwork(),params:this.#Kt({method:"getLogs",filter:e})});return r.map((t=>this._wrapLog(t,n)))}_getProvider(t){h(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(t){return await Ma.fromName(this,t)}async getAvatar(t){const e=await this.getResolver(t);return e?await e.getAvatar():null}async resolveName(t){const e=await this.getResolver(t);return e?await e.getAddress():null}async lookupAddress(t){const e=wi((t=Wt(t)).substring(2).toLowerCase()+".addr.reverse");try{const n=await Ma.getEnsAddress(this),r=new Yr(n,["function resolver(bytes32) view returns (address)"],this),s=await r.resolver(e);if(null==s||s===rr)return null;const i=new Yr(s,["function name(bytes32) view returns (string)"],this),o=await i.name(e);return await this.resolveName(o)!==t?null:o}catch(t){if(c(t,"BAD_DATA")&&"0x"===t.value)return null;if(c(t,"CALL_EXCEPTION"))return null;throw t}return null}async waitForTransaction(t,e,n){const r=null!=e?e:1;return 0===r?this.getTransactionReceipt(t):new Promise((async(e,s)=>{let i=null;const o=async n=>{try{const s=await this.getTransactionReceipt(t);if(null!=s&&n-s.blockNumber+1>=r)return e(s),void(i&&(clearTimeout(i),i=null))}catch(t){console.log("EEE",t)}this.once("block",o)};null!=n&&(i=setTimeout((()=>{null!=i&&(i=null,this.off("block",o),s(u("timeout","TIMEOUT",{reason:"timeout"})))}),n)),o(await this.getBlockNumber())}))}async waitForBlock(t){h(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(t){const e=this.#Jt.get(t);e&&(e.timer&&clearTimeout(e.timer),this.#Jt.delete(t))}_setTimeout(t,e){null==e&&(e=0);const n=this.#Vt++,r=()=>{this.#Jt.delete(n),t()};if(this.paused)this.#Jt.set(n,{timer:null,func:r,time:e});else{const t=setTimeout(r,e);this.#Jt.set(n,{timer:t,func:r,time:wc()})}return n}_forEachSubscriber(t){for(const e of this.#Dt.values())t(e.subscriber)}_getSubscriber(t){switch(t.type){case"debug":case"error":case"network":return new gc(t.type);case"block":{const t=new oc(this);return t.pollingInterval=this.pollingInterval,t}case"safe":case"finalized":return new cc(this,t.type);case"event":return new hc(this,t.filter);case"transaction":return new uc(this,t.hash);case"orphan":return new lc(this,t.filter)}throw new Error(`unsupported event: ${t.type}`)}_recoverSubscriber(t,e){for(const n of this.#Dt.values())if(n.subscriber===t){n.started&&n.subscriber.stop(),n.subscriber=e,n.started&&e.start(),null!=this.#Lt&&e.pause(this.#Lt);break}}async#Yt(t,e){let n=await yc(t,this);return"event"===n.type&&e&&e.length>0&&!0===e[0].removed&&(n=await yc({orphan:"drop-log",log:e[0]},this)),this.#Dt.get(n.tag)||null}async#Xt(t){const e=await yc(t,this),n=e.tag;let r=this.#Dt.get(n);if(!r){r={subscriber:this._getSubscriber(e),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},this.#Dt.set(n,r)}return r}async on(t,e){const n=await this.#Xt(t);return n.listeners.push({listener:e,once:!1}),n.started||(n.subscriber.start(),n.started=!0,null!=this.#Lt&&n.subscriber.pause(this.#Lt)),this}async once(t,e){const n=await this.#Xt(t);return n.listeners.push({listener:e,once:!0}),n.started||(n.subscriber.start(),n.started=!0,null!=this.#Lt&&n.subscriber.pause(this.#Lt)),this}async emit(t,...e){const n=await this.#Yt(t,e);if(!n||0===n.listeners.length)return!1;const r=n.listeners.length;return n.listeners=n.listeners.filter((({listener:n,once:r})=>{const s=new Er(this,r?null:n,t);try{n.call(this,...e,s)}catch(t){}return!r})),0===n.listeners.length&&(n.started&&n.subscriber.stop(),this.#Dt.delete(n.tag)),r>0}async listenerCount(t){if(t){const e=await this.#Yt(t);return e?e.listeners.length:0}let e=0;for(const{listeners:t}of this.#Dt.values())e+=t.length;return e}async listeners(t){if(t){const e=await this.#Yt(t);return e?e.listeners.map((({listener:t})=>t)):[]}let e=[];for(const{listeners:t}of this.#Dt.values())e=e.concat(t.map((({listener:t})=>t)));return e}async off(t,e){const n=await this.#Yt(t);if(!n)return this;if(e){const t=n.listeners.map((({listener:t})=>t)).indexOf(e);t>=0&&n.listeners.splice(t,1)}return e&&0!==n.listeners.length||(n.started&&n.subscriber.stop(),this.#Dt.delete(n.tag)),this}async removeAllListeners(t){if(t){const{tag:e,started:n,subscriber:r}=await this.#Xt(t);n&&r.stop(),this.#Dt.delete(e)}else for(const[t,{started:e,subscriber:n}]of this.#Dt)e&&n.stop(),this.#Dt.delete(t);return this}async addListener(t,e){return await this.on(t,e)}async removeListener(t,e){return this.off(t,e)}get destroyed(){return this.#Mt}destroy(){this.removeAllListeners();for(const t of this.#Jt.keys())this._clearTimeout(t);this.#Mt=!0}get paused(){return null!=this.#Lt}set paused(t){!!t!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(t){if(this.#jt=-1,null!=this.#Lt){if(this.#Lt==!!t)return;h(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber((e=>e.pause(t))),this.#Lt=!!t;for(const t of this.#Jt.values())t.timer&&clearTimeout(t.timer),t.time=wc()-t.time}resume(){if(null!=this.#Lt){this._forEachSubscriber((t=>t.resume())),this.#Lt=null;for(const t of this.#Jt.values()){let e=t.time;e<0&&(e=0),t.time=wc(),setTimeout(t.func,e)}}}}function vc(t,e){try{const n=Ec(t,e);if(n)return ve(n)}catch(t){}return null}function Ec(t,e){if("0x"===t)return null;try{const n=L(x(t,e,e+32)),r=L(x(t,n,n+32));return x(t,n+32,n+32+r)}catch(t){}return null}function kc(t){const e=G(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function Pc(t){if(t.length%32==0)return t;const e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}const xc=new Uint8Array([]);function Nc(t){const e=[];let n=0;for(let r=0;r<t.length;r++)e.push(xc),n+=32;for(let r=0;r<t.length;r++){const s=y(t[r]);e[r]=kc(n),e.push(kc(s.length)),e.push(Pc(s)),n+=32+32*Math.ceil(s.length/32)}return k(e)}const Bc="0x0000000000000000000000000000000000000000000000000000000000000000";function Ic(t,e){if(t.provider)return t.provider;h(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function Cc(t,e){let n=gr(e);if(null!=n.to&&(n.to=xn(n.to,t)),null!=n.from){const e=n.from;n.from=Promise.all([t.getAddress(),xn(e,t)]).then((([t,e])=>(f(t.toLowerCase()===e.toLowerCase(),"transaction from mismatch","tx.from",e),t)))}else n.from=t.getAddress();return await i(n)}class Oc{provider;constructor(t){o(this,{provider:t||null})}async getNonce(t){return Ic(this,"getTransactionCount").getTransactionCount(await this.getAddress(),t)}async populateCall(t){return await Cc(this,t)}async populateTransaction(t){const e=Ic(this,"populateTransaction"),n=await Cc(this,t);null==n.nonce&&(n.nonce=await this.getNonce("pending")),null==n.gasLimit&&(n.gasLimit=await this.estimateGas(n));const r=await this.provider.getNetwork();if(null!=n.chainId){f(S(n.chainId)===r.chainId,"transaction chainId mismatch","tx.chainId",t.chainId)}else n.chainId=r.chainId;const s=null!=n.maxFeePerGas||null!=n.maxPriorityFeePerGas;if(null==n.gasPrice||2!==n.type&&!s?0!==n.type&&1!==n.type||!s||f(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",t):f(!1,"eip-1559 transaction do not support gasPrice","tx",t),2!==n.type&&null!=n.type||null==n.maxFeePerGas||null==n.maxPriorityFeePerGas)if(0===n.type||1===n.type){const t=await e.getFeeData();h(null!=t.gasPrice,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),null==n.gasPrice&&(n.gasPrice=t.gasPrice)}else{const t=await e.getFeeData();if(null==n.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(n.type=2,null!=n.gasPrice){const t=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=t,n.maxPriorityFeePerGas=t}else null==n.maxFeePerGas&&(n.maxFeePerGas=t.maxFeePerGas),null==n.maxPriorityFeePerGas&&(n.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(h(!s,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),null==n.gasPrice&&(n.gasPrice=t.gasPrice),n.type=0):h(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else 2!==n.type&&3!==n.type||(null==n.maxFeePerGas&&(n.maxFeePerGas=t.maxFeePerGas),null==n.maxPriorityFeePerGas&&(n.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else n.type=2;return await i(n)}async estimateGas(t){return Ic(this,"estimateGas").estimateGas(await this.populateCall(t))}async call(t){return Ic(this,"call").call(await this.populateCall(t))}async resolveName(t){const e=Ic(this,"resolveName");return await e.resolveName(t)}async sendTransaction(t){const e=Ic(this,"sendTransaction"),n=await this.populateTransaction(t);delete n.from;const r=Ra.from(n);return await e.broadcastTransaction(await this.signTransaction(r))}}class Rc{#Bt;#$t;#It;#Tt;#te;#ee;constructor(t){this.#Bt=t,this.#$t=null,this.#It=this.#Rt.bind(this),this.#Tt=!1,this.#te=null,this.#ee=!1}_subscribe(t){throw new Error("subclasses must override this")}_emitResults(t,e){throw new Error("subclasses must override this")}_recover(t){throw new Error("subclasses must override this")}async#Rt(t){try{null==this.#$t&&(this.#$t=this._subscribe(this.#Bt));let t=null;try{t=await this.#$t}catch(t){if(!c(t,"UNSUPPORTED_OPERATION")||"eth_newFilter"!==t.operation)throw t}if(null==t)return this.#$t=null,void this.#Bt._recoverSubscriber(this,this._recover(this.#Bt));const e=await this.#Bt.getNetwork();if(this.#te||(this.#te=e),this.#te.chainId!==e.chainId)throw new Error("chaid changed");if(this.#ee)return;const n=await this.#Bt.send("eth_getFilterChanges",[t]);await this._emitResults(this.#Bt,n)}catch(t){console.log("@TODO",t)}this.#Bt.once("block",this.#It)}#ne(){const t=this.#$t;t&&(this.#$t=null,t.then((t=>{this.#Bt.destroyed||this.#Bt.send("eth_uninstallFilter",[t])})))}start(){this.#Tt||(this.#Tt=!0,this.#Rt(-2))}stop(){this.#Tt&&(this.#Tt=!1,this.#ee=!0,this.#ne(),this.#Bt.off("block",this.#It))}pause(t){t&&this.#ne(),this.#Bt.off("block",this.#It)}resume(){this.start()}}class Tc extends Rc{#re;constructor(t,e){var n;super(t),this.#re=(n=e,JSON.parse(JSON.stringify(n)))}_recover(t){return new hc(t,this.#re)}async _subscribe(t){return await t.send("eth_newFilter",[this.#re])}async _emitResults(t,e){for(const n of e)t.emit(this.#re,t._wrapLog(n,t._network))}}class Sc extends Rc{async _subscribe(t){return await t.send("eth_newPendingTransactionFilter",[])}async _emitResults(t,e){for(const n of e)t.emit("pending",n)}}const Fc="bigint,boolean,function,number,string,symbol".split(/,/g);function Uc(t){if(null==t||Fc.indexOf(typeof t)>=0)return t;if("function"==typeof t.getAddress)return t;if(Array.isArray(t))return t.map(Uc);if("object"==typeof t)return Object.keys(t).reduce(((e,n)=>(e[n]=t[n],e)),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function Dc(t){return new Promise((e=>{setTimeout(e,t)}))}function Lc(t){return t?t.toLowerCase():t}function Mc(t){return t&&"number"==typeof t.pollingInterval}const Gc={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Hc extends Oc{address;constructor(t,e){super(t),o(this,{address:e=Wt(e)})}connect(t){h(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(t){return await this.populateCall(t)}async sendUncheckedTransaction(t){const e=Uc(t),n=[];if(e.from){const r=e.from;n.push((async()=>{const n=await xn(r,this.provider);f(null!=n&&n.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),e.from=n})())}else e.from=this.address;if(null==e.gasLimit&&n.push((async()=>{e.gasLimit=await this.provider.estimateGas({...e,from:this.address})})()),null!=e.to){const t=e.to;n.push((async()=>{e.to=await xn(t,this.provider)})())}n.length&&await Promise.all(n);const r=this.provider.getRpcTransaction(e);return this.provider.send("eth_sendTransaction",[r])}async sendTransaction(t){const e=await this.provider.getBlockNumber(),n=await this.sendUncheckedTransaction(t);return await new Promise(((t,r)=>{const s=[1e3,100];let i=0;const o=async()=>{try{const r=await this.provider.getTransaction(n);if(null!=r)return void t(r.replaceableTransaction(e))}catch(t){if(c(t,"CANCELLED")||c(t,"BAD_DATA")||c(t,"NETWORK_ERROR"))return null==t.info&&(t.info={}),t.info.sendTransactionHash=n,void r(t);if(c(t,"INVALID_ARGUMENT")&&(i++,null==t.info&&(t.info={}),t.info.sendTransactionHash=n,i>10))return void r(t);this.provider.emit("error",u("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:t}))}this.provider._setTimeout((()=>{o()}),s.pop()||4e3)};o()}))}async signTransaction(t){const e=Uc(t);if(e.from){const n=await xn(e.from,this.provider);f(null!=n&&n.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),e.from=n}else e.from=this.address;const n=this.provider.getRpcTransaction(e);return await this.provider.send("eth_signTransaction",[n])}async signMessage(t){const e="string"==typeof t?Ae(t):t;return await this.provider.send("personal_sign",[E(e),this.address.toLowerCase()])}async signTypedData(t,e,n){const r=Uc(n),s=await Hn.resolveNames(t,e,r,(async t=>{const e=await xn(t);return f(null!=e,"TypedData does not support null address","value",t),e}));return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(Hn.getPayload(s.domain,e,s.value))])}async unlock(t){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),t,null])}async _legacySignMessage(t){const e="string"==typeof t?Ae(t):t;return await this.provider.send("eth_sign",[this.address.toLowerCase(),E(e)])}}class Qc extends Ac{#u;#se;#ie;#oe;#ae;#te;#ce;#le(){if(this.#oe)return;const t=1===this._getOption("batchMaxCount")?0:this._getOption("batchStallTime");this.#oe=setTimeout((()=>{this.#oe=null;const t=this.#ie;for(this.#ie=[];t.length;){const e=[t.shift()];for(;t.length&&e.length!==this.#u.batchMaxCount;){e.push(t.shift());if(JSON.stringify(e.map((t=>t.payload))).length>this.#u.batchMaxSize){t.unshift(e.pop());break}}(async()=>{const t=1===e.length?e[0].payload:e.map((t=>t.payload));this.emit("debug",{action:"sendRpcPayload",payload:t});try{const n=await this._send(t);this.emit("debug",{action:"receiveRpcResult",result:n});for(const{resolve:t,reject:r,payload:s}of e){if(this.destroyed){r(u("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:s.method}));continue}const e=n.filter((t=>t.id===s.id))[0];if(null!=e)"error"in e?r(this.getRpcError(s,e)):t(e.result);else{const t=u("missing response for request","BAD_DATA",{value:n,info:{payload:s}});this.emit("error",t),r(t)}}}catch(t){this.emit("debug",{action:"receiveRpcError",error:t});for(const{reject:n}of e)n(t)}})()}}),t)}constructor(t,e){super(t,e),this.#se=1,this.#u=Object.assign({},Gc,e||{}),this.#ie=[],this.#oe=null,this.#te=null,this.#ce=null;{let t=null;const e=new Promise((e=>{t=e}));this.#ae={promise:e,resolve:t}}const n=this._getOption("staticNetwork");"boolean"==typeof n?(f(!n||"any"!==t,"staticNetwork cannot be used on special network \'any\'","options",e),n&&null!=t&&(this.#te=ec.from(t))):n&&(f(null==t||n.matches(t),"staticNetwork MUST match network object","options",e),this.#te=n)}_getOption(t){return this.#u[t]}get _network(){return h(this.#te,"network is not available yet","NETWORK_ERROR"),this.#te}async _perform(t){if("call"===t.method||"estimateGas"===t.method){let e=t.transaction;if(e&&null!=e.type&&S(e.type)&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const n=await this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&(t=Object.assign({},t,{transaction:Object.assign({},e,{type:void 0})}))}}const e=this.getRpcRequest(t);return null!=e?await this.send(e.method,e.args):super._perform(t)}async _detectNetwork(){const t=this._getOption("staticNetwork");if(t){if(!0!==t)return t;if(this.#te)return this.#te}return this.#ce?await this.#ce:this.ready?(this.#ce=(async()=>{try{const t=ec.from(S(await this.send("eth_chainId",[])));return this.#ce=null,t}catch(t){throw this.#ce=null,t}})(),await this.#ce):(this.#ce=(async()=>{const t={id:this.#se++,method:"eth_chainId",params:[],jsonrpc:"2.0"};let e;this.emit("debug",{action:"sendRpcPayload",payload:t});try{e=(await this._send(t))[0],this.#ce=null}catch(t){throw this.#ce=null,this.emit("debug",{action:"receiveRpcError",error:t}),t}if(this.emit("debug",{action:"receiveRpcResult",result:e}),"result"in e)return ec.from(S(e.result));throw this.getRpcError(t,e)})(),await this.#ce)}_start(){null!=this.#ae&&null!=this.#ae.resolve&&(this.#ae.resolve(),this.#ae=null,(async()=>{for(;null==this.#te&&!this.destroyed;)try{this.#te=await this._detectNetwork()}catch(t){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",u("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:t}})),await Dc(1e3)}this.#le()})())}async _waitUntilReady(){if(null!=this.#ae)return await this.#ae.promise}_getSubscriber(t){return"pending"===t.type?new Sc(this):"event"===t.type?this._getOption("polling")?new hc(this,t.filter):new Tc(this,t.filter):"orphan"===t.type&&"drop-log"===t.filter.orphan?new gc("orphan"):super._getSubscriber(t)}get ready(){return null==this.#ae}getRpcTransaction(t){const e={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((n=>{if(null==t[n])return;let r=n;"gasLimit"===n&&(r="gas"),e[r]=H(S(t[n],`tx.${n}`))})),["from","to","data"].forEach((n=>{null!=t[n]&&(e[n]=E(t[n]))})),t.accessList&&(e.accessList=jn(t.accessList)),t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.map((t=>t.toLowerCase()))),e}getRpcRequest(t){switch(t.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Lc(t.address),t.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Lc(t.address),t.blockTag]};case"getCode":return{method:"eth_getCode",args:[Lc(t.address),t.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Lc(t.address),"0x"+t.position.toString(16),t.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[t.signedTransaction]};case"getBlock":if("blockTag"in t)return{method:"eth_getBlockByNumber",args:[t.blockTag,!!t.includeTransactions]};if("blockHash"in t)return{method:"eth_getBlockByHash",args:[t.blockHash,!!t.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[t.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[t.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(t.transaction),t.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(t.transaction)]};case"getLogs":return t.filter&&null!=t.filter.address&&(Array.isArray(t.filter.address)?t.filter.address=t.filter.address.map(Lc):t.filter.address=Lc(t.filter.address)),{method:"eth_getLogs",args:[t.filter]}}return null}getRpcError(t,e){const{method:n}=t,{error:r}=e;if("eth_estimateGas"===n&&r.message){const e=r.message;if(!e.match(/revert/i)&&e.match(/insufficient funds/i))return u("insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.params[0],info:{payload:t,error:r}})}if("eth_call"===n||"eth_estimateGas"===n){const e=Jc(r),s=En.getBuiltinCallException("eth_call"===n?"call":"estimateGas",t.params[0],e?e.data:null);return s.info={error:r,payload:t},s}const s=JSON.stringify(function(t){const e=[];return zc(t,e),e}(r));if("string"==typeof r.message&&r.message.match(/user denied|ethers-user-denied/i)){return u("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[n]||"unknown",reason:"rejected",info:{payload:t,error:r}})}if("eth_sendRawTransaction"===n||"eth_sendTransaction"===n){const e=t.params[0];if(s.match(/insufficient funds|base fee exceeds gas limit/i))return u("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:e,info:{error:r}});if(s.match(/nonce/i)&&s.match(/too low/i))return u("nonce has already been used","NONCE_EXPIRED",{transaction:e,info:{error:r}});if(s.match(/replacement transaction/i)&&s.match(/underpriced/i))return u("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:e,info:{error:r}});if(s.match(/only replay-protected/i))return u("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:n,info:{transaction:e,info:{error:r}}})}let i=!!s.match(/the method .* does not exist/i);return i||r&&r.details&&r.details.startsWith("Unauthorized method:")&&(i=!0),i?u("unsupported operation","UNSUPPORTED_OPERATION",{operation:t.method,info:{error:r,payload:t}}):u("could not coalesce error","UNKNOWN_ERROR",{error:r,payload:t})}send(t,e){if(this.destroyed)return Promise.reject(u("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t}));const n=this.#se++,r=new Promise(((r,s)=>{this.#ie.push({resolve:r,reject:s,payload:{method:t,params:e,id:n,jsonrpc:"2.0"}})}));return this.#le(),r}async getSigner(t){null==t&&(t=0);const e=this.send("eth_accounts",[]);if("number"==typeof t){const n=await e;if(t>=n.length)throw new Error("no such account");return new Hc(this,n[t])}const{accounts:n}=await i({network:this.getNetwork(),accounts:e});t=Wt(t);for(const e of n)if(Wt(e)===t)return new Hc(this,t);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map((t=>new Hc(this,t)))}destroy(){this.#oe&&(clearTimeout(this.#oe),this.#oe=null);for(const{payload:t,reject:e}of this.#ie)e(u("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t.method}));this.#ie=[],super.destroy()}}class jc extends Qc{#ue;constructor(t,e){super(t,e);let n=this._getOption("pollingInterval");null==n&&(n=Gc.pollingInterval),this.#ue=n}_getSubscriber(t){const e=super._getSubscriber(t);return Mc(e)&&(e.pollingInterval=this.#ue),e}get pollingInterval(){return this.#ue}set pollingInterval(t){if(!Number.isInteger(t)||t<0)throw new Error("invalid interval");this.#ue=t,this._forEachSubscriber((t=>{Mc(t)&&(t.pollingInterval=this.#ue)}))}}class Vc extends jc{#he;constructor(t,e,n){null==t&&(t="http://localhost:8545"),super(e,n),this.#he="string"==typeof t?new tr(t):t.clone()}_getConnection(){return this.#he.clone()}async send(t,e){return await this._start(),await super.send(t,e)}async _send(t){const e=this._getConnection();e.body=JSON.stringify(t),e.setHeader("content-type","application/json");const n=await e.send();n.assertOk();let r=n.bodyJson;return Array.isArray(r)||(r=[r]),r}}function Jc(t){if(null==t)return null;if("string"==typeof t.message&&t.message.match(/revert/i)&&b(t.data))return{message:t.message,data:t.data};if("object"==typeof t){for(const e in t){const n=Jc(t[e]);if(n)return n}return null}if("string"==typeof t)try{return Jc(JSON.parse(t))}catch(t){}return null}function zc(t,e){if(null!=t){if("string"==typeof t.message&&e.push(t.message),"object"==typeof t)for(const n in t)zc(t[n],e);if("string"==typeof t)try{return zc(JSON.parse(t),e)}catch(t){}}}class Kc extends jc{#G;constructor(t,e,n){const r=Object.assign({},null!=n?n:{},{batchMaxCount:1});f(t&&t.request,"invalid EIP-1193 provider","ethereum",t),super(e,r),this.#G=async(e,n)=>{const r={method:e,params:n};this.emit("debug",{action:"sendEip1193Request",payload:r});try{const e=await t.request(r);return this.emit("debug",{action:"receiveEip1193Result",result:e}),e}catch(t){const e=new Error(t.message);throw e.code=t.code,e.data=t.data,e.payload=r,this.emit("debug",{action:"receiveEip1193Error",error:e}),e}}}async send(t,e){return await this._start(),await super.send(t,e)}async _send(t){f(!Array.isArray(t),"EIP-1193 does not support batch request","payload",t);try{const e=await this.#G(t.method,t.params||[]);return[{id:t.id,result:e}]}catch(e){return[{id:t.id,error:{code:e.code,data:e.data,message:e.message}}]}}getRpcError(t,e){switch((e=JSON.parse(JSON.stringify(e))).error.code||-1){case 4001:e.error.message=`ethers-user-denied: ${e.error.message}`;break;case 4200:e.error.message=`ethers-unsupported: ${e.error.message}`}return super.getRpcError(t,e)}async hasSigner(t){null==t&&(t=0);const e=await this.send("eth_accounts",[]);return"number"==typeof t?e.length>t:(t=t.toLowerCase(),0!==e.filter((e=>e.toLowerCase()===t)).length)}async getSigner(t){if(null==t&&(t=0),!await this.hasSigner(t))try{await this.#G("eth_requestAccounts",[])}catch(t){const e=t.payload;throw this.getRpcError(e,{id:e.id,error:t})}return await super.getSigner(t)}}const qc=new Set;const _c=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}().WebSocket;class Zc{#Bt;#X;get filter(){return JSON.parse(this.#X)}#fe;#de;#pe;constructor(t,e){this.#Bt=t,this.#X=JSON.stringify(e),this.#fe=null,this.#de=null,this.#pe=null}start(){this.#fe=this.#Bt.send("eth_subscribe",this.filter).then((t=>(this.#Bt._register(t,this),t)))}stop(){this.#fe.then((t=>{this.#Bt.destroyed||this.#Bt.send("eth_unsubscribe",[t])})),this.#fe=null}pause(t){h(t,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),this.#de=!!t}resume(){this.#de=null}_handleMessage(t){if(null!=this.#fe&&null===this.#de){let e=this.#pe;e=null==e?this._emit(this.#Bt,t):e.then((async()=>{await this._emit(this.#Bt,t)})),this.#pe=e.then((()=>{this.#pe===e&&(this.#pe=null)}))}}async _emit(t,e){throw new Error("sub-classes must implemente this; _emit")}}class Wc extends Zc{constructor(t){super(t,["newHeads"])}async _emit(t,e){t.emit("block",parseInt(e.number))}}class Yc extends Zc{constructor(t){super(t,["newPendingTransactions"])}async _emit(t,e){t.emit("pending",e)}}class Xc extends Zc{#ge;get logFilter(){return JSON.parse(this.#ge)}constructor(t,e){super(t,["logs",e]),this.#ge=JSON.stringify(e)}async _emit(t,e){t.emit(this.logFilter,t._wrapLog(e,t._network))}}class $c extends Qc{#me;#Dt;#ye;constructor(t,e){const n=Object.assign({},null!=e?e:{});f(null==n.batchMaxCount||1===n.batchMaxCount,"sockets-based providers do not support batches","options.batchMaxCount",e),n.batchMaxCount=1,null==n.staticNetwork&&(n.staticNetwork=!0),super(t,n),this.#me=new Map,this.#Dt=new Map,this.#ye=new Map}_getSubscriber(t){switch(t.type){case"close":return new gc("close");case"block":return new Wc(this);case"pending":return new Yc(this);case"event":return new Xc(this,t.filter);case"orphan":if("drop-log"===t.filter.orphan)return new gc("drop-log")}return super._getSubscriber(t)}_register(t,e){this.#Dt.set(t,e);const n=this.#ye.get(t);if(n){for(const t of n)e._handleMessage(t);this.#ye.delete(t)}}async _send(t){f(!Array.isArray(t),"WebSocket does not support batch send","payload",t);const e=new Promise(((e,n)=>{this.#me.set(t.id,{payload:t,resolve:e,reject:n})}));return await this._waitUntilReady(),await this._write(JSON.stringify(t)),[await e]}async _processMessage(t){const e=JSON.parse(t);if(e&&"object"==typeof e&&"id"in e){const t=this.#me.get(e.id);if(null==t)return void this.emit("error",u("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:e}));this.#me.delete(e.id),t.resolve(e)}else{if(!e||"eth_subscription"!==e.method)return void this.emit("error",u("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:e}));{const t=e.params.subscription,n=this.#Dt.get(t);if(n)n._handleMessage(e.params.result);else{let n=this.#ye.get(t);null==n&&(n=[],this.#ye.set(t,n)),n.push(e.params.result)}}}}async _write(t){throw new Error("sub-classes must override this")}}class tl extends $c{#he;#we;get websocket(){if(null==this.#we)throw new Error("websocket closed");return this.#we}constructor(t,e,n){super(e,n),"string"==typeof t?(this.#he=()=>new _c(t),this.#we=this.#he()):"function"==typeof t?(this.#he=t,this.#we=t()):(this.#he=null,this.#we=t),this.websocket.onopen=async()=>{try{await this._start(),this.resume()}catch(t){console.log("failed to start WebsocketProvider",t)}},this.websocket.onmessage=t=>{this._processMessage(t.data)}}async _write(t){this.websocket.send(t)}async destroy(){null!=this.#we&&(this.#we.close(),this.#we=null),super.destroy()}}const el="84842078b09946638c03157f83405213";class nl extends tl{projectId;projectSecret;constructor(t,e){const n=new rl(t,e),r=n._getConnection();h(!r.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});super(r.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/"),n._network),o(this,{projectId:n.projectId,projectSecret:n.projectSecret})}isCommunityResource(){return this.projectId===el}}class rl extends Vc{projectId;projectSecret;constructor(t,e,n){null==t&&(t="mainnet");const r=ec.from(t);null==e&&(e=el),null==n&&(n=null);super(rl.getRequest(r,e,n),r,{staticNetwork:r}),o(this,{projectId:e,projectSecret:n})}_getProvider(t){try{return new rl(t,this.projectId,this.projectSecret)}catch(t){}return super._getProvider(t)}isCommunityResource(){return this.projectId===el}static getWebSocketProvider(t,e){return new nl(t,e)}static getRequest(t,e,n){null==e&&(e=el),null==n&&(n=null);const r=new tr(`https://${function(t){switch(t){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"arbitrum-sepolia":return"arbitrum-sepolia.infura.io";case"base":return"base-mainnet.infura.io";case"base-goerlia":return"base-goerli.infura.io";case"base-sepolia":return"base-sepolia.infura.io";case"bnb":return"bnbsmartchain-mainnet.infura.io";case"bnbt":return"bnbsmartchain-testnet.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"linea-sepolia":return"linea-sepolia.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-amoy":return"polygon-amoy.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io";case"optimism-sepolia":return"optimism-sepolia.infura.io"}f(!1,"unsupported network","network",t)}(t.name)}/v3/${e}`);return r.allowGzip=!0,n&&r.setCredentials("",n),e===el&&(r.retryFunc=async(t,e,n)=>{var r;return r="InfuraProvider",qc.has(r)||(qc.add(r),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${r} (this message will not be repeated)`),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.org/api-keys/"),console.log("==========================")),!0}),r}}const sl=["eip155:1","eip155:11155111","eip155:17000"],il="Ethereum Name Service";const ol=async t=>{const{chainId:e,address:n,domain:r}=t;let s;const i=parseInt(e.split(":")[1]??"1",10);if(sl.includes(e))s=new Kc(ethereum,i);else{const t="992108d9a01d4bffb06df489a0a3f458";if(!t)throw new Error("INFURA_PROJECT_ID is missing.");s=new rl(1,t)}if(r){const t=await s.getResolver(r);if(sl.includes(e)){var o;const e=await(null===(o=t)||void 0===o?void 0:o.getAddress());if(e)return{resolvedAddresses:[{resolvedAddress:e,protocol:il,domainName:r}]}}else{var a,c;const e=await(null===(a=t)||void 0===a?void 0:a.getAddress(i));if(e)return{resolvedAddresses:[{resolvedAddress:e,protocol:il,domainName:r}]};const n=await(null===(c=t)||void 0===c?void 0:c.getAddress());if(n){const t=await async function(t,e){try{return"0x"!==await t.getCode(e,"pending")}catch(t){return console.error("Unable to determine if resolved ENS address is a contract. Assuming it is and returning nothing."),!0}}(s,n);if(!t){const t=(await s.getNetwork()).name;return{resolvedAddresses:[{resolvedAddress:n,protocol:`⚠️ ${il} (${t})`,domainName:r}]}}}}}else if(n){const t=await s.lookupAddress(n);if(t)return{resolvedDomains:[{resolvedDomain:t,protocol:il}]}}return null};var al=exports;for(var cl in e)al[cl]=e[cl];e.__esModule&&Object.defineProperty(al,"__esModule",{value:!0})})();'}],removable:!1}}}},{package:"@metamask/ens-resolver-snap",file:"node_modules/@metamask/ens-resolver-snap/dist/preinstalled-snap.json"}],[151,{"../../../../../shared/constants/permissions":5738,"../../../controllers/permissions":72,"@metamask/multichain":2146,"@metamask/permission-controller":2393},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getPermissionsHandler=void 0;var n=e("@metamask/permission-controller"),s=e("@metamask/multichain"),i=e("../../../controllers/permissions"),a=e("../../../../../shared/constants/permissions");r.getPermissionsHandler={methodNames:[n.MethodNames.GetPermissions],implementation:async function(e,t,r,n,{getPermissionsForOrigin:o,getAccounts:c}){var u;const l={...o()},d=l[s.Caip25EndowmentPermissionName],h=null==d||null===(u=d.caveats)||void 0===u||null===(u=u.find((({type:e})=>e===s.Caip25CaveatType)))||void 0===u?void 0:u.value;if(delete l[s.Caip25EndowmentPermissionName],h){const e=c({ignoreLock:!0});e.length>0&&(l[a.RestrictedMethods.eth_accounts]={...d,parentCapability:a.RestrictedMethods.eth_accounts,caveats:[{type:a.CaveatTypes.restrictReturnedAccounts,value:e}]});const t=(0,s.getPermittedEthChainIds)(h);t.length>0&&(l[i.PermissionNames.permittedChains]={...d,parentCapability:i.PermissionNames.permittedChains,caveats:[{type:a.CaveatTypes.restrictNetworkSwitching,value:t}]})}return t.result=Object.values(l),n()},hookNames:{getPermissionsForOrigin:!0,getAccounts:!0}}}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-getPermissions.ts"}],[152,{"../../../../../shared/constants/permissions":5738,"../../../controllers/permissions":72,"@metamask/controller-utils":1474,"@metamask/multichain":2146,"@metamask/permission-controller":2393,lodash:4855},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.requestPermissionsHandler=void 0;var n=e("lodash"),s=e("@metamask/controller-utils"),i=e("@metamask/permission-controller"),a=e("@metamask/multichain"),o=e("../../../../../shared/constants/permissions"),c=e("../../../controllers/permissions");r.requestPermissionsHandler={methodNames:[i.MethodNames.RequestPermissions],implementation:async function(e,t,r,u,{getAccounts:l,requestPermissionsForOrigin:d,getCaip25PermissionFromLegacyPermissionsForOrigin:h}){const{params:f}=e;if(!Array.isArray(f)||!(0,s.isPlainObject)(f[0]))return u((0,i.invalidParams)({data:{request:e}}));let[p]=f;delete p[a.Caip25EndowmentPermissionName];const m=(0,n.pick)(p,[o.RestrictedMethods.eth_accounts,c.PermissionNames.permittedChains]);delete p[o.RestrictedMethods.eth_accounts],delete p[c.PermissionNames.permittedChains];const g=Object.keys(m).length>0;if(g){const e=h(m);p={...p,...e}}let y={};const[b]=await d(p);if(y={...b},g){var w;const e=y[a.Caip25EndowmentPermissionName];if(!e)throw new Error(`could not find ${a.Caip25EndowmentPermissionName} permission.`);const t=null===(w=e.caveats)||void 0===w||null===(w=w.find((({type:e})=>e===a.Caip25CaveatType)))||void 0===w?void 0:w.value;if(!t)throw new Error(`could not find ${a.Caip25CaveatType} in granted ${a.Caip25EndowmentPermissionName} permission.`);delete y[a.Caip25EndowmentPermissionName];const r=l();y[o.RestrictedMethods.eth_accounts]={...e,parentCapability:o.RestrictedMethods.eth_accounts,caveats:[{type:o.CaveatTypes.restrictReturnedAccounts,value:r}]};const n=(0,a.getPermittedEthChainIds)(t);n.length>0&&(y[c.PermissionNames.permittedChains]={...e,parentCapability:c.PermissionNames.permittedChains,caveats:[{type:o.CaveatTypes.restrictNetworkSwitching,value:n}]})}return t.result=Object.values(y).filter((e=>e!==undefined)),u()},hookNames:{getAccounts:!0,requestPermissionsForOrigin:!0,getCaip25PermissionFromLegacyPermissionsForOrigin:!0}}}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-requestPermissions.ts"}],[153,{"../../../../../shared/constants/permissions":5738,"../../../controllers/permissions":72,"@metamask/multichain":2146,"@metamask/permission-controller":2393,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.revokePermissionsHandler=void 0;var n=e("@metamask/permission-controller"),s=e("@metamask/utils"),i=e("@metamask/multichain"),a=e("../../../../../shared/constants/permissions"),o=e("../../../controllers/permissions");r.revokePermissionsHandler={methodNames:[n.MethodNames.RevokePermissions],implementation:function(e,t,r,c,{revokePermissionsForOrigin:u,rejectApprovalRequestsForOrigin:l}){const{params:d}=e,h=null==d?void 0:d[0];if(!h)return c((0,n.invalidParams)({data:{request:e}}));const f=Object.keys(h).filter((e=>e!==i.Caip25EndowmentPermissionName));if(!(0,s.isNonEmptyArray)(f))return c((0,n.invalidParams)({data:{request:e}}));const p=[a.RestrictedMethods.eth_accounts,o.PermissionNames.permittedChains],m=f.filter((e=>!p.includes(e)));m.length!==f.length&&m.push(i.Caip25EndowmentPermissionName);return u(m),l(),t.result=null,c()},hookNames:{revokePermissionsForOrigin:!0,rejectApprovalRequestsForOrigin:!0,updateCaveat:!0}}}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/wallet-revokePermissions.ts"}],[154,{"../../../../../shared/constants/app":5719,"@metamask/controller-utils":1474,"@metamask/rpc-errors":2554},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("@metamask/controller-utils"),s=e("@metamask/rpc-errors"),i=e("../../../../../shared/constants/app");const a={methodNames:[i.MESSAGE_TYPE.WATCH_ASSET,i.MESSAGE_TYPE.WATCH_ASSET_LEGACY],implementation:async function(e,t,r,i,{handleWatchAssetRequest:a}){try{const{params:{options:r,type:o},origin:c,networkClientId:u}=e,{tokenId:l}=r;return[n.ERC721,n.ERC1155].includes(o)&&l!==undefined&&"string"!=typeof l?i(s.rpcErrors.invalidParams({message:`Expected parameter 'tokenId' to be type 'string'. Received type '${typeof l}'`})):(await a({asset:r,type:o,origin:c,networkClientId:u}),t.result=!0,i())}catch(e){return i(e)}},hookNames:{handleWatchAssetRequest:!0}};r.default=a}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/handlers/watch-asset.js"}],[155,{"./createMethodMiddleware":138,"./createUnsupportedMethodMiddleware":139},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./createMethodMiddleware");Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var s=e("./createUnsupportedMethodMiddleware");Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===s[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return s[e]}}))}))}}},{package:"$root$",file:"app/scripts/lib/rpc-method-middleware/index.js"}],[156,{"../util":187,"@segment/loosely-validate-event":3045,buffer:4074,"is-retry-allowed":4668,lodash:4855,"remove-trailing-slash":5283,timers:5602},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t,n){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var s=u(e("remove-trailing-slash")),i=u(e("@segment/loosely-validate-event")),a=e("lodash"),o=u(e("is-retry-allowed")),c=e("../util");function u(e){return e&&e.__esModule?e:{default:e}}const l=()=>({});r.default=class{constructor(e,t={}){this.writeKey=e,this.host=(0,s.default)(t.host||"https://api.segment.io"),this.flushInterval=t.flushInterval||1e4,this.flushAt=t.flushAt||Math.max(t.flushAt,1)||20,this.queue=[],this.path="/v1/batch",this.maxQueueSize=460800,this.flushed=!1,this.retryCount=3,Object.defineProperty(this,"enable",{configurable:!1,writable:!1,enumerable:!0,value:!0})}_validate(e,t){(0,i.default)(e,t)}_message(e,t,r){return this._validate(t,e),this.enqueue(e,t,r),this}identify(e,t){return this._message("identify",e,t)}track(e,t){return this._message("track",e,t)}page(e,t){return this._message("page",e,t)}enqueue(e,t,r=l){if(!this.enable)return void n(r);const s={...t,type:e};if(s.context={...s.context,library:{name:"analytics-node"}},s.timestamp||(s.timestamp=new Date),s.messageId||(s.messageId=(0,c.generateRandomId)()),s.anonymousId&&!(0,a.isString)(s.anonymousId)&&(s.anonymousId=JSON.stringify(s.anonymousId)),s.userId&&!(0,a.isString)(s.userId)&&(s.userId=JSON.stringify(s.userId)),this.queue.push({message:s,callback:r}),!this.flushed)return this.flushed=!0,void this.flush();const i=this.queue.length>=this.flushAt,o=this.queue.reduce(((e,t)=>e+JSON.stringify(t).length),0)>=this.maxQueueSize;(i||o)&&this.flush(),this.flushInterval&&!this.timer&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))}flush(e=l){if(!this.enable)return n(e),Promise.resolve();if(this.timer&&(clearTimeout(this.timer),this.timer=null),!this.queue.length)return n(e),Promise.resolve();const r=this.queue.splice(0,this.flushAt),s=r.map((e=>e.callback)),i={batch:r.map((e=>e.message)),timestamp:new Date,sentAt:new Date},a={Authorization:`Basic ${t.from(this.writeKey,"utf8").toString("base64")}`};return this._sendRequest(`${this.host}${this.path}`,{method:"POST",body:JSON.stringify(i),headers:a},(t=>{n((()=>{s.forEach((e=>e(t,i))),e(t,i)}))}),0)}_retryRequest(e,t,r,n){const s=100*Math.pow(2,n);setTimeout((()=>{this._sendRequest(e,t,r,n+1)}),s)}async _sendRequest(e,t,r,n){return fetch(e,t).then((async s=>{if(s.ok)r();else if(this._isErrorRetryable({response:s})&&n<=this.retryCount)this._retryRequest(e,t,r,n);else{const e=new Error(s.statusText);r(e)}})).catch((s=>{this._isErrorRetryable(s)&&n<=this.retryCount?this._retryRequest(e,t,r,n):r(s)}))}_isErrorRetryable(e){return!!function(e){return!e.response&&Boolean(e.code)&&"ECONNABORTED"!==e.code&&(0,o.default)(e)}(e)||!!e.response&&(e.response.status>=500&&e.response.status<=599||429===e.response.status)}}}).call(this)}).call(this,e("buffer").Buffer,e("timers").setImmediate)}}},{package:"$root$",file:"app/scripts/lib/segment/analytics.js"}],[157,{"../../../../shared/constants/time":5747,"./analytics":156},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.segment=r.createSegmentMock=void 0;var n,s=e("../../../../shared/constants/time"),i=(n=e("./analytics"))&&n.__esModule?n:{default:n};const a="XdGJ17zKf3NjBPCDQ2UDjJjkx6FYBMGP",o=undefined,c=5*s.SECOND,u=(e=o)=>{const t={queue:[],flush(){t.queue.forEach((([e,t])=>{t()})),t.queue=[]},track(r,n=(()=>undefined)){t.queue.push([r,n]),t.queue.length>=e&&t.flush()},page(){},identify(){}};return t};r.createSegmentMock=u;r.segment=a?new i.default(a,{host:null,flushAt:o,flushInterval:c}):u(o)}}},{package:"$root$",file:"app/scripts/lib/segment/index.js"}],[1587,{"./logging-utils":1594,"./utils/cache":1600,"@metamask/json-rpc-engine":1933},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createBlockCacheMiddleware=void 0;const n=e("@metamask/json-rpc-engine"),s=e("./logging-utils"),i=e("./utils/cache"),a=(0,s.createModuleLogger)(s.projectLogger,"block-cache"),o=[undefined,null,"<nil>"];class c{constructor(){this.cache={}}getBlockCache(e){const t=Number.parseInt(e,16);let r=this.cache[t];if(!r){const e={};this.cache[t]=e,r=e}return r}async get(e,t){const r=this.getBlockCache(t),n=(0,i.cacheIdentifierForRequest)(e,!0);return n?r[n]:undefined}async set(e,t,r){if(!this.canCacheResult(e,r))return;const n=(0,i.cacheIdentifierForRequest)(e,!0);if(!n)return;this.getBlockCache(t)[n]=r}canCacheRequest(e){if(!(0,i.canCache)(e.method))return!1;return"pending"!==(0,i.blockTagForRequest)(e)}canCacheResult(e,t){return!o.includes(t)&&!(e.method&&["eth_getTransactionByHash","eth_getTransactionReceipt"].includes(e.method)&&(!t||!t.blockHash||"0x0000000000000000000000000000000000000000000000000000000000000000"===t.blockHash))}clearBefore(e){const t=Number.parseInt(e,16);Object.keys(this.cache).map(Number).filter((e=>e<t)).forEach((e=>delete this.cache[e]))}}r.createBlockCacheMiddleware=function({blockTracker:e}={}){if(!e)throw new Error("createBlockCacheMiddleware - No PollingBlockTracker specified");const t=new c,r={[i.CacheStrategy.Permanent]:t,[i.CacheStrategy.Block]:t,[i.CacheStrategy.Fork]:t,[i.CacheStrategy.Never]:undefined};return(0,n.createAsyncMiddleware)((async(n,s,o)=>{if(n.skipCache)return o();const c=(0,i.cacheTypeForMethod)(n.method),u=r[c];if(!u)return o();if(!u.canCacheRequest(n))return o();const l=(0,i.blockTagForRequest)(n),d=l&&"string"==typeof l?l:"latest";let h;if(a("blockTag = %o, req = %o",d,n),"earliest"===d)h="0x00";else if("latest"===d){a("Fetching latest block number to determine cache key");const r=await e.getLatestBlock();a("Clearing values stored under block numbers before %o",r),t.clearBefore(r),h=r}else h=d;const f=await u.get(n,h);return f===undefined?(a("No cache stored under block number %o, carrying request forward",h),await o(),a("Populating cache with",s),await u.set(n,h,s.result)):(a("Cache hit, reusing cache result stored under block number %o",h),s.result=f),undefined}))}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/block-cache.js"}],[1588,{"./utils/cache":1600,"@metamask/json-rpc-engine":1933},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createBlockRefRewriteMiddleware=void 0;const n=e("@metamask/json-rpc-engine"),s=e("./utils/cache");r.createBlockRefRewriteMiddleware=function({blockTracker:e}={}){if(!e)throw Error('BlockRefRewriteMiddleware - mandatory "blockTracker" option is missing.');return(0,n.createAsyncMiddleware)((async(t,r,n)=>{const i=(0,s.blockTagParamIndex)(t.method);if(i===undefined)return n();if("latest"!==(Array.isArray(t.params)&&t.params[i]?t.params[i]:"latest"))return n();const a=await e.getLatestBlock();return Array.isArray(t.params)&&(t.params[i]=a),n()}))}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/block-ref-rewrite.js"}],[1589,{"./logging-utils":1594,"./utils/cache":1600,"@metamask/json-rpc-engine":1933,"klona/full":4707},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createBlockRefMiddleware=void 0;const n=e("@metamask/json-rpc-engine"),s=e("klona/full"),i=e("./logging-utils"),a=e("./utils/cache"),o=(0,i.createModuleLogger)(i.projectLogger,"block-ref");r.createBlockRefMiddleware=function({provider:e,blockTracker:t}={}){if(!e)throw Error('BlockRefMiddleware - mandatory "provider" option is missing.');if(!t)throw Error('BlockRefMiddleware - mandatory "blockTracker" option is missing.');return(0,n.createAsyncMiddleware)((async(r,n,i)=>{var c;const u=(0,a.blockTagParamIndex)(r.method);if(u===undefined)return i();if("latest"!==(Array.isArray(r.params)&&null!==(c=r.params[u])&&void 0!==c?c:"latest"))return o('blockRef is not "latest", carrying request forward'),i();const l=await t.getLatestBlock();o(`blockRef is "latest", setting param ${u} to latest block ${l}`);const d=(0,s.klona)(r);return Array.isArray(d.params)&&(d.params[u]=l),o("Performing another request %o",d),n.result=await e.request(d),undefined}))}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/block-ref.js"}],[1590,{"./logging-utils":1594,"@metamask/json-rpc-engine":1933},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createBlockTrackerInspectorMiddleware=void 0;const n=e("@metamask/json-rpc-engine"),s=e("./logging-utils"),i=(0,s.createModuleLogger)(s.projectLogger,"block-tracker-inspector"),a=["eth_getTransactionByHash","eth_getTransactionReceipt"];function o(e){const{result:t}=e;return t&&"object"==typeof t&&(r=t,n="blockNumber",Object.hasOwnProperty.call(r,n))&&"string"==typeof t.blockNumber?t.blockNumber:undefined;var r,n}r.createBlockTrackerInspectorMiddleware=function({blockTracker:e}){return(0,n.createAsyncMiddleware)((async(t,r,n)=>{if(!a.includes(t.method))return n();await n();const s=o(r);if(!s)return undefined;i("res.result.blockNumber exists, proceeding. res = %o",r);return Number.parseInt(s,16)>Number.parseInt(e.getCurrentBlock(),16)&&(i("blockNumber from response is greater than current block number, refreshing current block number"),await e.checkForLatestBlock()),undefined}))}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/block-tracker-inspector.js"}],[1591,{"./utils/timeout":1604,"@metamask/json-rpc-engine":1933,"@metamask/rpc-errors":2554},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createFetchConfigFromReq=r.createFetchMiddleware=void 0;const n=e("@metamask/json-rpc-engine"),s=e("@metamask/rpc-errors"),i=e("./utils/timeout"),a=["Gateway timeout","ETIMEDOUT","failed to parse response body","Failed to fetch"];function o(e){switch(e.status){case 405:throw s.rpcErrors.methodNotFound();case 418:throw s.rpcErrors.internal({message:"Request is being rate limited."});case 503:case 504:throw function(){let e="Gateway timeout. The request took too long to process. ";return e+="This can happen when querying logs over too wide a block range.",s.rpcErrors.internal({message:e})}()}}function c(e,t){if(200!==e.status)throw s.rpcErrors.internal({message:`Non-200 status code: '${e.status}'`,data:t});if(t.error)throw s.rpcErrors.internal({data:t.error});return t.result}function u({btoa:e,req:t,rpcUrl:r,originHttpHeaderKey:n}){const s=new URL(r),i=function(e){let t="";t+=e.protocol,t+=`//${e.hostname}`,e.port&&(t+=`:${e.port}`);return t+=`${e.pathname}`,t+=`${e.search}`,t}(s),a={id:t.id,jsonrpc:t.jsonrpc,method:t.method,params:t.params},o=t.origin,c={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)};if(s.username&&s.password){const t=e(`${s.username}:${s.password}`);c.headers.Authorization=`Basic ${t}`}return n&&o&&(c.headers[n]=o),{fetchUrl:i,fetchParams:c}}r.createFetchMiddleware=function(e){return"rpcService"in e?function({rpcService:e,options:t={}}){return(0,n.createAsyncMiddleware)((async(r,n)=>{const i="originHttpHeaderKey"in t&&t.originHttpHeaderKey!==undefined&&r.origin!==undefined?{[t.originHttpHeaderKey]:r.origin}:{},a=await e.request({id:r.id,jsonrpc:r.jsonrpc,method:r.method,params:r.params},{headers:i});if("error"in a)throw s.rpcErrors.internal({data:a.error});n.result=a.result}))}(e):function({btoa:e,fetch:t,rpcUrl:r,originHttpHeaderKey:s}){return(0,n.createAsyncMiddleware)((async(n,l,d)=>{const{fetchUrl:h,fetchParams:f}=u({btoa:e,req:n,rpcUrl:r,originHttpHeaderKey:s}),p=5,m=1e3;for(let e=0;e<p;e++){try{const e=await t(h,f);o(e);const r=await e.text();let n;try{n=JSON.parse(r)}catch(e){throw new Error(`FetchMiddleware - failed to parse response body: "${r}"`)}const s=c(e,n);return void(l.result=s)}catch(e){const t=e.toString();if(!a.some((e=>t.includes(e))))throw e}await(0,i.timeout)(m)}}))}(e)},r.createFetchConfigFromReq=u}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/fetch.js"}],[1592,{"./block-cache":1587,"./block-ref":1589,"./block-ref-rewrite":1588,"./block-tracker-inspector":1590,"./fetch":1591,"./inflight-cache":1593,"./methods/wallet-get-calls-status":1595,"./providerAsMiddleware":1598,"./retryOnEmpty":1599,"./wallet":1606},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.GetCallsStatusCode=void 0,s(e("./block-cache"),r),s(e("./block-ref-rewrite"),r),s(e("./block-ref"),r),s(e("./block-tracker-inspector"),r),s(e("./fetch"),r),s(e("./inflight-cache"),r);var i=e("./methods/wallet-get-calls-status");Object.defineProperty(r,"GetCallsStatusCode",{enumerable:!0,get:function(){return i.GetCallsStatusCode}}),s(e("./providerAsMiddleware"),r),s(e("./retryOnEmpty"),r),s(e("./wallet"),r)}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/index.js"}],[1593,{"./logging-utils":1594,"./utils/cache":1600,"@metamask/json-rpc-engine":1933,"klona/full":4707},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createInflightCacheMiddleware=void 0;const n=e("@metamask/json-rpc-engine"),s=e("klona/full"),i=e("./logging-utils"),a=e("./utils/cache"),o=(0,i.createModuleLogger)(i.projectLogger,"inflight-cache");r.createInflightCacheMiddleware=function(){const e={};return(0,n.createAsyncMiddleware)((async(t,r,n)=>{if(t.skipCache)return n();const i=(0,a.cacheIdentifierForRequest)(t);if(!i)return o("Request is not cacheable, proceeding. req = %o",t),n();let c=e[i];return c?(o("Running %i handler(s) for request %o",c.length,t),await async function(e,t){const{resolve:r,promise:n}=function(){let e;const t=new Promise((t=>{e=t}));return{resolve:e,promise:t}}();return t.push((t=>{e.result=(0,s.klona)(t.result),e.error=(0,s.klona)(t.error),r()})),n}(r,c),undefined):(c=[],e[i]=c,o("Carrying original request forward %o",t),await n(),delete e[i],o("Running %i collected handler(s) for request %o",c.length,t),function(e,t){setTimeout((()=>{t.forEach((t=>{try{t(e)}catch(e){console.error(e)}}))}))}(r,c),undefined)}))}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/inflight-cache.js"}],[1594,{"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createModuleLogger=r.projectLogger=void 0;const n=e("@metamask/utils");Object.defineProperty(r,"createModuleLogger",{enumerable:!0,get:function(){return n.createModuleLogger}}),r.projectLogger=(0,n.createProjectLogger)("eth-json-rpc-middleware")}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/logging-utils.js"}],[1595,{"../utils/validation":1605,"@metamask/rpc-errors":2554,"@metamask/superstruct":2872,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.walletGetCallsStatus=r.GetCallsStatusCode=void 0;const n=e("@metamask/rpc-errors"),s=e("@metamask/superstruct"),i=e("@metamask/utils"),a=e("../utils/validation"),o=(0,s.tuple)([i.StrictHexStruct]);!function(e){e[e.PENDING=100]="PENDING",e[e.CONFIRMED=200]="CONFIRMED",e[e.FAILED_OFFCHAIN=400]="FAILED_OFFCHAIN",e[e.REVERTED=500]="REVERTED",e[e.REVERTED_PARTIAL=600]="REVERTED_PARTIAL"}(r.GetCallsStatusCode||(r.GetCallsStatusCode={})),r.walletGetCallsStatus=async function(e,t,{getCallsStatus:r}){if(!r)throw n.rpcErrors.methodNotSupported();(0,a.validateParams)(e.params,o);const s=e.params[0];t.result=await r(s,e)}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/methods/wallet-get-calls-status.js"}],[1596,{"../utils/validation":1605,"@metamask/rpc-errors":2554,"@metamask/superstruct":2872,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.walletGetCapabilities=void 0;const n=e("@metamask/rpc-errors"),s=e("@metamask/superstruct"),i=e("@metamask/utils"),a=e("../utils/validation"),o=(0,s.tuple)([i.HexChecksumAddressStruct,(0,s.optional)((0,s.array)(i.StrictHexStruct))]);r.walletGetCapabilities=async function(e,t,{getAccounts:r,getCapabilities:s}){if(!s)throw n.rpcErrors.methodNotSupported();(0,a.validateParams)(e.params,o);const i=e.params[0],c=e.params[1];await(0,a.validateAndNormalizeKeyholder)(i,e,{getAccounts:r});const u=await s(i,c,e);t.result=u}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/methods/wallet-get-capabilities.js"}],[1597,{"../utils/validation":1605,"@metamask/rpc-errors":2554,"@metamask/superstruct":2872,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.walletSendCalls=void 0;const n=e("@metamask/rpc-errors"),s=e("@metamask/superstruct"),i=e("@metamask/utils"),a=e("../utils/validation"),o=(0,s.record)((0,s.string)(),(0,s.type)({optional:(0,s.optional)((0,s.boolean)())})),c=(0,s.tuple)([(0,s.object)({version:(0,s.nonempty)((0,s.string)()),id:(0,s.optional)(i.StrictHexStruct),from:(0,s.optional)(i.HexChecksumAddressStruct),chainId:i.StrictHexStruct,atomicRequired:(0,s.boolean)(),calls:(0,s.array)((0,s.object)({to:(0,s.optional)(i.HexChecksumAddressStruct),data:(0,s.optional)(i.StrictHexStruct),value:(0,s.optional)(i.StrictHexStruct),capabilities:(0,s.optional)(o)})),capabilities:(0,s.optional)(o)})]);r.walletSendCalls=async function(e,t,{getAccounts:r,processSendCalls:s}){if(!s)throw n.rpcErrors.methodNotSupported();(0,a.validateParams)(e.params,c);const i=e.params[0],o=i.from?await(0,a.validateAndNormalizeKeyholder)(i.from,e,{getAccounts:r}):undefined,u=Object.assign(Object.assign({},i),{from:o});t.result=await s(u,e)}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/methods/wallet-send-calls.js"}],[1598,{"@metamask/json-rpc-engine":1933},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.ethersProviderAsMiddleware=r.providerAsMiddleware=void 0;const n=e("@metamask/json-rpc-engine");r.providerAsMiddleware=function(e){return(0,n.createAsyncMiddleware)((async(t,r)=>{r.result=await e.request(t)}))},r.ethersProviderAsMiddleware=function(e){return(t,r,n,s)=>{e.send(t,((e,t)=>e?s(e):(Object.assign(r,t),s())))}}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/providerAsMiddleware.js"}],[1599,{"./logging-utils":1594,"./utils/cache":1600,"./utils/error":1602,"./utils/timeout":1604,"@metamask/json-rpc-engine":1933,"klona/full":4707},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.createRetryOnEmptyMiddleware=void 0;const n=e("@metamask/json-rpc-engine"),s=e("klona/full"),i=e("./logging-utils"),a=e("./utils/cache"),o=e("./utils/error"),c=e("./utils/timeout"),u=(0,i.createModuleLogger)(i.projectLogger,"retry-on-empty"),l=[undefined,null,"<nil>"];r.createRetryOnEmptyMiddleware=function({provider:e,blockTracker:t}={}){if(!e)throw Error('RetryOnEmptyMiddleware - mandatory "provider" option is missing.');if(!t)throw Error('RetryOnEmptyMiddleware - mandatory "blockTracker" option is missing.');return(0,n.createAsyncMiddleware)((async(r,n,i)=>{const d=(0,a.blockTagParamIndex)(r.method);if(d===undefined)return i();let h=Array.isArray(r.params)&&r.params[d]?r.params[d]:undefined;if(h===undefined&&(h="latest"),["latest","pending"].includes(h))return i();const f=Number.parseInt(h.slice(2),16);if(Number.isNaN(f))return i();const p=await t.getLatestBlock(),m=Number.parseInt(p.slice(2),16);if(f>m)return u("Requested block number %o is higher than latest block number %o, falling through to original request",f,m),i();u("Requested block number %o is not higher than latest block number %o, trying request until non-empty response is received",f,m);const g=(0,s.klona)(r),y=await async function(e,t){for(let r=0;r<e;r++)try{return await t()}catch(e){if((0,o.isExecutionRevertedError)(e))throw e;u("(call %i) Request failed, waiting 1s to retry again...",r+1),await(0,c.timeout)(1e3)}throw u("Retries exhausted"),new Error("RetryOnEmptyMiddleware - retries exhausted")}(10,(async()=>{u("Performing request %o",g);const t=await e.request(g);u("Result is %o",t);if(l.includes(t))throw new Error(`RetryOnEmptyMiddleware - empty result "${JSON.stringify(t)}" for request "${JSON.stringify(g)}"`);return t}));return u("Copying result %o",y),n.result=y,undefined}))}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/retryOnEmpty.js"}],[16,{"./identity":14,"./multichain":17,"./notifications":23,"./ppom-controller-messenger":26,"./snaps":29,"./transaction-controller-messenger":35,lodash:4855},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.CONTROLLER_MESSENGERS=void 0;var n=e("lodash"),s=e("./ppom-controller-messenger"),i=e("./snaps"),a=e("./transaction-controller-messenger"),o=e("./multichain"),c=e("./identity"),u=e("./notifications");r.CONTROLLER_MESSENGERS={AuthenticationController:{getMessenger:c.getAuthenticationControllerMessenger,getInitMessenger:n.noop},CronjobController:{getMessenger:i.getCronjobControllerMessenger,getInitMessenger:n.noop},ExecutionService:{getMessenger:i.getExecutionServiceMessenger,getInitMessenger:n.noop},MultichainAssetsController:{getMessenger:o.getMultichainAssetsControllerMessenger,getInitMessenger:n.noop},MultichainAssetsRatesController:{getMessenger:o.getMultichainAssetsRatesControllerMessenger,getInitMessenger:n.noop},MultichainBalancesController:{getMessenger:o.getMultichainBalancesControllerMessenger,getInitMessenger:n.noop},MultichainTransactionsController:{getMessenger:o.getMultichainTransactionsControllerMessenger,getInitMessenger:n.noop},MultichainNetworkController:{getMessenger:o.getMultichainNetworkControllerMessenger,getInitMessenger:n.noop},NotificationServicesController:{getMessenger:u.getNotificationServicesControllerMessenger,getInitMessenger:n.noop},NotificationServicesPushController:{getMessenger:u.getNotificationServicesPushControllerMessenger,getInitMessenger:n.noop},RateLimitController:{getMessenger:i.getRateLimitControllerMessenger,getInitMessenger:i.getRateLimitControllerInitMessenger},SnapsRegistry:{getMessenger:i.getSnapsRegistryMessenger,getInitMessenger:n.noop},SnapController:{getMessenger:i.getSnapControllerMessenger,getInitMessenger:i.getSnapControllerInitMessenger},SnapInsightsController:{getMessenger:i.getSnapInsightsControllerMessenger,getInitMessenger:n.noop},SnapInterfaceController:{getMessenger:i.getSnapInterfaceControllerMessenger,getInitMessenger:n.noop},PPOMController:{getMessenger:s.getPPOMControllerMessenger,getInitMessenger:s.getPPOMControllerInitMessenger},TransactionController:{getMessenger:a.getTransactionControllerMessenger,getInitMessenger:a.getTransactionControllerInitMessenger},UserStorageController:{getMessenger:c.getUserStorageControllerMessenger,getInitMessenger:n.noop}}}}},{package:"$root$",file:"app/scripts/controller-init/messengers/index.ts"}],[1600,{"safe-stable-stringify":5515},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.cacheTypeForMethod=r.blockTagParamIndex=r.blockTagForRequest=r.canCache=r.cacheIdentifierForRequest=r.CacheStrategy=void 0;const n=(0,e("safe-stable-stringify").configure)({bigint:!1,circularValue:Error});var s;function i(e){return o(e)!==s.Never}function a(e){switch(e){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":return 1;case"eth_getBlockByNumber":return 0;default:return undefined}}function o(e){switch(e){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":case"test_permaCache":return s.Permanent;case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":case"test_forkCache":return s.Fork;case"eth_gasPrice":case"eth_blockNumber":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"test_blockCache":return s.Block;default:return s.Never}}!function(e){e.Block="block",e.Fork="fork",e.Never="never",e.Permanent="perma"}(s=r.CacheStrategy||(r.CacheStrategy={})),r.cacheIdentifierForRequest=function(e,t){var r;const s=t?function(e){if(!e.params)return[];const t=a(e.method);if(t===undefined||!Array.isArray(e.params)||t>=e.params.length)return e.params;if("eth_getBlockByNumber"===e.method)return e.params.slice(1);return e.params.slice(0,t)}(e):null!==(r=e.params)&&void 0!==r?r:[];return i(e.method)?`${e.method}:${n(s)}`:null},r.canCache=i,r.blockTagForRequest=function(e){if(!e.params)return undefined;const t=a(e.method);return t===undefined||!Array.isArray(e.params)||t>=e.params.length?undefined:e.params[t]},r.blockTagParamIndex=a,r.cacheTypeForMethod=o}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/utils/cache.js"}],[1601,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.stripArrayTypeIfPresent=void 0;r.stripArrayTypeIfPresent=e=>(null==e?void 0:e.match(/\S\[\d*\]$/u))?e.replace(/\[\d*\]$/gu,"").trim():e}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/utils/common.js"}],[1602,{"@metamask/rpc-errors":2554,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.isExecutionRevertedError=void 0;const n=e("@metamask/rpc-errors"),s=e("@metamask/utils");r.isExecutionRevertedError=function(e){return(0,s.isJsonRpcError)(e)&&e.code===n.errorCodes.rpc.invalidInput&&"execution reverted"===e.message}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/utils/error.js"}],[1603,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){function n(e){return"string"!=typeof e?e:JSON.parse(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.parseTypedMessage=r.normalizeTypedMessage=void 0,r.normalizeTypedMessage=function(e){var t;let r;try{r=n(e)}catch(t){return e}const{verifyingContract:s}=null!==(t=r.domain)&&void 0!==t?t:{};return s?(r.domain.verifyingContract=function(e){if(e.startsWith("0X"))return`0x${e.slice(2)}`;return e}(s),JSON.stringify(r)):e},r.parseTypedMessage=n}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/utils/normalize.js"}],[1604,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.timeout=void 0,r.timeout=async function(e){return new Promise((t=>setTimeout(t,e)))}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/utils/timeout.js"}],[1605,{"@metamask/rpc-errors":2554,"@metamask/superstruct":2872},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.resemblesAddress=r.validateParams=r.validateAndNormalizeKeyholder=void 0;const n=e("@metamask/rpc-errors"),s=e("@metamask/superstruct");function i(e){return 42===e.length}r.validateAndNormalizeKeyholder=async function(e,t,{getAccounts:r}){if("string"==typeof e&&e.length>0&&i(e)){const s=(await r(t)).map((e=>e.toLowerCase())),i=e.toLowerCase();if(s.includes(i))return i;throw n.providerErrors.unauthorized()}throw n.rpcErrors.invalidParams({message:"Invalid parameters: must provide an Ethereum address."})},r.validateParams=function(e,t){const[r]=(0,s.validate)(e,t);if(r)throw n.rpcErrors.invalidParams(function(e,t){return`${t}\n\n${e.failures().map((e=>`${e.path.join(" > ")}${e.path.length?" - ":""}${e.message}`)).join("\n")}`}(r,"Invalid params"))},r.resemblesAddress=i}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/utils/validation.js"}],[1606,{"./methods/wallet-get-calls-status":1595,"./methods/wallet-get-capabilities":1596,"./methods/wallet-send-calls":1597,"./utils/common":1601,"./utils/normalize":1603,"./utils/validation":1605,"@metamask/eth-sig-util":1643,"@metamask/json-rpc-engine":1933,"@metamask/rpc-errors":2554,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return s(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.createWalletMiddleware=void 0;const a=i(e("@metamask/eth-sig-util")),o=e("@metamask/json-rpc-engine"),c=e("@metamask/rpc-errors"),u=e("@metamask/utils"),l=e("./methods/wallet-get-calls-status"),d=e("./methods/wallet-get-capabilities"),h=e("./methods/wallet-send-calls"),f=e("./utils/common"),p=e("./utils/normalize"),m=e("./utils/validation");function g(e){const{primaryType:t,types:r}=(0,p.parseTypedMessage)(e);if(!r)throw c.rpcErrors.invalidInput();if(!r[(0,f.stripArrayTypeIfPresent)(t)])throw c.rpcErrors.invalidInput()}function y(e){const{domain:{verifyingContract:t}={}}=(0,p.parseTypedMessage)(e);if(t&&"cosmos"!==t&&!(0,u.isValidHexAddress)(t))throw c.rpcErrors.invalidInput()}r.createWalletMiddleware=function({getAccounts:e,getCallsStatus:t,getCapabilities:r,processDecryptMessage:n,processEncryptionPublicKey:s,processPersonalMessage:i,processTransaction:u,processSignTransaction:f,processTypedMessage:b,processTypedMessageV3:w,processTypedMessageV4:A,processSendCalls:v}){if(!e)throw new Error("opts.getAccounts is required");return(0,o.createScaffoldMiddleware)({eth_accounts:(0,o.createAsyncMiddleware)((async function(t,r){r.result=await e(t)})),eth_coinbase:(0,o.createAsyncMiddleware)((async function(t,r){const n=await e(t);r.result=n[0]||null})),eth_sendTransaction:(0,o.createAsyncMiddleware)((async function(e,t){if(!u)throw c.rpcErrors.methodNotSupported();if(!(e.params&&Array.isArray(e.params)&&e.params.length>=1))throw c.rpcErrors.invalidInput();const r=e.params[0],n=Object.assign(Object.assign({},r),{from:await E((null==r?void 0:r.from)||"",e)});t.result=await u(n,e)})),eth_signTransaction:(0,o.createAsyncMiddleware)((async function(e,t){if(!f)throw c.rpcErrors.methodNotSupported();if(!(e.params&&Array.isArray(e.params)&&e.params.length>=1))throw c.rpcErrors.invalidInput();const r=e.params[0],n=Object.assign(Object.assign({},r),{from:await E((null==r?void 0:r.from)||"",e)});t.result=await f(n,e)})),eth_signTypedData:(0,o.createAsyncMiddleware)((async function(e,t){if(!b)throw c.rpcErrors.methodNotSupported();if(!((null==e?void 0:e.params)&&Array.isArray(e.params)&&e.params.length>=2))throw c.rpcErrors.invalidInput();const r=e.params,n=r[0],s=await E(r[1],e),i=r[2]||{},a=Object.assign(Object.assign({},i),{from:s,data:n,signatureMethod:"eth_signTypedData",version:"V1"});t.result=await b(a,e,"V1")})),eth_signTypedData_v3:(0,o.createAsyncMiddleware)((async function(e,t){if(!w)throw c.rpcErrors.methodNotSupported();if(!((null==e?void 0:e.params)&&Array.isArray(e.params)&&e.params.length>=2))throw c.rpcErrors.invalidInput();const r=e.params,n=await E(r[0],e),s=(0,p.normalizeTypedMessage)(r[1]);g(s),y(s);const i={data:s,from:n,version:"V3",signatureMethod:"eth_signTypedData_v3"};t.result=await w(i,e,"V3")})),eth_signTypedData_v4:(0,o.createAsyncMiddleware)((async function(e,t){if(!A)throw c.rpcErrors.methodNotSupported();if(!((null==e?void 0:e.params)&&Array.isArray(e.params)&&e.params.length>=2))throw c.rpcErrors.invalidInput();const r=e.params,n=await E(r[0],e),s=(0,p.normalizeTypedMessage)(r[1]);g(s),y(s);const i={data:s,from:n,version:"V4",signatureMethod:"eth_signTypedData_v4"};t.result=await A(i,e,"V4")})),personal_sign:(0,o.createAsyncMiddleware)((async function(e,t){if(!i)throw c.rpcErrors.methodNotSupported();if(!((null==e?void 0:e.params)&&Array.isArray(e.params)&&e.params.length>=2))throw c.rpcErrors.invalidInput();const r=e.params,n=r[0],s=r[1],a=r[2]||{};let o,u;if((0,m.resemblesAddress)(n)&&!(0,m.resemblesAddress)(s)){let e="The eth_personalSign method requires params ordered ";e+="[message, address]. This was previously handled incorrectly, ",e+="and has been corrected automatically. ",e+="Please switch this param order for smooth behavior in the future.",t.warning=e,o=n,u=s}else u=n,o=s;o=await E(o,e);const l=Object.assign(Object.assign({},a),{from:o,data:u,signatureMethod:"personal_sign"});t.result=await i(l,e)})),eth_getEncryptionPublicKey:(0,o.createAsyncMiddleware)((async function(e,t){if(!s)throw c.rpcErrors.methodNotSupported();if(!((null==e?void 0:e.params)&&Array.isArray(e.params)&&e.params.length>=1))throw c.rpcErrors.invalidInput();const r=e.params,n=await E(r[0],e);t.result=await s(n,e)})),eth_decrypt:(0,o.createAsyncMiddleware)((async function(e,t){if(!n)throw c.rpcErrors.methodNotSupported();if(!((null==e?void 0:e.params)&&Array.isArray(e.params)&&e.params.length>=1))throw c.rpcErrors.invalidInput();const r=e.params,s=r[0],i=await E(r[1],e),a=r[2]||{},o=Object.assign(Object.assign({},a),{from:i,data:s});t.result=await n(o,e)})),personal_ecRecover:(0,o.createAsyncMiddleware)((async function(e,t){if(!((null==e?void 0:e.params)&&Array.isArray(e.params)&&e.params.length>=2))throw c.rpcErrors.invalidInput();const r=e.params,n=r[0],s=r[1],i=a.recoverPersonalSignature({data:n,signature:s});t.result=i})),wallet_getCapabilities:(0,o.createAsyncMiddleware)((async(t,n)=>(0,d.walletGetCapabilities)(t,n,{getAccounts:e,getCapabilities:r}))),wallet_sendCalls:(0,o.createAsyncMiddleware)((async(t,r)=>(0,h.walletSendCalls)(t,r,{getAccounts:e,processSendCalls:v}))),wallet_getCallsStatus:(0,o.createAsyncMiddleware)((async(e,r)=>(0,l.walletGetCallsStatus)(e,r,{getCallsStatus:t})))});async function E(t,r){return(0,m.validateAndNormalizeKeyholder)(t,r,{getAccounts:e})}}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/wallet.js"}],[1607,{"./bytes":1610,"./constants":1611,"./helpers":1613,"./internal":1615,"@ethereumjs/rlp":429,buffer:4074,"ethereum-cryptography/keccak":4300,"ethereum-cryptography/secp256k1":4317,"ethereum-cryptography/utils":4319},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.accountBodyToRLP=r.accountBodyToSlim=r.accountBodyFromSlim=r.isZeroAddress=r.zeroAddress=r.importPublic=r.privateToAddress=r.privateToPublic=r.publicToAddress=r.pubToAddress=r.isValidPublic=r.isValidPrivate=r.generateAddress2=r.generateAddress=r.isValidChecksumAddress=r.toChecksumAddress=r.isValidAddress=r.Account=void 0;const n=e("@ethereumjs/rlp"),s=e("ethereum-cryptography/keccak"),i=e("ethereum-cryptography/secp256k1"),a=e("ethereum-cryptography/utils"),o=e("./bytes"),c=e("./constants"),u=e("./helpers"),l=e("./internal"),d=BigInt(0);class h{constructor(e=d,t=d,r=c.KECCAK256_RLP,n=c.KECCAK256_NULL){this.nonce=e,this.balance=t,this.storageRoot=r,this.codeHash=n,this._validate()}static fromAccountData(e){const{nonce:t,balance:r,storageRoot:n,codeHash:s}=e;return new h(t!==undefined?(0,o.bufferToBigInt)((0,o.toBuffer)(t)):undefined,r!==undefined?(0,o.bufferToBigInt)((0,o.toBuffer)(r)):undefined,n!==undefined?(0,o.toBuffer)(n):undefined,s!==undefined?(0,o.toBuffer)(s):undefined)}static fromRlpSerializedAccount(e){const t=(0,o.arrToBufArr)(n.RLP.decode(Uint8Array.from(e)));if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)}static fromValuesArray(e){const[t,r,n,s]=e;return new h((0,o.bufferToBigInt)(t),(0,o.bufferToBigInt)(r),n,s)}_validate(){if(this.nonce<d)throw new Error("nonce must be greater than zero");if(this.balance<d)throw new Error("balance must be greater than zero");if(32!==this.storageRoot.length)throw new Error("storageRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")}raw(){return[(0,o.bigIntToUnpaddedBuffer)(this.nonce),(0,o.bigIntToUnpaddedBuffer)(this.balance),this.storageRoot,this.codeHash]}serialize(){return t.from(n.RLP.encode((0,o.bufArrToArr)(this.raw())))}isContract(){return!this.codeHash.equals(c.KECCAK256_NULL)}isEmpty(){return this.balance===d&&this.nonce===d&&this.codeHash.equals(c.KECCAK256_NULL)}}r.Account=h;r.isValidAddress=function(e){try{(0,u.assertIsString)(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)};r.toChecksumAddress=function(e,r){(0,u.assertIsHexString)(e);const n=(0,l.stripHexPrefix)(e).toLowerCase();let i="";if(r!==undefined){i=(0,o.bufferToBigInt)((0,o.toBuffer)(r)).toString()+"0x"}const c=t.from(i+n,"utf8"),d=(0,a.bytesToHex)((0,s.keccak256)(c));let h="0x";for(let e=0;e<n.length;e++)parseInt(d[e],16)>=8?h+=n[e].toUpperCase():h+=n[e];return h};r.isValidChecksumAddress=function(e,t){return(0,r.isValidAddress)(e)&&(0,r.toChecksumAddress)(e,t)===e};r.generateAddress=function(e,r){return(0,u.assertIsBuffer)(e),(0,u.assertIsBuffer)(r),(0,o.bufferToBigInt)(r)===BigInt(0)?t.from((0,s.keccak256)(n.RLP.encode((0,o.bufArrToArr)([e,null])))).slice(-20):t.from((0,s.keccak256)(n.RLP.encode((0,o.bufArrToArr)([e,r])))).slice(-20)};r.generateAddress2=function(e,r,n){if((0,u.assertIsBuffer)(e),(0,u.assertIsBuffer)(r),(0,u.assertIsBuffer)(n),20!==e.length)throw new Error("Expected from to be of length 20");if(32!==r.length)throw new Error("Expected salt to be of length 32");const i=(0,s.keccak256)(t.concat([t.from("ff","hex"),e,r,(0,s.keccak256)(n)]));return(0,o.toBuffer)(i).slice(-20)};r.isValidPrivate=function(e){return i.secp256k1.utils.isValidPrivateKey(e)};r.isValidPublic=function(e,r=!1){if((0,u.assertIsBuffer)(e),64===e.length)try{return i.secp256k1.ProjectivePoint.fromHex(t.concat([t.from([4]),e])),!0}catch(e){return!1}if(!r)return!1;try{return i.secp256k1.ProjectivePoint.fromHex(e),!0}catch(e){return!1}};r.pubToAddress=function(e,r=!1){if((0,u.assertIsBuffer)(e),r&&64!==e.length&&(e=t.from(i.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),64!==e.length)throw new Error("Expected pubKey to be of length 64");return t.from((0,s.keccak256)(e)).slice(-20)},r.publicToAddress=r.pubToAddress;r.privateToPublic=function(e){return(0,u.assertIsBuffer)(e),t.from(i.secp256k1.ProjectivePoint.fromPrivateKey(e).toRawBytes(!1).slice(1))};r.privateToAddress=function(e){return(0,r.publicToAddress)((0,r.privateToPublic)(e))};r.importPublic=function(e){return(0,u.assertIsBuffer)(e),64!==e.length&&(e=t.from(i.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),e};r.zeroAddress=function(){const e=(0,o.zeros)(20);return(0,o.bufferToHex)(e)};function f(e){const[t,r,n,s]=e;return[t,r,0===(0,o.arrToBufArr)(n).length?c.KECCAK256_RLP:n,0===(0,o.arrToBufArr)(s).length?c.KECCAK256_NULL:s]}r.isZeroAddress=function(e){try{(0,u.assertIsString)(e)}catch(e){return!1}return(0,r.zeroAddress)()===e},r.accountBodyFromSlim=f;const p=new Uint8Array(0);r.accountBodyToSlim=function(e){const[t,r,n,s]=e;return[t,r,(0,o.arrToBufArr)(n).equals(c.KECCAK256_RLP)?p:n,(0,o.arrToBufArr)(s).equals(c.KECCAK256_NULL)?p:s]},r.accountBodyToRLP=function(e,t=!0){const r=t?f(e):e;return(0,o.arrToBufArr)(n.RLP.encode(r))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/account.js"}],[1608,{"./account":1607,"./bytes":1610,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.Address=void 0;const n=e("./account"),s=e("./bytes");class i{constructor(e){if(20!==e.length)throw new Error("Invalid address length");this.buf=e}static zero(){return new i((0,s.zeros)(20))}static fromString(e){if(!(0,n.isValidAddress)(e))throw new Error("Invalid address");return new i((0,s.toBuffer)(e))}static fromPublicKey(e){if(!t.isBuffer(e))throw new Error("Public key should be Buffer");const r=(0,n.pubToAddress)(e);return new i(r)}static fromPrivateKey(e){if(!t.isBuffer(e))throw new Error("Private key should be Buffer");const r=(0,n.privateToAddress)(e);return new i(r)}static generate(e,t){if("bigint"!=typeof t)throw new Error("Expected nonce to be a bigint");return new i((0,n.generateAddress)(e.buf,(0,s.bigIntToBuffer)(t)))}static generate2(e,r,s){if(!t.isBuffer(r))throw new Error("Expected salt to be a Buffer");if(!t.isBuffer(s))throw new Error("Expected initCode to be a Buffer");return new i((0,n.generateAddress2)(e.buf,r,s))}equals(e){return this.buf.equals(e.buf)}isZero(){return this.equals(i.zero())}isPrecompileOrSystemAddress(){const e=(0,s.bufferToBigInt)(this.buf),t=BigInt(0),r=BigInt("0xffff");return e>=t&&e<=r}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return t.from(this.buf)}}r.Address=i}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/address.js"}],[1609,{events:4399},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.AsyncEventEmitter=void 0;const n=e("events");class s extends n.EventEmitter{emit(e,...t){let[r,n]=t;const s=this;let i=s._events[e]??[];return n===undefined&&"function"==typeof r&&(n=r,r=undefined),"newListener"!==e&&"removeListener"!==e||(r={event:r,fn:n},n=undefined),i=Array.isArray(i)?i:[i],async function(e,t,r){let n;for await(const s of t)try{s.length<2?s.call(e,r):await new Promise(((t,n)=>{s.call(e,r,(e=>{e?n(e):t()}))}))}catch(e){n=e}if(n)throw n}(s,i.slice(),r).then(n).catch(n),s.listenerCount(e)>0}once(e,t){const r=this;let n;if("function"!=typeof t)throw new TypeError("listener must be a function");return n=t.length>=2?function(s,i){r.removeListener(e,n),t(s,i)}:function(s){r.removeListener(e,n),t(s,n)},r.on(e,n),r}first(e,t){let r=this._events[e]??[];if("function"!=typeof t)throw new TypeError("listener must be a function");return Array.isArray(r)||(this._events[e]=r=[r]),r.unshift(t),this}before(e,t,r){return this.beforeOrAfter(e,t,r)}after(e,t,r){return this.beforeOrAfter(e,t,r,"after")}beforeOrAfter(e,t,r,n){let s,i,a=this._events[e]??[];const o="after"===n?1:0;if("function"!=typeof r)throw new TypeError("listener must be a function");if("function"!=typeof t)throw new TypeError("target must be a function");for(Array.isArray(a)||(this._events[e]=a=[a]),i=a.length,s=a.length;s--;)if(a[s]===t){i=s+o;break}return a.splice(i,0,r),this}on(e,t){return super.on(e,t)}addListener(e,t){return super.addListener(e,t)}prependListener(e,t){return super.prependListener(e,t)}prependOnceListener(e,t){return super.prependOnceListener(e,t)}removeAllListeners(e){return super.removeAllListeners(e)}removeListener(e,t){return super.removeListener(e,t)}eventNames(){return super.eventNames()}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(e){return super.setMaxListeners(e)}}r.AsyncEventEmitter=s}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/asyncEventEmitter.js"}],[161,{"../../../../shared/lib/trace":5773},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.addPersonalMessage=async function({signatureParams:e,signatureController:t}){return s(e,t,"newUnsignedPersonalMessage")},r.addTypedMessage=async function({signatureParams:e,signatureController:t}){return s(e,t,"newUnsignedTypedMessage")};var n=e("../../../../shared/lib/trace");async function s(e,t,r){const[,s]=e,{id:i}=s,a=null==i?void 0:i.toString();(0,n.endTrace)({name:n.TraceName.Middleware,id:a});const o=await t[r](...e);return(0,n.endTrace)({name:n.TraceName.Signature,id:a}),o}}}},{package:"$root$",file:"app/scripts/lib/signature/util.ts"}],[1610,{"./helpers":1613,"./internal":1615,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.intToUnpaddedBuffer=r.bigIntToUnpaddedBuffer=r.bigIntToHex=r.bufArrToArr=r.arrToBufArr=r.validateNoLeadingZeroes=r.baToJSON=r.toUtf8=r.short=r.addHexPrefix=r.toUnsigned=r.fromSigned=r.bufferToInt=r.bigIntToBuffer=r.bufferToBigInt=r.bufferToHex=r.toBuffer=r.unpadHexString=r.unpadArray=r.unpadBuffer=r.setLengthRight=r.setLengthLeft=r.zeros=r.intToBuffer=r.intToHex=void 0;const n=e("./helpers"),s=e("./internal");r.intToHex=function(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`};r.intToBuffer=function(e){const n=(0,r.intToHex)(e);return t.from((0,s.padToEven)(n.slice(2)),"hex")};r.zeros=function(e){return t.allocUnsafe(e).fill(0)};const i=function(e,t,n){const s=(0,r.zeros)(t);return n?e.length<t?(e.copy(s),s):e.slice(0,t):e.length<t?(e.copy(s,t-e.length),s):e.slice(-t)};r.setLengthLeft=function(e,t){return(0,n.assertIsBuffer)(e),i(e,t,!1)};r.setLengthRight=function(e,t){return(0,n.assertIsBuffer)(e),i(e,t,!0)};const a=function(e){let t=e[0];for(;e.length>0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};r.unpadBuffer=function(e){return(0,n.assertIsBuffer)(e),a(e)};r.unpadArray=function(e){return(0,n.assertIsArray)(e),a(e)};r.unpadHexString=function(e){return(0,n.assertIsHexString)(e),e=(0,s.stripHexPrefix)(e),"0x"+a(e)};r.toBuffer=function(e){if(null===e||e===undefined)return t.allocUnsafe(0);if(t.isBuffer(e))return t.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return t.from(e);if("string"==typeof e){if(!(0,s.isHexString)(e))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${e}`);return t.from((0,s.padToEven)((0,s.stripHexPrefix)(e)),"hex")}if("number"==typeof e)return(0,r.intToBuffer)(e);if("bigint"==typeof e){if(e<BigInt(0))throw new Error(`Cannot convert negative bigint to buffer. Given: ${e}`);let r=e.toString(16);return r.length%2&&(r="0"+r),t.from(r,"hex")}if(e.toArray)return t.from(e.toArray());if(e.toBuffer)return t.from(e.toBuffer());throw new Error("invalid type")};function o(e){const t=(0,r.bufferToHex)(e);return"0x"===t?BigInt(0):BigInt(t)}function c(e){return(0,r.toBuffer)("0x"+e.toString(16))}r.bufferToHex=function(e){return"0x"+(e=(0,r.toBuffer)(e)).toString("hex")},r.bufferToBigInt=o,r.bigIntToBuffer=c;r.bufferToInt=function(e){const t=Number(o(e));if(!Number.isSafeInteger(t))throw new Error("Number exceeds 53 bits");return t};r.fromSigned=function(e){return BigInt.asIntN(256,o(e))};r.toUnsigned=function(e){return c(BigInt.asUintN(256,e))};r.addHexPrefix=function(e){return"string"!=typeof e||(0,s.isHexPrefixed)(e)?e:"0x"+e},r.short=function(e,r=50){const n=t.isBuffer(e)?e.toString("hex"):e;return n.length<=r?n:n.slice(0,r)+"…"};r.toUtf8=function(e){if((e=(0,s.stripHexPrefix)(e)).length%2!=0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return t.from(e.replace(/^(00)+|(00)+$/g,""),"hex").toString("utf8")};r.baToJSON=function(e){if(t.isBuffer(e))return`0x${e.toString("hex")}`;if(e instanceof Array){const t=[];for(let n=0;n<e.length;n++)t.push((0,r.baToJSON)(e[n]));return t}};r.validateNoLeadingZeroes=function(e){for(const[t,r]of Object.entries(e))if(r!==undefined&&r.length>0&&0===r[0])throw new Error(`${t} cannot have leading zeroes, received: ${r.toString("hex")}`)},r.arrToBufArr=function e(r){return Array.isArray(r)?r.map((t=>e(t))):t.from(r)},r.bufArrToArr=function e(t){return Array.isArray(t)?t.map((t=>e(t))):Uint8Array.from(t??[])};r.bigIntToHex=e=>"0x"+e.toString(16),r.bigIntToUnpaddedBuffer=function(e){return(0,r.unpadBuffer)(c(e))},r.intToUnpaddedBuffer=function(e){return(0,r.unpadBuffer)((0,r.intToBuffer)(e))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/bytes.js"}],[1611,{buffer:4074,"ethereum-cryptography/secp256k1":4317},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.MAX_WITHDRAWALS_PER_PAYLOAD=r.RLP_EMPTY_STRING=r.KECCAK256_RLP=r.KECCAK256_RLP_S=r.KECCAK256_RLP_ARRAY=r.KECCAK256_RLP_ARRAY_S=r.KECCAK256_NULL=r.KECCAK256_NULL_S=r.TWO_POW256=r.SECP256K1_ORDER_DIV_2=r.SECP256K1_ORDER=r.MAX_INTEGER_BIGINT=r.MAX_INTEGER=r.MAX_UINT64=void 0;const n=e("buffer"),s=e("ethereum-cryptography/secp256k1");r.MAX_UINT64=BigInt("0xffffffffffffffff"),r.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),r.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),r.SECP256K1_ORDER=s.secp256k1.CURVE.n,r.SECP256K1_ORDER_DIV_2=s.secp256k1.CURVE.n/BigInt(2),r.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),r.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",r.KECCAK256_NULL=n.Buffer.from(r.KECCAK256_NULL_S,"hex"),r.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",r.KECCAK256_RLP_ARRAY=n.Buffer.from(r.KECCAK256_RLP_ARRAY_S,"hex"),r.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",r.KECCAK256_RLP=n.Buffer.from(r.KECCAK256_RLP_S,"hex"),r.RLP_EMPTY_STRING=n.Buffer.from([128]),r.MAX_WITHDRAWALS_PER_PAYLOAD=16}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/constants.js"}],[1612,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.compactBytesToNibbles=r.bytesToNibbles=r.nibblesToCompactBytes=r.nibblesToBytes=r.hasTerminator=void 0;r.hasTerminator=e=>e.length>0&&16===e[e.length-1];r.nibblesToBytes=(e,t)=>{for(let r=0,n=0;n<e.length;r+=1,n+=2)t[r]=e[n]<<4|e[n+1]};r.nibblesToCompactBytes=e=>{let t=0;(0,r.hasTerminator)(e)&&(t=1,e=e.subarray(0,e.length-1));const n=new Uint8Array(e.length/2+1);return n[0]=t<<5,1&~e.length||(n[0]|=16,n[0]|=e[0],e=e.subarray(1)),(0,r.nibblesToBytes)(e,n.subarray(1)),n};r.bytesToNibbles=e=>{const t=2*e.length+1,r=new Uint8Array(t);for(let t=0;t<e.length;t++){const n=e[t];r[2*t]=n/16,r[2*t+1]=n%16}return r[t-1]=16,r};r.compactBytesToNibbles=e=>{if(0===e.length)return e;let t=(0,r.bytesToNibbles)(e);t[0]<2&&(t=t.subarray(0,t.length-1));const n=2-(1&t[0]);return t.subarray(n)}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/encoding.js"}],[1613,{"../../../../../../is-buffer/index.js":4657,"./internal":1615},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.assertIsString=r.assertIsArray=r.assertIsBuffer=r.assertIsHexString=void 0;const n=e("./internal");r.assertIsHexString=function(e){if(!(0,n.isHexString)(e)){throw new Error(`This method only supports 0x-prefixed hex strings but input was: ${e}`)}};r.assertIsBuffer=function(e){if(!t.isBuffer(e)){throw new Error(`This method only supports Buffer but input was: ${e}`)}};r.assertIsArray=function(e){if(!Array.isArray(e)){throw new Error(`This method only supports number arrays but input was: ${e}`)}};r.assertIsString=function(e){if("string"!=typeof e){throw new Error(`This method only supports strings but input was: ${e}`)}}}).call(this)}).call(this,{isBuffer:e("../../../../../../is-buffer/index.js")})}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/helpers.js"}],[1614,{"./account":1607,"./address":1608,"./asyncEventEmitter":1609,"./bytes":1610,"./constants":1611,"./encoding":1612,"./internal":1615,"./lock":1616,"./provider":1617,"./signature":1618,"./types":1619,"./units":1620,"./withdrawal":1621},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.toAscii=r.stripHexPrefix=r.padToEven=r.isHexString=r.isHexPrefixed=r.getKeys=r.getBinarySize=r.fromUtf8=r.fromAscii=r.arrayContainsArray=void 0,s(e("./constants"),r),s(e("./units"),r),s(e("./account"),r),s(e("./address"),r),s(e("./withdrawal"),r),s(e("./signature"),r),s(e("./bytes"),r),s(e("./types"),r),s(e("./encoding"),r),s(e("./asyncEventEmitter"),r);var i=e("./internal");Object.defineProperty(r,"arrayContainsArray",{enumerable:!0,get:function(){return i.arrayContainsArray}}),Object.defineProperty(r,"fromAscii",{enumerable:!0,get:function(){return i.fromAscii}}),Object.defineProperty(r,"fromUtf8",{enumerable:!0,get:function(){return i.fromUtf8}}),Object.defineProperty(r,"getBinarySize",{enumerable:!0,get:function(){return i.getBinarySize}}),Object.defineProperty(r,"getKeys",{enumerable:!0,get:function(){return i.getKeys}}),Object.defineProperty(r,"isHexPrefixed",{enumerable:!0,get:function(){return i.isHexPrefixed}}),Object.defineProperty(r,"isHexString",{enumerable:!0,get:function(){return i.isHexString}}),Object.defineProperty(r,"padToEven",{enumerable:!0,get:function(){return i.padToEven}}),Object.defineProperty(r,"stripHexPrefix",{enumerable:!0,get:function(){return i.stripHexPrefix}}),Object.defineProperty(r,"toAscii",{enumerable:!0,get:function(){return i.toAscii}}),s(e("./lock"),r),s(e("./provider"),r)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/index.js"}],[1615,{buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(e){(function(){function t(e){if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type "+typeof e);return"0"===e[0]&&"x"===e[1]}Object.defineProperty(r,"__esModule",{value:!0}),r.isHexString=r.getKeys=r.fromAscii=r.fromUtf8=r.toAscii=r.arrayContainsArray=r.getBinarySize=r.padToEven=r.stripHexPrefix=r.isHexPrefixed=void 0,r.isHexPrefixed=t;function n(e){let t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received "+typeof t);return t.length%2&&(t=`0${t}`),t}r.stripHexPrefix=e=>{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return t(e)?e.slice(2):e},r.padToEven=n,r.getBinarySize=function(t){if("string"!=typeof t)throw new Error("[getBinarySize] method requires input type 'string', received "+typeof t);return e.byteLength(t,"utf8")},r.arrayContainsArray=function(e,t,r){if(!0!==Array.isArray(e))throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof e}'`);if(!0!==Array.isArray(t))throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof t}'`);return t[!0===r?"some":"every"]((t=>e.indexOf(t)>=0))},r.toAscii=function(e){let t="",r=0;const n=e.length;for("0x"===e.substring(0,2)&&(r=2);r<n;r+=2){const n=parseInt(e.substr(r,2),16);t+=String.fromCharCode(n)}return t},r.fromUtf8=function(t){return`0x${n(e.from(t,"utf8").toString("hex")).replace(/^0+|0+$/g,"")}`},r.fromAscii=function(e){let t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r).toString(16);t+=n.length<2?`0${n}`:n}return`0x${t}`},r.getKeys=function(e,t,r){if(!Array.isArray(e))throw new Error("[getKeys] method expects input 'params' to be an array, got "+typeof e);if("string"!=typeof t)throw new Error("[getKeys] method expects input 'key' to be type 'string', got "+typeof e);const n=[];for(let s=0;s<e.length;s++){let i=e[s][t];if(!0!==r||i){if("string"!=typeof i)throw new Error("invalid abi - expected type 'string', received "+typeof i)}else i="";n.push(i)}return n},r.isHexString=function(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&!(void 0!==t&&t>0&&e.length!==2+2*t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/internal.js"}],[1616,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Lock=void 0;r.Lock=class{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise((e=>this.promiseResolverQueue.push(e)))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(1===this.permits&&this.promiseResolverQueue.length>0){this.permits-=1;const e=this.promiseResolverQueue.shift();e&&e(!0)}}}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/lock.js"}],[1617,{"micro-ftch":4910},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getProvider=r.fetchFromProvider=void 0;const n=e("micro-ftch");r.fetchFromProvider=async(e,t)=>(await(0,n.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:t.method,params:t.params,jsonrpc:"2.0",id:1}})).result;r.getProvider=e=>{if("string"==typeof e)return e;if(e?.connection?.url!==undefined)return e.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/provider.js"}],[1618,{"./bytes":1610,"./constants":1611,"./helpers":1613,buffer:4074,"ethereum-cryptography/keccak":4300,"ethereum-cryptography/secp256k1":4317},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.hashPersonalMessage=r.isValidSignature=r.fromRpcSig=r.toCompactSig=r.toRpcSig=r.ecrecover=r.ecsign=void 0;const n=e("ethereum-cryptography/keccak"),s=e("ethereum-cryptography/secp256k1"),i=e("./bytes"),a=e("./constants"),o=e("./helpers");function c(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===undefined?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function u(e){return e===BigInt(0)||e===BigInt(1)}r.ecsign=function(e,r,n){const i=s.secp256k1.sign(e,r),a=i.toCompactRawBytes();return{r:t.from(a.slice(0,32)),s:t.from(a.slice(32,64)),v:n===undefined?BigInt(i.recovery+27):BigInt(i.recovery+35)+BigInt(n)*BigInt(2)}};r.ecrecover=function(e,r,n,a,o){const l=t.concat([(0,i.setLengthLeft)(n,32),(0,i.setLengthLeft)(a,32)],64),d=c(r,o);if(!u(d))throw new Error("Invalid signature v value");const h=s.secp256k1.Signature.fromCompact(l).addRecoveryBit(Number(d)).recoverPublicKey(e);return t.from(h.toRawBytes(!1).slice(1))};r.toRpcSig=function(e,r,n,s){if(!u(c(e,s)))throw new Error("Invalid signature v value");return(0,i.bufferToHex)(t.concat([(0,i.setLengthLeft)(r,32),(0,i.setLengthLeft)(n,32),(0,i.toBuffer)(e)]))};r.toCompactSig=function(e,r,n,s){if(!u(c(e,s)))throw new Error("Invalid signature v value");let a=n;return(e>BigInt(28)&&e%BigInt(2)===BigInt(1)||e===BigInt(1)||e===BigInt(28))&&(a=t.from(n),a[0]|=128),(0,i.bufferToHex)(t.concat([(0,i.setLengthLeft)(r,32),(0,i.setLengthLeft)(a,32)]))};r.fromRpcSig=function(e){const t=(0,i.toBuffer)(e);let r,n,s;if(t.length>=65)r=t.slice(0,32),n=t.slice(32,64),s=(0,i.bufferToBigInt)(t.slice(64));else{if(64!==t.length)throw new Error("Invalid signature length");r=t.slice(0,32),n=t.slice(32,64),s=BigInt((0,i.bufferToInt)(t.slice(32,33))>>7),n[0]&=127}return s<27&&(s+=BigInt(27)),{v:s,r:r,s:n}};r.isValidSignature=function(e,t,r,n=!0,s){if(32!==t.length||32!==r.length)return!1;if(!u(c(e,s)))return!1;const o=(0,i.bufferToBigInt)(t),l=(0,i.bufferToBigInt)(r);return!(o===BigInt(0)||o>=a.SECP256K1_ORDER||l===BigInt(0)||l>=a.SECP256K1_ORDER)&&!(n&&l>=a.SECP256K1_ORDER_DIV_2)};r.hashPersonalMessage=function(e){(0,o.assertIsBuffer)(e);const r=t.from(`Ethereum Signed Message:\n${e.length}`,"utf-8");return t.from((0,n.keccak256)(t.concat([r,e])))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/signature.js"}],[1619,{"./bytes":1610,"./internal":1615},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.toType=r.TypeOutput=void 0;const n=e("./bytes"),s=e("./internal");var i;!function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(i=r.TypeOutput||(r.TypeOutput={})),r.toType=function(e,t){if(null===e)return null;if(e===undefined)return undefined;if("string"==typeof e&&!(0,s.isHexString)(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const r=(0,n.toBuffer)(e);switch(t){case i.Buffer:return r;case i.BigInt:return(0,n.bufferToBigInt)(r);case i.Number:{const e=(0,n.bufferToBigInt)(r);if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(e)}case i.PrefixedHexString:return(0,n.bufferToHex)(r);default:throw new Error("unknown outputType")}}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/types.js"}],[162,{"./snap-keyring":165,"./utils":167},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getAccountsBySnapId",{enumerable:!0,get:function(){return s.getAccountsBySnapId}}),Object.defineProperty(r,"snapKeyringBuilder",{enumerable:!0,get:function(){return n.snapKeyringBuilder}});var n=e("./snap-keyring"),s=e("./utils")}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/index.ts"}],[1620,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.GWEI_TO_WEI=void 0,r.GWEI_TO_WEI=BigInt(1e9)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/units.js"}],[1621,{"./address":1608,"./bytes":1610,"./types":1619,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.Withdrawal=void 0;const n=e("./address"),s=e("./bytes"),i=e("./types");class a{constructor(e,t,r,n){this.index=e,this.validatorIndex=t,this.address=r,this.amount=n}static fromWithdrawalData(e){const{index:t,validatorIndex:r,address:s,amount:o}=e,c=(0,i.toType)(t,i.TypeOutput.BigInt),u=(0,i.toType)(r,i.TypeOutput.BigInt),l=new n.Address((0,i.toType)(s,i.TypeOutput.Buffer)),d=(0,i.toType)(o,i.TypeOutput.BigInt);return new a(c,u,l,d)}static fromValuesArray(e){if(4!==e.length)throw Error(`Invalid withdrawalArray length expected=4 actual=${e.length}`);const[t,r,n,s]=e;return a.fromWithdrawalData({index:t,validatorIndex:r,address:n,amount:s})}static toBufferArray(e){const{index:r,validatorIndex:s,address:a,amount:o}=e,c=(0,i.toType)(r,i.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,i.toType)(r,i.TypeOutput.Buffer),u=(0,i.toType)(s,i.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,i.toType)(s,i.TypeOutput.Buffer);let l;l=a instanceof n.Address?a.buf:(0,i.toType)(a,i.TypeOutput.Buffer);return[c,u,l,(0,i.toType)(o,i.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,i.toType)(o,i.TypeOutput.Buffer)]}raw(){return a.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,s.bigIntToHex)(this.index),validatorIndex:(0,s.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,s.bigIntToHex)(this.amount)}}}r.Withdrawal=a}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@ethereumjs/util/dist/withdrawal.js"}],[1622,{"./errors":1623,"./packer":1626,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.decodeSingle=r.decode=r.encodePacked=r.encodeSingle=r.encode=void 0;const n=e("@metamask/utils"),s=e("./errors"),i=e("./packer");r.encode=(e,t,r,n)=>{try{return(0,i.pack)({types:e,values:t,packed:r,tight:n})}catch(e){if(e instanceof s.ParserError)throw new s.ParserError(`Unable to encode value: ${e.message}`,e);throw new s.ParserError(`An unexpected error occurred: ${(0,s.getErrorMessage)(e)}`,e)}};r.encodeSingle=(e,t)=>(0,r.encode)([e],[t]);r.encodePacked=(e,t,n)=>(0,r.encode)(e,t,!0,n);r.decode=(e,t)=>{const r=(0,n.createBytes)(t);try{return(0,i.unpack)(e,r)}catch(e){if(e instanceof s.ParserError)throw new s.ParserError(`Unable to decode value: ${e.message}`,e);throw new s.ParserError(`An unexpected error occurred: ${(0,s.getErrorMessage)(e)}`,e)}};r.decodeSingle=(e,t)=>{const i=(0,r.decode)([e],t);return(0,n.assert)(1===i.length,new s.ParserError("Decoded value array has unexpected length.")),i[0]}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/abi.js"}],[1623,{"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.ParserError=r.getErrorStack=r.getErrorMessage=void 0;const n=e("@metamask/utils");r.getErrorMessage=e=>"string"==typeof e?e:e instanceof Error||(0,n.isObject)(e)&&(0,n.hasProperty)(e,"message")&&"string"==typeof e.message?e.message:"Unknown error.";r.getErrorStack=e=>e instanceof Error?e.stack:undefined;class s extends Error{constructor(e,t){super(e),this.name="ParserError";const n=(0,r.getErrorStack)(t);n&&(this.stack=n)}}r.ParserError=s}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/errors.js"}],[1624,{"./abi":1622,"./errors":1623,"./types":1639},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),s(e("./abi"),r),s(e("./errors"),r),s(e("./types"),r)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/index.js"}],[1625,{"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.iterate=void 0;const n=e("@metamask/utils");r.iterate=function*(e,t=32){for(let r=0;r<e.length;r+=t){const s=e=>{(0,n.assert)(e>=0,"Cannot skip a negative number of bytes."),(0,n.assert)(e%t==0,"Length must be a multiple of the size."),r+=e},i=e.subarray(r);yield{skip:s,value:i}}return{skip:()=>undefined,value:new Uint8Array}}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/iterator.js"}],[1626,{"./errors":1623,"./iterator":1625,"./parsers":1633,"./utils":1641,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.unpack=r.pack=r.isDynamicParser=r.getParser=void 0;const n=e("@metamask/utils"),s=e("./errors"),i=e("./iterator"),a=e("./parsers"),o=e("./utils");r.getParser=e=>{const t={address:a.address,array:a.array,bool:a.bool,bytes:a.bytes,fixedBytes:a.fixedBytes,function:a.fn,number:a.number,string:a.string,tuple:a.tuple},r=t[e];if(r)return r;const n=Object.values(t).find((t=>t.isType(e)));if(n)return n;throw new s.ParserError(`The type "${e}" is not supported.`)};r.isDynamicParser=(e,t)=>{const{isDynamic:r}=e;return"function"==typeof r?r(t):r};r.pack=({types:e,values:t,packed:i=!1,tight:a=!1,arrayPacked:c=!1,byteArray:u=new Uint8Array})=>{(0,n.assert)(e.length===t.length,new s.ParserError(`The number of types (${e.length}) does not match the number of values (${t.length}).`));const{staticBuffer:l,dynamicBuffer:d,pointers:h}=e.reduce((({staticBuffer:e,dynamicBuffer:s,pointers:o},u,l)=>{const d=(0,r.getParser)(u),h=t[l];if(i||c||!(0,r.isDynamicParser)(d,u))return{staticBuffer:d.encode({buffer:e,value:h,type:u,packed:i,tight:a}),dynamicBuffer:s,pointers:o};return{staticBuffer:(0,n.concatBytes)([e,new Uint8Array(32)]),dynamicBuffer:d.encode({buffer:s,value:h,type:u,packed:i,tight:a}),pointers:[...o,{position:e.length,pointer:s.length}]}}),{staticBuffer:new Uint8Array,dynamicBuffer:new Uint8Array,pointers:[]});(0,n.assert)(!i&&!c||0===d.length,new s.ParserError("Invalid pack state."));const f=l.length,p=h.reduce(((e,{pointer:t,position:r})=>{const s=(0,o.padStart)((0,n.numberToBytes)(f+t));return(0,o.set)(e,s,r)}),l);return(0,n.concatBytes)([u,p,d])};r.unpack=(e,t)=>{const a=(0,i.iterate)(t);return e.map((e=>{const{value:{value:i,skip:o},done:c}=a.next();(0,n.assert)(!c,new s.ParserError(`The encoded value is invalid for the provided types. Reached end of buffer while attempting to parse "${e}".`));const u=(0,r.getParser)(e);if((0,r.isDynamicParser)(u,e)){const r=(0,n.bytesToNumber)(i.subarray(0,32)),s=t.subarray(r);return u.decode({type:e,value:s,skip:o})}return u.decode({type:e,value:i,skip:o})}))}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/packer.js"}],[1627,{"../errors":1623,"../utils":1641,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.address=r.getAddress=void 0;const n=e("@metamask/utils"),s=e("../errors"),i=e("../utils");r.getAddress=e=>{const t=(0,n.createBytes)(e);return(0,n.assert)(t.length<=20,new s.ParserError(`Invalid address value. Expected address to be 20 bytes long, but received ${t.length} bytes.`)),(0,i.padStart)(t,20)},r.address={isDynamic:!1,isType:e=>"address"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:s}){const a=(0,r.getAddress)(t);if(s)return(0,n.concatBytes)([e,a]);const o=(0,i.padStart)(a);return(0,n.concatBytes)([e,o])},decode:({value:e})=>(0,n.add0x)((0,n.bytesToHex)(e.slice(12,32)))}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/parsers/address.js"}],[1628,{"../errors":1623,"../packer":1626,"../utils":1641,"./fixed-bytes":1631,"./tuple":1637,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.array=r.getTupleType=r.getArrayType=r.isArrayType=void 0;const n=e("@metamask/utils"),s=e("../errors"),i=e("../packer"),a=e("../utils"),o=e("./fixed-bytes"),c=e("./tuple"),u=/^(?<type>.*)\[(?<length>\d*?)\]$/u;r.isArrayType=e=>u.test(e);r.getArrayType=e=>{const t=e.match(u);return(0,n.assert)(t?.groups?.type,new s.ParserError(`Invalid array type. Expected an array type, but received "${e}".`)),[t.groups.type,t.groups.length?parseInt(t.groups.length,10):undefined]};r.getTupleType=(e,t)=>`(${new Array(t).fill(e).join(",")})`,r.array={isDynamic(e){const[t,n]=(0,r.getArrayType)(e);return n===undefined||(0,i.isDynamicParser)((0,i.getParser)(t),t)},isType:e=>(0,r.isArrayType)(e),getByteLength(e){(0,n.assert)((0,r.isArrayType)(e),new s.ParserError(`Expected an array type, but received "${e}".`));const[t,a]=(0,r.getArrayType)(e);return(0,i.isDynamicParser)(this,e)||a===undefined?32:c.tuple.getByteLength((0,r.getTupleType)(t,a))},encode({type:e,buffer:t,value:u,packed:l,tight:d}){const[h,f]=(0,r.getArrayType)(e);if((0,n.assert)(!l||!(0,r.isArrayType)(h),new s.ParserError("Cannot pack nested arrays.")),l&&(0,i.isDynamicParser)((0,i.getParser)(h),h))return(0,i.pack)({types:new Array(u.length).fill(h),values:u,byteArray:t,packed:l,arrayPacked:!0,tight:d});if(f)return(0,n.assert)(f===u.length,new s.ParserError(`Array length does not match type length. Expected a length of ${f}, but received ${u.length}.`)),c.tuple.encode({type:(0,r.getTupleType)(h,f),buffer:t,value:u,packed:o.fixedBytes.isType(h)&&d,tight:d});if(l)return(0,i.pack)({types:new Array(u.length).fill(h),values:u,byteArray:t,packed:o.fixedBytes.isType(h)&&d,arrayPacked:!0,tight:d});const p=(0,a.padStart)((0,n.numberToBytes)(u.length));return(0,i.pack)({types:new Array(u.length).fill(h),values:u,byteArray:(0,n.concatBytes)([t,p]),packed:l,tight:d})},decode({type:e,value:t,...a}){const[o,u]=(0,r.getArrayType)(e);if(u){const e=c.tuple.decode({type:(0,r.getTupleType)(o,u),value:t,...a});return(0,n.assert)(e.length===u,new s.ParserError(`Array length does not match type length. Expected a length of ${u}, but received ${e.length}.`)),e}const l=(0,n.bytesToNumber)(t.subarray(0,32));return(0,i.unpack)(new Array(l).fill(o),t.subarray(32))}}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/parsers/array.js"}],[1629,{"../errors":1623,"./number":1634,"@metamask/superstruct":2872,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.bool=r.getBooleanValue=void 0;const n=e("@metamask/superstruct"),s=e("@metamask/utils"),i=e("../errors"),a=e("./number"),o=(0,n.coerce)((0,n.boolean)(),(0,n.union)([(0,n.literal)("true"),(0,n.literal)("false")]),(e=>"true"===e));r.getBooleanValue=e=>{try{return(0,n.create)(e,o)?BigInt(1):BigInt(0)}catch{throw new i.ParserError(`Invalid boolean value. Expected a boolean literal, or the string "true" or "false", but received "${e}".`)}},r.bool={isDynamic:!1,isType:e=>"bool"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:n,tight:i}){const o=(0,r.getBooleanValue)(t);return n?(0,s.concatBytes)([e,(0,s.bigIntToBytes)(o)]):a.number.encode({type:"uint256",buffer:e,value:o,packed:n,tight:i})},decode:e=>a.number.decode({...e,type:"uint256"})===BigInt(1)}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/parsers/bool.js"}],[163,{"@metamask/keyring-api":1983,"@metamask/permission-controller":2393},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.isProtocolAllowed=l,r.keyringSnapPermissionsBuilder=function(e,t){return()=>{if("metamask"===t)return a;if(i.includes(t))return c;const r=e.getSubjectMetadata(t);return(null==r?void 0:r.subjectType)===n.SubjectType.Website&&l(t)?o:[]}};var n=e("@metamask/permission-controller"),s=e("@metamask/keyring-api");const i=["https://portfolio.metamask.io"],a=[s.KeyringRpcMethod.ListAccounts,s.KeyringRpcMethod.GetAccount,s.KeyringRpcMethod.FilterAccountChains,s.KeyringRpcMethod.DeleteAccount,s.KeyringRpcMethod.ListRequests,s.KeyringRpcMethod.GetRequest,s.KeyringRpcMethod.SubmitRequest,s.KeyringRpcMethod.RejectRequest],o=[s.KeyringRpcMethod.ListAccounts,s.KeyringRpcMethod.GetAccount,s.KeyringRpcMethod.CreateAccount,s.KeyringRpcMethod.FilterAccountChains,s.KeyringRpcMethod.UpdateAccount,s.KeyringRpcMethod.DeleteAccount,s.KeyringRpcMethod.ExportAccount,s.KeyringRpcMethod.ListRequests,s.KeyringRpcMethod.GetRequest,s.KeyringRpcMethod.ApproveRequest,s.KeyringRpcMethod.RejectRequest],c=[s.KeyringRpcMethod.ListAccounts,s.KeyringRpcMethod.GetAccount,s.KeyringRpcMethod.GetAccountBalances,s.KeyringRpcMethod.SubmitRequest],u=["https:"];function l(e){try{const t=new URL(e);return u.includes(t.protocol)}catch(e){return!1}}}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/keyring-snaps-permissions.ts"}],[1630,{"../utils":1641,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.bytes=void 0;const n=e("@metamask/utils"),s=e("../utils");r.bytes={isDynamic:!0,isType:e=>"bytes"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:r}){const i=(0,n.createBytes)(t);if(r)return(0,n.concatBytes)([e,i]);const a=32*Math.ceil(i.byteLength/32);return(0,n.concatBytes)([e,(0,s.padStart)((0,n.numberToBytes)(i.byteLength)),(0,s.padEnd)(i,a)])},decode({value:e}){const t=e.subarray(0,32),r=(0,n.bytesToNumber)(t);return e.slice(32,32+r)}}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/parsers/bytes.js"}],[1631,{"../errors":1623,"../utils":1641,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.fixedBytes=r.getByteLength=void 0;const n=e("@metamask/utils"),s=e("../errors"),i=e("../utils"),a=/^bytes([0-9]{1,2})$/u;r.getByteLength=e=>{const t=e.match(a)?.[1];(0,n.assert)(t,`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`);const r=Number(t);return(0,n.assert)(r>0&&r<=32,new s.ParserError(`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`)),r},r.fixedBytes={isDynamic:!1,isType:e=>a.test(e),getByteLength:()=>32,encode({type:e,buffer:t,value:a,packed:o}){const c=(0,r.getByteLength)(e),u=(0,n.createBytes)(a);return(0,n.assert)(u.length<=c,new s.ParserError(`Expected a value of length ${c}, but received a value of length ${u.length}.`)),o?(0,n.concatBytes)([t,(0,i.padEnd)(u,c)]):(0,n.concatBytes)([t,(0,i.padEnd)(u)])},decode({type:e,value:t}){const n=(0,r.getByteLength)(e);return t.slice(0,n)}}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/parsers/fixed-bytes.js"}],[1632,{"../errors":1623,"./fixed-bytes":1631,"@metamask/superstruct":2872,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.fn=r.getFunction=void 0;const n=e("@metamask/superstruct"),s=e("@metamask/utils"),i=e("../errors"),a=e("./fixed-bytes"),o=(0,n.coerce)((0,n.object)({address:s.StrictHexStruct,selector:s.StrictHexStruct}),(0,n.union)([s.StrictHexStruct,(0,n.instance)(Uint8Array)]),(e=>{const t=(0,s.createBytes)(e);return(0,s.assert)(24===t.length,new i.ParserError(`Invalid Solidity function. Expected function to be 24 bytes long, but received ${t.length} bytes.`)),{address:(0,s.bytesToHex)(t.subarray(0,20)),selector:(0,s.bytesToHex)(t.subarray(20,24))}}));r.getFunction=e=>{const t=(0,n.create)(e,o);return(0,s.concatBytes)([(0,s.hexToBytes)(t.address),(0,s.hexToBytes)(t.selector)])},r.fn={isDynamic:!1,isType:e=>"function"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:n,tight:s}){const i=(0,r.getFunction)(t);return a.fixedBytes.encode({type:"bytes24",buffer:e,value:i,packed:n,tight:s})},decode:({value:e})=>({address:(0,s.bytesToHex)(e.slice(0,20)),selector:(0,s.bytesToHex)(e.slice(20,24))})}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/parsers/function.js"}],[1633,{"./address":1627,"./array":1628,"./bool":1629,"./bytes":1630,"./fixed-bytes":1631,"./function":1632,"./number":1634,"./parser":1635,"./string":1636,"./tuple":1637},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),s(e("./address"),r),s(e("./array"),r),s(e("./bool"),r),s(e("./bytes"),r),s(e("./fixed-bytes"),r),s(e("./function"),r),s(e("./number"),r),s(e("./parser"),r),s(e("./string"),r),s(e("./tuple"),r)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/parsers/index.js"}],[1634,{"../errors":1623,"../utils":1641,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.number=r.getBigInt=r.assertNumberLength=r.getLength=r.isSigned=void 0;const n=e("@metamask/utils"),s=e("../errors"),i=e("../utils"),a=/^u?int(?<length>[0-9]*)?$/u;r.isSigned=e=>!e.startsWith("u");r.getLength=e=>{if("int"===e||"uint"===e)return 256;const t=e.match(a);(0,n.assert)(t?.groups?.length,new s.ParserError(`Invalid number type. Expected a number type, but received "${e}".`));const r=parseInt(t.groups.length,10);return(0,n.assert)(r>=8&&r<=256,new s.ParserError(`Invalid number length. Expected a number between 8 and 256, but received "${e}".`)),(0,n.assert)(r%8==0,new s.ParserError(`Invalid number length. Expected a multiple of 8, but received "${e}".`)),r};r.assertNumberLength=(e,t)=>{const i=(0,r.getLength)(t),a=BigInt(2)**BigInt(i-((0,r.isSigned)(t)?1:0))-BigInt(1);(0,r.isSigned)(t)?(0,n.assert)(e>=-(a+BigInt(1))&&e<=a,new s.ParserError(`Number "${e}" is out of range for type "${t}".`)):(0,n.assert)(e<=a,new s.ParserError(`Number "${e}" is out of range for type "${t}".`))};r.getBigInt=e=>{try{return(0,n.createBigInt)(e)}catch{throw new s.ParserError(`Invalid number. Expected a valid number value, but received "${e}".`)}},r.number={isDynamic:!1,isType:e=>a.test(e),getByteLength:()=>32,encode({type:e,buffer:t,value:s,packed:a}){const o=(0,r.getBigInt)(s);if((0,r.assertNumberLength)(o,e),(0,r.isSigned)(e)){if(a){const s=(0,r.getLength)(e)/8;return(0,n.concatBytes)([t,(0,n.signedBigIntToBytes)(o,s)])}return(0,n.concatBytes)([t,(0,i.padStart)((0,n.signedBigIntToBytes)(o,32))])}if(a){const s=(0,r.getLength)(e)/8;return(0,n.concatBytes)([t,(0,i.padStart)((0,n.bigIntToBytes)(o),s)])}return(0,n.concatBytes)([t,(0,i.padStart)((0,n.bigIntToBytes)(o))])},decode({type:e,value:t}){const s=t.subarray(0,32);if((0,r.isSigned)(e)){const t=(0,n.bytesToSignedBigInt)(s);return(0,r.assertNumberLength)(t,e),t}const i=(0,n.bytesToBigInt)(s);return(0,r.assertNumberLength)(i,e),i}}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/parsers/number.js"}],[1635,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0})}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/parsers/parser.js"}],[1636,{"./bytes":1630,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.string=void 0;const n=e("@metamask/utils"),s=e("./bytes");r.string={isDynamic:!0,isType:e=>"string"===e,getByteLength:()=>32,encode:({buffer:e,value:t,packed:r,tight:i})=>s.bytes.encode({type:"bytes",buffer:e,value:(0,n.stringToBytes)(t),packed:r,tight:i}),decode:e=>(0,n.bytesToString)(s.bytes.decode(e))}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/parsers/string.js"}],[1637,{"../errors":1623,"../packer":1626,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.tuple=r.getTupleElements=void 0;const n=e("@metamask/utils"),s=e("../errors"),i=e("../packer"),a=/^\((.+)\)$/u;r.getTupleElements=e=>{(0,n.assert)(e.startsWith("(")&&e.endsWith(")"),new s.ParserError(`Invalid tuple type. Expected tuple type, but received "${e}".`));const t=[];let r="",i=0;for(let n=1;n<e.length-1;n++){const s=e[n];","===s&&0===i?(t.push(r.trim()),r=""):(r+=s,"("===s?i+=1:")"===s&&(i-=1))}return r.trim()&&t.push(r.trim()),t},r.tuple={isDynamic:e=>(0,r.getTupleElements)(e).some((e=>{const t=(0,i.getParser)(e);return(0,i.isDynamicParser)(t,e)})),isType:e=>(e=>a.test(e))(e),getByteLength(e){if((0,i.isDynamicParser)(this,e))return 32;return(0,r.getTupleElements)(e).reduce(((e,t)=>e+(0,i.getParser)(t).getByteLength(t)),0)},encode({type:e,buffer:t,value:n,packed:s,tight:a}){const o=(0,r.getTupleElements)(e);return(0,i.pack)({types:o,values:n,byteArray:t,packed:s,tight:a})},decode({type:e,value:t,skip:n}){const s=(0,r.getTupleElements)(e);return n(this.getByteLength(e)-32),(0,i.unpack)(s,t)}}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/parsers/tuple.js"}],[1638,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0})}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/types/abi.js"}],[1639,{"./abi":1638},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),s(e("./abi"),r)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/types/index.js"}],[164,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getSnapAndHardwareInfoForMetrics=async function(e,t,r,n){var s,i,a;if(!n)return{};const o=n.call("AccountsController:getSelectedAccount"),c=o.address;let u;var l;null!==(s=o.metadata.snap)&&void 0!==s&&s.id&&(u=n.call("SnapController:get",null===(l=o.metadata.snap)||void 0===l?void 0:l.id));return{account_type:await e(c),device_model:await t(c),account_hardware_type:await r(c),account_snap_type:null===(i=u)||void 0===i?void 0:i.id,account_snap_version:null===(a=u)||void 0===a?void 0:a.version}}}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/metrics.ts"}],[1640,{"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.padEnd=r.padStart=r.set=void 0;const n=e("@metamask/utils");r.set=(e,t,r)=>(0,n.concatBytes)([e.subarray(0,r),t,e.subarray(r+t.length)]);r.padStart=(e,t=32)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,n.concatBytes)([r,e])};r.padEnd=(e,t=32)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,n.concatBytes)([e,r])}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/utils/buffer.js"}],[1641,{"./buffer":1640},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),s(e("./buffer"),r)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/abi-utils/dist/utils/index.js"}],[1642,{"./utils":1647,"@scure/base":3027,buffer:4074,tweetnacl:5616},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return s(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.getEncryptionPublicKey=r.decryptSafely=r.decrypt=r.encryptSafely=r.encrypt=void 0;const a=e("@scure/base"),o=i(e("tweetnacl")),c=e("./utils");function u({publicKey:e,data:t,version:r}){if((0,c.isNullish)(e))throw new Error("Missing publicKey parameter");if((0,c.isNullish)(t))throw new Error("Missing data parameter");if((0,c.isNullish)(r))throw new Error("Missing version parameter");if("x25519-xsalsa20-poly1305"===r){if("string"!=typeof t)throw new Error("Message data must be given as a string");const r=o.box.keyPair();let n;try{n=a.base64.decode(e)}catch(e){throw new Error("Bad public key")}const s=a.utf8.decode(t),i=o.randomBytes(o.box.nonceLength),c=o.box(s,i,n,r.secretKey);return{version:"x25519-xsalsa20-poly1305",nonce:a.base64.encode(i),ephemPublicKey:a.base64.encode(r.publicKey),ciphertext:a.base64.encode(c)}}throw new Error("Encryption type/version not supported")}function l({encryptedData:e,privateKey:r}){if((0,c.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,c.isNullish)(r))throw new Error("Missing privateKey parameter");if("x25519-xsalsa20-poly1305"===e.version){const n=t.from(r,"hex"),s=o.box.keyPair.fromSecretKey(n).secretKey,i=a.base64.decode(e.nonce),c=a.base64.decode(e.ciphertext),u=a.base64.decode(e.ephemPublicKey),l=o.box.open(c,i,u,s);try{if(!l)throw new Error;const e=a.utf8.encode(l);if(!e)throw new Error;return e}catch(e){if(e&&"string"==typeof e.message&&e.message.length)throw new Error(`Decryption failed: ${e.message}`);throw new Error("Decryption failed.")}}throw new Error("Encryption type/version not supported.")}r.encrypt=u,r.encryptSafely=function({publicKey:e,data:r,version:n}){if((0,c.isNullish)(e))throw new Error("Missing publicKey parameter");if((0,c.isNullish)(r))throw new Error("Missing data parameter");if((0,c.isNullish)(n))throw new Error("Missing version parameter");if("object"==typeof r&&r&&"toJSON"in r)throw new Error("Cannot encrypt with toJSON property. Please remove toJSON property");const s={data:r,padding:""},i=t.byteLength(JSON.stringify(s),"utf-8")%2048;let a=0;return i>0&&(a=2048-i-16),s.padding="0".repeat(a),u({publicKey:e,data:JSON.stringify(s),version:n})},r.decrypt=l,r.decryptSafely=function({encryptedData:e,privateKey:t}){if((0,c.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,c.isNullish)(t))throw new Error("Missing privateKey parameter");return JSON.parse(l({encryptedData:e,privateKey:t})).data},r.getEncryptionPublicKey=function(e){const r=t.from(e,"hex"),n=o.box.keyPair.fromSecretKey(r).publicKey;return a.base64.encode(n)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/eth-sig-util/dist/encryption.js"}],[1643,{"./encryption":1642,"./personal-sign":1644,"./sign-eip7702-authorization":1645,"./sign-typed-data":1646,"./utils":1647},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.normalize=r.concatSig=void 0,s(e("./personal-sign"),r),s(e("./sign-typed-data"),r),s(e("./encryption"),r),s(e("./sign-eip7702-authorization"),r);var i=e("./utils");Object.defineProperty(r,"concatSig",{enumerable:!0,get:function(){return i.concatSig}}),Object.defineProperty(r,"normalize",{enumerable:!0,get:function(){return i.normalize}})}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/eth-sig-util/dist/index.js"}],[1644,{"./utils":1647,"@ethereumjs/util":1614},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.extractPublicKey=r.recoverPersonalSignature=r.personalSign=void 0;const n=e("@ethereumjs/util"),s=e("./utils");function i(e,t){const r=(0,n.hashPersonalMessage)((0,s.legacyToBuffer)(e));return(0,s.recoverPublicKey)(r,t)}r.personalSign=function({privateKey:e,data:t}){if((0,s.isNullish)(t))throw new Error("Missing data parameter");if((0,s.isNullish)(e))throw new Error("Missing privateKey parameter");const r=(0,s.legacyToBuffer)(t),i=(0,n.hashPersonalMessage)(r),a=(0,n.ecsign)(i,e);return(0,s.concatSig)((0,n.toBuffer)(a.v),a.r,a.s)},r.recoverPersonalSignature=function({data:e,signature:t}){if((0,s.isNullish)(e))throw new Error("Missing data parameter");if((0,s.isNullish)(t))throw new Error("Missing signature parameter");const r=i(e,t),a=(0,n.publicToAddress)(r);return(0,n.bufferToHex)(a)},r.extractPublicKey=function({data:e,signature:t}){if((0,s.isNullish)(e))throw new Error("Missing data parameter");if((0,s.isNullish)(t))throw new Error("Missing signature parameter");return`0x${i(e,t).toString("hex")}`}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/eth-sig-util/dist/personal-sign.js"}],[1645,{"./utils":1647,"@ethereumjs/rlp":429,"@ethereumjs/util":1614,"@metamask/utils":2950,buffer:4074,"ethereum-cryptography/keccak":4300},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.hashEIP7702Authorization=r.recoverEIP7702Authorization=r.signEIP7702Authorization=void 0;const n=e("@ethereumjs/rlp"),s=e("@ethereumjs/util"),i=e("@metamask/utils"),a=e("ethereum-cryptography/keccak"),o=e("./utils");function c(e){u(e);const r=(0,n.encode)(e),s=t.concat([t.from("05","hex"),r]);return t.from((0,a.keccak256)(s))}function u(e){if((0,o.isNullish)(e))throw new Error("Missing authorization parameter");const[t,r,n]=e;if((0,o.isNullish)(t))throw new Error("Missing chainId parameter");if((0,o.isNullish)(r))throw new Error("Missing contractAddress parameter");if((0,o.isNullish)(n))throw new Error("Missing nonce parameter")}r.signEIP7702Authorization=function({privateKey:e,authorization:t}){if(u(t),(0,o.isNullish)(e))throw new Error("Missing privateKey parameter");const r=c(t),{r:n,s:i,v:a}=(0,s.ecsign)(r,e),l=(0,s.toBuffer)(a);return(0,o.concatSig)(l,n,i)},r.recoverEIP7702Authorization=function({signature:e,authorization:t}){if(u(t),(0,o.isNullish)(e))throw new Error("Missing signature parameter");const r=c(t),n=(0,o.recoverPublicKey)(r,e),a=(0,s.publicToAddress)(n);return(0,i.bytesToHex)(a)},r.hashEIP7702Authorization=c}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/eth-sig-util/dist/sign-eip7702-authorization.js"}],[1646,{"./utils":1647,"@ethereumjs/util":1614,"@metamask/abi-utils":1624,"@metamask/abi-utils/dist/parsers":1633,"@metamask/abi-utils/dist/utils":1641,"@metamask/utils":2950,"ethereum-cryptography/keccak":4300},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.recoverTypedSignature=r.signTypedData=r.typedSignatureHash=r.TypedDataUtils=r.TYPED_MESSAGE_SCHEMA=r.SignTypedDataVersion=void 0;const n=e("@ethereumjs/util"),s=e("@metamask/abi-utils"),i=e("@metamask/abi-utils/dist/parsers"),a=e("@metamask/abi-utils/dist/utils"),o=e("@metamask/utils"),c=e("ethereum-cryptography/keccak"),u=e("./utils");var l;function d(e,t){if(!Object.keys(l).includes(e))throw new Error(`Invalid version: '${e}'`);if(t&&!t.includes(e))throw new Error(`SignTypedDataVersion not allowed: '${e}'. Allowed versions are: ${t.join(", ")}`)}function h(e,t){(0,o.assert)(null!==t,`Unable to encode value: Invalid number. Expected a valid number value, but received "${t}".`);const r=BigInt(t),n=(0,i.getLength)(e),s=BigInt(2)**BigInt(n)-BigInt(1);return(0,o.assert)(r>=-s&&r<=s,`Unable to encode value: Number "${t}" is out of range for type "${e}".`),r}function f(e){let t=BigInt(0);for(let r=0;r<e.length;r++){const n=BigInt(e.charCodeAt(r)-48);t*=BigInt(10),t+=n>=49?n-BigInt(49)+BigInt(10):n>=17?n-BigInt(17)+BigInt(10):n}return(0,a.padStart)((0,o.bigIntToBytes)(t),20)}function p(e,t,r,i,u){if(d(u,[l.V3,l.V4]),e[r]!==undefined)return["bytes32",u===l.V4&&null==i?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,n.arrToBufArr)((0,c.keccak256)(m(r,i,e,u)))];if("function"===r)throw new Error('Unsupported or invalid type: "function"');if(i===undefined)throw new Error(`missing value for field ${t} of type ${r}`);if("address"===r){if("number"==typeof i)return["address",(0,a.padStart)((0,o.numberToBytes)(i),20)];if((0,o.isStrictHexString)(i))return["address",(0,o.add0x)(i)];if("string"==typeof i)return["address",f(i).subarray(0,20)]}if("bool"===r)return["bool",Boolean(i)];if("bytes"===r)return"number"==typeof i?i=(0,o.numberToBytes)(i):(0,o.isStrictHexString)(i)||"0x"===i?i=(0,o.hexToBytes)(i):"string"==typeof i&&(i=(0,o.stringToBytes)(i)),["bytes32",(0,n.arrToBufArr)((0,c.keccak256)(i))];if(r.startsWith("bytes")&&"bytes"!==r&&!r.includes("["))return"number"==typeof i?i<0?["bytes32",new Uint8Array(32)]:["bytes32",(0,o.bigIntToBytes)(BigInt(i))]:(0,o.isStrictHexString)(i)?["bytes32",(0,o.hexToBytes)(i)]:["bytes32",i];if(r.startsWith("int")&&!r.includes("[")){const e=h(r,i);return e>=BigInt(0)?["uint256",e]:["int256",e]}if("string"===r)return i="number"==typeof i?(0,o.numberToBytes)(i):(0,o.stringToBytes)(null!=i?i:""),["bytes32",(0,n.arrToBufArr)((0,c.keccak256)(i))];if(r.endsWith("]")){if(u===l.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const a=r.slice(0,r.lastIndexOf("[")),o=i.map((r=>p(e,t,a,r,u)));return["bytes32",(0,n.arrToBufArr)((0,c.keccak256)((0,s.encode)(o.map((([e])=>e)),o.map((([,e])=>e)))))]}return[r,i]}function m(e,t,r,i){d(i,[l.V3,l.V4]);const a=["bytes32"],o=[w(e,r)];for(const n of r[e]){if(i===l.V3&&t[n.name]===undefined)continue;const[e,s]=p(r,n.name,n.type,t[n.name],i);a.push(e),o.push(s)}return(0,n.arrToBufArr)((0,s.encode)(a,o))}function g(e,t){let r="";const n=y(e,t);n.delete(e);const s=[e,...Array.from(n).sort()];for(const e of s){if(!t[e])throw new Error(`No type definition specified: ${e}`);r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`}return r}function y(e,t,r=new Set){if("string"!=typeof e)throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(e)}`);const n=e.match(/^\w*/u);if([e]=n,r.has(e)||t[e]===undefined)return r;r.add(e);for(const n of t[e])y(n.type,t,r);return r}function b(e,t,r,s){d(s,[l.V3,l.V4]);const i=m(e,t,r,s),a=(0,c.keccak256)(i);return(0,n.arrToBufArr)(a)}function w(e,t){const r=(0,o.stringToBytes)(g(e,t));return(0,n.arrToBufArr)((0,c.keccak256)(r))}function A(e){const t={};for(const n in r.TYPED_MESSAGE_SCHEMA.properties)e[n]&&(t[n]=e[n]);return"types"in t&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t}function v(e,t){d(t,[l.V3,l.V4]);const r=A(e),{domain:n}=r;return b("EIP712Domain",n,{EIP712Domain:r.types.EIP712Domain},t)}function E(e,t){if((0,i.isArrayType)(e)&&Array.isArray(t)){const[r]=(0,i.getArrayType)(e);return t.map((e=>E(r,e)))}if("address"===e){if((0,o.isStrictHexString)(t))return(0,a.padStart)((0,o.hexToBytes)(t).subarray(0,20),20);if(t instanceof Uint8Array)return(0,a.padStart)(t.subarray(0,20),20)}if("bool"===e)return Boolean(t);if(e.startsWith("bytes")&&"bytes"!==e){const r=(0,i.getByteLength)(e);if("number"==typeof t)return t<0?new Uint8Array:(0,o.numberToBytes)(t).subarray(0,r);if((0,o.isStrictHexString)(t))return(0,o.hexToBytes)(t).subarray(0,r);if(t instanceof Uint8Array)return t.subarray(0,r)}if(e.startsWith("uint")&&"number"==typeof t)return Math.abs(t);if(e.startsWith("int")&&"number"==typeof t){const r=(0,i.getLength)(e);return BigInt.asIntN(r,BigInt(t))}return t}function k(e,t){return t.map((t=>{if("string"==typeof t||"number"==typeof t||"bigint"==typeof t){const r=h(e,t);if(r>=BigInt(0))return(0,a.padStart)((0,o.bigIntToBytes)(r),32);const n=(0,i.getLength)(e),s=BigInt.asIntN(n,r);return(0,o.signedBigIntToBytes)(s,32)}return t}))}function T(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!("length"in e)||!e.length)throw t;const r=e.map((({name:e,type:t,value:r})=>{if("address[]"===t)return{name:e,type:"bytes32[]",value:(n=r,n.map((e=>"number"==typeof e?(0,a.padStart)((0,o.numberToBytes)(e),32):(0,o.isStrictHexString)(e)?(0,a.padStart)((0,o.hexToBytes)(e).subarray(0,32),32):e instanceof Uint8Array?(0,a.padStart)(e.subarray(0,32),32):e)))};var n;if(t.startsWith("int")&&(0,i.isArrayType)(t)){const[n,s]=(0,i.getArrayType)(t);return{name:e,type:`bytes32[${null!=s?s:""}]`,value:k(n,r)}}return{name:e,type:t,value:E(t,r)}})),l=r.map((e=>"bytes"!==e.type?e.value:(0,u.legacyToBuffer)(e.value))),d=r.map((e=>{if("function"===e.type)throw new Error('Unsupported or invalid type: "function"');return e.type})),h=e.map((e=>{if(!e.name)throw t;return`${e.type} ${e.name}`}));return(0,n.arrToBufArr)((0,c.keccak256)((0,s.encodePacked)(["bytes32","bytes32"],[(0,c.keccak256)((0,s.encodePacked)(["string[]"],[h],!0)),(0,c.keccak256)((0,s.encodePacked)(d,l,!0))])))}!function(e){e.V1="V1",e.V3="V3",e.V4="V4"}(l=r.SignTypedDataVersion||(r.SignTypedDataVersion={})),r.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},r.TypedDataUtils={encodeData:m,encodeType:g,findTypeDependencies:y,hashStruct:b,hashType:w,sanitizeData:A,eip712Hash:function(e,t){d(t,[l.V3,l.V4]);const r=A(e),s=[(0,o.hexToBytes)("1901")];return s.push(v(e,t)),"EIP712Domain"!==r.primaryType&&s.push(b(r.primaryType,r.message,r.types,t)),(0,n.arrToBufArr)((0,c.keccak256)((0,o.concatBytes)(s)))},eip712DomainHash:v},r.typedSignatureHash=function(e){const t=T(e);return(0,o.bytesToHex)(t)},r.signTypedData=function({privateKey:e,data:t,version:s}){if(d(s),(0,u.isNullish)(t))throw new Error("Missing data parameter");if((0,u.isNullish)(e))throw new Error("Missing private key parameter");const i=s===l.V1?T(t):r.TypedDataUtils.eip712Hash(t,s),a=(0,n.ecsign)(i,e);return(0,u.concatSig)((0,n.arrToBufArr)((0,o.bigIntToBytes)(a.v)),a.r,a.s)},r.recoverTypedSignature=function({data:e,signature:t,version:s}){if(d(s),(0,u.isNullish)(e))throw new Error("Missing data parameter");if((0,u.isNullish)(t))throw new Error("Missing signature parameter");const i=s===l.V1?T(e):r.TypedDataUtils.eip712Hash(e,s),a=(0,u.recoverPublicKey)(i,t),c=(0,n.publicToAddress)(a);return(0,o.bytesToHex)(c)}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/eth-sig-util/dist/sign-typed-data.js"}],[1647,{"@ethereumjs/util":1614,"@metamask/utils":2950,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.normalize=r.recoverPublicKey=r.concatSig=r.legacyToBuffer=r.isNullish=r.padWithZeroes=void 0;const n=e("@ethereumjs/util"),s=e("@metamask/utils");function i(e,t){if(""!==e&&!/^[a-f0-9]+$/iu.test(e))throw new Error(`Expected an unprefixed hex string. Received: ${e}`);if(t<0)throw new Error(`Expected a non-negative integer target length. Received: ${t}`);return String.prototype.padStart.call(e,t,"0")}function a(e){return null===e||e===undefined}r.padWithZeroes=i,r.isNullish=a,r.legacyToBuffer=function(e){return"string"!=typeof e||(0,n.isHexString)(e)?(0,n.toBuffer)(e):t.from(e)},r.concatSig=function(e,t,r){const a=(0,n.fromSigned)(t),o=(0,n.fromSigned)(r),c=(0,n.bufferToInt)(e),u=i((0,n.toUnsigned)(a).toString("hex"),64),l=i((0,n.toUnsigned)(o).toString("hex"),64),d=(0,s.remove0x)((0,s.numberToHex)(c));return(0,s.add0x)(u.concat(l,d))},r.recoverPublicKey=function(e,t){const r=(0,n.fromRpcSig)(t);return(0,n.ecrecover)(e,r.v,r.r,r.s)},r.normalize=function(e){if(a(e))return undefined;if("number"==typeof e){if(e<0)return"0x";const t=(0,s.numberToBytes)(e);e=(0,s.bytesToHex)(t)}if("string"!=typeof e){let t="eth-sig-util.normalize() requires hex string or integer input.";throw t+=` received ${typeof e}: ${e}`,new Error(t)}return(0,s.add0x)(e.toLowerCase())}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/eth-sig-util/dist/utils.js"}],[165,{"../../../../shared/constants/app":5719,"../../../../shared/constants/metametrics":5730,"../../../../shared/lib/accounts":5754,"../../../../ui/components/component-library/icon":6313,"../../translate":366,"./snaps":166,"./utils/isBlockedUrl":168,"./utils/showResult":169,"@metamask/eth-snap-keyring":1792,"@metamask/snaps-utils":2850,"webextension-polyfill":5696},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.showAccountCreationDialog=A,r.showAccountNameSuggestionDialog=v,r.snapKeyringBuilder=function(e,t){const r=()=>new s.SnapKeyring(e,new _(e,t));return r.type=s.SnapKeyring.type,r};var n,s=e("@metamask/eth-snap-keyring"),i=(n=e("webextension-polyfill"))&&n.__esModule?n:{default:n},a=e("@metamask/snaps-utils"),o=e("../../../../shared/constants/metametrics"),c=e("../../../../shared/constants/app"),u=e("../../translate"),l=e("../../../../ui/components/component-library/icon"),d=e("../../../../shared/lib/accounts"),h=e("./utils/isBlockedUrl"),f=e("./utils/showResult"),p=e("./snaps");function m(e,t,r){g(e,t),t.set(e,r)}function g(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function y(e,t){return e.get(w(e,t))}function b(e,t,r){return e.set(w(e,t),r),r}function w(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}async function A(e,t){try{return Boolean(await t.call("ApprovalController:addRequest",{origin:e,type:c.SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountCreation},!0))}catch(e){throw new Error(`Error occurred while showing account creation dialog.\n${e}`)}}async function v(e,t,r){try{return await t.call("ApprovalController:addRequest",{origin:e,type:c.SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showNameSnapAccount,requestData:{snapSuggestedAccountName:r}},!0)}catch(e){throw new Error(`Error occurred while showing name account dialog.\n${e}`)}}var E=new WeakMap,k=new WeakMap,T=new WeakMap,P=new WeakMap,S=new WeakSet;class _{constructor(e,{trackEvent:t,persistKeyringHelper:r,removeAccountHelper:n}){!function(e,t){g(e,t),t.add(e)}(this,S),m(this,E,void 0),m(this,k,void 0),m(this,T,void 0),m(this,P,void 0),b(E,this,e),b(k,this,t),b(T,this,r),b(P,this,n)}async addressExists(e){return(await y(E,this).call("KeyringController:getAccounts")).includes(e.toLowerCase())}async redirectUser(e,t,r){if(t.length>0||r.length>0){const n=await(0,h.isBlockedUrl)(t,(async()=>await y(E,this).call("PhishingController:maybeUpdateState")),(e=>y(E,this).call("PhishingController:testOrigin",e))),s=await y(E,this).call("ApprovalController:addRequest",{origin:e,requestData:{url:t,message:r,isBlockedUrl:n},type:c.SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showSnapAccountRedirect},!0);Boolean(s)&&t.length>0?i.default.tabs.create({url:t}):console.log("User refused snap account redirection to:",t)}else console.log("Error occurred when redirecting snap account. url or message must be defined")}async saveState(){await y(T,this).call(this)}async addAccount(e,t,r,n,s="",i=!1,o=!0){(0,a.assertIsValidSnapId)(t);const c=(0,p.isSnapPreinstalled)(t)&&!i,u=(0,p.isSnapPreinstalled)(t)&&!o,{accountName:l}=await w(S,this,x).call(this,{snapId:t,skipConfirmationDialog:c,skipAccountNameSuggestionDialog:u,accountNameSuggestion:s,handleUserInput:r});w(S,this,M).call(this,{address:e,snapId:t,skipConfirmationDialog:c,accountName:l,onceSaved:n})}async removeAccount(e,t,r){(0,a.assertIsValidSnapId)(t);const n=(0,p.getSnapName)(t,y(E,this)),{id:s}=y(E,this).call("ApprovalController:startFlow"),i="https://support.metamask.io/managing-my-wallet/accounts-and-addresses/how-to-remove-an-account-from-your-metamask-wallet/",d=e=>{y(k,this).call(this,{event:e,category:o.MetaMetricsEventCategory.Accounts,properties:{account_type:o.MetaMetricsEventAccountType.Snap,snap_id:t,snap_name:n}})};let h=!1;try{if(h=Boolean(await y(E,this).call("ApprovalController:addRequest",{origin:t,type:c.SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountRemoval,requestData:{publicAddress:e}},!0)),!h)throw await r(h),new Error("User denied account removal");try{await y(P,this).call(this,e),await r(h),await y(T,this).call(this),d(o.MetaMetricsEventName.RemoveSnapAccountSuccessViewed),await(0,f.showError)(y(E,this),t,{icon:l.IconName.UserCircleRemove,title:(0,u.t)("snapAccountRemoved")},{message:(0,u.t)("snapAccountRemovedDescription"),learnMoreLink:i}),d(o.MetaMetricsEventName.RemoveSnapAccountSuccessClicked)}catch(e){const r=e.message;throw await(0,f.showError)(y(E,this),t,{icon:l.IconName.UserCircleRemove,title:(0,u.t)("snapAccountRemovalFailed")},{message:(0,u.t)("snapAccountRemovalFailedDescription",n),learnMoreLink:i,error:r}),d(o.MetaMetricsEventName.AccountRemoveFailed),new Error(`Error occurred while removing snap account: ${r}`)}}finally{h&&d(o.MetaMetricsEventName.AccountRemoved),y(E,this).call("ApprovalController:endFlow",{id:s})}}}async function C(e){const{id:t}=y(E,this).call("ApprovalController:startFlow");try{return await e(t)}finally{y(E,this).call("ApprovalController:endFlow",{id:t})}}async function I(e,t){const{success:r,name:n}=await v(e,y(E,this),t);return{success:r,accountName:n}}async function B(e){const t=await y(E,this).call("AccountsController:listMultichainAccounts");return{success:!0,accountName:(0,d.getUniqueAccountName)(t,e)}}async function x({snapId:e,skipConfirmationDialog:t,skipAccountNameSuggestionDialog:r,handleUserInput:n,accountNameSuggestion:s}){return await w(S,this,C).call(this,(async i=>{{const r=t||await A(e,y(E,this));if(!r)throw await n(r),new Error("User denied account creation")}{const{success:t,accountName:i}=r?await w(S,this,B).call(this,s):await w(S,this,I).call(this,e,s);if(await n(t),!t)throw new Error("User denied account creation");return{accountName:i}}}))}async function M({address:e,snapId:t,skipConfirmationDialog:r,accountName:n,onceSaved:s}){const i="https://support.metamask.io/managing-my-wallet/accounts-and-addresses/how-to-add-accounts-in-your-wallet/",a=(0,p.getSnapName)(t,y(E,this)),c=e=>{y(k,this).call(this,{event:e,category:o.MetaMetricsEventCategory.Accounts,properties:{account_type:o.MetaMetricsEventAccountType.Snap,snap_id:t,snap_name:a}})};await w(S,this,C).call(this,(async d=>{try{const a=await s;y(E,this).call("AccountsController:setSelectedAccount",a),n&&y(E,this).call("AccountsController:setAccountName",a,n),r||(c(o.MetaMetricsEventName.AddSnapAccountSuccessViewed),await(0,f.showSuccess)(y(E,this),t,{icon:l.IconName.UserCircleAdd,title:(0,u.t)("snapAccountCreated")},{message:(0,u.t)("snapAccountCreatedDescription"),address:e,learnMoreLink:i}),c(o.MetaMetricsEventName.AddSnapAccountSuccessClicked)),c(o.MetaMetricsEventName.AccountAdded)}catch(e){const r=e.message;await(0,f.showError)(y(E,this),t,{icon:l.IconName.UserCircleAdd,title:(0,u.t)("snapAccountCreationFailed")},{message:(0,u.t)("snapAccountCreationFailedDescription",a),learnMoreLink:i,error:r}),console.error("Error occurred while creating snap account:",r)}}))}}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/snap-keyring.ts"}],[1652,{"./ledger-hw-app.cjs":1653,"./ledger-iframe-bridge.cjs":1654,"./ledger-keyring.cjs":1655,"./ledger-mobile-bridge.cjs":1656,"./ledger-transport-middleware.cjs":1657},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),s(e("./ledger-keyring.cjs"),r),s(e("./ledger-iframe-bridge.cjs"),r),s(e("./ledger-mobile-bridge.cjs"),r),s(e("./ledger-transport-middleware.cjs"),r),s(e("./ledger-hw-app.cjs"),r)}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/index.cjs"}],[1653,{"@ledgerhq/hw-app-eth":808,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.MetaMaskLedgerHwAppEth=void 0;const s=n(e("@ledgerhq/hw-app-eth")),i=e("buffer");class a extends s.default{constructor(){super(...arguments),this.mainAppName="BOLOS",this.ethAppName="Ethereum",this.transportEncoding="ascii"}async openEthApp(){await this.transport.send(224,216,0,0,i.Buffer.from(this.ethAppName,this.transportEncoding))}async closeApps(){await this.transport.send(176,167,0,0)}async getAppNameAndVersion(){const e=await this.transport.send(176,1,0,0);if(1!==e[0])throw new Error("Incorrect format return from getAppNameAndVersion.");let t=1;const r=e[t]??0;t+=1;const n=e.slice(t,t+=r).toString(this.transportEncoding),s=e[t]??0;t+=1;return{appName:n,version:e.slice(t,t+=s).toString(this.transportEncoding)}}}r.MetaMaskLedgerHwAppEth=a}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs"}],[1654,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n,s,i,a,o,c,u,l,d=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},h=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r};Object.defineProperty(r,"__esModule",{value:!0}),r.LedgerIframeBridge=r.IFrameMessageAction=void 0;var f;!function(e){e.LedgerConnectionChange="ledger-connection-change",e.LedgerUnlock="ledger-unlock",e.LedgerMakeApp="ledger-make-app",e.LedgerUpdateTransport="ledger-update-transport",e.LedgerSignTransaction="ledger-sign-transaction",e.LedgerSignPersonalMessage="ledger-sign-personal-message",e.LedgerSignTypedData="ledger-sign-typed-data"}(f||(r.IFrameMessageAction=f={}));r.LedgerIframeBridge=class{constructor(e={bridgeUrl:"https://metamask.github.io/eth-ledger-bridge-keyring"}){n.add(this),this.iframeLoaded=!1,s.set(this,void 0),this.isDeviceConnected=!1,this.currentMessageId=0,this.messageCallbacks={},d(this,n,"m",l).call(this,e),h(this,s,{bridgeUrl:e?.bridgeUrl},"f")}async init(){await d(this,n,"m",a).call(this,d(this,s,"f").bridgeUrl),this.eventListener=d(this,n,"m",c).bind(this,d(this,s,"f").bridgeUrl),window.addEventListener("message",this.eventListener)}async destroy(){this.eventListener&&window.removeEventListener("message",this.eventListener)}async getOptions(){return d(this,s,"f")}async setOptions(e){d(this,n,"m",l).call(this,e),d(this,s,"f")?.bridgeUrl!==e.bridgeUrl&&(d(this,s,"f").bridgeUrl=e.bridgeUrl,await this.destroy(),await this.init())}async attemptMakeApp(){return new Promise(((e,t)=>{d(this,n,"m",u).call(this,{action:f.LedgerMakeApp},(r=>{"success"in r&&r.success?e(!0):t("error"in r?r.error:new Error("Unknown error occurred"))}))}))}async updateTransportMethod(e){return new Promise(((t,r)=>{if(!this.iframeLoaded)throw new Error("The iframe is not loaded yet");d(this,n,"m",u).call(this,{action:f.LedgerUpdateTransport,params:{transportType:e}},(e=>"success"in e&&e.success?t(!0):r(new Error("Ledger transport could not be updated"))))}))}async getPublicKey(e){return d(this,n,"m",i).call(this,f.LedgerUnlock,e)}async deviceSignTransaction(e){return d(this,n,"m",i).call(this,f.LedgerSignTransaction,e)}async deviceSignMessage(e){return d(this,n,"m",i).call(this,f.LedgerSignPersonalMessage,e)}async deviceSignTypedData(e){return d(this,n,"m",i).call(this,f.LedgerSignTypedData,e)}},s=new WeakMap,n=new WeakSet,i=async function(...[e,t]){return new Promise(((r,s)=>{d(this,n,"m",u).call(this,{action:e,params:t},(e=>{if("payload"in e&&e.payload){if("success"in e&&e.success)return r(e.payload);if("error"in e.payload)return s(e.payload.error)}return s(new Error("Unknown error occurred"))}))}))},a=async function(e){return new Promise((t=>{this.iframe=document.createElement("iframe"),this.iframe.src=e,this.iframe.allow="hid 'src'",this.iframe.onload=async()=>{this.iframeLoaded=!0,t()},document.head.appendChild(this.iframe)}))},o=function(e){const t=e.split("/");return t.splice(-1,1),t.join("/")},c=function(e,t){if(t.origin===d(this,n,"m",o).call(this,e)&&t.data){const e=this.messageCallbacks[t.data.messageId];e?e(t.data):t.data.action===f.LedgerConnectionChange&&(this.isDeviceConnected=t.data.payload.connected)}},u=function(e,t){this.currentMessageId+=1;const r={...e,messageId:this.currentMessageId,target:"LEDGER-IFRAME"};if(this.messageCallbacks[this.currentMessageId]=t,!this.iframeLoaded||!this.iframe?.contentWindow)throw new Error("The iframe is not loaded yet");this.iframe.contentWindow.postMessage(r,"*")},l=function(e){if("string"!=typeof e.bridgeUrl||0===e.bridgeUrl.length)throw new Error("bridgeURL is not a valid URL")}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-iframe-bridge.cjs"}],[1655,{"@ethereumjs/rlp":1658,"@ethereumjs/tx":442,"@ethereumjs/util":457,"@metamask/eth-sig-util":1680,"@metamask/utils":2950,buffer:4074,hdkey:4632},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n,s,i,a,o,c,u,l,d,h,f,p,m,g,y,b=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},w=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.LedgerKeyring=void 0;const A=e("@ethereumjs/rlp"),v=e("@ethereumjs/tx"),E=e("@ethereumjs/util"),k=e("@metamask/eth-sig-util"),T=e("@metamask/utils"),P=e("buffer"),S=w(e("hdkey")),_="m",C=`${_}/44'/60'/0'`,I="Ledger Hardware";var B;!function(e){e.Ropsten="https://api-ropsten.etherscan.io",e.Kovan="https://api-kovan.etherscan.io",e.Rinkeby="https://api-rinkeby.etherscan.io",e.Mainnet="https://api.etherscan.io"}(B||(B={}));class x{constructor({bridge:e}){if(n.add(this),this.deviceId="",this.type=I,this.page=0,this.perPage=5,this.unlockedAccount=0,this.accounts=[],this.accountDetails={},this.hdk=new S.default,this.hdPath=C,this.paths={},this.network=B.Mainnet,this.implementFullBIP44=!1,!e)throw new Error("Bridge is a required dependency for the keyring");this.bridge=e}async init(){return this.bridge.init()}async destroy(){return this.bridge.destroy()}async serialize(){return{hdPath:this.hdPath,accounts:this.accounts.slice(),deviceId:this.deviceId,accountDetails:this.accountDetails,implementFullBIP44:!1}}async deserialize(e){this.hdPath=e.hdPath??C,this.accounts=e.accounts??[],this.deviceId=e.deviceId??"",this.accountDetails=e.accountDetails??{},e.accountDetails||b(this,n,"m",s).call(this,e),this.implementFullBIP44=e.implementFullBIP44??!1;const t=new Set(Object.keys(this.accountDetails));return this.accounts=this.accounts.filter((e=>t.has(b(this,n,"m",y).call(this,e)))),Promise.resolve()}setDeviceId(e){this.deviceId=e}getDeviceId(){return this.deviceId}isUnlocked(){return Boolean(this.hdk.publicKey)}isConnected(){return this.bridge.isDeviceConnected}setAccountToUnlock(e){this.unlockedAccount=e}setHdPath(e){this.hdPath!==e&&(this.hdk=new S.default),this.hdPath=e}async unlock(e,t=!0){if(this.isUnlocked()&&!e)return b(this,n,"m",y).call(this,(0,T.bytesToHex)((0,E.publicToAddress)(this.hdk.publicKey,!0)));const r=e?b(this,n,"m",p).call(this,e):this.hdPath;let s;try{s=await this.bridge.getPublicKey({hdPath:r})}catch(e){throw e instanceof Error?e:new Error("Ledger Ethereum app closed. Open it to unlock.")}return t&&s.chainCode&&(this.hdk.publicKey=P.Buffer.from(s.publicKey,"hex"),this.hdk.chainCode=P.Buffer.from(s.chainCode,"hex")),(0,T.add0x)(s.address)}async addAccounts(e){return new Promise(((t,r)=>{this.unlock().then((async r=>{const s=this.unlockedAccount,i=s+e,a=[];for(let e=s;e<i;e++){const t=b(this,n,"m",h).call(this,e);let r;r=b(this,n,"m",f).call(this)?await this.unlock(t):b(this,n,"m",l).call(this,_,e),this.accountDetails[b(this,n,"m",y).call(this,r)]={bip44:b(this,n,"m",f).call(this),hdPath:t},this.accounts.includes(r)||(this.accounts=[...this.accounts,r],a.push(r)),this.page=0}t(a)})).catch(r)}))}getName(){return I}async getFirstPage(){return this.page=0,b(this,n,"m",o).call(this,1)}async getNextPage(){return b(this,n,"m",o).call(this,1)}async getPreviousPage(){return b(this,n,"m",o).call(this,-1)}async getAccounts(){return Promise.resolve(this.accounts.slice())}removeAccount(e){const t=this.accounts.filter((t=>t.toLowerCase()!==e.toLowerCase()));if(t.length===this.accounts.length)throw new Error(`Address ${e} not found in this keyring`);this.accounts=t,delete this.accountDetails[b(this,n,"m",y).call(this,e)]}async attemptMakeApp(){return this.bridge.attemptMakeApp()}async updateTransportMethod(e){return this.bridge.updateTransportMethod(e)}async signTransaction(e,t){let r;if(function(e){return"getChainId"in e&&"function"==typeof e.getChainId}(t))return t.v=t.getChainId(),t.r="0x00",t.s="0x00",r=t.serialize().toString("hex"),b(this,n,"m",i).call(this,e,r,(e=>(t.v=P.Buffer.from(e.v,"hex"),t.r=P.Buffer.from(e.r,"hex"),t.s=P.Buffer.from(e.s,"hex"),t)));const s=t.getMessageToSign();return r=Array.isArray(s)?P.Buffer.from(A.RLP.encode(s)).toString("hex"):(0,T.bytesToHex)(s),b(this,n,"m",i).call(this,e,r,(e=>{const r=t.toJSON();return r.type=t.type,r.v=(0,T.add0x)(e.v),r.r=(0,T.add0x)(e.r),r.s=(0,T.add0x)(e.s),v.TransactionFactory.fromTxData(r,{common:t.common,freeze:Object.isFrozen(t)})}))}async signMessage(e,t){return this.signPersonalMessage(e,t)}async signPersonalMessage(e,t){const r=await this.unlockAccountByAddress(e);if(!r)throw new Error("Ledger: Unknown error while signing message");let s;try{s=await this.bridge.deviceSignMessage({hdPath:r,message:(0,T.remove0x)(t)})}catch(e){throw e instanceof Error?e:new Error("Ledger: Unknown error while signing message")}let i=parseInt(String(s.v),10).toString(16);i.length<2&&(i=`0${i}`);const a=`0x${s.r}${s.s}${i}`,o=(0,k.recoverPersonalSignature)({data:t,signature:a});if(b(this,n,"m",y).call(this,o)!==b(this,n,"m",y).call(this,e))throw new Error("Ledger: The signature doesnt match the right address");return a}async unlockAccountByAddress(e){const t=b(this,n,"m",y).call(this,e),r=this.accountDetails[t];if(!r)throw new Error(`Ledger: Account for address '${t}' not found`);const{hdPath:s}=r;if((await this.unlock(s,!1)).toLowerCase()!==e.toLowerCase())throw new Error(`Ledger: Account ${e} does not belong to the connected device`);return s}async signTypedData(e,t,r){const{version:s}=r??{};if(!("V4"===s))throw new Error("Ledger: Only version 4 of typed data signing is supported");const{domain:i,types:o,primaryType:c,message:u}=k.TypedDataUtils.sanitizeData(t),l=await this.unlockAccountByAddress(e);if(!l)throw new Error("Ledger: Unknown error while signing message");let d;try{d=await this.bridge.deviceSignTypedData({hdPath:l,message:{domain:{name:i.name,chainId:i.chainId,version:i.version,verifyingContract:i.verifyingContract,salt:b(this,n,"m",a).call(this,i.salt)},types:o,primaryType:c.toString(),message:u}})}catch(e){throw e instanceof Error?e:new Error("Ledger: Unknown error while signing message")}let h=parseInt(String(d.v),10).toString(16);h.length<2&&(h=`0${h}`);const f=`0x${d.r}${d.s}${h}`,p=(0,k.recoverTypedSignature)({data:t,signature:f,version:k.SignTypedDataVersion.V4});if(b(this,n,"m",y).call(this,p)!==b(this,n,"m",y).call(this,e))throw new Error("Ledger: The signature doesnt match the right address");return f}forgetDevice(){this.deviceId="",this.accounts=[],this.page=0,this.unlockedAccount=0,this.paths={},this.accountDetails={},this.hdk=new S.default}}r.LedgerKeyring=x,n=new WeakSet,s=function(e){if(b(this,n,"m",f).call(this)&&e.accountIndexes)for(const[t,r]of Object.entries(e.accountIndexes))this.accountDetails[t]={bip44:!0,hdPath:b(this,n,"m",h).call(this,r)};const t=new Set(Object.keys(this.accountDetails));b(this,n,"m",f).call(this)||this.accounts.forEach((e=>{const r=b(this,n,"m",y).call(this,e);t.has(r)||(this.accountDetails[r]={bip44:!1,hdPath:b(this,n,"m",d).call(this,e)})}))},i=async function(e,t,r){const n=await this.unlockAccountByAddress(e);if(!n)throw new Error("Ledger: hdPath is empty while signing transaction");let s;try{s=await this.bridge.deviceSignTransaction({tx:(0,T.remove0x)(t),hdPath:n})}catch(e){throw e instanceof Error?e:new Error("Ledger: Unknown error while signing transaction")}const i=r(s);if(i.verifySignature())return i;throw new Error("Ledger: The transaction signature is not valid")},a=function(e){if(!e)return undefined;const t=new Uint8Array(e);return String.fromCharCode(...t)},o=async function(e){this.page+=e,this.page<=0&&(this.page=1);const t=(this.page-1)*this.perPage,r=t+this.perPage;let s;return await this.unlock(),s=b(this,n,"m",f).call(this)?await b(this,n,"m",c).call(this,t,r):b(this,n,"m",u).call(this,t,r),s},c=async function(e,t){const r=[];for(let s=e;s<t;s++){const e=b(this,n,"m",h).call(this,s),t=await this.unlock(e),i=!this.implementFullBIP44||await b(this,n,"m",m).call(this,t);if(r.push({address:t,balance:null,index:s}),!i)break}return r},u=function(e,t){const r=[];for(let s=e;s<t;s++){const e=b(this,n,"m",l).call(this,_,s);r.push({address:e,balance:null,index:s}),this.paths[b(this,n,"m",y).call(this,e)]=s}return r},l=function(e,t){const r=this.hdk.derive(`${e}/${t}`),s=(0,T.bytesToHex)((0,E.publicToAddress)(r.publicKey,!0));return b(this,n,"m",y).call(this,s)},d=function(e){const t=b(this,n,"m",y).call(this,e);let r=this.paths[t];if(void 0===r)for(let e=0;e<1e3;e++)if(t===b(this,n,"m",l).call(this,_,e)){r=e;break}if(void 0===r)throw new Error("Unknown address");return b(this,n,"m",h).call(this,r)},h=function(e){return b(this,n,"m",f).call(this)?`m/44'/60'/${e}'/0/0`:`${this.hdPath}/${e}`},f=function(){return"m/44'/60'/0'/0/0"===this.hdPath},p=function(e){return e.toString().replace("m/","")},m=async function(e){const t=b(this,n,"m",g).call(this),r=await window.fetch(`${t}/api?module=account&action=txlist&address=${e}&tag=latest&page=1&offset=1`),s=await r.json();return"0"!==s.status&&s.result.length>0},g=function(){return this.network},y=function(e){return(0,T.getChecksumAddress)((0,T.add0x)(e))},x.type=I}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring.cjs"}],[1656,{"./ledger-hw-app.cjs":1653},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n,s,i,a,o,c=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r},u=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};Object.defineProperty(r,"__esModule",{value:!0}),r.LedgerMobileBridge=void 0;e("./ledger-hw-app.cjs");r.LedgerMobileBridge=class{constructor(e,t={}){n.add(this),s.set(this,void 0),i.set(this,void 0),this.isDeviceConnected=!1,c(this,i,t,"f"),c(this,s,e,"f")}async init(){return Promise.resolve()}async destroy(){try{await u(this,n,"m",a).call(this).dispose()}catch(e){console.error(e)}this.isDeviceConnected=!1}async deviceSignMessage({hdPath:e,message:t}){return u(this,n,"m",o).call(this).signPersonalMessage(e,t)}async deviceSignTypedData({hdPath:e,message:t}){return u(this,n,"m",o).call(this).signEIP712Message(e,t)}async deviceSignTransaction({tx:e,hdPath:t}){return u(this,n,"m",o).call(this).clearSignTransaction(t,e,{externalPlugins:!0,erc20:!0,nft:!0})}async getPublicKey({hdPath:e}){return await u(this,n,"m",o).call(this).getAddress(e,!1,!0)}async getOptions(){return u(this,i,"f")}async setOptions(e){c(this,i,e,"f")}async updateTransportMethod(e){if(!e.deviceModel)throw new Error("Property `deviceModel` is not defined in `transport`.");if(!e.deviceModel.id)throw new Error("Property `deviceModel.id` is not defined in `transport`.");return u(this,n,"m",a).call(this).setTransport(e),this.isDeviceConnected=!0,Promise.resolve(!0)}async attemptMakeApp(){throw new Error("Method not supported.")}async openEthApp(){await u(this,n,"m",o).call(this).openEthApp()}async closeApps(){await u(this,n,"m",o).call(this).closeApps()}async getAppNameAndVersion(){return u(this,n,"m",o).call(this).getAppNameAndVersion()}},s=new WeakMap,i=new WeakMap,n=new WeakSet,a=function(){if(u(this,s,"f"))return u(this,s,"f");throw new Error("Instance `transportMiddleware` is not initialized.")},o=function(){return u(this,n,"m",a).call(this).getEthApp()}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-mobile-bridge.cjs"}],[1657,{"./ledger-hw-app.cjs":1653},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n,s=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r},i=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};Object.defineProperty(r,"__esModule",{value:!0}),r.LedgerTransportMiddleware=void 0;const a=e("./ledger-hw-app.cjs");r.LedgerTransportMiddleware=class{constructor(){this.mainAppName="BOLOS",this.ethAppName="Ethereum",this.transportEncoding="ascii",n.set(this,void 0)}async dispose(){const e=this.getTransport();await e.close()}setTransport(e){s(this,n,e,"f")}getTransport(){if(!i(this,n,"f"))throw new Error("Instance `transport` is not initialized.");return i(this,n,"f")}getEthApp(){return new a.MetaMaskLedgerHwAppEth(this.getTransport())}},n=new WeakMap}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-transport-middleware.cjs"}],[1658,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){function n(e){if(Array.isArray(e)){const t=[];let r=0;for(let s=0;s<e.length;s++){const i=n(e[s]);t.push(i),r+=i.length}return f(a(r,192),...t)}const t=y(e);return 1===t.length&&t[0]<128?t:f(a(t.length,128),t)}function s(e,t,r){if(r>e.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(t,r)}function i(e){if(0===e[0])throw new Error("invalid RLP: extra zeros");return d(l(e))}function a(e,t){if(e<56)return Uint8Array.from([e+t]);const r=m(e),n=m(t+55+r.length/2);return Uint8Array.from(h(n+r))}function o(e,t=!1){if(null==e||0===e.length)return Uint8Array.from([]);const r=c(y(e));if(t)return{data:r.data,remainder:r.remainder.slice()};if(0!==r.remainder.length)throw new Error("invalid RLP: remainder must be zero");return r.data}function c(e){let t,r,n,a,o;const u=[],l=e[0];if(l<=127)return{data:e.slice(0,1),remainder:e.subarray(1)};if(l<=183){if(t=l-127,n=128===l?Uint8Array.from([]):s(e,1,t),2===t&&n[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:n,remainder:e.subarray(t)}}if(l<=191){if(r=l-182,e.length-1<r)throw new Error("invalid RLP: not enough bytes for string length");if(t=i(s(e,1,r)),t<=55)throw new Error("invalid RLP: expected string length to be greater than 55");return n=s(e,r,t+r),{data:n,remainder:e.subarray(t+r)}}if(l<=247){for(t=l-191,a=s(e,1,t);a.length;)o=c(a),u.push(o.data),a=o.remainder;return{data:u,remainder:e.subarray(t)}}{if(r=l-246,t=i(s(e,1,r)),t<56)throw new Error("invalid RLP: encoded list too short");const n=r+t;if(n>e.length)throw new Error("invalid RLP: total length is larger than the data");for(a=s(e,r,n);a.length;)o=c(a),u.push(o.data),a=o.remainder;return{data:u,remainder:e.subarray(n)}}}Object.defineProperty(r,"__esModule",{value:!0}),r.RLP=r.utils=r.decode=r.encode=void 0,r.encode=n,r.decode=o;const u=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function l(e){let t="";for(let r=0;r<e.length;r++)t+=u[e[r]];return t}function d(e){const t=Number.parseInt(e,16);if(Number.isNaN(t))throw new Error("Invalid byte sequence");return t}function h(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r;t[r]=d(e.slice(n,n+2))}return t}function f(...e){if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const s=e[t];r.set(s,n),n+=s.length}return r}function p(e){return(new TextEncoder).encode(e)}function m(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");const t=e.toString(16);return t.length%2?`0${t}`:t}function g(e){return e.length>=2&&"0"===e[0]&&"x"===e[1]}function y(e){if(e instanceof Uint8Array)return e;if("string"==typeof e)return g(e)?h((t="string"!=typeof(r=e)?r:g(r)?r.slice(2):r).length%2?`0${t}`:t):p(e);var t,r;if("number"==typeof e||"bigint"==typeof e)return e?h(m(e)):Uint8Array.from([]);if(null===e||e===undefined)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}r.utils={bytesToHex:l,concatBytes:f,hexToBytes:h,utf8ToBytes:p},r.RLP={encode:n,decode:o}}}},{package:"@metamask/eth-ledger-bridge-keyring>@ethereumjs/rlp",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@ethereumjs/rlp/dist/cjs/index.js"}],[1659,{"./errors":1660,"./packer":1663,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.decodeSingle=r.decode=r.encodePacked=r.encodeSingle=r.encode=void 0;const n=e("@metamask/utils"),s=e("./errors"),i=e("./packer");r.encode=(e,t,r,n)=>{try{return(0,i.pack)({types:e,values:t,packed:r,tight:n})}catch(e){if(e instanceof s.ParserError)throw new s.ParserError(`Unable to encode value: ${e.message}`,e);throw new s.ParserError(`An unexpected error occurred: ${(0,s.getErrorMessage)(e)}`,e)}};r.encodeSingle=(e,t)=>(0,r.encode)([e],[t]);r.encodePacked=(e,t,n)=>(0,r.encode)(e,t,!0,n);r.decode=(e,t)=>{const r=(0,n.createBytes)(t);try{return(0,i.unpack)(e,r)}catch(e){if(e instanceof s.ParserError)throw new s.ParserError(`Unable to decode value: ${e.message}`,e);throw new s.ParserError(`An unexpected error occurred: ${(0,s.getErrorMessage)(e)}`,e)}};r.decodeSingle=(e,t)=>{const i=(0,r.decode)([e],t);return(0,n.assert)(1===i.length,new s.ParserError("Decoded value array has unexpected length.")),i[0]}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/abi.js"}],[166,{"../../snaps/preinstalled-snaps":365,"@metamask/snaps-utils":2850},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getSnapName=function(e,t){const{currentLocale:r}=t.call("PreferencesController:getState"),n=t.call("SnapController:get",e);if(!n)return(0,s.stripSnapPrefix)(e);if(n.localizationFiles){return(0,s.getLocalizedSnapManifest)(n.manifest,r,n.localizationFiles).proposedName}return n.manifest.proposedName},r.isSnapPreinstalled=function(e){return i.default.some((t=>t.snapId===e))};var n,s=e("@metamask/snaps-utils"),i=(n=e("../../snaps/preinstalled-snaps"))&&n.__esModule?n:{default:n}}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/snaps.ts"}],[1660,{"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.ParserError=r.getErrorStack=r.getErrorMessage=void 0;const n=e("@metamask/utils");r.getErrorMessage=e=>"string"==typeof e?e:e instanceof Error||(0,n.isObject)(e)&&(0,n.hasProperty)(e,"message")&&"string"==typeof e.message?e.message:"Unknown error.";r.getErrorStack=e=>e instanceof Error?e.stack:undefined;class s extends Error{constructor(e,t){super(e),this.name="ParserError";const n=(0,r.getErrorStack)(t);n&&(this.stack=n)}}r.ParserError=s}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/errors.js"}],[1661,{"./abi":1659,"./errors":1660,"./types":1676},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),s(e("./abi"),r),s(e("./errors"),r),s(e("./types"),r)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/index.js"}],[1662,{"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.iterate=void 0;const n=e("@metamask/utils");r.iterate=function*(e,t=32){for(let r=0;r<e.length;r+=t){const s=e=>{(0,n.assert)(e>=0,"Cannot skip a negative number of bytes."),(0,n.assert)(e%t==0,"Length must be a multiple of the size."),r+=e},i=e.subarray(r);yield{skip:s,value:i}}return{skip:()=>undefined,value:new Uint8Array}}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/iterator.js"}],[1663,{"./errors":1660,"./iterator":1662,"./parsers":1670,"./utils":1678,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.unpack=r.pack=r.isDynamicParser=r.getParser=void 0;const n=e("@metamask/utils"),s=e("./errors"),i=e("./iterator"),a=e("./parsers"),o=e("./utils");r.getParser=e=>{const t={address:a.address,array:a.array,bool:a.bool,bytes:a.bytes,fixedBytes:a.fixedBytes,function:a.fn,number:a.number,string:a.string,tuple:a.tuple},r=t[e];if(r)return r;const n=Object.values(t).find((t=>t.isType(e)));if(n)return n;throw new s.ParserError(`The type "${e}" is not supported.`)};r.isDynamicParser=(e,t)=>{const{isDynamic:r}=e;return"function"==typeof r?r(t):r};r.pack=({types:e,values:t,packed:i=!1,tight:a=!1,arrayPacked:c=!1,byteArray:u=new Uint8Array})=>{(0,n.assert)(e.length===t.length,new s.ParserError(`The number of types (${e.length}) does not match the number of values (${t.length}).`));const{staticBuffer:l,dynamicBuffer:d,pointers:h}=e.reduce((({staticBuffer:e,dynamicBuffer:s,pointers:o},u,l)=>{const d=(0,r.getParser)(u),h=t[l];if(i||c||!(0,r.isDynamicParser)(d,u))return{staticBuffer:d.encode({buffer:e,value:h,type:u,packed:i,tight:a}),dynamicBuffer:s,pointers:o};return{staticBuffer:(0,n.concatBytes)([e,new Uint8Array(32)]),dynamicBuffer:d.encode({buffer:s,value:h,type:u,packed:i,tight:a}),pointers:[...o,{position:e.length,pointer:s.length}]}}),{staticBuffer:new Uint8Array,dynamicBuffer:new Uint8Array,pointers:[]});(0,n.assert)(!i&&!c||0===d.length,new s.ParserError("Invalid pack state."));const f=l.length,p=h.reduce(((e,{pointer:t,position:r})=>{const s=(0,o.padStart)((0,n.numberToBytes)(f+t));return(0,o.set)(e,s,r)}),l);return(0,n.concatBytes)([u,p,d])};r.unpack=(e,t)=>{const a=(0,i.iterate)(t);return e.map((e=>{const{value:{value:i,skip:o},done:c}=a.next();(0,n.assert)(!c,new s.ParserError(`The encoded value is invalid for the provided types. Reached end of buffer while attempting to parse "${e}".`));const u=(0,r.getParser)(e);if((0,r.isDynamicParser)(u,e)){const r=(0,n.bytesToNumber)(i.subarray(0,32)),s=t.subarray(r);return u.decode({type:e,value:s,skip:o})}return u.decode({type:e,value:i,skip:o})}))}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/packer.js"}],[1664,{"../errors":1660,"../utils":1678,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.address=r.getAddress=void 0;const n=e("@metamask/utils"),s=e("../errors"),i=e("../utils");r.getAddress=e=>{const t=(0,n.createBytes)(e);return(0,n.assert)(t.length<=20,new s.ParserError(`Invalid address value. Expected address to be 20 bytes long, but received ${t.length} bytes.`)),(0,i.padStart)(t,20)},r.address={isDynamic:!1,isType:e=>"address"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:s}){const a=(0,r.getAddress)(t);if(s)return(0,n.concatBytes)([e,a]);const o=(0,i.padStart)(a);return(0,n.concatBytes)([e,o])},decode:({value:e})=>(0,n.add0x)((0,n.bytesToHex)(e.slice(12,32)))}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/parsers/address.js"}],[1665,{"../errors":1660,"../packer":1663,"../utils":1678,"./fixed-bytes":1668,"./tuple":1674,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.array=r.getTupleType=r.getArrayType=r.isArrayType=void 0;const n=e("@metamask/utils"),s=e("../errors"),i=e("../packer"),a=e("../utils"),o=e("./fixed-bytes"),c=e("./tuple"),u=/^(?<type>.*)\[(?<length>\d*?)\]$/u;r.isArrayType=e=>u.test(e);r.getArrayType=e=>{const t=e.match(u);return(0,n.assert)(t?.groups?.type,new s.ParserError(`Invalid array type. Expected an array type, but received "${e}".`)),[t.groups.type,t.groups.length?parseInt(t.groups.length,10):undefined]};r.getTupleType=(e,t)=>`(${new Array(t).fill(e).join(",")})`,r.array={isDynamic(e){const[t,n]=(0,r.getArrayType)(e);return n===undefined||(0,i.isDynamicParser)((0,i.getParser)(t),t)},isType:e=>(0,r.isArrayType)(e),getByteLength(e){(0,n.assert)((0,r.isArrayType)(e),new s.ParserError(`Expected an array type, but received "${e}".`));const[t,a]=(0,r.getArrayType)(e);return(0,i.isDynamicParser)(this,e)||a===undefined?32:c.tuple.getByteLength((0,r.getTupleType)(t,a))},encode({type:e,buffer:t,value:u,packed:l,tight:d}){const[h,f]=(0,r.getArrayType)(e);if((0,n.assert)(!l||!(0,r.isArrayType)(h),new s.ParserError("Cannot pack nested arrays.")),l&&(0,i.isDynamicParser)((0,i.getParser)(h),h))return(0,i.pack)({types:new Array(u.length).fill(h),values:u,byteArray:t,packed:l,arrayPacked:!0,tight:d});if(f)return(0,n.assert)(f===u.length,new s.ParserError(`Array length does not match type length. Expected a length of ${f}, but received ${u.length}.`)),c.tuple.encode({type:(0,r.getTupleType)(h,f),buffer:t,value:u,packed:o.fixedBytes.isType(h)&&d,tight:d});if(l)return(0,i.pack)({types:new Array(u.length).fill(h),values:u,byteArray:t,packed:o.fixedBytes.isType(h)&&d,arrayPacked:!0,tight:d});const p=(0,a.padStart)((0,n.numberToBytes)(u.length));return(0,i.pack)({types:new Array(u.length).fill(h),values:u,byteArray:(0,n.concatBytes)([t,p]),packed:l,tight:d})},decode({type:e,value:t,...a}){const[o,u]=(0,r.getArrayType)(e);if(u){const e=c.tuple.decode({type:(0,r.getTupleType)(o,u),value:t,...a});return(0,n.assert)(e.length===u,new s.ParserError(`Array length does not match type length. Expected a length of ${u}, but received ${e.length}.`)),e}const l=(0,n.bytesToNumber)(t.subarray(0,32));return(0,i.unpack)(new Array(l).fill(o),t.subarray(32))}}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/parsers/array.js"}],[1666,{"../errors":1660,"./number":1671,"@metamask/superstruct":2872,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.bool=r.getBooleanValue=void 0;const n=e("@metamask/superstruct"),s=e("@metamask/utils"),i=e("../errors"),a=e("./number"),o=(0,n.coerce)((0,n.boolean)(),(0,n.union)([(0,n.literal)("true"),(0,n.literal)("false")]),(e=>"true"===e));r.getBooleanValue=e=>{try{return(0,n.create)(e,o)?BigInt(1):BigInt(0)}catch{throw new i.ParserError(`Invalid boolean value. Expected a boolean literal, or the string "true" or "false", but received "${e}".`)}},r.bool={isDynamic:!1,isType:e=>"bool"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:n,tight:i}){const o=(0,r.getBooleanValue)(t);return n?(0,s.concatBytes)([e,(0,s.bigIntToBytes)(o)]):a.number.encode({type:"uint256",buffer:e,value:o,packed:n,tight:i})},decode:e=>a.number.decode({...e,type:"uint256"})===BigInt(1)}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/parsers/bool.js"}],[1667,{"../utils":1678,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.bytes=void 0;const n=e("@metamask/utils"),s=e("../utils");r.bytes={isDynamic:!0,isType:e=>"bytes"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:r}){const i=(0,n.createBytes)(t);if(r)return(0,n.concatBytes)([e,i]);const a=32*Math.ceil(i.byteLength/32);return(0,n.concatBytes)([e,(0,s.padStart)((0,n.numberToBytes)(i.byteLength)),(0,s.padEnd)(i,a)])},decode({value:e}){const t=e.subarray(0,32),r=(0,n.bytesToNumber)(t);return e.slice(32,32+r)}}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/parsers/bytes.js"}],[1668,{"../errors":1660,"../utils":1678,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.fixedBytes=r.getByteLength=void 0;const n=e("@metamask/utils"),s=e("../errors"),i=e("../utils"),a=/^bytes([0-9]{1,2})$/u;r.getByteLength=e=>{const t=e.match(a)?.[1];(0,n.assert)(t,`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`);const r=Number(t);return(0,n.assert)(r>0&&r<=32,new s.ParserError(`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`)),r},r.fixedBytes={isDynamic:!1,isType:e=>a.test(e),getByteLength:()=>32,encode({type:e,buffer:t,value:a,packed:o}){const c=(0,r.getByteLength)(e),u=(0,n.createBytes)(a);return(0,n.assert)(u.length<=c,new s.ParserError(`Expected a value of length ${c}, but received a value of length ${u.length}.`)),o?(0,n.concatBytes)([t,(0,i.padEnd)(u,c)]):(0,n.concatBytes)([t,(0,i.padEnd)(u)])},decode({type:e,value:t}){const n=(0,r.getByteLength)(e);return t.slice(0,n)}}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/parsers/fixed-bytes.js"}],[1669,{"../errors":1660,"./fixed-bytes":1668,"@metamask/superstruct":2872,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.fn=r.getFunction=void 0;const n=e("@metamask/superstruct"),s=e("@metamask/utils"),i=e("../errors"),a=e("./fixed-bytes"),o=(0,n.coerce)((0,n.object)({address:s.StrictHexStruct,selector:s.StrictHexStruct}),(0,n.union)([s.StrictHexStruct,(0,n.instance)(Uint8Array)]),(e=>{const t=(0,s.createBytes)(e);return(0,s.assert)(24===t.length,new i.ParserError(`Invalid Solidity function. Expected function to be 24 bytes long, but received ${t.length} bytes.`)),{address:(0,s.bytesToHex)(t.subarray(0,20)),selector:(0,s.bytesToHex)(t.subarray(20,24))}}));r.getFunction=e=>{const t=(0,n.create)(e,o);return(0,s.concatBytes)([(0,s.hexToBytes)(t.address),(0,s.hexToBytes)(t.selector)])},r.fn={isDynamic:!1,isType:e=>"function"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:n,tight:s}){const i=(0,r.getFunction)(t);return a.fixedBytes.encode({type:"bytes24",buffer:e,value:i,packed:n,tight:s})},decode:({value:e})=>({address:(0,s.bytesToHex)(e.slice(0,20)),selector:(0,s.bytesToHex)(e.slice(20,24))})}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/parsers/function.js"}],[167,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getAccountsBySnapId=void 0;r.getAccountsBySnapId=async(e,t)=>{const r=await e();return await r.getAccountsBySnapId(t)}}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/utils.ts"}],[1670,{"./address":1664,"./array":1665,"./bool":1666,"./bytes":1667,"./fixed-bytes":1668,"./function":1669,"./number":1671,"./parser":1672,"./string":1673,"./tuple":1674},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),s(e("./address"),r),s(e("./array"),r),s(e("./bool"),r),s(e("./bytes"),r),s(e("./fixed-bytes"),r),s(e("./function"),r),s(e("./number"),r),s(e("./parser"),r),s(e("./string"),r),s(e("./tuple"),r)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/parsers/index.js"}],[1671,{"../errors":1660,"../utils":1678,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.number=r.getBigInt=r.assertNumberLength=r.getLength=r.isSigned=void 0;const n=e("@metamask/utils"),s=e("../errors"),i=e("../utils"),a=/^u?int(?<length>[0-9]*)?$/u;r.isSigned=e=>!e.startsWith("u");r.getLength=e=>{if("int"===e||"uint"===e)return 256;const t=e.match(a);(0,n.assert)(t?.groups?.length,new s.ParserError(`Invalid number type. Expected a number type, but received "${e}".`));const r=parseInt(t.groups.length,10);return(0,n.assert)(r>=8&&r<=256,new s.ParserError(`Invalid number length. Expected a number between 8 and 256, but received "${e}".`)),(0,n.assert)(r%8==0,new s.ParserError(`Invalid number length. Expected a multiple of 8, but received "${e}".`)),r};r.assertNumberLength=(e,t)=>{const i=(0,r.getLength)(t),a=BigInt(2)**BigInt(i-((0,r.isSigned)(t)?1:0))-BigInt(1);(0,r.isSigned)(t)?(0,n.assert)(e>=-(a+BigInt(1))&&e<=a,new s.ParserError(`Number "${e}" is out of range for type "${t}".`)):(0,n.assert)(e<=a,new s.ParserError(`Number "${e}" is out of range for type "${t}".`))};r.getBigInt=e=>{try{return(0,n.createBigInt)(e)}catch{throw new s.ParserError(`Invalid number. Expected a valid number value, but received "${e}".`)}},r.number={isDynamic:!1,isType:e=>a.test(e),getByteLength:()=>32,encode({type:e,buffer:t,value:s,packed:a}){const o=(0,r.getBigInt)(s);if((0,r.assertNumberLength)(o,e),(0,r.isSigned)(e)){if(a){const s=(0,r.getLength)(e)/8;return(0,n.concatBytes)([t,(0,n.signedBigIntToBytes)(o,s)])}return(0,n.concatBytes)([t,(0,i.padStart)((0,n.signedBigIntToBytes)(o,32))])}if(a){const s=(0,r.getLength)(e)/8;return(0,n.concatBytes)([t,(0,i.padStart)((0,n.bigIntToBytes)(o),s)])}return(0,n.concatBytes)([t,(0,i.padStart)((0,n.bigIntToBytes)(o))])},decode({type:e,value:t}){const s=t.subarray(0,32);if((0,r.isSigned)(e)){const t=(0,n.bytesToSignedBigInt)(s);return(0,r.assertNumberLength)(t,e),t}const i=(0,n.bytesToBigInt)(s);return(0,r.assertNumberLength)(i,e),i}}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/parsers/number.js"}],[1672,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0})}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/parsers/parser.js"}],[1673,{"./bytes":1667,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.string=void 0;const n=e("@metamask/utils"),s=e("./bytes");r.string={isDynamic:!0,isType:e=>"string"===e,getByteLength:()=>32,encode:({buffer:e,value:t,packed:r,tight:i})=>s.bytes.encode({type:"bytes",buffer:e,value:(0,n.stringToBytes)(t),packed:r,tight:i}),decode:e=>(0,n.bytesToString)(s.bytes.decode(e))}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/parsers/string.js"}],[1674,{"../errors":1660,"../packer":1663,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.tuple=r.getTupleElements=void 0;const n=e("@metamask/utils"),s=e("../errors"),i=e("../packer"),a=/^\((.+)\)$/u;r.getTupleElements=e=>{(0,n.assert)(e.startsWith("(")&&e.endsWith(")"),new s.ParserError(`Invalid tuple type. Expected tuple type, but received "${e}".`));const t=[];let r="",i=0;for(let n=1;n<e.length-1;n++){const s=e[n];","===s&&0===i?(t.push(r.trim()),r=""):(r+=s,"("===s?i+=1:")"===s&&(i-=1))}return r.trim()&&t.push(r.trim()),t},r.tuple={isDynamic:e=>(0,r.getTupleElements)(e).some((e=>{const t=(0,i.getParser)(e);return(0,i.isDynamicParser)(t,e)})),isType:e=>(e=>a.test(e))(e),getByteLength(e){if((0,i.isDynamicParser)(this,e))return 32;return(0,r.getTupleElements)(e).reduce(((e,t)=>e+(0,i.getParser)(t).getByteLength(t)),0)},encode({type:e,buffer:t,value:n,packed:s,tight:a}){const o=(0,r.getTupleElements)(e);return(0,i.pack)({types:o,values:n,byteArray:t,packed:s,tight:a})},decode({type:e,value:t,skip:n}){const s=(0,r.getTupleElements)(e);return n(this.getByteLength(e)-32),(0,i.unpack)(s,t)}}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/parsers/tuple.js"}],[1675,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0})}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/types/abi.js"}],[1676,{"./abi":1675},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),s(e("./abi"),r)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/types/index.js"}],[1677,{"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.padEnd=r.padStart=r.set=void 0;const n=e("@metamask/utils");r.set=(e,t,r)=>(0,n.concatBytes)([e.subarray(0,r),t,e.subarray(r+t.length)]);r.padStart=(e,t=32)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,n.concatBytes)([r,e])};r.padEnd=(e,t=32)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,n.concatBytes)([e,r])}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/utils/buffer.js"}],[1678,{"./buffer":1677},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),s(e("./buffer"),r)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@metamask/abi-utils",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/abi-utils/dist/utils/index.js"}],[1679,{"./utils":1684,"@scure/base":3027,buffer:4074,tweetnacl:5616},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return s(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.getEncryptionPublicKey=r.decryptSafely=r.decrypt=r.encryptSafely=r.encrypt=void 0;const a=e("@scure/base"),o=i(e("tweetnacl")),c=e("./utils");function u({publicKey:e,data:t,version:r}){if((0,c.isNullish)(e))throw new Error("Missing publicKey parameter");if((0,c.isNullish)(t))throw new Error("Missing data parameter");if((0,c.isNullish)(r))throw new Error("Missing version parameter");if("x25519-xsalsa20-poly1305"===r){if("string"!=typeof t)throw new Error("Message data must be given as a string");const r=o.box.keyPair();let n;try{n=a.base64.decode(e)}catch(e){throw new Error("Bad public key")}const s=a.utf8.decode(t),i=o.randomBytes(o.box.nonceLength),c=o.box(s,i,n,r.secretKey);return{version:"x25519-xsalsa20-poly1305",nonce:a.base64.encode(i),ephemPublicKey:a.base64.encode(r.publicKey),ciphertext:a.base64.encode(c)}}throw new Error("Encryption type/version not supported")}function l({encryptedData:e,privateKey:r}){if((0,c.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,c.isNullish)(r))throw new Error("Missing privateKey parameter");if("x25519-xsalsa20-poly1305"===e.version){const n=t.from(r,"hex"),s=o.box.keyPair.fromSecretKey(n).secretKey,i=a.base64.decode(e.nonce),c=a.base64.decode(e.ciphertext),u=a.base64.decode(e.ephemPublicKey),l=o.box.open(c,i,u,s);try{if(!l)throw new Error;const e=a.utf8.encode(l);if(!e)throw new Error;return e}catch(e){if(e&&"string"==typeof e.message&&e.message.length)throw new Error(`Decryption failed: ${e.message}`);throw new Error("Decryption failed.")}}throw new Error("Encryption type/version not supported.")}r.encrypt=u,r.encryptSafely=function({publicKey:e,data:r,version:n}){if((0,c.isNullish)(e))throw new Error("Missing publicKey parameter");if((0,c.isNullish)(r))throw new Error("Missing data parameter");if((0,c.isNullish)(n))throw new Error("Missing version parameter");if("object"==typeof r&&r&&"toJSON"in r)throw new Error("Cannot encrypt with toJSON property. Please remove toJSON property");const s={data:r,padding:""},i=t.byteLength(JSON.stringify(s),"utf-8")%2048;let a=0;return i>0&&(a=2048-i-16),s.padding="0".repeat(a),u({publicKey:e,data:JSON.stringify(s),version:n})},r.decrypt=l,r.decryptSafely=function({encryptedData:e,privateKey:t}){if((0,c.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,c.isNullish)(t))throw new Error("Missing privateKey parameter");return JSON.parse(l({encryptedData:e,privateKey:t})).data},r.getEncryptionPublicKey=function(e){const r=t.from(e,"hex"),n=o.box.keyPair.fromSecretKey(r).publicKey;return a.base64.encode(n)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/dist/encryption.js"}],[168,{"../keyring-snaps-permissions":163},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.isBlockedUrl=void 0;var n=e("../keyring-snaps-permissions");r.isBlockedUrl=async(e,t,r)=>{try{return!(0,n.isProtocolAllowed)(e)||(await t(),r(e).result)}catch(e){return console.error("Invalid URL passed into snap-keyring:",e),!1}}}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/utils/isBlockedUrl.ts"}],[1680,{"./encryption":1679,"./personal-sign":1681,"./sign-eip7702-authorization":1682,"./sign-typed-data":1683,"./utils":1684},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.normalize=r.concatSig=void 0,s(e("./personal-sign"),r),s(e("./sign-typed-data"),r),s(e("./encryption"),r),s(e("./sign-eip7702-authorization"),r);var i=e("./utils");Object.defineProperty(r,"concatSig",{enumerable:!0,get:function(){return i.concatSig}}),Object.defineProperty(r,"normalize",{enumerable:!0,get:function(){return i.normalize}})}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/dist/index.js"}],[1681,{"./utils":1684,"@ethereumjs/util":1693},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.extractPublicKey=r.recoverPersonalSignature=r.personalSign=void 0;const n=e("@ethereumjs/util"),s=e("./utils");function i(e,t){const r=(0,n.hashPersonalMessage)((0,s.legacyToBuffer)(e));return(0,s.recoverPublicKey)(r,t)}r.personalSign=function({privateKey:e,data:t}){if((0,s.isNullish)(t))throw new Error("Missing data parameter");if((0,s.isNullish)(e))throw new Error("Missing privateKey parameter");const r=(0,s.legacyToBuffer)(t),i=(0,n.hashPersonalMessage)(r),a=(0,n.ecsign)(i,e);return(0,s.concatSig)((0,n.toBuffer)(a.v),a.r,a.s)},r.recoverPersonalSignature=function({data:e,signature:t}){if((0,s.isNullish)(e))throw new Error("Missing data parameter");if((0,s.isNullish)(t))throw new Error("Missing signature parameter");const r=i(e,t),a=(0,n.publicToAddress)(r);return(0,n.bufferToHex)(a)},r.extractPublicKey=function({data:e,signature:t}){if((0,s.isNullish)(e))throw new Error("Missing data parameter");if((0,s.isNullish)(t))throw new Error("Missing signature parameter");return`0x${i(e,t).toString("hex")}`}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/dist/personal-sign.js"}],[1682,{"./utils":1684,"@ethereumjs/rlp":1685,"@ethereumjs/util":1693,"@metamask/utils":2950,buffer:4074,"ethereum-cryptography/keccak":4300},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.hashEIP7702Authorization=r.recoverEIP7702Authorization=r.signEIP7702Authorization=void 0;const n=e("@ethereumjs/rlp"),s=e("@ethereumjs/util"),i=e("@metamask/utils"),a=e("ethereum-cryptography/keccak"),o=e("./utils");function c(e){u(e);const r=(0,n.encode)(e),s=t.concat([t.from("05","hex"),r]);return t.from((0,a.keccak256)(s))}function u(e){if((0,o.isNullish)(e))throw new Error("Missing authorization parameter");const[t,r,n]=e;if((0,o.isNullish)(t))throw new Error("Missing chainId parameter");if((0,o.isNullish)(r))throw new Error("Missing contractAddress parameter");if((0,o.isNullish)(n))throw new Error("Missing nonce parameter")}r.signEIP7702Authorization=function({privateKey:e,authorization:t}){if(u(t),(0,o.isNullish)(e))throw new Error("Missing privateKey parameter");const r=c(t),{r:n,s:i,v:a}=(0,s.ecsign)(r,e),l=(0,s.toBuffer)(a);return(0,o.concatSig)(l,n,i)},r.recoverEIP7702Authorization=function({signature:e,authorization:t}){if(u(t),(0,o.isNullish)(e))throw new Error("Missing signature parameter");const r=c(t),n=(0,o.recoverPublicKey)(r,e),a=(0,s.publicToAddress)(n);return(0,i.bytesToHex)(a)},r.hashEIP7702Authorization=c}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/dist/sign-eip7702-authorization.js"}],[1683,{"./utils":1684,"@ethereumjs/util":1693,"@metamask/abi-utils":1661,"@metamask/abi-utils/dist/parsers":1670,"@metamask/abi-utils/dist/utils":1678,"@metamask/utils":2950,"ethereum-cryptography/keccak":4300},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.recoverTypedSignature=r.signTypedData=r.typedSignatureHash=r.TypedDataUtils=r.TYPED_MESSAGE_SCHEMA=r.SignTypedDataVersion=void 0;const n=e("@ethereumjs/util"),s=e("@metamask/abi-utils"),i=e("@metamask/abi-utils/dist/parsers"),a=e("@metamask/abi-utils/dist/utils"),o=e("@metamask/utils"),c=e("ethereum-cryptography/keccak"),u=e("./utils");var l;function d(e,t){if(!Object.keys(l).includes(e))throw new Error(`Invalid version: '${e}'`);if(t&&!t.includes(e))throw new Error(`SignTypedDataVersion not allowed: '${e}'. Allowed versions are: ${t.join(", ")}`)}function h(e,t){(0,o.assert)(null!==t,`Unable to encode value: Invalid number. Expected a valid number value, but received "${t}".`);const r=BigInt(t),n=(0,i.getLength)(e),s=BigInt(2)**BigInt(n)-BigInt(1);return(0,o.assert)(r>=-s&&r<=s,`Unable to encode value: Number "${t}" is out of range for type "${e}".`),r}function f(e){let t=BigInt(0);for(let r=0;r<e.length;r++){const n=BigInt(e.charCodeAt(r)-48);t*=BigInt(10),t+=n>=49?n-BigInt(49)+BigInt(10):n>=17?n-BigInt(17)+BigInt(10):n}return(0,a.padStart)((0,o.bigIntToBytes)(t),20)}function p(e,t,r,i,u){if(d(u,[l.V3,l.V4]),e[r]!==undefined)return["bytes32",u===l.V4&&null==i?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,n.arrToBufArr)((0,c.keccak256)(m(r,i,e,u)))];if("function"===r)throw new Error('Unsupported or invalid type: "function"');if(i===undefined)throw new Error(`missing value for field ${t} of type ${r}`);if("address"===r){if("number"==typeof i)return["address",(0,a.padStart)((0,o.numberToBytes)(i),20)];if((0,o.isStrictHexString)(i))return["address",(0,o.add0x)(i)];if("string"==typeof i)return["address",f(i).subarray(0,20)]}if("bool"===r)return["bool",Boolean(i)];if("bytes"===r)return"number"==typeof i?i=(0,o.numberToBytes)(i):(0,o.isStrictHexString)(i)||"0x"===i?i=(0,o.hexToBytes)(i):"string"==typeof i&&(i=(0,o.stringToBytes)(i)),["bytes32",(0,n.arrToBufArr)((0,c.keccak256)(i))];if(r.startsWith("bytes")&&"bytes"!==r&&!r.includes("["))return"number"==typeof i?i<0?["bytes32",new Uint8Array(32)]:["bytes32",(0,o.bigIntToBytes)(BigInt(i))]:(0,o.isStrictHexString)(i)?["bytes32",(0,o.hexToBytes)(i)]:["bytes32",i];if(r.startsWith("int")&&!r.includes("[")){const e=h(r,i);return e>=BigInt(0)?["uint256",e]:["int256",e]}if("string"===r)return i="number"==typeof i?(0,o.numberToBytes)(i):(0,o.stringToBytes)(null!=i?i:""),["bytes32",(0,n.arrToBufArr)((0,c.keccak256)(i))];if(r.endsWith("]")){if(u===l.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const a=r.slice(0,r.lastIndexOf("[")),o=i.map((r=>p(e,t,a,r,u)));return["bytes32",(0,n.arrToBufArr)((0,c.keccak256)((0,s.encode)(o.map((([e])=>e)),o.map((([,e])=>e)))))]}return[r,i]}function m(e,t,r,i){d(i,[l.V3,l.V4]);const a=["bytes32"],o=[w(e,r)];for(const n of r[e]){if(i===l.V3&&t[n.name]===undefined)continue;const[e,s]=p(r,n.name,n.type,t[n.name],i);a.push(e),o.push(s)}return(0,n.arrToBufArr)((0,s.encode)(a,o))}function g(e,t){let r="";const n=y(e,t);n.delete(e);const s=[e,...Array.from(n).sort()];for(const e of s){if(!t[e])throw new Error(`No type definition specified: ${e}`);r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`}return r}function y(e,t,r=new Set){if("string"!=typeof e)throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(e)}`);const n=e.match(/^\w*/u);if([e]=n,r.has(e)||t[e]===undefined)return r;r.add(e);for(const n of t[e])y(n.type,t,r);return r}function b(e,t,r,s){d(s,[l.V3,l.V4]);const i=m(e,t,r,s),a=(0,c.keccak256)(i);return(0,n.arrToBufArr)(a)}function w(e,t){const r=(0,o.stringToBytes)(g(e,t));return(0,n.arrToBufArr)((0,c.keccak256)(r))}function A(e){const t={};for(const n in r.TYPED_MESSAGE_SCHEMA.properties)e[n]&&(t[n]=e[n]);return"types"in t&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t}function v(e,t){d(t,[l.V3,l.V4]);const r=A(e),{domain:n}=r;return b("EIP712Domain",n,{EIP712Domain:r.types.EIP712Domain},t)}function E(e,t){if((0,i.isArrayType)(e)&&Array.isArray(t)){const[r]=(0,i.getArrayType)(e);return t.map((e=>E(r,e)))}if("address"===e){if((0,o.isStrictHexString)(t))return(0,a.padStart)((0,o.hexToBytes)(t).subarray(0,20),20);if(t instanceof Uint8Array)return(0,a.padStart)(t.subarray(0,20),20)}if("bool"===e)return Boolean(t);if(e.startsWith("bytes")&&"bytes"!==e){const r=(0,i.getByteLength)(e);if("number"==typeof t)return t<0?new Uint8Array:(0,o.numberToBytes)(t).subarray(0,r);if((0,o.isStrictHexString)(t))return(0,o.hexToBytes)(t).subarray(0,r);if(t instanceof Uint8Array)return t.subarray(0,r)}if(e.startsWith("uint")&&"number"==typeof t)return Math.abs(t);if(e.startsWith("int")&&"number"==typeof t){const r=(0,i.getLength)(e);return BigInt.asIntN(r,BigInt(t))}return t}function k(e,t){return t.map((t=>{if("string"==typeof t||"number"==typeof t||"bigint"==typeof t){const r=h(e,t);if(r>=BigInt(0))return(0,a.padStart)((0,o.bigIntToBytes)(r),32);const n=(0,i.getLength)(e),s=BigInt.asIntN(n,r);return(0,o.signedBigIntToBytes)(s,32)}return t}))}function T(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!("length"in e)||!e.length)throw t;const r=e.map((({name:e,type:t,value:r})=>{if("address[]"===t)return{name:e,type:"bytes32[]",value:(n=r,n.map((e=>"number"==typeof e?(0,a.padStart)((0,o.numberToBytes)(e),32):(0,o.isStrictHexString)(e)?(0,a.padStart)((0,o.hexToBytes)(e).subarray(0,32),32):e instanceof Uint8Array?(0,a.padStart)(e.subarray(0,32),32):e)))};var n;if(t.startsWith("int")&&(0,i.isArrayType)(t)){const[n,s]=(0,i.getArrayType)(t);return{name:e,type:`bytes32[${null!=s?s:""}]`,value:k(n,r)}}return{name:e,type:t,value:E(t,r)}})),l=r.map((e=>"bytes"!==e.type?e.value:(0,u.legacyToBuffer)(e.value))),d=r.map((e=>{if("function"===e.type)throw new Error('Unsupported or invalid type: "function"');return e.type})),h=e.map((e=>{if(!e.name)throw t;return`${e.type} ${e.name}`}));return(0,n.arrToBufArr)((0,c.keccak256)((0,s.encodePacked)(["bytes32","bytes32"],[(0,c.keccak256)((0,s.encodePacked)(["string[]"],[h],!0)),(0,c.keccak256)((0,s.encodePacked)(d,l,!0))])))}!function(e){e.V1="V1",e.V3="V3",e.V4="V4"}(l=r.SignTypedDataVersion||(r.SignTypedDataVersion={})),r.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},r.TypedDataUtils={encodeData:m,encodeType:g,findTypeDependencies:y,hashStruct:b,hashType:w,sanitizeData:A,eip712Hash:function(e,t){d(t,[l.V3,l.V4]);const r=A(e),s=[(0,o.hexToBytes)("1901")];return s.push(v(e,t)),"EIP712Domain"!==r.primaryType&&s.push(b(r.primaryType,r.message,r.types,t)),(0,n.arrToBufArr)((0,c.keccak256)((0,o.concatBytes)(s)))},eip712DomainHash:v},r.typedSignatureHash=function(e){const t=T(e);return(0,o.bytesToHex)(t)},r.signTypedData=function({privateKey:e,data:t,version:s}){if(d(s),(0,u.isNullish)(t))throw new Error("Missing data parameter");if((0,u.isNullish)(e))throw new Error("Missing private key parameter");const i=s===l.V1?T(t):r.TypedDataUtils.eip712Hash(t,s),a=(0,n.ecsign)(i,e);return(0,u.concatSig)((0,n.arrToBufArr)((0,o.bigIntToBytes)(a.v)),a.r,a.s)},r.recoverTypedSignature=function({data:e,signature:t,version:s}){if(d(s),(0,u.isNullish)(e))throw new Error("Missing data parameter");if((0,u.isNullish)(t))throw new Error("Missing signature parameter");const i=s===l.V1?T(e):r.TypedDataUtils.eip712Hash(e,s),a=(0,u.recoverPublicKey)(i,t),c=(0,n.publicToAddress)(a);return(0,o.bytesToHex)(c)}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/dist/sign-typed-data.js"}],[1684,{"@ethereumjs/util":1693,"@metamask/utils":2950,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.normalize=r.recoverPublicKey=r.concatSig=r.legacyToBuffer=r.isNullish=r.padWithZeroes=void 0;const n=e("@ethereumjs/util"),s=e("@metamask/utils");function i(e,t){if(""!==e&&!/^[a-f0-9]+$/iu.test(e))throw new Error(`Expected an unprefixed hex string. Received: ${e}`);if(t<0)throw new Error(`Expected a non-negative integer target length. Received: ${t}`);return String.prototype.padStart.call(e,t,"0")}function a(e){return null===e||e===undefined}r.padWithZeroes=i,r.isNullish=a,r.legacyToBuffer=function(e){return"string"!=typeof e||(0,n.isHexString)(e)?(0,n.toBuffer)(e):t.from(e)},r.concatSig=function(e,t,r){const a=(0,n.fromSigned)(t),o=(0,n.fromSigned)(r),c=(0,n.bufferToInt)(e),u=i((0,n.toUnsigned)(a).toString("hex"),64),l=i((0,n.toUnsigned)(o).toString("hex"),64),d=(0,s.remove0x)((0,s.numberToHex)(c));return(0,s.add0x)(u.concat(l,d))},r.recoverPublicKey=function(e,t){const r=(0,n.fromRpcSig)(t);return(0,n.ecrecover)(e,r.v,r.r,r.s)},r.normalize=function(e){if(a(e))return undefined;if("number"==typeof e){if(e<0)return"0x";const t=(0,s.numberToBytes)(e);e=(0,s.bytesToHex)(t)}if("string"!=typeof e){let t="eth-sig-util.normalize() requires hex string or integer input.";throw t+=` received ${typeof e}: ${e}`,new Error(t)}return(0,s.add0x)(e.toLowerCase())}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/dist/utils.js"}],[1685,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){function n(e){if(Array.isArray(e)){const t=[];let r=0;for(let s=0;s<e.length;s++){const i=n(e[s]);t.push(i),r+=i.length}return f(a(r,192),...t)}const t=y(e);return 1===t.length&&t[0]<128?t:f(a(t.length,128),t)}function s(e,t,r){if(r>e.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(t,r)}function i(e){if(0===e[0])throw new Error("invalid RLP: extra zeros");return d(l(e))}function a(e,t){if(e<56)return Uint8Array.from([e+t]);const r=m(e),n=m(t+55+r.length/2);return Uint8Array.from(h(n+r))}function o(e,t=!1){if(null==e||0===e.length)return Uint8Array.from([]);const r=c(y(e));if(t)return r;if(0!==r.remainder.length)throw new Error("invalid RLP: remainder must be zero");return r.data}function c(e){let t,r,n,a,o;const u=[],l=e[0];if(l<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(l<=183){if(t=l-127,n=128===l?Uint8Array.from([]):s(e,1,t),2===t&&n[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:n,remainder:e.slice(t)}}if(l<=191){if(r=l-182,e.length-1<r)throw new Error("invalid RLP: not enough bytes for string length");if(t=i(s(e,1,r)),t<=55)throw new Error("invalid RLP: expected string length to be greater than 55");return n=s(e,r,t+r),{data:n,remainder:e.slice(t+r)}}if(l<=247){for(t=l-191,a=s(e,1,t);a.length;)o=c(a),u.push(o.data),a=o.remainder;return{data:u,remainder:e.slice(t)}}{if(r=l-246,t=i(s(e,1,r)),t<56)throw new Error("invalid RLP: encoded list too short");const n=r+t;if(n>e.length)throw new Error("invalid RLP: total length is larger than the data");for(a=s(e,r,n);a.length;)o=c(a),u.push(o.data),a=o.remainder;return{data:u,remainder:e.slice(n)}}}Object.defineProperty(r,"__esModule",{value:!0}),r.RLP=r.utils=r.decode=r.encode=void 0,r.encode=n,r.decode=o;const u=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function l(e){let t="";for(let r=0;r<e.length;r++)t+=u[e[r]];return t}function d(e){const t=Number.parseInt(e,16);if(Number.isNaN(t))throw new Error("Invalid byte sequence");return t}function h(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r;t[r]=d(e.slice(n,n+2))}return t}function f(...e){if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const s=e[t];r.set(s,n),n+=s.length}return r}function p(e){return(new TextEncoder).encode(e)}function m(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");const t=e.toString(16);return t.length%2?`0${t}`:t}function g(e){return e.length>=2&&"0"===e[0]&&"x"===e[1]}function y(e){if(e instanceof Uint8Array)return e;if("string"==typeof e)return g(e)?h((t="string"!=typeof(r=e)?r:g(r)?r.slice(2):r).length%2?`0${t}`:t):p(e);var t,r;if("number"==typeof e||"bigint"==typeof e)return e?h(m(e)):Uint8Array.from([]);if(null===e||e===undefined)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}r.utils={bytesToHex:l,concatBytes:f,hexToBytes:h,utf8ToBytes:p},r.RLP={encode:n,decode:o}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/rlp",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/rlp/dist/index.js"}],[1686,{"./bytes":1689,"./constants":1690,"./helpers":1692,"./internal":1694,"@ethereumjs/rlp":1685,buffer:4074,"ethereum-cryptography/keccak":4300,"ethereum-cryptography/secp256k1":4317,"ethereum-cryptography/utils":4319},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.accountBodyToRLP=r.accountBodyToSlim=r.accountBodyFromSlim=r.isZeroAddress=r.zeroAddress=r.importPublic=r.privateToAddress=r.privateToPublic=r.publicToAddress=r.pubToAddress=r.isValidPublic=r.isValidPrivate=r.generateAddress2=r.generateAddress=r.isValidChecksumAddress=r.toChecksumAddress=r.isValidAddress=r.Account=void 0;const n=e("@ethereumjs/rlp"),s=e("ethereum-cryptography/keccak"),i=e("ethereum-cryptography/secp256k1"),a=e("ethereum-cryptography/utils"),o=e("./bytes"),c=e("./constants"),u=e("./helpers"),l=e("./internal"),d=BigInt(0);class h{constructor(e=d,t=d,r=c.KECCAK256_RLP,n=c.KECCAK256_NULL){this.nonce=e,this.balance=t,this.storageRoot=r,this.codeHash=n,this._validate()}static fromAccountData(e){const{nonce:t,balance:r,storageRoot:n,codeHash:s}=e;return new h(t!==undefined?(0,o.bufferToBigInt)((0,o.toBuffer)(t)):undefined,r!==undefined?(0,o.bufferToBigInt)((0,o.toBuffer)(r)):undefined,n!==undefined?(0,o.toBuffer)(n):undefined,s!==undefined?(0,o.toBuffer)(s):undefined)}static fromRlpSerializedAccount(e){const t=(0,o.arrToBufArr)(n.RLP.decode(Uint8Array.from(e)));if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)}static fromValuesArray(e){const[t,r,n,s]=e;return new h((0,o.bufferToBigInt)(t),(0,o.bufferToBigInt)(r),n,s)}_validate(){if(this.nonce<d)throw new Error("nonce must be greater than zero");if(this.balance<d)throw new Error("balance must be greater than zero");if(32!==this.storageRoot.length)throw new Error("storageRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")}raw(){return[(0,o.bigIntToUnpaddedBuffer)(this.nonce),(0,o.bigIntToUnpaddedBuffer)(this.balance),this.storageRoot,this.codeHash]}serialize(){return t.from(n.RLP.encode((0,o.bufArrToArr)(this.raw())))}isContract(){return!this.codeHash.equals(c.KECCAK256_NULL)}isEmpty(){return this.balance===d&&this.nonce===d&&this.codeHash.equals(c.KECCAK256_NULL)}}r.Account=h;r.isValidAddress=function(e){try{(0,u.assertIsString)(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)};r.toChecksumAddress=function(e,r){(0,u.assertIsHexString)(e);const n=(0,l.stripHexPrefix)(e).toLowerCase();let i="";if(r!==undefined){i=(0,o.bufferToBigInt)((0,o.toBuffer)(r)).toString()+"0x"}const c=t.from(i+n,"utf8"),d=(0,a.bytesToHex)((0,s.keccak256)(c));let h="0x";for(let e=0;e<n.length;e++)parseInt(d[e],16)>=8?h+=n[e].toUpperCase():h+=n[e];return h};r.isValidChecksumAddress=function(e,t){return(0,r.isValidAddress)(e)&&(0,r.toChecksumAddress)(e,t)===e};r.generateAddress=function(e,r){return(0,u.assertIsBuffer)(e),(0,u.assertIsBuffer)(r),(0,o.bufferToBigInt)(r)===BigInt(0)?t.from((0,s.keccak256)(n.RLP.encode((0,o.bufArrToArr)([e,null])))).slice(-20):t.from((0,s.keccak256)(n.RLP.encode((0,o.bufArrToArr)([e,r])))).slice(-20)};r.generateAddress2=function(e,r,n){if((0,u.assertIsBuffer)(e),(0,u.assertIsBuffer)(r),(0,u.assertIsBuffer)(n),20!==e.length)throw new Error("Expected from to be of length 20");if(32!==r.length)throw new Error("Expected salt to be of length 32");const i=(0,s.keccak256)(t.concat([t.from("ff","hex"),e,r,(0,s.keccak256)(n)]));return(0,o.toBuffer)(i).slice(-20)};r.isValidPrivate=function(e){return i.secp256k1.utils.isValidPrivateKey(e)};r.isValidPublic=function(e,r=!1){if((0,u.assertIsBuffer)(e),64===e.length)try{return i.secp256k1.ProjectivePoint.fromHex(t.concat([t.from([4]),e])),!0}catch(e){return!1}if(!r)return!1;try{return i.secp256k1.ProjectivePoint.fromHex(e),!0}catch(e){return!1}};r.pubToAddress=function(e,r=!1){if((0,u.assertIsBuffer)(e),r&&64!==e.length&&(e=t.from(i.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),64!==e.length)throw new Error("Expected pubKey to be of length 64");return t.from((0,s.keccak256)(e)).slice(-20)},r.publicToAddress=r.pubToAddress;r.privateToPublic=function(e){return(0,u.assertIsBuffer)(e),t.from(i.secp256k1.ProjectivePoint.fromPrivateKey(e).toRawBytes(!1).slice(1))};r.privateToAddress=function(e){return(0,r.publicToAddress)((0,r.privateToPublic)(e))};r.importPublic=function(e){return(0,u.assertIsBuffer)(e),64!==e.length&&(e=t.from(i.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),e};r.zeroAddress=function(){const e=(0,o.zeros)(20);return(0,o.bufferToHex)(e)};function f(e){const[t,r,n,s]=e;return[t,r,0===(0,o.arrToBufArr)(n).length?c.KECCAK256_RLP:n,0===(0,o.arrToBufArr)(s).length?c.KECCAK256_NULL:s]}r.isZeroAddress=function(e){try{(0,u.assertIsString)(e)}catch(e){return!1}return(0,r.zeroAddress)()===e},r.accountBodyFromSlim=f;const p=new Uint8Array(0);r.accountBodyToSlim=function(e){const[t,r,n,s]=e;return[t,r,(0,o.arrToBufArr)(n).equals(c.KECCAK256_RLP)?p:n,(0,o.arrToBufArr)(s).equals(c.KECCAK256_NULL)?p:s]},r.accountBodyToRLP=function(e,t=!0){const r=t?f(e):e;return(0,o.arrToBufArr)(n.RLP.encode(r))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/account.js"}],[1687,{"./account":1686,"./bytes":1689,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.Address=void 0;const n=e("./account"),s=e("./bytes");class i{constructor(e){if(20!==e.length)throw new Error("Invalid address length");this.buf=e}static zero(){return new i((0,s.zeros)(20))}static fromString(e){if(!(0,n.isValidAddress)(e))throw new Error("Invalid address");return new i((0,s.toBuffer)(e))}static fromPublicKey(e){if(!t.isBuffer(e))throw new Error("Public key should be Buffer");const r=(0,n.pubToAddress)(e);return new i(r)}static fromPrivateKey(e){if(!t.isBuffer(e))throw new Error("Private key should be Buffer");const r=(0,n.privateToAddress)(e);return new i(r)}static generate(e,t){if("bigint"!=typeof t)throw new Error("Expected nonce to be a bigint");return new i((0,n.generateAddress)(e.buf,(0,s.bigIntToBuffer)(t)))}static generate2(e,r,s){if(!t.isBuffer(r))throw new Error("Expected salt to be a Buffer");if(!t.isBuffer(s))throw new Error("Expected initCode to be a Buffer");return new i((0,n.generateAddress2)(e.buf,r,s))}equals(e){return this.buf.equals(e.buf)}isZero(){return this.equals(i.zero())}isPrecompileOrSystemAddress(){const e=(0,s.bufferToBigInt)(this.buf),t=BigInt(0),r=BigInt("0xffff");return e>=t&&e<=r}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return t.from(this.buf)}}r.Address=i}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/address.js"}],[1688,{events:4399},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.AsyncEventEmitter=void 0;const n=e("events");class s extends n.EventEmitter{emit(e,...t){let[r,n]=t;const s=this;let i=s._events[e]??[];return n===undefined&&"function"==typeof r&&(n=r,r=undefined),"newListener"!==e&&"removeListener"!==e||(r={event:r,fn:n},n=undefined),i=Array.isArray(i)?i:[i],async function(e,t,r){let n;for await(const s of t)try{s.length<2?s.call(e,r):await new Promise(((t,n)=>{s.call(e,r,(e=>{e?n(e):t()}))}))}catch(e){n=e}if(n)throw n}(s,i.slice(),r).then(n).catch(n),s.listenerCount(e)>0}once(e,t){const r=this;let n;if("function"!=typeof t)throw new TypeError("listener must be a function");return n=t.length>=2?function(s,i){r.removeListener(e,n),t(s,i)}:function(s){r.removeListener(e,n),t(s,n)},r.on(e,n),r}first(e,t){let r=this._events[e]??[];if("function"!=typeof t)throw new TypeError("listener must be a function");return Array.isArray(r)||(this._events[e]=r=[r]),r.unshift(t),this}before(e,t,r){return this.beforeOrAfter(e,t,r)}after(e,t,r){return this.beforeOrAfter(e,t,r,"after")}beforeOrAfter(e,t,r,n){let s,i,a=this._events[e]??[];const o="after"===n?1:0;if("function"!=typeof r)throw new TypeError("listener must be a function");if("function"!=typeof t)throw new TypeError("target must be a function");for(Array.isArray(a)||(this._events[e]=a=[a]),i=a.length,s=a.length;s--;)if(a[s]===t){i=s+o;break}return a.splice(i,0,r),this}on(e,t){return super.on(e,t)}addListener(e,t){return super.addListener(e,t)}prependListener(e,t){return super.prependListener(e,t)}prependOnceListener(e,t){return super.prependOnceListener(e,t)}removeAllListeners(e){return super.removeAllListeners(e)}removeListener(e,t){return super.removeListener(e,t)}eventNames(){return super.eventNames()}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(e){return super.setMaxListeners(e)}}r.AsyncEventEmitter=s}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/asyncEventEmitter.js"}],[1689,{"./helpers":1692,"./internal":1694,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.intToUnpaddedBuffer=r.bigIntToUnpaddedBuffer=r.bigIntToHex=r.bufArrToArr=r.arrToBufArr=r.validateNoLeadingZeroes=r.baToJSON=r.toUtf8=r.short=r.addHexPrefix=r.toUnsigned=r.fromSigned=r.bufferToInt=r.bigIntToBuffer=r.bufferToBigInt=r.bufferToHex=r.toBuffer=r.unpadHexString=r.unpadArray=r.unpadBuffer=r.setLengthRight=r.setLengthLeft=r.zeros=r.intToBuffer=r.intToHex=void 0;const n=e("./helpers"),s=e("./internal");r.intToHex=function(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`};r.intToBuffer=function(e){const n=(0,r.intToHex)(e);return t.from((0,s.padToEven)(n.slice(2)),"hex")};r.zeros=function(e){return t.allocUnsafe(e).fill(0)};const i=function(e,t,n){const s=(0,r.zeros)(t);return n?e.length<t?(e.copy(s),s):e.slice(0,t):e.length<t?(e.copy(s,t-e.length),s):e.slice(-t)};r.setLengthLeft=function(e,t){return(0,n.assertIsBuffer)(e),i(e,t,!1)};r.setLengthRight=function(e,t){return(0,n.assertIsBuffer)(e),i(e,t,!0)};const a=function(e){let t=e[0];for(;e.length>0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};r.unpadBuffer=function(e){return(0,n.assertIsBuffer)(e),a(e)};r.unpadArray=function(e){return(0,n.assertIsArray)(e),a(e)};r.unpadHexString=function(e){return(0,n.assertIsHexString)(e),e=(0,s.stripHexPrefix)(e),"0x"+a(e)};r.toBuffer=function(e){if(null===e||e===undefined)return t.allocUnsafe(0);if(t.isBuffer(e))return t.from(e);if(Array.isArray(e)||e instanceof Uint8Array)return t.from(e);if("string"==typeof e){if(!(0,s.isHexString)(e))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${e}`);return t.from((0,s.padToEven)((0,s.stripHexPrefix)(e)),"hex")}if("number"==typeof e)return(0,r.intToBuffer)(e);if("bigint"==typeof e){if(e<BigInt(0))throw new Error(`Cannot convert negative bigint to buffer. Given: ${e}`);let r=e.toString(16);return r.length%2&&(r="0"+r),t.from(r,"hex")}if(e.toArray)return t.from(e.toArray());if(e.toBuffer)return t.from(e.toBuffer());throw new Error("invalid type")};function o(e){const t=(0,r.bufferToHex)(e);return"0x"===t?BigInt(0):BigInt(t)}function c(e){return(0,r.toBuffer)("0x"+e.toString(16))}r.bufferToHex=function(e){return"0x"+(e=(0,r.toBuffer)(e)).toString("hex")},r.bufferToBigInt=o,r.bigIntToBuffer=c;r.bufferToInt=function(e){const t=Number(o(e));if(!Number.isSafeInteger(t))throw new Error("Number exceeds 53 bits");return t};r.fromSigned=function(e){return BigInt.asIntN(256,o(e))};r.toUnsigned=function(e){return c(BigInt.asUintN(256,e))};r.addHexPrefix=function(e){return"string"!=typeof e||(0,s.isHexPrefixed)(e)?e:"0x"+e},r.short=function(e,r=50){const n=t.isBuffer(e)?e.toString("hex"):e;return n.length<=r?n:n.slice(0,r)+"…"};r.toUtf8=function(e){if((e=(0,s.stripHexPrefix)(e)).length%2!=0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return t.from(e.replace(/^(00)+|(00)+$/g,""),"hex").toString("utf8")};r.baToJSON=function(e){if(t.isBuffer(e))return`0x${e.toString("hex")}`;if(e instanceof Array){const t=[];for(let n=0;n<e.length;n++)t.push((0,r.baToJSON)(e[n]));return t}};r.validateNoLeadingZeroes=function(e){for(const[t,r]of Object.entries(e))if(r!==undefined&&r.length>0&&0===r[0])throw new Error(`${t} cannot have leading zeroes, received: ${r.toString("hex")}`)},r.arrToBufArr=function e(r){return Array.isArray(r)?r.map((t=>e(t))):t.from(r)},r.bufArrToArr=function e(t){return Array.isArray(t)?t.map((t=>e(t))):Uint8Array.from(t??[])};r.bigIntToHex=e=>"0x"+e.toString(16),r.bigIntToUnpaddedBuffer=function(e){return(0,r.unpadBuffer)(c(e))},r.intToUnpaddedBuffer=function(e){return(0,r.unpadBuffer)((0,r.intToBuffer)(e))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/bytes.js"}],[169,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.showSuccess=r.showError=void 0;const n=e=>({name:"SnapAuthorshipHeader",key:"snapHeader",properties:{snapId:e}});r.showError=(e,t,r,s)=>e.call("ApprovalController:showError",{header:[n(t)],title:r.title,icon:r.icon,error:{key:"snapAccountErrorMessage",name:"SnapAccountErrorMessage",properties:s}});r.showSuccess=(e,t,r,s)=>e.call("ApprovalController:showSuccess",{header:[n(t)],title:r.title,icon:r.icon,message:{key:"snapAccountSuccessMessage",name:"SnapAccountSuccessMessage",properties:s}})}}},{package:"$root$",file:"app/scripts/lib/snap-keyring/utils/showResult.ts"}],[1690,{buffer:4074,"ethereum-cryptography/secp256k1":4317},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.MAX_WITHDRAWALS_PER_PAYLOAD=r.RLP_EMPTY_STRING=r.KECCAK256_RLP=r.KECCAK256_RLP_S=r.KECCAK256_RLP_ARRAY=r.KECCAK256_RLP_ARRAY_S=r.KECCAK256_NULL=r.KECCAK256_NULL_S=r.TWO_POW256=r.SECP256K1_ORDER_DIV_2=r.SECP256K1_ORDER=r.MAX_INTEGER_BIGINT=r.MAX_INTEGER=r.MAX_UINT64=void 0;const n=e("buffer"),s=e("ethereum-cryptography/secp256k1");r.MAX_UINT64=BigInt("0xffffffffffffffff"),r.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),r.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),r.SECP256K1_ORDER=s.secp256k1.CURVE.n,r.SECP256K1_ORDER_DIV_2=s.secp256k1.CURVE.n/BigInt(2),r.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),r.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",r.KECCAK256_NULL=n.Buffer.from(r.KECCAK256_NULL_S,"hex"),r.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",r.KECCAK256_RLP_ARRAY=n.Buffer.from(r.KECCAK256_RLP_ARRAY_S,"hex"),r.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",r.KECCAK256_RLP=n.Buffer.from(r.KECCAK256_RLP_S,"hex"),r.RLP_EMPTY_STRING=n.Buffer.from([128]),r.MAX_WITHDRAWALS_PER_PAYLOAD=16}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/constants.js"}],[1691,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.compactBytesToNibbles=r.bytesToNibbles=r.nibblesToCompactBytes=r.nibblesToBytes=r.hasTerminator=void 0;r.hasTerminator=e=>e.length>0&&16===e[e.length-1];r.nibblesToBytes=(e,t)=>{for(let r=0,n=0;n<e.length;r+=1,n+=2)t[r]=e[n]<<4|e[n+1]};r.nibblesToCompactBytes=e=>{let t=0;(0,r.hasTerminator)(e)&&(t=1,e=e.subarray(0,e.length-1));const n=new Uint8Array(e.length/2+1);return n[0]=t<<5,1&~e.length||(n[0]|=16,n[0]|=e[0],e=e.subarray(1)),(0,r.nibblesToBytes)(e,n.subarray(1)),n};r.bytesToNibbles=e=>{const t=2*e.length+1,r=new Uint8Array(t);for(let t=0;t<e.length;t++){const n=e[t];r[2*t]=n/16,r[2*t+1]=n%16}return r[t-1]=16,r};r.compactBytesToNibbles=e=>{if(0===e.length)return e;let t=(0,r.bytesToNibbles)(e);t[0]<2&&(t=t.subarray(0,t.length-1));const n=2-(1&t[0]);return t.subarray(n)}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/encoding.js"}],[1692,{"../../../../../../../../../is-buffer/index.js":4657,"./internal":1694},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.assertIsString=r.assertIsArray=r.assertIsBuffer=r.assertIsHexString=void 0;const n=e("./internal");r.assertIsHexString=function(e){if(!(0,n.isHexString)(e)){throw new Error(`This method only supports 0x-prefixed hex strings but input was: ${e}`)}};r.assertIsBuffer=function(e){if(!t.isBuffer(e)){throw new Error(`This method only supports Buffer but input was: ${e}`)}};r.assertIsArray=function(e){if(!Array.isArray(e)){throw new Error(`This method only supports number arrays but input was: ${e}`)}};r.assertIsString=function(e){if("string"!=typeof e){throw new Error(`This method only supports strings but input was: ${e}`)}}}).call(this)}).call(this,{isBuffer:e("../../../../../../../../../is-buffer/index.js")})}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/helpers.js"}],[1693,{"./account":1686,"./address":1687,"./asyncEventEmitter":1688,"./bytes":1689,"./constants":1690,"./encoding":1691,"./internal":1694,"./lock":1695,"./provider":1696,"./signature":1697,"./types":1698,"./units":1699,"./withdrawal":1700},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){n===undefined&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){n===undefined&&(n=r),e[n]=t[r]}),s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),r.toAscii=r.stripHexPrefix=r.padToEven=r.isHexString=r.isHexPrefixed=r.getKeys=r.getBinarySize=r.fromUtf8=r.fromAscii=r.arrayContainsArray=void 0,s(e("./constants"),r),s(e("./units"),r),s(e("./account"),r),s(e("./address"),r),s(e("./withdrawal"),r),s(e("./signature"),r),s(e("./bytes"),r),s(e("./types"),r),s(e("./encoding"),r),s(e("./asyncEventEmitter"),r);var i=e("./internal");Object.defineProperty(r,"arrayContainsArray",{enumerable:!0,get:function(){return i.arrayContainsArray}}),Object.defineProperty(r,"fromAscii",{enumerable:!0,get:function(){return i.fromAscii}}),Object.defineProperty(r,"fromUtf8",{enumerable:!0,get:function(){return i.fromUtf8}}),Object.defineProperty(r,"getBinarySize",{enumerable:!0,get:function(){return i.getBinarySize}}),Object.defineProperty(r,"getKeys",{enumerable:!0,get:function(){return i.getKeys}}),Object.defineProperty(r,"isHexPrefixed",{enumerable:!0,get:function(){return i.isHexPrefixed}}),Object.defineProperty(r,"isHexString",{enumerable:!0,get:function(){return i.isHexString}}),Object.defineProperty(r,"padToEven",{enumerable:!0,get:function(){return i.padToEven}}),Object.defineProperty(r,"stripHexPrefix",{enumerable:!0,get:function(){return i.stripHexPrefix}}),Object.defineProperty(r,"toAscii",{enumerable:!0,get:function(){return i.toAscii}}),s(e("./lock"),r),s(e("./provider"),r)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/index.js"}],[1694,{buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(e){(function(){function t(e){if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type "+typeof e);return"0"===e[0]&&"x"===e[1]}Object.defineProperty(r,"__esModule",{value:!0}),r.isHexString=r.getKeys=r.fromAscii=r.fromUtf8=r.toAscii=r.arrayContainsArray=r.getBinarySize=r.padToEven=r.stripHexPrefix=r.isHexPrefixed=void 0,r.isHexPrefixed=t;function n(e){let t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received "+typeof t);return t.length%2&&(t=`0${t}`),t}r.stripHexPrefix=e=>{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return t(e)?e.slice(2):e},r.padToEven=n,r.getBinarySize=function(t){if("string"!=typeof t)throw new Error("[getBinarySize] method requires input type 'string', received "+typeof t);return e.byteLength(t,"utf8")},r.arrayContainsArray=function(e,t,r){if(!0!==Array.isArray(e))throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof e}'`);if(!0!==Array.isArray(t))throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof t}'`);return t[!0===r?"some":"every"]((t=>e.indexOf(t)>=0))},r.toAscii=function(e){let t="",r=0;const n=e.length;for("0x"===e.substring(0,2)&&(r=2);r<n;r+=2){const n=parseInt(e.substr(r,2),16);t+=String.fromCharCode(n)}return t},r.fromUtf8=function(t){return`0x${n(e.from(t,"utf8").toString("hex")).replace(/^0+|0+$/g,"")}`},r.fromAscii=function(e){let t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r).toString(16);t+=n.length<2?`0${n}`:n}return`0x${t}`},r.getKeys=function(e,t,r){if(!Array.isArray(e))throw new Error("[getKeys] method expects input 'params' to be an array, got "+typeof e);if("string"!=typeof t)throw new Error("[getKeys] method expects input 'key' to be type 'string', got "+typeof e);const n=[];for(let s=0;s<e.length;s++){let i=e[s][t];if(!0!==r||i){if("string"!=typeof i)throw new Error("invalid abi - expected type 'string', received "+typeof i)}else i="";n.push(i)}return n},r.isHexString=function(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&!(void 0!==t&&t>0&&e.length!==2+2*t)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/internal.js"}],[1695,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Lock=void 0;r.Lock=class{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise((e=>this.promiseResolverQueue.push(e)))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(1===this.permits&&this.promiseResolverQueue.length>0){this.permits-=1;const e=this.promiseResolverQueue.shift();e&&e(!0)}}}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/lock.js"}],[1696,{"micro-ftch":4910},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getProvider=r.fetchFromProvider=void 0;const n=e("micro-ftch");r.fetchFromProvider=async(e,t)=>(await(0,n.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:t.method,params:t.params,jsonrpc:"2.0",id:1}})).result;r.getProvider=e=>{if("string"==typeof e)return e;if(e?.connection?.url!==undefined)return e.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/provider.js"}],[1697,{"./bytes":1689,"./constants":1690,"./helpers":1692,buffer:4074,"ethereum-cryptography/keccak":4300,"ethereum-cryptography/secp256k1":4317},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.hashPersonalMessage=r.isValidSignature=r.fromRpcSig=r.toCompactSig=r.toRpcSig=r.ecrecover=r.ecsign=void 0;const n=e("ethereum-cryptography/keccak"),s=e("ethereum-cryptography/secp256k1"),i=e("./bytes"),a=e("./constants"),o=e("./helpers");function c(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===undefined?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function u(e){return e===BigInt(0)||e===BigInt(1)}r.ecsign=function(e,r,n){const i=s.secp256k1.sign(e,r),a=i.toCompactRawBytes();return{r:t.from(a.slice(0,32)),s:t.from(a.slice(32,64)),v:n===undefined?BigInt(i.recovery+27):BigInt(i.recovery+35)+BigInt(n)*BigInt(2)}};r.ecrecover=function(e,r,n,a,o){const l=t.concat([(0,i.setLengthLeft)(n,32),(0,i.setLengthLeft)(a,32)],64),d=c(r,o);if(!u(d))throw new Error("Invalid signature v value");const h=s.secp256k1.Signature.fromCompact(l).addRecoveryBit(Number(d)).recoverPublicKey(e);return t.from(h.toRawBytes(!1).slice(1))};r.toRpcSig=function(e,r,n,s){if(!u(c(e,s)))throw new Error("Invalid signature v value");return(0,i.bufferToHex)(t.concat([(0,i.setLengthLeft)(r,32),(0,i.setLengthLeft)(n,32),(0,i.toBuffer)(e)]))};r.toCompactSig=function(e,r,n,s){if(!u(c(e,s)))throw new Error("Invalid signature v value");let a=n;return(e>BigInt(28)&&e%BigInt(2)===BigInt(1)||e===BigInt(1)||e===BigInt(28))&&(a=t.from(n),a[0]|=128),(0,i.bufferToHex)(t.concat([(0,i.setLengthLeft)(r,32),(0,i.setLengthLeft)(a,32)]))};r.fromRpcSig=function(e){const t=(0,i.toBuffer)(e);let r,n,s;if(t.length>=65)r=t.slice(0,32),n=t.slice(32,64),s=(0,i.bufferToBigInt)(t.slice(64));else{if(64!==t.length)throw new Error("Invalid signature length");r=t.slice(0,32),n=t.slice(32,64),s=BigInt((0,i.bufferToInt)(t.slice(32,33))>>7),n[0]&=127}return s<27&&(s+=BigInt(27)),{v:s,r:r,s:n}};r.isValidSignature=function(e,t,r,n=!0,s){if(32!==t.length||32!==r.length)return!1;if(!u(c(e,s)))return!1;const o=(0,i.bufferToBigInt)(t),l=(0,i.bufferToBigInt)(r);return!(o===BigInt(0)||o>=a.SECP256K1_ORDER||l===BigInt(0)||l>=a.SECP256K1_ORDER)&&!(n&&l>=a.SECP256K1_ORDER_DIV_2)};r.hashPersonalMessage=function(e){(0,o.assertIsBuffer)(e);const r=t.from(`Ethereum Signed Message:\n${e.length}`,"utf-8");return t.from((0,n.keccak256)(t.concat([r,e])))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/signature.js"}],[1698,{"./bytes":1689,"./internal":1694},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.toType=r.TypeOutput=void 0;const n=e("./bytes"),s=e("./internal");var i;!function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(i=r.TypeOutput||(r.TypeOutput={})),r.toType=function(e,t){if(null===e)return null;if(e===undefined)return undefined;if("string"==typeof e&&!(0,s.isHexString)(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const r=(0,n.toBuffer)(e);switch(t){case i.Buffer:return r;case i.BigInt:return(0,n.bufferToBigInt)(r);case i.Number:{const e=(0,n.bufferToBigInt)(r);if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(e)}case i.PrefixedHexString:return(0,n.bufferToHex)(r);default:throw new Error("unknown outputType")}}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/types.js"}],[1699,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.GWEI_TO_WEI=void 0,r.GWEI_TO_WEI=BigInt(1e9)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/units.js"}],[17,{"./multichain-assets-controller-messenger":18,"./multichain-assets-rates-controller-messenger":19,"./multichain-balances-controller-messenger":20,"./multichain-network-controller-messenger":21,"./multichain-transactions-controller-messenger":22},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getMultichainAssetsControllerMessenger",{enumerable:!0,get:function(){return n.getMultichainAssetsControllerMessenger}}),Object.defineProperty(r,"getMultichainAssetsRatesControllerMessenger",{enumerable:!0,get:function(){return s.getMultichainAssetsRatesControllerMessenger}}),Object.defineProperty(r,"getMultichainBalancesControllerMessenger",{enumerable:!0,get:function(){return i.getMultichainBalancesControllerMessenger}}),Object.defineProperty(r,"getMultichainNetworkControllerMessenger",{enumerable:!0,get:function(){return o.getMultichainNetworkControllerMessenger}}),Object.defineProperty(r,"getMultichainTransactionsControllerMessenger",{enumerable:!0,get:function(){return a.getMultichainTransactionsControllerMessenger}});var n=e("./multichain-assets-controller-messenger"),s=e("./multichain-assets-rates-controller-messenger"),i=e("./multichain-balances-controller-messenger"),a=e("./multichain-transactions-controller-messenger"),o=e("./multichain-network-controller-messenger")}}},{package:"$root$",file:"app/scripts/controller-init/messengers/multichain/index.ts"}],[170,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.sanitizeUIState=function(e){const t={...e};for(const e of n)delete t[e];return function(e){const t=e.snaps;if(!t)return;e.snaps=Object.values(t).reduce(((e,t)=>(e[t.id]=function(e){const t={...e};return delete t.sourceCode,delete t.auxiliaryFiles,t}(t),e)),{})}(t),t};const n=["snapStates","unencryptedSnapStates","vault"]}}},{package:"$root$",file:"app/scripts/lib/state-utils.ts"}],[1700,{"./address":1687,"./bytes":1689,"./types":1698,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.Withdrawal=void 0;const n=e("./address"),s=e("./bytes"),i=e("./types");class a{constructor(e,t,r,n){this.index=e,this.validatorIndex=t,this.address=r,this.amount=n}static fromWithdrawalData(e){const{index:t,validatorIndex:r,address:s,amount:o}=e,c=(0,i.toType)(t,i.TypeOutput.BigInt),u=(0,i.toType)(r,i.TypeOutput.BigInt),l=new n.Address((0,i.toType)(s,i.TypeOutput.Buffer)),d=(0,i.toType)(o,i.TypeOutput.BigInt);return new a(c,u,l,d)}static fromValuesArray(e){if(4!==e.length)throw Error(`Invalid withdrawalArray length expected=4 actual=${e.length}`);const[t,r,n,s]=e;return a.fromWithdrawalData({index:t,validatorIndex:r,address:n,amount:s})}static toBufferArray(e){const{index:r,validatorIndex:s,address:a,amount:o}=e,c=(0,i.toType)(r,i.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,i.toType)(r,i.TypeOutput.Buffer),u=(0,i.toType)(s,i.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,i.toType)(s,i.TypeOutput.Buffer);let l;l=a instanceof n.Address?a.buf:(0,i.toType)(a,i.TypeOutput.Buffer);return[c,u,l,(0,i.toType)(o,i.TypeOutput.BigInt)===BigInt(0)?t.alloc(0):(0,i.toType)(o,i.TypeOutput.Buffer)]}raw(){return a.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,s.bigIntToHex)(this.index),validatorIndex:(0,s.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,s.bigIntToHex)(this.amount)}}}r.Withdrawal=a}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/eth-sig-util>@ethereumjs/util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/eth-sig-util/node_modules/@ethereumjs/util/dist/withdrawal.js"}],[176,{"../../../../../shared/lib/four-byte":5764,"@ethersproject/abi":484,"@metamask/utils":2950,"ethereumjs-util":4327},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.decodeTransactionDataWithFourByte=async function(e){const t=e.slice(0,10),r=await(0,a.getMethodFrom4Byte)(t);if(!r)return undefined;const i=r.split("(")[0],d=function(e){let t=e.slice(e.indexOf("(")+1,-1);const r=[];for(;t.includes("(");){const e=l(t);if(!e)break;r.push(e.value),t=`${t.slice(0,e.start)}${r.length-1}#${t.slice(e.end+1)}`}return u(t,r)}(r);o("Generated inputs",d);const h=(0,n.addHexPrefix)(e.slice(10)),f=s.Interface.getAbiCoder().decode(d,h),p=d.map(((e,t)=>c(e,t,f)));return{name:i,params:p}};var n=e("ethereumjs-util"),s=e("@ethersproject/abi"),i=e("@metamask/utils"),a=e("../../../../../shared/lib/four-byte");const o=(0,i.createProjectLogger)("four-byte");function c(e,t,r){var n;const s=r[t],{type:i,name:a}=e;let o=null===(n=e.components)||void 0===n?void 0:n.map(((e,t)=>c(e,t,s)));if(i.endsWith("[]")){const t=i.slice(0,-2);o=s.map(((r,n)=>{const i=`Item ${n+1}`;return c({...e,name:i,type:t},n,s)}))}return{name:a,type:i,value:s,children:o}}function u(e,t){return e.split(",").map((e=>{const r=e.split("#"),n=r.length>1?parseInt(r[0],10):undefined;return{type:n===undefined?e:`tuple${r[1]??""}`,components:n===undefined?undefined:u(t[n],t)}}))}function l(e){let t=-1;for(let r=0;r<e.length;r++)if("("===e[r])t=r;else if(")"===e[r]&&-1!==t)return{start:t,end:r,value:e.slice(t+1,r)};return undefined}}}},{package:"$root$",file:"app/scripts/lib/transaction/decode/four-byte.ts"}],[177,{"ethereumjs-util":4327},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.getContractProxyAddress=async function(e,t){const r=(await Promise.all(s.map((r=>t.request({method:"eth_getStorageAt",params:[e,r,"latest"]}))))).find((e=>(0,n.stripHexPrefix)(e)!==i));return r&&(0,n.addHexPrefix)(r.slice(26))};var n=e("ethereumjs-util");const s=["0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3","0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"],i="0".padEnd(64,"0")}}},{package:"$root$",file:"app/scripts/lib/transaction/decode/proxy.ts"}],[178,{"@ethersproject/abi":484,"@metamask/utils":2950},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.decodeTransactionDataWithSourcify=async function(e,t,r){var o,c;const u=await async function(e,t){var r;const n=await async function(e,t){const r=parseInt(t,16),n=await fetch(`https://sourcify.dev/server/files/any/${r}/${e}`);if(!n.ok)throw new Error("Failed to fetch Sourcify files");return n.json()}(e,t),s=null===(r=n.files)||void 0===r?void 0:r.find((e=>e.name.includes("metadata.json")));if(!s)throw new Error("Metadata not found");return JSON.parse(s.content)}(t,r);s("Retrieved Sourcify metadata",{contractAddress:t,chainId:r,metadata:u});const{abi:l}=u.output,d=new n.Interface(l),h=e.slice(0,10);let f;try{f=d.getFunction(h)}catch(e){}if(!f)return s("Failed to find function in ABI",h,l),undefined;const{name:p,inputs:m}=f,g=a(p,m),y=null===(o=u.output.userdoc)||void 0===o?void 0:o.methods[g],b=null===(c=u.output.devdoc)||void 0===c?void 0:c.methods[g],w=(null==y?void 0:y.notice)??(null==b?void 0:b.details);s("Extracted NatSpec",{signature:g,userDoc:y,devDoc:b});const A=d.decodeFunctionData(h,e),v=m.map(((e,t)=>i(e,t,A,y,b)));return{name:p,description:w,params:v}};var n=e("@ethersproject/abi");const s=(0,e("@metamask/utils").createProjectLogger)("sourcify");function i(e,t,r,n,s){var a,o;const{name:c,type:u,components:l}=e,d=(null==n||null===(a=n.params)||void 0===a?void 0:a[c])??(null==s||null===(o=s.params)||void 0===o?void 0:o[c]),h=r[t];let f=null==l?void 0:l.map(((e,t)=>i(e,t,h,{},{})));if(u.endsWith("[]")){const t=u.slice(0,-2);f=h.map(((r,n)=>{const s=`Item ${n+1}`;return i({...e,name:s,type:t},n,h,{},{})}))}return{name:c,description:d,type:u,value:h,children:f}}function a(e,t){return`${e??""}(${t.map((e=>{var t;return null!==(t=e.components)&&void 0!==t&&t.length?`${a(undefined,e.components)}${e.type.endsWith("[]")?"[]":""}`:e.type})).join(",")})`}}}},{package:"$root$",file:"app/scripts/lib/transaction/decode/sourcify.ts"}],[1786,{"./util.cjs":1797},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.CaseInsensitiveMap=void 0;const n=e("./util.cjs");class s extends Map{static fromObject(e){return new s(Object.entries(e))}toObject(){return Object.fromEntries(this.entries())}get(e){return super.get(e.toLowerCase())}getOrThrow(e,t="Key"){return this.get(e)??(0,n.throwError)(`${t} '${e}' not found`)}has(e){return super.has(e.toLowerCase())}set(e,t){return super.set(e.toLowerCase(),t)}delete(e){return super.delete(e.toLowerCase())}}r.CaseInsensitiveMap=s}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/CaseInsensitiveMap.cjs"}],[1787,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.DeferredPromise=void 0;r.DeferredPromise=class{constructor(){if(this.resolve=undefined,this.reject=undefined,this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t})),!this.resolve||!this.reject)throw new Error("Promise constructor failed")}}}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/DeferredPromise.cjs"}],[1788,{"./CaseInsensitiveMap.cjs":1786},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n,s=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r},i=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};Object.defineProperty(r,"__esModule",{value:!0}),r.SnapIdMap=r.InvalidSnapIdError=void 0;const a=e("./CaseInsensitiveMap.cjs");class o extends Error{constructor(e,t){super(`Snap "${e}" is not allowed to set "${t}"`),this.name="InvalidSnapIdError",this.snapId=e,this.key=t}}r.InvalidSnapIdError=o;class c{constructor(e){n.set(this,void 0),s(this,n,new a.CaseInsensitiveMap(e),"f")}toObject(){return i(this,n,"f").toObject()}static fromObject(e){return new c(Object.entries(e))}get(e,t){const r=i(this,n,"f").get(t);return r?.snapId===e?r:undefined}has(e,t){return this.get(e,t)!==undefined}hasSnapId(e){return[...i(this,n,"f").values()].some((t=>t.snapId===e))}delete(e,t){return this.has(e,t)&&i(this,n,"f").delete(t)}set(e,t){if(i(this,n,"f").has(e)&&!this.has(t.snapId,e))throw new o(t.snapId,e);return i(this,n,"f").set(e,t),this}values(){return i(this,n,"f").values()}get size(){return i(this,n,"f").size}}r.SnapIdMap=c,n=new WeakMap}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/SnapIdMap.cjs"}],[1789,{"./DeferredPromise.cjs":1787,"./SnapIdMap.cjs":1788,"./account.cjs":1790,"./events.cjs":1791,"./logger.cjs":1793,"./migrations/index.cjs":1794,"./types.cjs":1796,"./util.cjs":1797,"@ethereumjs/tx":442,"@metamask/eth-sig-util":1834,"@metamask/keyring-api":1983,"@metamask/keyring-internal-snap-client":2033,"@metamask/keyring-utils":2064,"@metamask/superstruct":2872,"@metamask/utils":2950,events:4399,uuid:1839},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){var n,s,i,a,o,c,u,l,d,h,f,p,m,g,y,b,w,A,v,E,k,T,P,S,_,C,I,B,x,M,O=this&&this.__classPrivateFieldSet||function(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r},N=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};Object.defineProperty(r,"__esModule",{value:!0}),r.SnapKeyring=r.SNAP_KEYRING_TYPE=void 0;const R=e("@ethereumjs/tx"),j=e("@metamask/eth-sig-util"),L=e("@metamask/keyring-api"),D=e("@metamask/keyring-internal-snap-client"),U=e("@metamask/keyring-utils"),H=e("@metamask/superstruct"),F=e("@metamask/utils"),G=e("events"),K=e("uuid"),$=e("./account.cjs"),V=e("./DeferredPromise.cjs"),q=e("./events.cjs"),z=e("./logger.cjs"),Q=e("./migrations/index.cjs"),J=e("./SnapIdMap.cjs"),W=e("./types.cjs"),Y=e("./util.cjs");function X(e){return(0,L.isEvmAccountType)(e.type)?e.address.toLowerCase():e.address}r.SNAP_KEYRING_TYPE="Snap Keyring";class Z extends G.EventEmitter{constructor(e,t){super(),n.add(this),s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),o.set(this,void 0),c.set(this,void 0),this.type=Z.type,O(this,s,e,"f"),O(this,i,new D.KeyringInternalSnapClient({messenger:e}),"f"),O(this,o,new J.SnapIdMap,"f"),O(this,a,new J.SnapIdMap,"f"),O(this,c,t,"f")}async handleKeyringSnapMessage(e,t){switch((0,H.assert)(t,W.SnapMessageStruct),t.method){case`${L.KeyringEvent.AccountCreated}`:return N(this,n,"m",u).call(this,e,t);case`${L.KeyringEvent.AccountUpdated}`:return N(this,n,"m",l).call(this,e,t);case`${L.KeyringEvent.AccountDeleted}`:return N(this,n,"m",d).call(this,e,t);case`${L.KeyringEvent.RequestApproved}`:return N(this,n,"m",h).call(this,e,t);case`${L.KeyringEvent.RequestRejected}`:return N(this,n,"m",f).call(this,e,t);case`${L.KeyringEvent.AccountBalancesUpdated}`:return N(this,n,"m",m).call(this,t);case`${L.KeyringEvent.AccountAssetListUpdated}`:return N(this,n,"m",g).call(this,t);case`${L.KeyringEvent.AccountTransactionsUpdated}`:return N(this,n,"m",y).call(this,t);default:throw new Error(`Method not supported: ${t.method}`)}}async serialize(){return{accounts:N(this,a,"f").toObject()}}async deserialize(e){if(e===undefined)return;const t={};for(const[r,n]of Object.entries(e.accounts))(0,Q.isAccountV1)(n.account)?(console.info(`SnapKeyring - Found a KeyringAccountV1, migrating to V2: ${n.account.id}`),t[r]={...n,account:(0,Q.migrateAccountV1)(n.account)}):t[r]=n;O(this,a,J.SnapIdMap.fromObject(t),"f")}async getAccounts(){return(0,Y.unique)([...N(this,a,"f").values()].map((({account:e})=>X(e))))}async getAccountsBySnapId(e){return(0,Y.unique)([...N(this,a,"f").values()].filter((({snapId:t})=>t===e)).map((({account:e})=>X(e))))}hasSnapId(e){return N(this,a,"f").hasSnapId(e)}async resolveAccountAddress(e,t,r){if(!this.hasSnapId(e))throw new Error(`Unable to resolve account address: unknown Snap ID: ${e}`);return await N(this,i,"f").withSnapId(e).resolveAccountAddress(t,r)}async submitRequest({account:e,method:t,params:r,scope:s}){const{account:i,snapId:a}=N(this,n,"m",b).call(this,e);return await N(this,n,"m",A).call(this,{snapId:a,account:i,method:t,params:r,scope:s,noPending:!0})}async signTransaction(e,t,r={}){const s=t.common.chainId(),i=(0,Y.toJson)({...t.toJSON(),from:e,type:`0x${t.type.toString(16)}`,chainId:(0,F.bigIntToHex)(s)}),a=await N(this,n,"m",w).call(this,{address:e,method:L.EthMethod.SignTransaction,params:[i],scope:(0,F.toCaipChainId)(F.KnownCaipNamespace.Eip155,`${s}`)}),o=(0,H.mask)(a,(0,H.object)({r:(0,H.string)(),s:(0,H.string)(),v:(0,H.string)()}));return R.TransactionFactory.fromTxData({...i,r:o.r,s:o.s,v:o.v})}async signTypedData(e,t,r={version:j.SignTypedDataVersion.V1}){const s={[j.SignTypedDataVersion.V1]:L.EthMethod.SignTypedDataV1,[j.SignTypedDataVersion.V3]:L.EthMethod.SignTypedDataV3,[j.SignTypedDataVersion.V4]:L.EthMethod.SignTypedDataV4}[r.version]||L.EthMethod.SignTypedDataV1,i=t.domain?.chainId;return(0,U.strictMask)(await N(this,n,"m",w).call(this,{address:e,method:s,params:(0,Y.toJson)([e,t]),...i===undefined?{}:{scope:(0,F.toCaipChainId)(F.KnownCaipNamespace.Eip155,`${i}`)}}),L.EthBytesStruct)}async signMessage(e,t){return(0,U.strictMask)(await N(this,n,"m",w).call(this,{address:e,method:L.EthMethod.Sign,params:(0,Y.toJson)([e,t])}),L.EthBytesStruct)}async signPersonalMessage(e,t){return(0,U.strictMask)(await N(this,n,"m",w).call(this,{address:e,method:L.EthMethod.PersonalSign,params:(0,Y.toJson)([t,e])}),L.EthBytesStruct)}async prepareUserOperation(e,t,r){return(0,U.strictMask)(await N(this,n,"m",w).call(this,{address:e,method:L.EthMethod.PrepareUserOperation,params:(0,Y.toJson)(t),noPending:!0,scope:(0,F.toCaipChainId)(F.KnownCaipNamespace.Eip155,r.chainId)}),L.EthBaseUserOperationStruct)}async patchUserOperation(e,t,r){return(0,U.strictMask)(await N(this,n,"m",w).call(this,{address:e,method:L.EthMethod.PatchUserOperation,params:(0,Y.toJson)([t]),noPending:!0,scope:(0,F.toCaipChainId)(F.KnownCaipNamespace.Eip155,r.chainId)}),L.EthUserOperationPatchStruct)}async signUserOperation(e,t,r){return(0,U.strictMask)(await N(this,n,"m",w).call(this,{address:e,method:L.EthMethod.SignUserOperation,params:(0,Y.toJson)([t]),scope:(0,F.toCaipChainId)(F.KnownCaipNamespace.Eip155,r.chainId)}),L.EthBytesStruct)}exportAccount(e){throw new Error("Exporting accounts from snaps is not supported.")}async removeAccount(e){const{account:t,snapId:r}=N(this,n,"m",I).call(this,e);await N(this,n,"m",C).call(this,r,t)}getAccountByAddress(e){return this.listAccounts().find((({address:t})=>(0,Y.equalsIgnoreCase)(t,e)))}listAccounts(){return[...N(this,a,"f").values()].map((({account:e,snapId:t})=>{const r=N(this,n,"m",x).call(this,t);return{...e,address:X(e),metadata:{name:"",importTime:0,keyring:{type:this.type},...r!==undefined&&{snap:r}}}}))}}r.SnapKeyring=Z,s=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,c=new WeakMap,n=new WeakSet,u=async function(e,t){(0,H.assert)(t,q.AccountCreatedEventStruct);const{account:r,accountNameSuggestion:s,displayConfirmation:i,displayAccountNameSuggestion:o}=t.params,u=(0,$.transformAccount)(r),l=X(u);if(await N(this,c,"f").addressExists(l))throw new Error(`Account address '${l}' already exists`);if(N(this,a,"f").has(e,u.id))throw new Error(`Account '${u.id}' already exists`);const d=new V.DeferredPromise;return await N(this,c,"f").addAccount(l,e,(async t=>{t&&(N(this,a,"f").set(u.id,{account:u,snapId:e}),N(this,c,"f").saveState().then((()=>{d.resolve(u.id)})).catch((async t=>{await N(this,n,"m",C).call(this,e,u),d.reject(t)})))}),d.promise,s,i,o),null},l=async function(e,t){(0,H.assert)(t,q.AccountUpdatedEventStruct);const{account:r}=t.params,{account:n}=N(this,a,"f").get(e,r.id)??(0,Y.throwError)(`Account '${r.id}' not found`),s=(0,$.transformAccount)(r);if(!(0,Y.equalsIgnoreCase)(n.address,s.address))throw new Error(`Cannot change address of account '${s.id}'`);return N(this,a,"f").set(s.id,{account:s,snapId:e}),await N(this,c,"f").saveState(),null},d=async function(e,t){(0,H.assert)(t,q.AccountDeletedEventStruct);const{id:r}=t.params,n=N(this,a,"f").get(e,r);if(n===undefined)return null;const{account:s}=n;return await N(this,c,"f").removeAccount(X(s),e,(async e=>{e&&await N(this,c,"f").saveState()})),null},h=async function(e,t){(0,H.assert)(t,q.RequestApprovedEventStruct);const{id:r,result:n}=t.params,{promise:s}=N(this,o,"f").get(e,r)??(0,Y.throwError)(`Request '${r}' not found`);return N(this,o,"f").delete(e,r),s.resolve(n),null},f=async function(e,t){(0,H.assert)(t,q.RequestRejectedEventStruct);const{id:r}=t.params,{promise:n}=N(this,o,"f").get(e,r)??(0,Y.throwError)(`Request '${r}' not found`);return N(this,o,"f").delete(e,r),n.reject(new Error("Request rejected by user or snap.")),null},p=async function(e,...t){return N(this,s,"f").publish(e,...t),null},m=async function(e){return(0,H.assert)(e,L.AccountBalancesUpdatedEventStruct),N(this,n,"m",p).call(this,"SnapKeyring:accountBalancesUpdated",e.params)},g=async function(e){return(0,H.assert)(e,L.AccountAssetListUpdatedEventStruct),N(this,n,"m",p).call(this,"SnapKeyring:accountAssetListUpdated",e.params)},y=async function(e){return(0,H.assert)(e,L.AccountTransactionsUpdatedEventStruct),N(this,n,"m",p).call(this,"SnapKeyring:accountTransactionsUpdated",e.params)},b=function(e){const t=[...N(this,a,"f").values()].find((t=>t.account.id===e));if(!t)throw new Error(`Unable to get account: unknown account ID: '${e}'`);return t},w=async function({address:e,method:t,params:r,scope:s="",noPending:i=!1}){const{account:a,snapId:o}=N(this,n,"m",I).call(this,e);return await N(this,n,"m",A).call(this,{snapId:o,account:a,method:t,params:r,scope:s,noPending:i})},A=async function({snapId:e,account:t,method:r,params:s,scope:a,noPending:o}){if(!N(this,n,"m",v).call(this,t,r))throw new Error(`Method '${r}' not supported for account ${t.address}`);const c=(0,K.v4)(),u=N(this,n,"m",E).call(this,c,e);try{const l={id:c,scope:a,account:t.id,request:{method:r,...s!==undefined&&{params:s}}};(0,z.projectLogger)("Submit Snap request: ",l);const d=await N(this,i,"f").withSnapId(e).submitRequest(l);if(o&&d.pending)throw new Error(`Request '${c}' to Snap '${e}' is pending and noPending is true.`);return d.pending?((d.redirect?.message||d.redirect?.url)&&await N(this,n,"m",P).call(this,d.redirect,e),u.promise):N(this,n,"m",T).call(this,d,c,e)}catch(t){throw(0,z.projectLogger)("Snap Request failed: ",{requestId:c}),N(this,n,"m",k).call(this,c,e),t}},v=function(e,t){return e.methods.includes(t)},E=function(e,t){const r=new V.DeferredPromise;return N(this,o,"f").set(e,{promise:r,snapId:t}),r},k=function(e,t){N(this,o,"f").delete(t,e)},T=function(e,t,r){return N(this,o,"f").delete(r,t),e.result},P=async function(e,t){const{message:r="",url:s=""}=e,i=N(this,n,"m",S).call(this,s);i&&N(this,n,"m",_).call(this,i,t),await N(this,c,"f").redirectUser(t,i,r)},S=function(e){return e?(0,Y.sanitizeUrl)(e):e},_=function(e,t){const{origin:r}=new URL(e),s=N(this,n,"m",B).call(this,t);if(!s)throw new Error(`Snap '${t}' not found.`);if(!N(this,n,"m",M).call(this,s).includes(r))throw new Error(`Redirect URL domain '${r}' is not an allowed origin by snap '${t}'`)},C=async function(e,t){N(this,a,"f").delete(e,t.id);try{await N(this,i,"f").withSnapId(e).deleteAccount(t.id)}catch(r){console.error(`Account '${t.address}' may not have been removed from snap '${e}':`,r)}},I=function(e){return[...N(this,a,"f").values()].find((({account:t})=>(0,Y.equalsIgnoreCase)(t.address,e)))??(0,Y.throwError)(`Account '${e}' not found`)},B=function(e){return N(this,s,"f").call("SnapController:get",e)},x=function(e){const t=N(this,n,"m",B).call(this,e);return t?{id:e,name:t.manifest.proposedName,enabled:t.enabled}:undefined},M=function(e){return e.manifest.initialPermissions["endowment:keyring"]?.allowedOrigins??[]},Z.type=r.SNAP_KEYRING_TYPE}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/SnapKeyring.cjs"}],[179,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.UNISWAP_ROUTER_COMMANDS=void 0;r.UNISWAP_ROUTER_COMMANDS={0:{name:"V3_SWAP_EXACT_IN",params:[{type:"address",description:"The recipient of the output of the trade",name:"recipient"},{type:"uint256",description:"The amount of input tokens for the trade",name:"amountIn"},{type:"uint256",description:"The minimum amount of output tokens the user wants",name:"amountOutMin"},{type:"bytes",description:"The UniswapV3 encoded path to trade along",name:"path"},{type:"bool",description:"A flag for whether the input tokens should come from the msg.sender (through Permit2) or whether the funds are already in the UniversalRouter",name:"payerIsUser"}]},1:{name:"V3_SWAP_EXACT_OUT",params:[{type:"address",description:"The recipient of the output of the trade",name:"recipient"},{type:"uint256",description:"The amount of output tokens to receive",name:"amountOut"},{type:"uint256",description:"The maximum number of input tokens that should be spent",name:"amountInMax"},{type:"bytes",description:"The UniswapV3 encoded path to trade along",name:"path"},{type:"bool",description:"A flag for whether the input tokens should come from the msg.sender (through Permit2) or whether the funds are already in the UniversalRouter",name:"payerIsUser"}]},2:{name:"PERMIT2_TRANSFER_FROM",params:[{type:"address",description:"The token to fetch from Permit2",name:"token"},{type:"address",description:"The recipient of the tokens fetched",name:"recipient"},{type:"uint256",description:"The amount of token to fetch",name:"amount"}]},3:{name:"PERMIT2_PERMIT_BATCH",params:[{type:"bytes",description:"A PermitBatch struct outlining all of the Permit2 permits to execute.",name:"batch"},{type:"bytes",description:"The signature to provide to Permit2",name:"data"}]},4:{name:"SWEEP",params:[{type:"address",description:"The ERC20 token to sweep (or Constants.ETH for ETH)",name:"token"},{type:"address",description:"The recipient of the sweep",name:"recipient"},{type:"uint256",description:"The minimum required tokens to receive from the sweep",name:"amountMin"}]},5:{name:"TRANSFER",params:[{type:"address",description:"The ERC20 token to transfer (or Constants.ETH for ETH)",name:"token"},{type:"address",description:"The recipient of the transfer",name:"recipient"},{type:"uint256",description:"The amount to transfer",name:"value"}]},6:{name:"PAY_PORTION",params:[{type:"address",description:"The ERC20 token to transfer (or Constants.ETH for ETH)",name:"token"},{type:"address",description:"The recipient of the transfer",name:"recipient"},{type:"uint256",description:"In basis points, the percentage of the contracts balance to transfer",name:"bips"}]},8:{name:"V2_SWAP_EXACT_IN",params:[{type:"address",description:"The recipient of the output of the trade",name:"recipient"},{type:"uint256",description:"The amount of input tokens for the trade",name:"amountIn"},{type:"uint256",description:"The minimum amount of output tokens the user wants",name:"amountOutMin"},{type:"address[]",description:"The UniswapV2 token path to trade along",name:"path"},{type:"bool",description:"A flag for whether the input tokens should come from the msg.sender (through Permit2) or whether the funds are already in the UniversalRouter",name:"payerIsUser"}]},9:{name:"V2_SWAP_EXACT_OUT",params:[{type:"address",description:"The recipient of the output of the trade",name:"recipient"},{type:"uint256",description:"The amount of output tokens to receive",name:"amountOut"},{type:"uint256",description:"The maximum number of input tokens that should be spent",name:"amountInMax"},{type:"address[]",description:"The UniswapV2 token path to trade along",name:"path"},{type:"bool",description:"A flag for whether the input tokens should come from the msg.sender (through Permit2) or whether the funds are already in the UniversalRouter",name:"payerIsUser"}]},10:{name:"PERMIT2_PERMIT",params:[{type:"bytes",description:"A PermitSingle struct outlining the Permit2 permit to execute",name:"permitSingle"},{type:"bytes",description:"The signature to provide to Permit2",name:"signature"}]},11:{name:"WRAP_ETH",params:[{type:"address",description:"The recipient of the WETH",name:"recipient"},{type:"uint256",description:"The amount of ETH to wrap",name:"amountMin"}]},12:{name:"UNWRAP_WETH",params:[{type:"address",description:"The recipient of the ETH",name:"recipient"},{type:"uint256",description:"The minimum required ETH to receive from the unwrapping",name:"amountMin"}]},13:{name:"PERMIT2_TRANSFER_FROM_BATCH",params:[{type:"bytes",description:"An array of AllowanceTransferDetails structs that each describe a Permit2 transfer to perform",name:"batchDetails"}]},16:{name:"SEAPORT",params:[{type:"uint256",description:"The ETH value to forward to the Seaport contract",name:"value"},{type:"bytes",description:"The calldata to use to call the Seaport contract",name:"data"}]},17:{name:"LOOKS_RARE_721",params:[{type:"uint256",description:"The ETH value to forward to the LooksRare contract",name:"value"},{type:"bytes",description:"The calldata to use to call the LooksRare contract",name:"data"},{type:"address",description:"The recipient of the ERC721",name:"recipient"},{type:"address",description:"The ERC721 token address",name:"token"},{type:"uint256",description:"The ID of the ERC721",name:"id"}]},18:{name:"NFTX",params:[{type:"uint256",description:"The ETH value to forward to the NFTX contract",name:"value"},{type:"bytes",description:"The calldata to use to call the NFTX contract",name:"data"}]},19:{name:"CRYPTOPUNKS",params:[{type:"uint256",description:"The PunkID to purchase",name:"punkId"},{type:"address",description:"The recipient for the cryptopunk",name:"recipient"},{type:"uint256",description:"The ETH value to forward to the Cryptopunks contract",name:"value"}]},20:{name:"LOOKS_RARE_1155",params:[{type:"uint256",description:"The ETH value to forward to the LooksRare contract",name:"value"},{type:"bytes",description:"The calldata to use to call the LooksRare contract",name:"data"},{type:"address",description:"The recipient of the ERC1155",name:"recipient"},{type:"address",description:"The ERC1155 token address",name:"token"},{type:"uint256",description:"The ID of the ERC1155",name:"id"},{type:"uint256",description:"The amount of the ERC1155 to transfer",name:"amount"}]},21:{name:"OWNER_CHECK_721",params:[{type:"address",description:"The required owner of the ERC721",name:"owner"},{type:"address",description:"The ERC721 token address",name:"token"},{type:"uint256",description:"The ID of the ERC721",name:"id"}]},22:{name:"OWNER_CHECK_1155",params:[{type:"address",description:"The required owner of the ERC1155",name:"owner"},{type:"address",description:"The ERC721 token address",name:"token"},{type:"uint256",description:"The ID of the ERC1155",name:"id"},{type:"uint256",description:"The minimum required amount of the ERC1155",name:"minBalance"}]},23:{name:"SWEEP_ERC721",params:[{type:"address",description:"The ERC721 token address to transfer",name:"token"},{type:"address",description:"The recipient of the transfer",name:"recipient"},{type:"uint256",description:"The token ID to transfer",name:"id"}]},24:{name:"X2Y2_721",params:[{type:"uint256",description:"The ETH value to forward to the X2Y2 contract",name:"value"},{type:"bytes",description:"The calldata to use to call the X2Y2 contract",name:"data"},{type:"address",description:"The recipient of the ERC721",name:"recipient"},{type:"address",description:"The ERC721 token address",name:"token"},{type:"uint256",description:"The ID of the ERC721",name:"id"}]},25:{name:"SUDOSWAP",params:[{type:"uint256",description:"The ETH value to forward to the Sudoswap contract",name:"value"},{type:"bytes",description:"The calldata to use to call the Sudoswap contract",name:"data"}]},26:{name:"NFT20",params:[{type:"uint256",description:"The ETH value to forward to the NFT20 contract",name:"value"},{type:"bytes",description:"The calldata to use to call the NFT20 contract",name:"data"}]},27:{name:"X2Y2_1155",params:[{type:"uint256",description:"The ETH value to forward to the X2Y2 contract",name:"value"},{type:"bytes",description:"The calldata to use to call the X2Y2 contract",name:"data"},{type:"address",description:"The recipient of the ERC1155",name:"recipient"},{type:"address",description:"The ERC1155 token address",name:"token"},{type:"uint256",description:"The ID of the ERC1155",name:"id"},{type:"uint256",description:"The amount of the ERC1155 to transfer",name:"amount"}]},28:{name:"FOUNDATION",params:[{type:"uint256",description:"The ETH value to forward to the Foundation contract",name:"value"},{type:"bytes",description:"The calldata to use to call the Foundation contract",name:"data"},{type:"address",description:"The recipient of the ERC721",name:"recipient"},{type:"address",description:"The ERC721 token address",name:"token"},{type:"uint256",description:"The ID of the ERC721",name:"id"}]},29:{name:"SWEEP_ERC1155",params:[{type:"address",description:"The ERC1155 token address to sweep",name:"token"},{type:"address",description:"The recipient of the sweep",name:"recipient"},{type:"uint256",description:"The token ID to sweep",name:"id"},{type:"uint256",description:"The minimum required tokens to receive from the sweep",name:"amount"}]}}}}},{package:"$root$",file:"app/scripts/lib/transaction/decode/uniswap-commands.ts"}],[1790,{"./migrations/index.cjs":1794,"@metamask/keyring-api":1983,"@metamask/superstruct":2872},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.KeyringAccountV1Struct=void 0,r.assertKeyringAccount=a,r.transformAccount=function(e){return a((0,i.isAccountV1)(e)?(0,i.transformAccountV1)(e):e)};const n=e("@metamask/keyring-api"),s=e("@metamask/superstruct"),i=e("./migrations/index.cjs");function a(e){switch(e.type){case n.BtcAccountType.P2wpkh:return(0,s.assert)(e,n.BtcP2wpkhAccountStruct),e;case n.SolAccountType.DataAccount:return(0,s.assert)(e,n.SolDataAccountStruct),e;case n.EthAccountType.Erc4337:return(0,s.assert)(e,n.EthErc4337AccountStruct),e;case n.EthAccountType.Eoa:return(0,s.assert)(e,n.EthEoaAccountStruct),e;default:throw new Error(`Unknown account type: '${e.type}'`)}}r.KeyringAccountV1Struct=(0,s.omit)(n.KeyringAccountStruct,["scopes"])}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/account.cjs"}],[1791,{"./account.cjs":1790,"@metamask/keyring-api":1983,"@metamask/keyring-utils":2064,"@metamask/superstruct":2872},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.RequestRejectedEventStruct=r.RequestApprovedEventStruct=r.AccountDeletedEventStruct=r.AccountUpdatedEventStruct=r.AccountCreatedEventStruct=void 0;const n=e("@metamask/keyring-api");Object.defineProperty(r,"AccountDeletedEventStruct",{enumerable:!0,get:function(){return n.AccountDeletedEventStruct}}),Object.defineProperty(r,"RequestApprovedEventStruct",{enumerable:!0,get:function(){return n.RequestApprovedEventStruct}}),Object.defineProperty(r,"RequestRejectedEventStruct",{enumerable:!0,get:function(){return n.RequestRejectedEventStruct}});const s=e("@metamask/keyring-utils"),i=e("@metamask/superstruct"),a=e("./account.cjs");r.AccountCreatedEventStruct=(0,s.object)({...n.AccountCreatedEventStruct.schema,params:(0,s.object)({...n.AccountCreatedEventStruct.schema.params.schema,account:(0,i.union)([a.KeyringAccountV1Struct,n.KeyringAccountStruct])})}),r.AccountUpdatedEventStruct=(0,s.object)({...n.AccountUpdatedEventStruct.schema,params:(0,s.object)({...n.AccountUpdatedEventStruct.schema.params.schema,account:(0,i.union)([a.KeyringAccountV1Struct,n.KeyringAccountStruct])})})}}},{package:"@metamask/eth-snap-keyring",file:"node_modules/@metamask/eth-snap-keyring/dist/events.cjs"}]],[],{});