LavaPack.loadBundle([[10,{"../../../shared/constants/metametrics":3408,"../../../shared/constants/network":3409,"../../../shared/constants/time":3415,"../../../shared/constants/tokens":3416,"../../../shared/constants/transaction":3417,"../../../shared/modules/network.utils":3437,"../../../shared/modules/string-utils":3442,loglevel:2944},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("loglevel"),s=e("../../../shared/constants/time"),i=e("../../../shared/constants/network"),o=e("../../../shared/constants/tokens"),a=e("../../../shared/modules/network.utils"),c=e("../../../shared/modules/string-utils"),u=e("../../../shared/constants/transaction"),l=e("../../../shared/constants/metametrics");const d=3*s.MINUTE;n.default=class{constructor({interval:e=d,preferences:t,network:n,keyringMemStore:r,tokenList:s,tokensController:i,assetsContractController:o=null,trackMetaMetricsEvent:a}={}){var c,u,l,h,f;this.assetsContractController=o,this.tokensController=i,this.preferences=t,this.interval=e,this.network=n,this.keyringMemStore=r,this.tokenList=s,this.useTokenDetection=null===(c=this.preferences)||void 0===c?void 0:c.store.getState().useTokenDetection,this.selectedAddress=null===(u=this.preferences)||void 0===u?void 0:u.store.getState().selectedAddress,this.tokenAddresses=null===(l=this.tokensController)||void 0===l?void 0:l.state.tokens.map((e=>e.address)),this.hiddenTokens=null===(h=this.tokensController)||void 0===h?void 0:h.state.ignoredTokens,this.detectedTokens=null===(f=this.tokensController)||void 0===f?void 0:f.state.detectedTokens,this.chainId=this.getChainIdFromNetworkStore(n),this._trackMetaMetricsEvent=a,null==t||t.store.subscribe((({selectedAddress:e,useTokenDetection:t})=>{this.selectedAddress===e&&this.useTokenDetection===t||(this.selectedAddress=e,this.useTokenDetection=t,this.restartTokenDetection({selectedAddress:e}))})),null==i||i.subscribe((({tokens:e=[],ignoredTokens:t=[],detectedTokens:n=[]})=>{this.tokenAddresses=e.map((e=>e.address)),this.hiddenTokens=t,this.detectedTokens=n}))}async detectNewTokens({selectedAddress:e,chainId:t}={}){const n=e??this.selectedAddress,s=t??this.getChainIdFromNetworkStore(this._network);if(!this.isActive)return;if(!(0,a.isTokenDetectionEnabledForNetwork)(s))return;if(!this.useTokenDetection&&s!==i.CHAIN_IDS.MAINNET)return;const d=!this.useTokenDetection&&s===i.CHAIN_IDS.MAINNET,{tokenList:h}=this._tokenList.state,f=d?o.STATIC_MAINNET_TOKEN_LIST:h,p=[];for(const e in f)this.tokenAddresses.find((t=>(0,c.isEqualCaseInsensitive)(t,e)))||this.hiddenTokens.find((t=>(0,c.isEqualCaseInsensitive)(t,e)))||this.detectedTokens.find((({address:t})=>(0,c.isEqualCaseInsensitive)(t,e)))||p.push(e);const m=[p.slice(0,1e3),p.slice(1e3,p.length-1)];for(const e of m){let t;try{t=await this.assetsContractController.getBalancesInSingleCall(n,e)}catch(e){return void(0,r.warn)("MetaMask - DetectTokensController single call balance fetch failed",e)}const i=[],o=[];if(t){const e=Object.keys(t);for(const t of e){const{address:e,symbol:n,decimals:r}=f[t];o.push(`${n} - ${e}`),i.push({address:e,symbol:n,decimals:r})}i.length>0&&(this._trackMetaMetricsEvent({event:l.MetaMetricsEventName.TokenDetected,category:l.MetaMetricsEventCategory.Wallet,properties:{tokens:o,token_standard:u.TokenStandard.ERC20,asset_type:u.AssetType.token}}),await this.tokensController.addDetectedTokens(i,{selectedAddress:n,chainId:s}))}}}restartTokenDetection({selectedAddress:e,chainId:t}={}){const n=e??this.selectedAddress,r=t??this.chainId;this.isActive&&n&&(this.detectNewTokens({selectedAddress:n,chainId:r}),this.interval=d)}getChainIdFromNetworkStore(e){return null==e?void 0:e.store.getState().provider.chainId}set interval(e){this._handle&&clearInterval(this._handle),e&&(this._handle=setInterval((()=>{this.detectNewTokens()}),e))}set network(e){e&&(this._network=e,this._network.store.subscribe((()=>{if(this.chainId!==this.getChainIdFromNetworkStore(e)){const t=this.getChainIdFromNetworkStore(e);this.chainId=t,this.restartTokenDetection({chainId:this.chainId})}})))}set keyringMemStore(e){e&&(this._keyringMemStore=e,this._keyringMemStore.subscribe((({isUnlocked:e})=>{this.isUnlocked!==e&&(this.isUnlocked=e,e&&this.restartTokenDetection())})))}set tokenList(e){e&&(this._tokenList=e)}get isActive(){return this.isOpen&&this.isUnlocked}}}}},{package:"$root$",file:"app/scripts/controllers/detect-tokens.js"}],[100,{"../controllers/transactions/lib/tx-state-history-helpers":30,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../controllers/transactions/lib/tx-state-history-helpers");var i={version:18,migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=18;try{const e=function(e){const t=e,{TransactionController:n}=t;if(n&&n.transactions){const{transactions:e}=t.TransactionController;t.TransactionController.transactions=e.map((e=>{if(!e.history||0===e.history.length){const t=(0,s.snapshotFromTxMeta)(e);return e.history=[t],e}const t=(0,s.migrateFromSnapshotsToDiffs)(e.history).filter((e=>!Array.isArray(e)||e.length>0));return e.history=t,e}))}return t}(t.data);t.data=e}catch(e){console.warn(`MetaMask Migration #18${e.stack}`)}return Promise.resolve(t)}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/018.js"}],[101,{"../../../shared/constants/transaction":3417,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../../../shared/constants/transaction");var i={version:19,migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=19;try{const e=function(e){const t=e,{TransactionController:n}=t;if(n&&n.transactions){const{transactions:e}=t.TransactionController;t.TransactionController.transactions=e.map(((e,t,n)=>{if(e.status!==s.TransactionStatus.submitted)return e;const r=function(e){const t=e.map((e=>{const{nonce:t}=e.txParams;return parseInt(t||"0x0",16)}));return Math.max.apply(null,t)}(n.filter((e=>e.status===s.TransactionStatus.confirmed)).filter((t=>t.txParams.from===e.txParams.from)).filter((t=>t.metamaskNetworkId.from===e.metamaskNetworkId.from))),i=function(e,t){const n=e.map((e=>{const{nonce:t}=e.txParams;return parseInt(t,16)}));let r=t;for(;n.includes(r);)r+=1;return r}(n.filter((e=>e.status===s.TransactionStatus.submitted)).filter((t=>t.txParams.from===e.txParams.from)).filter((t=>t.metamaskNetworkId.from===e.metamaskNetworkId.from)),r),o=Math.max(i,r);return parseInt(e.txParams.nonce,16)>o+1&&(e.status=s.TransactionStatus.failed,e.err={message:"nonce too high",note:"migration 019 custom error"}),e}))}return t}(t.data);t.data=e}catch(e){console.warn(`MetaMask Migration #19${e.stack}`)}return Promise.resolve(t)}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/019.js"}],[1015,{"@metamask/base-controller":1020,"@metamask/controller-utils":1022},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AddressBookController=void 0;const r=e("@metamask/controller-utils"),s=e("@metamask/base-controller");class i extends s.BaseController{constructor(e,t){super(e,t),this.name="AddressBookController",this.defaultState={addressBook:{}},this.initialize()}clear(){this.update({addressBook:{}})}delete(e,t){if(t=(0,r.toChecksumHexAddress)(t),!(0,r.isValidHexAddress)(t)||!this.state.addressBook[e]||!this.state.addressBook[e][t])return!1;const n=Object.assign({},this.state.addressBook);return delete n[e][t],0===Object.keys(n[e]).length&&delete n[e],this.update({addressBook:n}),!0}set(e,t,n="1",s=""){if(e=(0,r.toChecksumHexAddress)(e),!(0,r.isValidHexAddress)(e))return!1;const i={address:e,chainId:n,isEns:!1,memo:s,name:t},o=(0,r.normalizeEnsName)(t);return o&&(i.name=o,i.isEns=!0),this.update({addressBook:Object.assign(Object.assign({},this.state.addressBook),{[n]:Object.assign(Object.assign({},this.state.addressBook[n]),{[e]:i})})}),!0}}n.AddressBookController=i,n.default=i}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/AddressBookController.js"}],[1016,{"./AddressBookController":1015},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./AddressBookController"),n)}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/index.js"}],[1017,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BaseController=void 0;class r{constructor(e={},t={}){this.defaultConfig={},this.defaultState={},this.disabled=!1,this.name="BaseController",this.internalConfig=this.defaultConfig,this.internalState=this.defaultState,this.internalListeners=[],this.initialState=t,this.initialConfig=e}initialize(){return this.internalState=this.defaultState,this.internalConfig=this.defaultConfig,this.configure(this.initialConfig),this.update(this.initialState),this}get config(){return this.internalConfig}get state(){return this.internalState}configure(e,t=!1,n=!0){if(n){this.internalConfig=t?e:Object.assign(this.internalConfig,e);for(const e in this.internalConfig)void 0!==this.internalConfig[e]&&(this[e]=this.internalConfig[e])}else for(const t in e)void 0!==this.internalConfig[t]&&(this.internalConfig[t]=e[t],this[t]=e[t])}notify(){this.disabled||this.internalListeners.forEach((e=>{e(this.internalState)}))}subscribe(e){this.internalListeners.push(e)}unsubscribe(e){const t=this.internalListeners.findIndex((t=>e===t));return t>-1&&this.internalListeners.splice(t,1),t>-1}update(e,t=!1){this.internalState=t?Object.assign({},e):Object.assign({},this.internalState,e),this.notify()}}n.BaseController=r,n.default=r}}},{package:"@metamask/address-book-controller>@metamask/base-controller",file:"node_modules/@metamask/address-book-controller/node_modules/@metamask/base-controller/dist/BaseController.js"}],[1018,{immer:2694},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseController=void 0;const r=e("immer");(0,r.enablePatches)();function s(e,t,n){return Object.keys(e).reduce(((r,s)=>{const i=t[s][n],o=e[s];return"function"==typeof i?r[s]=i(o):i&&(r[s]=o),r}),{})}n.BaseController=class{constructor({messenger:e,metadata:t,name:n,state:r}){this.messagingSystem=e,this.name=n,this.internalState=r,this.metadata=t,this.messagingSystem.registerActionHandler(`${n}:getState`,(()=>this.state))}get state(){return this.internalState}set state(e){throw new Error("Controller state cannot be directly mutated; use 'update' method instead.")}update(e){const[t,n]=r.produceWithPatches(this.internalState,e);this.internalState=t,this.messagingSystem.publish(`${this.name}:stateChange`,t,n)}destroy(){this.messagingSystem.clearEventSubscriptions(`${this.name}:stateChange`)}},n.getAnonymizedState=function(e,t){return s(e,t,"anonymous")},n.getPersistentState=function(e,t){return s(e,t,"persist")}}}},{package:"@metamask/address-book-controller>@metamask/base-controller",file:"node_modules/@metamask/address-book-controller/node_modules/@metamask/base-controller/dist/BaseControllerV2.js"}],[1019,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ControllerMessenger=n.RestrictedControllerMessenger=void 0;class r{constructor({controllerMessenger:e,name:t,allowedActions:n,allowedEvents:r}){this.controllerMessenger=e,this.controllerName=t,this.allowedActions=n||null,this.allowedEvents=r||null}registerActionHandler(e,t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed registering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.registerActionHandler(e,t)}unregisterActionHandler(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed unregistering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.unregisterActionHandler(e)}call(e,...t){if(null===this.allowedActions)throw new Error("No actions allowed");if(!this.allowedActions.includes(e))throw new Error(`Action missing from allow list: ${e}`);return this.controllerMessenger.call(e,...t)}publish(e,...t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed publishing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.publish(e,...t)}subscribe(e,t,n){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);return n?this.controllerMessenger.subscribe(e,t,n):this.controllerMessenger.subscribe(e,t)}unsubscribe(e,t){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);this.controllerMessenger.unsubscribe(e,t)}clearEventSubscriptions(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed clearing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.clearEventSubscriptions(e)}}n.RestrictedControllerMessenger=r;n.ControllerMessenger=class{constructor(){this.actions=new Map,this.events=new Map,this.eventPayloadCache=new Map}registerActionHandler(e,t){if(this.actions.has(e))throw new Error(`A handler for ${e} has already been registered`);this.actions.set(e,t)}unregisterActionHandler(e){this.actions.delete(e)}clearActions(){this.actions.clear()}call(e,...t){const n=this.actions.get(e);if(!n)throw new Error(`A handler for ${e} has not been registered`);return n(...t)}publish(e,...t){const n=this.events.get(e);if(n)for(const[e,r]of n.entries())if(r){const n=this.eventPayloadCache.get(e),s=r(...t);s!==n&&(this.eventPayloadCache.set(e,s),e(s,n))}else e(...t)}subscribe(e,t,n){let r=this.events.get(e);r||(r=new Map,this.events.set(e,r)),r.set(t,n)}unsubscribe(e,t){const n=this.events.get(e);if(!n||!n.has(t))throw new Error(`Subscription not found for event: ${e}`);n.get(t)&&this.eventPayloadCache.delete(t),n.delete(t)}clearEventSubscriptions(e){this.events.delete(e)}clearSubscriptions(){this.events.clear()}getRestricted({name:e,allowedActions:t,allowedEvents:n}){return new r({controllerMessenger:this,name:e,allowedActions:t,allowedEvents:n})}}}}},{package:"@metamask/address-book-controller>@metamask/base-controller",file:"node_modules/@metamask/address-book-controller/node_modules/@metamask/base-controller/dist/ControllerMessenger.js"}],[102,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:20,migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=20;try{const e=function(e){const t=e;"metamask"in t&&!("firstTimeInfo"in t.metamask)&&(t.metamask.firstTimeInfo={version:"3.12.0",date:Date.now()});return t}(t.data);t.data=e}catch(e){console.warn(`MetaMask Migration #20${e.stack}`)}return Promise.resolve(t)}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/020.js"}],[1020,{"./BaseController":1017,"./BaseControllerV2":1018,"./ControllerMessenger":1019},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseControllerV2=n.BaseController=void 0;var i=e("./BaseController");Object.defineProperty(n,"BaseController",{enumerable:!0,get:function(){return i.BaseController}});var o=e("./BaseControllerV2");Object.defineProperty(n,"BaseControllerV2",{enumerable:!0,get:function(){return o.BaseController}}),Object.defineProperty(n,"getAnonymizedState",{enumerable:!0,get:function(){return o.getAnonymizedState}}),Object.defineProperty(n,"getPersistentState",{enumerable:!0,get:function(){return o.getPersistentState}}),s(e("./ControllerMessenger"),n)}}},{package:"@metamask/address-book-controller>@metamask/base-controller",file:"node_modules/@metamask/address-book-controller/node_modules/@metamask/base-controller/dist/index.js"}],[1021,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.OPENSEA_TEST_API_URL=n.OPENSEA_API_URL=n.OPENSEA_PROXY_URL=n.TESTNET_NETWORK_TYPE_TO_TICKER_SYMBOL=n.TESTNET_TICKER_SYMBOLS=n.ASSET_TYPES=n.GWEI=n.ERC1155_TOKEN_RECEIVER_INTERFACE_ID=n.ERC1155_METADATA_URI_INTERFACE_ID=n.ERC1155_INTERFACE_ID=n.ERC721_ENUMERABLE_INTERFACE_ID=n.ERC721_METADATA_INTERFACE_ID=n.ERC721_INTERFACE_ID=n.ERC20=n.ERC1155=n.ERC721=n.GANACHE_CHAIN_ID=n.RINKEBY_CHAIN_ID=n.IPFS_DEFAULT_GATEWAY_URL=n.FALL_BACK_VS_CURRENCY=n.RPC=n.MAINNET=void 0,n.MAINNET="mainnet",n.RPC="rpc",n.FALL_BACK_VS_CURRENCY="ETH",n.IPFS_DEFAULT_GATEWAY_URL="https://cloudflare-ipfs.com/ipfs/",n.RINKEBY_CHAIN_ID="4",n.GANACHE_CHAIN_ID="1337",n.ERC721="ERC721",n.ERC1155="ERC1155",n.ERC20="ERC20",n.ERC721_INTERFACE_ID="0x80ac58cd",n.ERC721_METADATA_INTERFACE_ID="0x5b5e139f",n.ERC721_ENUMERABLE_INTERFACE_ID="0x780e9d63",n.ERC1155_INTERFACE_ID="0xd9b67a26",n.ERC1155_METADATA_URI_INTERFACE_ID="0x0e89341c",n.ERC1155_TOKEN_RECEIVER_INTERFACE_ID="0x4e2312e0",n.GWEI="gwei",n.ASSET_TYPES={NATIVE:"NATIVE",TOKEN:"TOKEN",NFT:"NFT",UNKNOWN:"UNKNOWN"},n.TESTNET_TICKER_SYMBOLS={RINKEBY:"RinkebyETH",GOERLI:"GoerliETH",ROPSTEN:"RopstenETH",KOVAN:"KovanETH"},n.TESTNET_NETWORK_TYPE_TO_TICKER_SYMBOL={rinkeby:"RinkebyETH",goerli:"GoerliETH",ropsten:"RopstenETH",kovan:"KovanETH",mainnet:"",rpc:"",localhost:""},n.OPENSEA_PROXY_URL="https://proxy.metaswap.codefi.network/opensea/v1/api/v1",n.OPENSEA_API_URL="https://api.opensea.io/api/v1",n.OPENSEA_TEST_API_URL="https://testnets-api.opensea.io/api/v1"}}},{package:"@metamask/address-book-controller>@metamask/controller-utils",file:"node_modules/@metamask/address-book-controller/node_modules/@metamask/controller-utils/dist/constants.js"}],[1022,{"./constants":1021,"./types":1023,"./util":1024,"isomorphic-fetch":2713},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),e("isomorphic-fetch"),s(e("./constants"),n),s(e("./util"),n),s(e("./types"),n)}}},{package:"@metamask/address-book-controller>@metamask/controller-utils",file:"node_modules/@metamask/address-book-controller/node_modules/@metamask/controller-utils/dist/index.js"}],[1023,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.NetworksChainId=void 0,function(e){e.mainnet="1",e.kovan="42",e.rinkeby="4",e.goerli="5",e.ropsten="3",e.localhost="",e.rpc=""}(n.NetworksChainId||(n.NetworksChainId={}))}}},{package:"@metamask/address-book-controller>@metamask/controller-utils",file:"node_modules/@metamask/address-book-controller/node_modules/@metamask/controller-utils/dist/types.js"}],[1024,{buffer:1943,"eth-ens-namehash":2139,"ethereumjs-util":2231,"ethjs-unit":2277,"fast-deep-equal":2486},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.isValidJson=n.isNonEmptyArray=n.hasProperty=n.isPlainObject=n.convertHexToDecimal=n.query=n.normalizeEnsName=n.timeoutFetch=n.fetchWithErrorHandling=n.handleFetch=n.successfulFetch=n.isSmartContractCode=n.isValidHexAddress=n.toChecksumHexAddress=n.safelyExecuteWithTimeout=n.safelyExecute=n.toHex=n.fromHex=n.hexToText=n.hexToBN=n.getBuyURL=n.weiHexToGweiDec=n.gweiDecToWEIBN=n.fractionBN=n.BNToHex=void 0;const i=e("ethereumjs-util"),o=e("ethjs-unit"),a=s(e("eth-ens-namehash")),c=s(e("fast-deep-equal")),u=new Error("timeout");function l(e){return new i.BN((0,i.stripHexPrefix)(e),16)}function d(e,t){return r(this,void 0,void 0,(function*(){const n=yield fetch(e,t);if(!n.ok)throw new Error(`Fetch failed with status '${n.status}' for request '${e}'`);return n}))}function h(e,t){return r(this,void 0,void 0,(function*(){const n=yield d(e,t);return yield n.json()}))}n.BNToHex=function(e){return(0,i.addHexPrefix)(e.toString(16))},n.fractionBN=function(e,t,n){const r=new i.BN(t),s=new i.BN(n);return e.mul(r).div(s)},n.gweiDecToWEIBN=function(e){if(Number.isNaN(e))return new i.BN(0);const t=e.toString().split("."),n=t[0]||"0";let r=t[1]||"";if(!r)return(0,o.toWei)(n,"gwei");if(r.length<=9)return(0,o.toWei)(`${n}.${r}`,"gwei");const s=r.slice(9)[0];r=r.slice(0,9);let a=(0,o.toWei)(`${n}.${r}`,"gwei");return Number(s)>=5&&(a=a.add(new i.BN(1))),a},n.weiHexToGweiDec=function(e){const t=new i.BN((0,i.stripHexPrefix)(e),16);return(0,o.fromWei)(t,"gwei").toString(10)},n.getBuyURL=function(e="1",t,n=5){switch(e){case"1":return`https://buy.coinbase.com/?code=9ec56d01-7e81-5017-930c-513daa27bb6a&amount=${n}&address=${t}&crypto_currency=ETH`;case"3":return"https://faucet.metamask.io/";case"4":return"https://www.rinkeby.io/";case"5":return"https://goerli-faucet.slock.it/";case"42":return"https://github.com/kovan-testnet/faucet";default:return undefined}},n.hexToBN=l,n.hexToText=function(e){try{const n=(0,i.stripHexPrefix)(e);return t.from(n,"hex").toString("utf8")}catch(t){return e}},n.fromHex=function(e){return i.BN.isBN(e)?e:new i.BN(l(e).toString(10))},n.toHex=function(e){return"string"==typeof e&&(0,i.isHexString)(e)?e:`0x${i.BN.isBN(e)?e.toString(16):new i.BN(e.toString(),10).toString(16)}`},n.safelyExecute=function(e,t=!1){return r(this,void 0,void 0,(function*(){try{return yield e()}catch(e){return t&&console.error(e),undefined}}))},n.safelyExecuteWithTimeout=function(e,t=!1,n=500){return r(this,void 0,void 0,(function*(){try{return yield Promise.race([e(),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))])}catch(e){return t&&console.error(e),undefined}}))},n.toChecksumHexAddress=function(e){const t=(0,i.addHexPrefix)(e);return(0,i.isHexString)(t)?(0,i.toChecksumAddress)(t):t},n.isValidHexAddress=function(e,{allowNonPrefixed:t=!0}={}){const n=t?(0,i.addHexPrefix)(e):e;return!!(0,i.isHexString)(n)&&(0,i.isValidAddress)(n)},n.isSmartContractCode=function(e){return!!e&&("0x"!==e&&"0x0"!==e)},n.successfulFetch=d,n.handleFetch=h,n.fetchWithErrorHandling=function({url:e,options:t,timeout:n,errorCodesToCatch:s}){return r(this,void 0,void 0,(function*(){let r;try{r=n?Promise.race([yield h(e,t),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))]):yield h(e,t)}catch(e){!function(e,t=[]){var n;if(!e)return;const r=t.some((t=>{var n;return null===(n=e.message)||void 0===n?void 0:n.includes(`Fetch failed with status '${t}'`)}));if(!(e instanceof Error&&(r||(null===(n=e.message)||void 0===n?void 0:n.includes("Failed to fetch"))||e===u)))throw e;console.error(e)}(e,s)}return r}))},n.timeoutFetch=function(e,t,n=500){return r(this,void 0,void 0,(function*(){return Promise.race([d(e,t),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))])}))},n.normalizeEnsName=function(e){if(e&&"string"==typeof e)try{const t=a.default.normalize(e.trim());if(t.match(/^(([\w\d-]+)\.)*[\w\d-]{7,}\.(eth|test)$/u))return t}catch(e){}return null},n.query=function(e,t,n=[]){return new Promise(((r,s)=>{const i=(e,t)=>{e?s(e):r(t)};"function"==typeof e[t]?e[t](...n,i):e.sendAsync({method:t,params:n},i)}))};n.convertHexToDecimal=(e="0x0")=>(0,i.isHexString)(e)?parseInt(e,16):Number(e)?Number(e):0,n.isPlainObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)};n.hasProperty=(e,t)=>Reflect.hasOwnProperty.call(e,t),n.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},n.isValidJson=function(e){try{return(0,c.default)(e,JSON.parse(JSON.stringify(e)))}catch(e){return!1}}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/address-book-controller>@metamask/controller-utils",file:"node_modules/@metamask/address-book-controller/node_modules/@metamask/controller-utils/dist/util.js"}],[1025,{"@metamask/base-controller":1030},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AnnouncementController=void 0;const r=e("@metamask/base-controller"),s={announcements:{}};class i extends r.BaseController{constructor(e,t){super(e,t||s),this.initialize(),this._addAnnouncements()}_addAnnouncements(){const e={},{allAnnouncements:t}=this.config;Object.values(t).forEach((t=>{e[t.id]=this.state.announcements[t.id]?this.state.announcements[t.id]:Object.assign(Object.assign({},t),{isShown:!1})})),this.update({announcements:e})}updateViewed(e){const t=this.state.announcements;for(const n of Object.keys(e).map(Number))t[n].isShown=e[n];this.update({announcements:t},!0)}}n.AnnouncementController=i}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/AnnouncementController.js"}],[1026,{"./AnnouncementController":1025},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./AnnouncementController"),n)}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/index.js"}],[1027,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BaseController=void 0;class r{constructor(e={},t={}){this.defaultConfig={},this.defaultState={},this.disabled=!1,this.name="BaseController",this.internalConfig=this.defaultConfig,this.internalState=this.defaultState,this.internalListeners=[],this.initialState=t,this.initialConfig=e}initialize(){return this.internalState=this.defaultState,this.internalConfig=this.defaultConfig,this.configure(this.initialConfig),this.update(this.initialState),this}get config(){return this.internalConfig}get state(){return this.internalState}configure(e,t=!1,n=!0){if(n){this.internalConfig=t?e:Object.assign(this.internalConfig,e);for(const e in this.internalConfig)void 0!==this.internalConfig[e]&&(this[e]=this.internalConfig[e])}else for(const t in e)void 0!==this.internalConfig[t]&&(this.internalConfig[t]=e[t],this[t]=e[t])}notify(){this.disabled||this.internalListeners.forEach((e=>{e(this.internalState)}))}subscribe(e){this.internalListeners.push(e)}unsubscribe(e){const t=this.internalListeners.findIndex((t=>e===t));return t>-1&&this.internalListeners.splice(t,1),t>-1}update(e,t=!1){this.internalState=t?Object.assign({},e):Object.assign({},this.internalState,e),this.notify()}}n.BaseController=r,n.default=r}}},{package:"@metamask/announcement-controller>@metamask/base-controller",file:"node_modules/@metamask/announcement-controller/node_modules/@metamask/base-controller/dist/BaseController.js"}],[1028,{immer:2694},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseController=void 0;const r=e("immer");(0,r.enablePatches)();function s(e,t,n){return Object.keys(e).reduce(((r,s)=>{const i=t[s][n],o=e[s];return"function"==typeof i?r[s]=i(o):i&&(r[s]=o),r}),{})}n.BaseController=class{constructor({messenger:e,metadata:t,name:n,state:r}){this.messagingSystem=e,this.name=n,this.internalState=r,this.metadata=t,this.messagingSystem.registerActionHandler(`${n}:getState`,(()=>this.state))}get state(){return this.internalState}set state(e){throw new Error("Controller state cannot be directly mutated; use 'update' method instead.")}update(e){const[t,n]=r.produceWithPatches(this.internalState,e);this.internalState=t,this.messagingSystem.publish(`${this.name}:stateChange`,t,n)}destroy(){this.messagingSystem.clearEventSubscriptions(`${this.name}:stateChange`)}},n.getAnonymizedState=function(e,t){return s(e,t,"anonymous")},n.getPersistentState=function(e,t){return s(e,t,"persist")}}}},{package:"@metamask/announcement-controller>@metamask/base-controller",file:"node_modules/@metamask/announcement-controller/node_modules/@metamask/base-controller/dist/BaseControllerV2.js"}],[1029,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ControllerMessenger=n.RestrictedControllerMessenger=void 0;class r{constructor({controllerMessenger:e,name:t,allowedActions:n,allowedEvents:r}){this.controllerMessenger=e,this.controllerName=t,this.allowedActions=n||null,this.allowedEvents=r||null}registerActionHandler(e,t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed registering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.registerActionHandler(e,t)}unregisterActionHandler(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed unregistering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.unregisterActionHandler(e)}call(e,...t){if(null===this.allowedActions)throw new Error("No actions allowed");if(!this.allowedActions.includes(e))throw new Error(`Action missing from allow list: ${e}`);return this.controllerMessenger.call(e,...t)}publish(e,...t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed publishing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.publish(e,...t)}subscribe(e,t,n){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);return n?this.controllerMessenger.subscribe(e,t,n):this.controllerMessenger.subscribe(e,t)}unsubscribe(e,t){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);this.controllerMessenger.unsubscribe(e,t)}clearEventSubscriptions(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed clearing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.clearEventSubscriptions(e)}}n.RestrictedControllerMessenger=r;n.ControllerMessenger=class{constructor(){this.actions=new Map,this.events=new Map,this.eventPayloadCache=new Map}registerActionHandler(e,t){if(this.actions.has(e))throw new Error(`A handler for ${e} has already been registered`);this.actions.set(e,t)}unregisterActionHandler(e){this.actions.delete(e)}clearActions(){this.actions.clear()}call(e,...t){const n=this.actions.get(e);if(!n)throw new Error(`A handler for ${e} has not been registered`);return n(...t)}publish(e,...t){const n=this.events.get(e);if(n)for(const[e,r]of n.entries())if(r){const n=this.eventPayloadCache.get(e),s=r(...t);s!==n&&(this.eventPayloadCache.set(e,s),e(s,n))}else e(...t)}subscribe(e,t,n){let r=this.events.get(e);r||(r=new Map,this.events.set(e,r)),r.set(t,n)}unsubscribe(e,t){const n=this.events.get(e);if(!n||!n.has(t))throw new Error(`Subscription not found for event: ${e}`);n.get(t)&&this.eventPayloadCache.delete(t),n.delete(t)}clearEventSubscriptions(e){this.events.delete(e)}clearSubscriptions(){this.events.clear()}getRestricted({name:e,allowedActions:t,allowedEvents:n}){return new r({controllerMessenger:this,name:e,allowedActions:t,allowedEvents:n})}}}}},{package:"@metamask/announcement-controller>@metamask/base-controller",file:"node_modules/@metamask/announcement-controller/node_modules/@metamask/base-controller/dist/ControllerMessenger.js"}],[103,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:21,migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=21;try{const e=function(e){const t=e;return delete t.BlacklistController,delete t.RecentBlocks,t}(t.data);t.data=e}catch(e){console.warn(`MetaMask Migration #21${e.stack}`)}return Promise.resolve(t)}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/021.js"}],[1030,{"./BaseController":1027,"./BaseControllerV2":1028,"./ControllerMessenger":1029},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseControllerV2=n.BaseController=void 0;var i=e("./BaseController");Object.defineProperty(n,"BaseController",{enumerable:!0,get:function(){return i.BaseController}});var o=e("./BaseControllerV2");Object.defineProperty(n,"BaseControllerV2",{enumerable:!0,get:function(){return o.BaseController}}),Object.defineProperty(n,"getAnonymizedState",{enumerable:!0,get:function(){return o.getAnonymizedState}}),Object.defineProperty(n,"getPersistentState",{enumerable:!0,get:function(){return o.getPersistentState}}),s(e("./ControllerMessenger"),n)}}},{package:"@metamask/announcement-controller>@metamask/base-controller",file:"node_modules/@metamask/announcement-controller/node_modules/@metamask/base-controller/dist/index.js"}],[1031,{"./errors":1032,"@metamask/base-controller":1037,"eth-rpc-errors":2170,nanoid:1038},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ApprovalController=void 0;const r=e("eth-rpc-errors"),s=e("nanoid"),i=e("@metamask/base-controller"),o=e("./errors"),a="ApprovalController",c={pendingApprovals:{persist:!1,anonymous:!0},pendingApprovalCount:{persist:!1,anonymous:!1}};class u extends i.BaseControllerV2{constructor({messenger:e,showApprovalRequest:t,state:n={},typesExcludedFromRateLimiting:r=[]}){super({name:a,metadata:c,messenger:e,state:Object.assign(Object.assign({},{pendingApprovals:{},pendingApprovalCount:0}),n)}),this._approvals=new Map,this._origins=new Map,this._showApprovalRequest=t,this._typesExcludedFromRateLimiting=r,this.registerMessageHandlers()}registerMessageHandlers(){this.messagingSystem.registerActionHandler(`${a}:clearRequests`,this.clear.bind(this)),this.messagingSystem.registerActionHandler(`${a}:addRequest`,((e,t)=>t?this.addAndShowApprovalRequest(e):this.add(e))),this.messagingSystem.registerActionHandler(`${a}:hasRequest`,this.has.bind(this)),this.messagingSystem.registerActionHandler(`${a}:acceptRequest`,this.accept.bind(this)),this.messagingSystem.registerActionHandler(`${a}:rejectRequest`,this.reject.bind(this)),this.messagingSystem.registerActionHandler(`${a}:updateRequestState`,this.updateRequestState.bind(this))}addAndShowApprovalRequest(e){const t=this._add(e.origin,e.type,e.id,e.requestData,e.requestState);return this._showApprovalRequest(),t}add(e){return this._add(e.origin,e.type,e.id,e.requestData,e.requestState)}get(e){return this.state.pendingApprovals[e]}getApprovalCount(e={}){var t;if(!e.origin&&!e.type)throw new Error("Must specify origin, type, or both.");const{origin:n,type:r}=e;if(n&&r)return(null===(t=this._origins.get(n))||void 0===t?void 0:t.get(r))||0;if(n)return Array.from((this._origins.get(n)||new Map).values()).reduce(((e,t)=>e+t),0);let s=0;for(const e of Object.values(this.state.pendingApprovals))e.type===r&&(s+=1);return s}getTotalApprovalCount(){return this.state.pendingApprovalCount}has(e={}){var t;const{id:n,origin:r,type:s}=e;if(n){if("string"!=typeof n)throw new Error("May not specify non-string id.");return this._approvals.has(n)}if(s&&"string"!=typeof s)throw new Error("May not specify non-string type.");if(r){if("string"!=typeof r)throw new Error("May not specify non-string origin.");return s?Boolean(null===(t=this._origins.get(r))||void 0===t?void 0:t.get(s)):this._origins.has(r)}if(s){for(const e of Object.values(this.state.pendingApprovals))if(e.type===s)return!0;return!1}throw new Error("Must specify a valid combination of id, origin, and type.")}accept(e,t){this._deleteApprovalAndGetCallbacks(e).resolve(t)}reject(e,t){this._deleteApprovalAndGetCallbacks(e).reject(t)}clear(e){for(const t of this._approvals.keys())this.reject(t,e);this._origins.clear(),this.update((()=>({pendingApprovals:{},pendingApprovalCount:0})))}updateRequestState(e){if(!this.state.pendingApprovals[e.id])throw new o.ApprovalRequestNotFoundError(e.id);this.update((t=>{t.pendingApprovals[e.id].requestState=e.requestState}))}_add(e,t,n=(0,s.nanoid)(),i,o){if(this._validateAddParams(n,e,t,i,o),!this._typesExcludedFromRateLimiting.includes(t)&&this.has({origin:e,type:t}))throw r.ethErrors.rpc.resourceUnavailable(((e,t)=>`Request of type '${t}' already pending for origin ${e}. Please wait.`)(e,t));return new Promise(((r,s)=>{this._approvals.set(n,{resolve:r,reject:s}),this._addPendingApprovalOrigin(e,t),this._addToStore(n,e,t,i,o)}))}_validateAddParams(e,t,n,s,i){let o=null;if(e&&"string"==typeof e?this._approvals.has(e)?o=`Approval request with id '${e}' already exists.`:t&&"string"==typeof t?n&&"string"==typeof n?s&&("object"!=typeof s||Array.isArray(s))?o="Request data must be a plain object if specified.":i&&("object"!=typeof i||Array.isArray(i))&&(o="Request state must be a plain object if specified."):o="Must specify non-empty string type.":o="Must specify non-empty string origin.":o="Must specify non-empty string id.",o)throw r.ethErrors.rpc.internal(o)}_addPendingApprovalOrigin(e,t){let n=this._origins.get(e);n||(n=new Map,this._origins.set(e,n));const r=n.get(t)||0;n.set(t,r+1)}_addToStore(e,t,n,r,s){const i={id:e,origin:t,type:n,time:Date.now(),requestData:r||null,requestState:s||null};this.update((t=>{t.pendingApprovals[e]=i,t.pendingApprovalCount=Object.keys(t.pendingApprovals).length}))}_delete(e){this._approvals.delete(e);const{origin:t,type:n}=this.state.pendingApprovals[e],r=this._origins.get(t),s=this.getApprovalCount({origin:t}),i=r.get(n);1===s?this._origins.delete(t):r.set(n,i-1),this.update((t=>{delete t.pendingApprovals[e],t.pendingApprovalCount=Object.keys(t.pendingApprovals).length}))}_deleteApprovalAndGetCallbacks(e){const t=this._approvals.get(e);if(!t)throw new o.ApprovalRequestNotFoundError(e);return this._delete(e),t}}n.ApprovalController=u,n.default=u}}},{package:"@metamask/approval-controller",file:"node_modules/@metamask/approval-controller/dist/ApprovalController.js"}],[1032,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ApprovalRequestNotFoundError=void 0;class r extends Error{constructor(e){super(`Approval request with id '${e}' not found.`)}}n.ApprovalRequestNotFoundError=r}}},{package:"@metamask/approval-controller",file:"node_modules/@metamask/approval-controller/dist/errors.js"}],[1033,{"./ApprovalController":1031,"./errors":1032},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./ApprovalController"),n),s(e("./errors"),n)}}},{package:"@metamask/approval-controller",file:"node_modules/@metamask/approval-controller/dist/index.js"}],[1034,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BaseController=void 0;class r{constructor(e={},t={}){this.defaultConfig={},this.defaultState={},this.disabled=!1,this.name="BaseController",this.internalConfig=this.defaultConfig,this.internalState=this.defaultState,this.internalListeners=[],this.initialState=t,this.initialConfig=e}initialize(){return this.internalState=this.defaultState,this.internalConfig=this.defaultConfig,this.configure(this.initialConfig),this.update(this.initialState),this}get config(){return this.internalConfig}get state(){return this.internalState}configure(e,t=!1,n=!0){if(n){this.internalConfig=t?e:Object.assign(this.internalConfig,e);for(const e in this.internalConfig)void 0!==this.internalConfig[e]&&(this[e]=this.internalConfig[e])}else for(const t in e)void 0!==this.internalConfig[t]&&(this.internalConfig[t]=e[t],this[t]=e[t])}notify(){this.disabled||this.internalListeners.forEach((e=>{e(this.internalState)}))}subscribe(e){this.internalListeners.push(e)}unsubscribe(e){const t=this.internalListeners.findIndex((t=>e===t));return t>-1&&this.internalListeners.splice(t,1),t>-1}update(e,t=!1){this.internalState=t?Object.assign({},e):Object.assign({},this.internalState,e),this.notify()}}n.BaseController=r,n.default=r}}},{package:"@metamask/approval-controller>@metamask/base-controller",file:"node_modules/@metamask/approval-controller/node_modules/@metamask/base-controller/dist/BaseController.js"}],[1035,{immer:2694},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseController=void 0;const r=e("immer");(0,r.enablePatches)();function s(e,t,n){return Object.keys(e).reduce(((r,s)=>{const i=t[s][n],o=e[s];return"function"==typeof i?r[s]=i(o):i&&(r[s]=o),r}),{})}n.BaseController=class{constructor({messenger:e,metadata:t,name:n,state:r}){this.messagingSystem=e,this.name=n,this.internalState=r,this.metadata=t,this.messagingSystem.registerActionHandler(`${n}:getState`,(()=>this.state))}get state(){return this.internalState}set state(e){throw new Error("Controller state cannot be directly mutated; use 'update' method instead.")}update(e){const[t,n,s]=r.produceWithPatches(this.internalState,e);return this.internalState=t,this.messagingSystem.publish(`${this.name}:stateChange`,t,n),{nextState:t,patches:n,inversePatches:s}}applyPatches(e){const t=(0,r.applyPatches)(this.internalState,e);this.internalState=t,this.messagingSystem.publish(`${this.name}:stateChange`,t,e)}destroy(){this.messagingSystem.clearEventSubscriptions(`${this.name}:stateChange`)}},n.getAnonymizedState=function(e,t){return s(e,t,"anonymous")},n.getPersistentState=function(e,t){return s(e,t,"persist")}}}},{package:"@metamask/approval-controller>@metamask/base-controller",file:"node_modules/@metamask/approval-controller/node_modules/@metamask/base-controller/dist/BaseControllerV2.js"}],[1036,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ControllerMessenger=n.RestrictedControllerMessenger=void 0;class r{constructor({controllerMessenger:e,name:t,allowedActions:n,allowedEvents:r}){this.controllerMessenger=e,this.controllerName=t,this.allowedActions=n||null,this.allowedEvents=r||null}registerActionHandler(e,t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed registering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.registerActionHandler(e,t)}unregisterActionHandler(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed unregistering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.unregisterActionHandler(e)}call(e,...t){if(null===this.allowedActions)throw new Error("No actions allowed");if(!this.allowedActions.includes(e))throw new Error(`Action missing from allow list: ${e}`);return this.controllerMessenger.call(e,...t)}publish(e,...t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed publishing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.publish(e,...t)}subscribe(e,t,n){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);return n?this.controllerMessenger.subscribe(e,t,n):this.controllerMessenger.subscribe(e,t)}unsubscribe(e,t){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);this.controllerMessenger.unsubscribe(e,t)}clearEventSubscriptions(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed clearing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.clearEventSubscriptions(e)}}n.RestrictedControllerMessenger=r;n.ControllerMessenger=class{constructor(){this.actions=new Map,this.events=new Map,this.eventPayloadCache=new Map}registerActionHandler(e,t){if(this.actions.has(e))throw new Error(`A handler for ${e} has already been registered`);this.actions.set(e,t)}unregisterActionHandler(e){this.actions.delete(e)}clearActions(){this.actions.clear()}call(e,...t){const n=this.actions.get(e);if(!n)throw new Error(`A handler for ${e} has not been registered`);return n(...t)}publish(e,...t){const n=this.events.get(e);if(n)for(const[e,r]of n.entries())if(r){const n=this.eventPayloadCache.get(e),s=r(...t);s!==n&&(this.eventPayloadCache.set(e,s),e(s,n))}else e(...t)}subscribe(e,t,n){let r=this.events.get(e);r||(r=new Map,this.events.set(e,r)),r.set(t,n)}unsubscribe(e,t){const n=this.events.get(e);if(!n||!n.has(t))throw new Error(`Subscription not found for event: ${e}`);n.get(t)&&this.eventPayloadCache.delete(t),n.delete(t)}clearEventSubscriptions(e){this.events.delete(e)}clearSubscriptions(){this.events.clear()}getRestricted({name:e,allowedActions:t,allowedEvents:n}){return new r({controllerMessenger:this,name:e,allowedActions:t,allowedEvents:n})}}}}},{package:"@metamask/approval-controller>@metamask/base-controller",file:"node_modules/@metamask/approval-controller/node_modules/@metamask/base-controller/dist/ControllerMessenger.js"}],[1037,{"./BaseController":1034,"./BaseControllerV2":1035,"./ControllerMessenger":1036},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseControllerV2=n.BaseController=void 0;var i=e("./BaseController");Object.defineProperty(n,"BaseController",{enumerable:!0,get:function(){return i.BaseController}});var o=e("./BaseControllerV2");Object.defineProperty(n,"BaseControllerV2",{enumerable:!0,get:function(){return o.BaseController}}),Object.defineProperty(n,"getAnonymizedState",{enumerable:!0,get:function(){return o.getAnonymizedState}}),Object.defineProperty(n,"getPersistentState",{enumerable:!0,get:function(){return o.getPersistentState}}),s(e("./ControllerMessenger"),n)}}},{package:"@metamask/approval-controller>@metamask/base-controller",file:"node_modules/@metamask/approval-controller/node_modules/@metamask/base-controller/dist/index.js"}],[1038,{"./url-alphabet/index.cjs":1039},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){let{urlAlphabet:r}=e("./url-alphabet/index.cjs"),s=e=>crypto.getRandomValues(new Uint8Array(e)),i=(e,t,n)=>{let r=(2<<Math.log(e.length-1)/Math.LN2)-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let t=n(s),a=s;for(;a--;)if(o+=e[t[a]&r]||"",o.length===i)return o}}};t.exports={nanoid:(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),""),customAlphabet:(e,t=21)=>i(e,t,s),customRandom:i,urlAlphabet:r,random:s}}}},{package:"@metamask/approval-controller>nanoid",file:"node_modules/@metamask/approval-controller/node_modules/nanoid/index.browser.cjs"}],[1039,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){t.exports={urlAlphabet:"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"}}}},{package:"@metamask/approval-controller>nanoid",file:"node_modules/@metamask/approval-controller/node_modules/nanoid/url-alphabet/index.cjs"}],[104,{"../../../shared/constants/transaction":3417,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../../../shared/constants/transaction");var i={version:22,migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=22;try{const e=function(e){const t=e,{TransactionController:n}=t;if(n&&n.transactions){const{transactions:e}=t.TransactionController;t.TransactionController.transactions=e.map((e=>(e.status!==s.TransactionStatus.submitted||e.submittedTime||(e.submittedTime=(new Date).getTime()),e)))}return t}(t.data);t.data=e}catch(e){console.warn(`MetaMask Migration #22${e.stack}`)}return Promise.resolve(t)}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/022.js"}],[105,{"../../../shared/constants/transaction":3417,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../../../shared/constants/transaction");var i={version:23,migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=23;try{const e=function(e){const t=e,{TransactionController:n}=t;if(n&&n.transactions){const{transactions:e}=t.TransactionController;if(e.length<=40)return t;const n=e.reverse();let r=!0;for(;n.length>40&&r;){const e=n.findIndex((e=>e.status===s.TransactionStatus.failed||e.status===s.TransactionStatus.rejected||e.status===s.TransactionStatus.confirmed||e.status===s.TransactionStatus.dropped));e<0?r=!1:n.splice(e,1)}t.TransactionController.transactions=n.reverse()}return t}(t.data);t.data=e}catch(e){console.warn(`MetaMask Migration #23${e.stack}`)}return Promise.resolve(t)}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/023.js"}],[106,{"../../../shared/constants/transaction":3417,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../../../shared/constants/transaction");var i={version:24,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=24;const n=function(e){const t=e;if(!t.TransactionController)return t;const{transactions:n}=t.TransactionController;return t.TransactionController.transactions=n.map(((e,t)=>(e.status===s.TransactionStatus.unapproved&&e.txParams&&e.txParams.from&&(e.txParams.from=e.txParams.from.toLowerCase()),e))),t}(t.data);return t.data=n,t}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/024.js"}],[107,{"../../../shared/constants/transaction":3417,"../lib/util":82,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../lib/util"),i=e("../../../shared/constants/transaction");var o={version:25,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=25;const n=function(e){const t=e;if(t.TransactionController&&t.TransactionController.transactions){const{transactions:e}=t.TransactionController;t.TransactionController.transactions=e.map((e=>(e.status!==i.TransactionStatus.unapproved||(e.txParams=function(e){const t={from:e=>(0,s.addHexPrefix)(e).toLowerCase(),to:()=>(0,s.addHexPrefix)(e.to).toLowerCase(),nonce:e=>(0,s.addHexPrefix)(e),value:e=>(0,s.addHexPrefix)(e),data:e=>(0,s.addHexPrefix)(e),gas:e=>(0,s.addHexPrefix)(e),gasPrice:e=>(0,s.addHexPrefix)(e)},n={};return Object.keys(t).forEach((r=>{e[r]&&(n[r]=t[r](e[r]))})),n}(e.txParams)),e)))}return t}(t.data);return t.data=n,t}};n.default=o}}},{package:"$root$",file:"app/scripts/migrations/025.js"}],[108,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:26,migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=26;try{const e=t.data;t.data=function(e){if(!e.KeyringController||!e.PreferencesController)return e;if(!e.KeyringController.walletNicknames)return e;return e.PreferencesController.identities=Object.keys(e.KeyringController.walletNicknames).reduce(((t,n)=>(t[n]={name:e.KeyringController.walletNicknames[n],address:n},t)),{}),delete e.KeyringController.walletNicknames,e}(e)}catch(e){return console.warn(`MetaMask Migration #26${e.stack}`),Promise.reject(e)}return Promise.resolve(t)}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/026.js"}],[1080,{buffer:1943},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(e){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.generateSalt=n.serializeBufferForStorage=n.serializeBufferFromStorage=n.keyFromPassword=n.exportKey=n.importKey=n.decryptWithKey=n.decryptWithDetail=n.decrypt=n.encryptWithKey=n.encryptWithDetail=n.encrypt=void 0;const t="AES-GCM",r="utf-8";async function s(e,t,n,r=l()){const s=n||await u(e,r),o=await i(s,t);return o.salt=r,JSON.stringify(o)}async function i(n,s){const i=JSON.stringify(s),o=e.from(i,r),a=global.crypto.getRandomValues(new Uint8Array(16)),c=await global.crypto.subtle.encrypt({name:t,iv:a},n,o),u=new Uint8Array(c),l=e.from(a).toString("base64");return{data:e.from(u).toString("base64"),iv:l}}async function o(e,t,n){const r=JSON.parse(t),{salt:s}=r,i=n||await u(e,s);return await a(i,r)}async function a(n,s){const i=e.from(s.data,"base64"),o=e.from(s.iv,"base64");let a;try{const s=await crypto.subtle.decrypt({name:t,iv:o},n,i),c=new Uint8Array(s),u=e.from(c).toString(r);a=JSON.parse(u)}catch(e){throw new Error("Incorrect password")}return a}async function c(e){const t=await window.crypto.subtle.exportKey("jwk",e);return JSON.stringify(t)}async function u(n,s,i=!1){const o=e.from(n,r),a=e.from(s,"base64"),c=await global.crypto.subtle.importKey("raw",o,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]);return await global.crypto.subtle.deriveKey({name:"PBKDF2",salt:a,iterations:1e4,hash:"SHA-256"},c,{name:t,length:256},i,["encrypt","decrypt"])}function l(e=32){const t=new Uint8Array(e);global.crypto.getRandomValues(t);return btoa(String.fromCharCode.apply(null,t))}n.encrypt=s,n.encryptWithDetail=async function(e,t,n=l()){const r=await u(e,n,!0),i=await c(r);return{vault:await s(e,t,r,n),exportedKeyString:i}},n.encryptWithKey=i,n.decrypt=o,n.decryptWithDetail=async function(e,t){const n=JSON.parse(t),{salt:r}=n,s=await u(e,r,!0);return{exportedKeyString:await c(s),vault:await o(e,t,s),salt:r}},n.decryptWithKey=a,n.importKey=async function(e){return await window.crypto.subtle.importKey("jwk",JSON.parse(e),t,!0,["encrypt","decrypt"])},n.exportKey=c,n.keyFromPassword=u,n.serializeBufferFromStorage=function(e){const t="0x"===e.slice(0,2)?e.slice(2):e,n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const r=t.substr(e,2);n[e/2]=parseInt(r,16)}return n},n.serializeBufferForStorage=function(e){let t="0x";return e.forEach((e=>{t+=function(e){let t=e.toString(16);for(;t.length<2;)t=`0${t}`;return t}(e)})),t},n.generateSalt=l}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/rpc-methods>@metamask/browser-passworder",file:"node_modules/@metamask/browser-passworder/dist/index.js"}],[109,{"../../../shared/constants/transaction":3417,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../../../shared/constants/transaction");var i={version:27,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=27;const n=function(e){const t=e;if(t.TransactionController&&t.TransactionController.transactions){const{transactions:e}=t.TransactionController;t.TransactionController.transactions=e.filter((e=>e.status!==s.TransactionStatus.rejected))}return t}(t.data);return t.data=n,t}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/027.js"}],[11,{"../../../../shared/constants/network":3409,"@ethersproject/providers":459,"ethereum-ens-network-map":2206},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,s=e("@ethersproject/providers"),i=(r=e("ethereum-ens-network-map"))&&r.__esModule?r:{default:r},o=e("../../../../shared/constants/network");n.default=class{static getNetworkEnsSupport(e){return Boolean(i.default[e])}constructor({network:e,provider:t}={}){const n=o.NETWORK_ID_TO_ETHERS_NETWORK_NAME_MAP[e],r=i.default[e],a=new s.Web3Provider(t,{chainId:parseInt(e,10),name:n,ensAddress:r});this._ethProvider=a}lookup(e){return this._ethProvider.resolveName(e)}reverse(e){return this._ethProvider.lookupAddress(e)}}}}},{package:"$root$",file:"app/scripts/controllers/ens/ens.js"}],[110,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:28,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=28;const n=function(e){const t=e;if(t.PreferencesController&&t.PreferencesController.tokens&&t.PreferencesController.identities){const{identities:e,tokens:n}=t.PreferencesController;t.PreferencesController.accountTokens={},Object.keys(e).forEach((e=>{t.PreferencesController.accountTokens[e]={mainnet:n}})),t.PreferencesController.tokens=[]}return t}(t.data);return t.data=n,t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/028.js"}],[1104,{"@ethereumjs/util":374,"@metamask/eth-sig-util":1194,"@metamask/scure-bip39":1326,"@metamask/scure-bip39/dist/wordlists/english":1327,buffer:1943,"ethereum-cryptography/hdkey":2193,"ethereum-cryptography/keccak":2194,"ethereum-cryptography/utils":2205},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(n){(function(){const{HDKey:r}=e("ethereum-cryptography/hdkey"),{keccak256:s}=e("ethereum-cryptography/keccak"),{bytesToHex:i}=e("ethereum-cryptography/utils"),{stripHexPrefix:o,privateToPublic:a,publicToAddress:c,ecsign:u,arrToBufArr:l,bufferToHex:d}=e("@ethereumjs/util"),h=e("@metamask/scure-bip39"),{wordlist:f}=e("@metamask/scure-bip39/dist/wordlists/english"),{concatSig:p,decrypt:m,getEncryptionPublicKey:g,normalize:y,personalSign:b,signTypedData:w,SignTypedDataVersion:v}=e("@metamask/eth-sig-util"),_="HD Key Tree";class E{constructor(e={}){this.type=_,this._wallets=[],this.deserialize(e)}generateRandomMnemonic(){this._initFromMnemonic(h.generateMnemonic(f))}_uint8ArrayToString(e){return Array.from(new Uint16Array(new Uint8Array(e).buffer)).map((e=>f[e])).join(" ")}_stringToUint8Array(e){const t=e.split(" ").map((e=>f.indexOf(e)));return new Uint8Array(new Uint16Array(t).buffer)}_mnemonicToUint8Array(e){let t=e;if(e&&e.type&&"Buffer"===e.type&&(t=e.data),"string"==typeof t||n.isBuffer(t)||Array.isArray(t)){let e=t;return Array.isArray(t)?e=n.from(t).toString():n.isBuffer(t)&&(e=t.toString()),this._stringToUint8Array(e)}return t instanceof Object&&!(t instanceof Uint8Array)?Uint8Array.from(Object.values(t)):t}serialize(){const e=this._uint8ArrayToString(this.mnemonic),t=new TextEncoder("utf-8").encode(e);return Promise.resolve({mnemonic:Array.from(t),numberOfAccounts:this._wallets.length,hdPath:this.hdPath})}deserialize(e={}){if(e.numberOfAccounts&&!e.mnemonic)throw new Error("Eth-Hd-Keyring: Deserialize method cannot be called with an opts value for numberOfAccounts and no menmonic");if(this.root)throw new Error("Eth-Hd-Keyring: Secret recovery phrase already provided");return this.opts=e,this._wallets=[],this.mnemonic=null,this.root=null,this.hdPath=e.hdPath||"m/44'/60'/0'/0",e.mnemonic&&this._initFromMnemonic(e.mnemonic),e.numberOfAccounts?this.addAccounts(e.numberOfAccounts):Promise.resolve([])}addAccounts(e=1){if(!this.root)throw new Error("Eth-Hd-Keyring: No secret recovery phrase provided");const t=this._wallets.length,n=[];for(let r=t;r<e+t;r++){const e=this.root.deriveChild(r);n.push(e),this._wallets.push(e)}const r=n.map((e=>this._addressfromPublicKey(e.publicKey)));return Promise.resolve(r)}getAccounts(){return this._wallets.map((e=>this._addressfromPublicKey(e.publicKey)))}async getAppKeyAddress(e,t){if(!t||"string"!=typeof t)throw new Error("'origin' must be a non-empty string");const n=this._getWalletForAccount(e,{withAppKeyOrigin:t});return y(c(n.publicKey).toString("hex"))}async exportAccount(e,t={}){const n=this._getWalletForAccount(e,t);return i(n.privateKey)}async signTransaction(e,t,n={}){const r=this._getPrivateKeyFor(e,n),s=t.sign(r);return s===undefined?t:s}async signMessage(e,t,r={}){const s=o(t),i=this._getPrivateKeyFor(e,r),a=u(n.from(s,"hex"),i);return p(a.v,a.r,a.s)}async signPersonalMessage(e,t,r={}){const s=this._getPrivateKeyFor(e,r),i=n.from(s,"hex");return b({privateKey:i,data:t})}async decryptMessage(e,t){const r=this._getWalletForAccount(e),{privateKey:s}=r,i=n.from(s).toString("hex");return m({privateKey:i,encryptedData:t})}async signTypedData(e,t,n={version:v.V1}){const r=Object.keys(v).includes(n.version)?n.version:v.V1,s=this._getPrivateKeyFor(e,n);return w({privateKey:s,data:t,version:r})}removeAccount(e){const t=y(e);if(!this._wallets.map((({publicKey:e})=>this._addressfromPublicKey(e))).includes(t))throw new Error(`Address ${t} not found in this keyring`);this._wallets=this._wallets.filter((({publicKey:e})=>this._addressfromPublicKey(e)!==t))}async getEncryptionPublicKey(e,t={}){const n=this._getPrivateKeyFor(e,t);return g(n)}_getPrivateKeyFor(e,t={}){if(!e)throw new Error("Must specify address.");return this._getWalletForAccount(e,t).privateKey}_getWalletForAccount(e,t={}){const r=y(e);let i=this._wallets.find((({publicKey:e})=>this._addressfromPublicKey(e)===r));if(!i)throw new Error("HD Keyring - Unable to find matching address.");if(t.withAppKeyOrigin){const{privateKey:e}=i,r=n.from(t.withAppKeyOrigin,"utf8"),o=n.concat([e,r]),c=l(s(o,256));i={privateKey:c,publicKey:a(c)}}return i}_initFromMnemonic(e){if(this.root)throw new Error("Eth-Hd-Keyring: Secret recovery phrase already provided");this.mnemonic=this._mnemonicToUint8Array(e);if(!h.validateMnemonic(this.mnemonic,f))throw new Error("Eth-Hd-Keyring: Invalid secret recovery phrase provided");const t=h.mnemonicToSeedSync(this.mnemonic,f);this.hdWallet=r.fromMasterSeed(t),this.root=this.hdWallet.derive(this.hdPath)}_addressfromPublicKey(e){return d(c(n.from(e),!0)).toLowerCase()}}E.type=_,t.exports=E}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-keyring-controller>@metamask/eth-hd-keyring",file:"node_modules/@metamask/eth-hd-keyring/index.js"}],[1105,{"./fetch-config-from-req":1107,"./logging-utils":1109,"eth-rpc-errors":2170,"json-rpc-engine":2724,"node-fetch":2989},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.createInfuraMiddleware=void 0;const s=e("json-rpc-engine"),i=e("eth-rpc-errors"),o=r(e("node-fetch")),a=e("./fetch-config-from-req"),c=e("./logging-utils"),u=(0,c.createModuleLogger)(c.projectLogger,"create-infura-middleware"),l=["Gateway timeout","ETIMEDOUT","ECONNRESET","SyntaxError"];async function d(e,t,n,r,s,c){const{fetchUrl:u,fetchParams:l}=(0,a.fetchConfigFromReq)({network:e,projectId:t,extraHeaders:n,req:r,source:c}),d=await(0,o.default)(u,l),f=await d.text();if(!d.ok)switch(d.status){case 405:throw i.ethErrors.rpc.methodNotFound();case 429:throw h("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.",h(e)}();default:throw h(f)}if("eth_getBlockByNumber"===r.method&&"Not Found"===f)return void(s.result=null);const p=JSON.parse(f);s.result=p.result,s.error=p.error}function h(e){return i.ethErrors.rpc.internal(e)}function f(e){const t=e.toString();return l.some((e=>t.includes(e)))}function p(e){return new Promise((t=>{setTimeout(t,e)}))}n.createInfuraMiddleware=function({network:e="mainnet",maxAttempts:t=5,source:n,projectId:r,headers:i={}}){if(!r||"string"!=typeof r)throw new Error(`Invalid value for 'projectId': "${r}"`);if(!i||"object"!=typeof i)throw new Error(`Invalid value for 'headers': "${i}"`);if(!t)throw new Error(`Invalid value for 'maxAttempts': "${t}" (${typeof t})`);return(0,s.createAsyncMiddleware)((async(s,o)=>{for(let a=1;a<=t;a++)try{u("Attempting request to Infura. network = %o, projectId = %s, headers = %o, req = %o",e,r,i,s),await d(e,r,i,s,o,n);break}catch(e){if(!f(e))throw u("Non-retriable request error encountered. req = %o, res = %o, error = %o",s,o,e),e;if(!(t-a)){u("Retriable request error encountered, but exceeded max attempts. req = %o, res = %o, error = %o",s,o,e);const t=`InfuraProvider - cannot complete request. All retries exhausted.\nOriginal Error:\n${e.toString()}\n\n`;throw new Error(t)}u("Retriable request error encountered. req = %o, res = %o, error = %o",s,o,e),u("Waiting 1 second to try again..."),await p(1e3)}}))}}}},{package:"@metamask/eth-json-rpc-infura",file:"node_modules/@metamask/eth-json-rpc-infura/dist/create-infura-middleware.js"}],[1106,{"./create-infura-middleware":1105,"eth-json-rpc-middleware":1130,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createProvider=void 0;const r=e("json-rpc-engine"),s=e("eth-json-rpc-middleware"),i=e("./create-infura-middleware");n.createProvider=function(e){const t=new r.JsonRpcEngine;return t.push((0,i.createInfuraMiddleware)(e)),(0,s.providerFromEngine)(t)}}}},{package:"@metamask/eth-json-rpc-infura",file:"node_modules/@metamask/eth-json-rpc-infura/dist/create-provider.js"}],[1107,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e){return{id:e.id,jsonrpc:e.jsonrpc,method:e.method,params:e.params}}Object.defineProperty(n,"__esModule",{value:!0}),n.fetchConfigFromReq=void 0,n.fetchConfigFromReq=function({network:e,projectId:t,extraHeaders:n={},req:s,source:i}){const o=s.origin||"internal",a=Object.assign({},n,{Accept:"application/json","Content-Type":"application/json"});return i&&(a["Infura-Source"]=`${i}/${o}`),{fetchUrl:`https://${e}.infura.io/v3/${t}`,fetchParams:{method:"POST",headers:a,body:JSON.stringify(r(s))}}}}}},{package:"@metamask/eth-json-rpc-infura",file:"node_modules/@metamask/eth-json-rpc-infura/dist/fetch-config-from-req.js"}],[1108,{"./create-infura-middleware":1105,"./create-provider":1106,"./fetch-config-from-req":1107},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./create-infura-middleware"),n),s(e("./fetch-config-from-req"),n),s(e("./create-provider"),n)}}},{package:"@metamask/eth-json-rpc-infura",file:"node_modules/@metamask/eth-json-rpc-infura/dist/index.js"}],[1109,{"@metamask/utils":1117},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.projectLogger=void 0;const r=e("@metamask/utils");Object.defineProperty(n,"createModuleLogger",{enumerable:!0,get:function(){return r.createModuleLogger}}),n.projectLogger=(0,r.createProjectLogger)("eth-json-rpc-infura")}}},{package:"@metamask/eth-json-rpc-infura",file:"node_modules/@metamask/eth-json-rpc-infura/dist/logging-utils.js"}],[111,{"../../../shared/constants/transaction":3417,"./fail-tx":167},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r,s=e("../../../shared/constants/transaction"),i=(r=e("./fail-tx"))&&r.__esModule?r:{default:r};var o={version:29,migrate:(0,i.default)(29,"Stuck in approved state for too long.",(e=>{const t=e.status===s.TransactionStatus.approved,n=e.submittedTime,r=Date.now();return t&&r-n>432e5}))};n.default=o}}},{package:"$root$",file:"app/scripts/migrations/029.js"}],[1110,{superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.assertExhaustive=n.assertStruct=n.assert=n.AssertionError=void 0;const r=e("superstruct");function s(e,t){return n=e,Boolean("string"==typeof(null===(s=null===(r=null==n?void 0:n.prototype)||void 0===r?void 0:r.constructor)||void 0===s?void 0:s.name))?new e({message:t}):e({message:t});var n,r,s}class i extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}n.AssertionError=i,n.assert=function(e,t="Assertion failed.",n=i){if(!e){if(t instanceof Error)throw t;throw s(n,t)}},n.assertStruct=function(e,t,n="Assertion failed",o=i){try{(0,r.assert)(e,t)}catch(e){throw s(o,`${n}: ${function(e){const t=function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}(e)}.`)}},n.assertExhaustive=function(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/assert.js"}],[1111,{"./assert":1110,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.base64=void 0;const r=e("superstruct"),s=e("./assert");n.base64=(e,t={})=>{var n,i;const o=null!==(n=t.paddingRequired)&&void 0!==n&&n,a=null!==(i=t.characterSet)&&void 0!==i?i:"base64";let c,u;return"base64"===a?c=String.raw`[A-Za-z0-9+\/]`:((0,s.assert)("base64url"===a),c=String.raw`[-_A-Za-z0-9]`),u=o?new RegExp(`^(?:${c}{4})*(?:${c}{3}=|${c}{2}==)?$`,"u"):new RegExp(`^(?:${c}{4})*(?:${c}{2,3}|${c}{3}=|${c}{2}==)?$`,"u"),(0,r.pattern)(e,u)}}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/base64.js"}],[1112,{"./assert":1110,"./hex":1116,buffer:1943},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.createDataView=n.concatBytes=n.valueToBytes=n.stringToBytes=n.numberToBytes=n.signedBigIntToBytes=n.bigIntToBytes=n.hexToBytes=n.bytesToString=n.bytesToNumber=n.bytesToSignedBigInt=n.bytesToBigInt=n.bytesToHex=n.assertIsBytes=n.isBytes=void 0;const r=e("./assert"),s=e("./hex");const i=function(){const e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function o(e){return e instanceof Uint8Array}function a(e){(0,r.assert)(o(e),"Value must be a Uint8Array.")}function c(e){if(a(e),0===e.length)return"0x";const t=i(),n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=t[e[r]];return(0,s.add0x)(n.join(""))}function u(e){a(e);const t=c(e);return BigInt(t)}function l(e){var t;if("0x"===(null===(t=null==e?void 0:e.toLowerCase)||void 0===t?void 0:t.call(e)))return new Uint8Array;(0,s.assertIsHexString)(e);const n=(0,s.remove0x)(e).toLowerCase(),r=n.length%2==0?n:`0${n}`,i=new Uint8Array(r.length/2);for(let e=0;e<i.length;e++){const t=r.charCodeAt(2*e),n=r.charCodeAt(2*e+1),s=t-(t<58?48:87),o=n-(n<58?48:87);i[e]=16*s+o}return i}function d(e){(0,r.assert)("bigint"==typeof e,"Value must be a bigint."),(0,r.assert)(e>=BigInt(0),"Value must be a non-negative bigint.");return l(e.toString(16))}function h(e){(0,r.assert)("number"==typeof e,"Value must be a number."),(0,r.assert)(e>=0,"Value must be a non-negative number."),(0,r.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");return l(e.toString(16))}function f(e){return(0,r.assert)("string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function p(e){if("bigint"==typeof e)return d(e);if("number"==typeof e)return h(e);if("string"==typeof e)return e.startsWith("0x")?l(e):f(e);if(o(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}n.isBytes=o,n.assertIsBytes=a,n.bytesToHex=c,n.bytesToBigInt=u,n.bytesToSignedBigInt=function(e){a(e);let t=BigInt(0);for(const n of e)t=(t<<BigInt(8))+BigInt(n);return BigInt.asIntN(8*e.length,t)},n.bytesToNumber=function(e){a(e);const t=u(e);return(0,r.assert)(t<=BigInt(Number.MAX_SAFE_INTEGER),"Number is not a safe integer. Use `bytesToBigInt` instead."),Number(t)},n.bytesToString=function(e){return a(e),(new TextDecoder).decode(e)},n.hexToBytes=l,n.bigIntToBytes=d,n.signedBigIntToBytes=function(e,t){(0,r.assert)("bigint"==typeof e,"Value must be a bigint."),(0,r.assert)("number"==typeof t,"Byte length must be a number."),(0,r.assert)(t>0,"Byte length must be greater than 0."),(0,r.assert)(function(e,t){(0,r.assert)(t>0);const n=e>>BigInt(31);return!((~e&n)+(e&~n)>>BigInt(8*t-1))}(e,t),"Byte length is too small to represent the given value.");let n=e;const s=new Uint8Array(t);for(let e=0;e<s.length;e++)s[e]=Number(BigInt.asUintN(8,n)),n>>=BigInt(8);return s.reverse()},n.numberToBytes=h,n.stringToBytes=f,n.valueToBytes=p,n.concatBytes=function(e){const t=new Array(e.length);let n=0;for(let r=0;r<e.length;r++){const s=p(e[r]);t[r]=s,n+=s.length}const r=new Uint8Array(n);for(let e=0,n=0;e<t.length;e++)r.set(t[e],n),n+=t[e].length;return r},n.createDataView=function(e){if(void 0!==t&&e instanceof t){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new DataView(t)}return new DataView(e.buffer,e.byteOffset,e.byteLength)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/bytes.js"}],[1113,{"./base64":1111,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ChecksumStruct=void 0;const r=e("superstruct"),s=e("./base64");n.ChecksumStruct=(0,r.size)((0,s.base64)((0,r.string)(),{paddingRequired:!0}),44,44)}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/checksum.js"}],[1114,{"./assert":1110,"./bytes":1112,"./hex":1116,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createHex=n.createBytes=n.createBigInt=n.createNumber=void 0;const r=e("superstruct"),s=e("./assert"),i=e("./bytes"),o=e("./hex"),a=(0,r.union)([(0,r.number)(),(0,r.bigint)(),(0,r.string)(),o.StrictHexStruct]),c=(0,r.coerce)((0,r.number)(),a,Number),u=(0,r.coerce)((0,r.bigint)(),a,BigInt),l=((0,r.union)([o.StrictHexStruct,(0,r.instance)(Uint8Array)]),(0,r.coerce)((0,r.instance)(Uint8Array),(0,r.union)([o.StrictHexStruct]),i.hexToBytes)),d=(0,r.coerce)(o.StrictHexStruct,(0,r.instance)(Uint8Array),i.bytesToHex);n.createNumber=function(e){try{const t=(0,r.create)(e,c);return(0,s.assert)(Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){if(t instanceof r.StructError)throw new Error(`Expected a number-like value, got "${e}".`);throw t}},n.createBigInt=function(e){try{return(0,r.create)(e,u)}catch(e){if(e instanceof r.StructError)throw new Error(`Expected a number-like value, got "${String(e.value)}".`);throw e}},n.createBytes=function(e){if("string"==typeof e&&"0x"===e.toLowerCase())return new Uint8Array;try{return(0,r.create)(e,l)}catch(e){if(e instanceof r.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}},n.createHex=function(e){if(e instanceof Uint8Array&&0===e.length||"string"==typeof e&&"0x"===e.toLowerCase())return"0x";try{return(0,r.create)(e,d)}catch(e){if(e instanceof r.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}}}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/coercers.js"}],[1115,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!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"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},o=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.FrozenSet=n.FrozenMap=void 0;class a{constructor(e){r.set(this,void 0),i(this,r,new Map(e),"f"),Object.freeze(this)}get size(){return o(this,r,"f").size}[(r=new WeakMap,Symbol.iterator)](){return o(this,r,"f")[Symbol.iterator]()}entries(){return o(this,r,"f").entries()}forEach(e,t){return o(this,r,"f").forEach(((n,r,s)=>e.call(t,n,r,this)))}get(e){return o(this,r,"f").get(e)}has(e){return o(this,r,"f").has(e)}keys(){return o(this,r,"f").keys()}values(){return o(this,r,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map((([e,t])=>`${String(e)} => ${String(t)}`)).join(", ")} `:""}}`}}n.FrozenMap=a;class c{constructor(e){s.set(this,void 0),i(this,s,new Set(e),"f"),Object.freeze(this)}get size(){return o(this,s,"f").size}[(s=new WeakMap,Symbol.iterator)](){return o(this,s,"f")[Symbol.iterator]()}entries(){return o(this,s,"f").entries()}forEach(e,t){return o(this,s,"f").forEach(((n,r,s)=>e.call(t,n,r,this)))}has(e){return o(this,s,"f").has(e)}keys(){return o(this,s,"f").keys()}values(){return o(this,s,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map((e=>String(e))).join(", ")} `:""}}`}}n.FrozenSet=c,Object.freeze(a),Object.freeze(a.prototype),Object.freeze(c),Object.freeze(c.prototype)}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/collections.js"}],[1116,{"./assert":1110,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.remove0x=n.add0x=n.assertIsStrictHexString=n.assertIsHexString=n.isStrictHexString=n.isHexString=n.StrictHexStruct=n.HexStruct=void 0;const r=e("superstruct"),s=e("./assert");function i(e){return(0,r.is)(e,n.HexStruct)}function o(e){return(0,r.is)(e,n.StrictHexStruct)}n.HexStruct=(0,r.pattern)((0,r.string)(),/^(?:0x)?[0-9a-f]+$/iu),n.StrictHexStruct=(0,r.pattern)((0,r.string)(),/^0x[0-9a-f]+$/iu),n.isHexString=i,n.isStrictHexString=o,n.assertIsHexString=function(e){(0,s.assert)(i(e),"Value must be a hexadecimal string.")},n.assertIsStrictHexString=function(e){(0,s.assert)(o(e),'Value must be a hexadecimal string, starting with "0x".')},n.add0x=function(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`},n.remove0x=function(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/hex.js"}],[1117,{"./assert":1110,"./base64":1111,"./bytes":1112,"./checksum":1113,"./coercers":1114,"./collections":1115,"./hex":1116,"./json":1118,"./logging":1119,"./misc":1120,"./number":1121,"./opaque":1122,"./time":1123,"./versions":1124},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./assert"),n),s(e("./base64"),n),s(e("./bytes"),n),s(e("./checksum"),n),s(e("./coercers"),n),s(e("./collections"),n),s(e("./hex"),n),s(e("./json"),n),s(e("./logging"),n),s(e("./misc"),n),s(e("./number"),n),s(e("./opaque"),n),s(e("./time"),n),s(e("./versions"),n)}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/index.js"}],[1118,{"./assert":1110,"./misc":1120,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateJsonAndGetSize=n.getJsonRpcIdValidator=n.assertIsJsonRpcError=n.isJsonRpcError=n.assertIsJsonRpcFailure=n.isJsonRpcFailure=n.assertIsJsonRpcSuccess=n.isJsonRpcSuccess=n.assertIsJsonRpcResponse=n.isJsonRpcResponse=n.assertIsPendingJsonRpcResponse=n.isPendingJsonRpcResponse=n.JsonRpcResponseStruct=n.JsonRpcFailureStruct=n.JsonRpcSuccessStruct=n.PendingJsonRpcResponseStruct=n.assertIsJsonRpcRequest=n.isJsonRpcRequest=n.assertIsJsonRpcNotification=n.isJsonRpcNotification=n.JsonRpcNotificationStruct=n.JsonRpcRequestStruct=n.JsonRpcParamsStruct=n.JsonRpcErrorStruct=n.JsonRpcIdStruct=n.JsonRpcVersionStruct=n.jsonrpc2=n.isValidJson=n.JsonStruct=void 0;const r=e("superstruct"),s=e("./assert"),i=e("./misc");function o(e,t=!1){const n=new Set;return function e(t,r){if(t===undefined)return[!1,0];if(null===t)return[!0,r?0:i.JsonSize.Null];const s=typeof t;try{if("function"===s)return[!1,0];if("string"===s||t instanceof String)return[!0,r?0:(0,i.calculateStringSize)(t)+2*i.JsonSize.Quote];if("boolean"===s||t instanceof Boolean)return r?[!0,0]:[!0,1==t?i.JsonSize.True:i.JsonSize.False];if("number"===s||t instanceof Number)return r?[!0,0]:[!0,(0,i.calculateNumberSize)(t)];if(t instanceof Date)return r?[!0,0]:[!0,isNaN(t.getDate())?i.JsonSize.Null:i.JsonSize.Date+2*i.JsonSize.Quote]}catch(e){return[!1,0]}if(!(0,i.isPlainObject)(t)&&!Array.isArray(t))return[!1,0];if(n.has(t))return[!1,0];n.add(t);try{return[!0,Object.entries(t).reduce(((s,[o,a],c,u)=>{let[l,d]=e(a,r);if(!l)throw new Error("JSON validation did not pass. Validation process stopped.");if(n.delete(t),r)return 0;return s+(Array.isArray(t)?0:o.length+i.JsonSize.Comma+2*i.JsonSize.Colon)+d+(c<u.length-1?i.JsonSize.Comma:0)}),r?0:2*i.JsonSize.Wrapper)]}catch(e){return[!1,0]}}(e,t)}n.JsonStruct=(0,r.define)("Json",(e=>{const[t]=o(e,!0);return!!t||"Expected a valid JSON-serializable value"})),n.isValidJson=function(e){return(0,r.is)(e,n.JsonStruct)},n.jsonrpc2="2.0",n.JsonRpcVersionStruct=(0,r.literal)(n.jsonrpc2),n.JsonRpcIdStruct=(0,r.nullable)((0,r.union)([(0,r.number)(),(0,r.string)()])),n.JsonRpcErrorStruct=(0,r.object)({code:(0,r.integer)(),message:(0,r.string)(),data:(0,r.optional)(n.JsonStruct),stack:(0,r.optional)((0,r.string)())}),n.JsonRpcParamsStruct=(0,r.optional)((0,r.union)([(0,r.record)((0,r.string)(),n.JsonStruct),(0,r.array)(n.JsonStruct)])),n.JsonRpcRequestStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,method:(0,r.string)(),params:n.JsonRpcParamsStruct}),n.JsonRpcNotificationStruct=(0,r.omit)(n.JsonRpcRequestStruct,["id"]),n.isJsonRpcNotification=function(e){return(0,r.is)(e,n.JsonRpcNotificationStruct)},n.assertIsJsonRpcNotification=function(e,t){(0,s.assertStruct)(e,n.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",t)},n.isJsonRpcRequest=function(e){return(0,r.is)(e,n.JsonRpcRequestStruct)},n.assertIsJsonRpcRequest=function(e,t){(0,s.assertStruct)(e,n.JsonRpcRequestStruct,"Invalid JSON-RPC request",t)},n.PendingJsonRpcResponseStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,result:(0,r.optional)((0,r.unknown)()),error:(0,r.optional)(n.JsonRpcErrorStruct)}),n.JsonRpcSuccessStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,result:n.JsonStruct}),n.JsonRpcFailureStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,error:n.JsonRpcErrorStruct}),n.JsonRpcResponseStruct=(0,r.union)([n.JsonRpcSuccessStruct,n.JsonRpcFailureStruct]),n.isPendingJsonRpcResponse=function(e){return(0,r.is)(e,n.PendingJsonRpcResponseStruct)},n.assertIsPendingJsonRpcResponse=function(e,t){(0,s.assertStruct)(e,n.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",t)},n.isJsonRpcResponse=function(e){return(0,r.is)(e,n.JsonRpcResponseStruct)},n.assertIsJsonRpcResponse=function(e,t){(0,s.assertStruct)(e,n.JsonRpcResponseStruct,"Invalid JSON-RPC response",t)},n.isJsonRpcSuccess=function(e){return(0,r.is)(e,n.JsonRpcSuccessStruct)},n.assertIsJsonRpcSuccess=function(e,t){(0,s.assertStruct)(e,n.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",t)},n.isJsonRpcFailure=function(e){return(0,r.is)(e,n.JsonRpcFailureStruct)},n.assertIsJsonRpcFailure=function(e,t){(0,s.assertStruct)(e,n.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",t)},n.isJsonRpcError=function(e){return(0,r.is)(e,n.JsonRpcErrorStruct)},n.assertIsJsonRpcError=function(e,t){(0,s.assertStruct)(e,n.JsonRpcErrorStruct,"Invalid JSON-RPC error",t)},n.getJsonRpcIdValidator=function(e){const{permitEmptyString:t,permitFractions:n,permitNull:r}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},e);return e=>Boolean("number"==typeof e&&(n||Number.isInteger(e))||"string"==typeof e&&(t||e.length>0)||r&&null===e)},n.validateJsonAndGetSize=o}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/json.js"}],[1119,{debug:2075},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.createProjectLogger=void 0;const s=(0,r(e("debug")).default)("metamask");n.createProjectLogger=function(e){return s.extend(e)},n.createModuleLogger=function(e,t){return e.extend(t)}}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/logging.js"}],[112,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:30,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=30;const n=function(e){const t=e;if(e.PreferencesController){const{frequentRpcListDetail:e}=t.PreferencesController;e&&(e.forEach(((t,n)=>{Boolean(t.chainId)&&Number.isNaN(parseInt(t.chainId))&&delete e[n].chainId})),t.PreferencesController.frequentRpcListDetail=e)}e.NetworkController&&(t.NetworkController.network&&Number.isNaN(parseInt(t.NetworkController.network))&&delete t.NetworkController.network,t.NetworkController.provider&&t.NetworkController.provider.chainId&&Number.isNaN(parseInt(t.NetworkController.provider.chainId))&&delete t.NetworkController.provider.chainId);return t}(t.data);return t.data=n,t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/030.js"}],[1120,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.calculateNumberSize=n.calculateStringSize=n.isASCII=n.isPlainObject=n.ESCAPE_CHARACTERS_REGEXP=n.JsonSize=n.hasProperty=n.isObject=n.isNullOrUndefined=n.isNonEmptyArray=void 0,n.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},n.isNullOrUndefined=function(e){return null===e||e===undefined},n.isObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)};function r(e){return e.charCodeAt(0)<=127}n.hasProperty=(e,t)=>Object.hasOwnProperty.call(e,t),function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(n.JsonSize||(n.JsonSize={})),n.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu,n.isPlainObject=function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}},n.isASCII=r,n.calculateStringSize=function(e){var t;return e.split("").reduce(((e,t)=>r(t)?e+1:e+2),0)+(null!==(t=e.match(n.ESCAPE_CHARACTERS_REGEXP))&&void 0!==t?t:[]).length},n.calculateNumberSize=function(e){return e.toString().length}}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/misc.js"}],[1121,{"./assert":1110,"./hex":1116},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.hexToBigInt=n.hexToNumber=n.bigIntToHex=n.numberToHex=void 0;const r=e("./assert"),s=e("./hex");n.numberToHex=e=>((0,r.assert)("number"==typeof e,"Value must be a number."),(0,r.assert)(e>=0,"Value must be a non-negative number."),(0,r.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,s.add0x)(e.toString(16)));n.bigIntToHex=e=>((0,r.assert)("bigint"==typeof e,"Value must be a bigint."),(0,r.assert)(e>=0,"Value must be a non-negative bigint."),(0,s.add0x)(e.toString(16)));n.hexToNumber=e=>{(0,s.assertIsHexString)(e);const t=parseInt(e,16);return(0,r.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};n.hexToBigInt=e=>((0,s.assertIsHexString)(e),BigInt((0,s.add0x)(e)))}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/number.js"}],[1122,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0})}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/opaque.js"}],[1123,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.timeSince=n.inMilliseconds=n.Duration=void 0,function(e){e[e.Millisecond=1]="Millisecond",e[e.Second=1e3]="Second",e[e.Minute=6e4]="Minute",e[e.Hour=36e5]="Hour",e[e.Day=864e5]="Day",e[e.Week=6048e5]="Week",e[e.Year=31536e6]="Year"}(n.Duration||(n.Duration={}));const r=(e,t)=>{if(!(e=>Number.isInteger(e)&&e>=0)(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};n.inMilliseconds=function(e,t){return r(e,"count"),e*t},n.timeSince=function(e){return r(e,"timestamp"),Date.now()-e}}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/time.js"}],[1124,{"./assert":1110,semver:3249,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.satisfiesVersionRange=n.gtRange=n.gtVersion=n.assertIsSemVerRange=n.assertIsSemVerVersion=n.isValidSemVerRange=n.isValidSemVerVersion=n.VersionRangeStruct=n.VersionStruct=void 0;const r=e("semver"),s=e("superstruct"),i=e("./assert");n.VersionStruct=(0,s.refine)((0,s.string)(),"Version",(e=>null!==(0,r.valid)(e)||`Expected SemVer version, got "${e}"`)),n.VersionRangeStruct=(0,s.refine)((0,s.string)(),"Version range",(e=>null!==(0,r.validRange)(e)||`Expected SemVer range, got "${e}"`)),n.isValidSemVerVersion=function(e){return(0,s.is)(e,n.VersionStruct)},n.isValidSemVerRange=function(e){return(0,s.is)(e,n.VersionRangeStruct)},n.assertIsSemVerVersion=function(e){(0,i.assertStruct)(e,n.VersionStruct)},n.assertIsSemVerRange=function(e){(0,i.assertStruct)(e,n.VersionRangeStruct)},n.gtVersion=function(e,t){return(0,r.gt)(e,t)},n.gtRange=function(e,t){return(0,r.gtr)(e,t)},n.satisfiesVersionRange=function(e,t){return(0,r.satisfies)(e,t,{includePrerelease:!0})}}}},{package:"@metamask/eth-json-rpc-infura>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/@metamask/utils/dist/versions.js"}],[1125,{"./logging-utils":1132,"./utils/cache":1137,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createBlockCacheMiddleware=void 0;const r=e("json-rpc-engine"),s=e("./logging-utils"),i=e("./utils/cache"),o=s.createModuleLogger(s.projectLogger,"block-cache"),a=[undefined,null,"<nil>"];class c{constructor(){this.cache={}}getBlockCacheForPayload(e,t){const n=Number.parseInt(t,16);let r=this.cache[n];if(!r){const e={};this.cache[n]=e,r=e}return r}async get(e,t){const n=this.getBlockCacheForPayload(e,t),r=i.cacheIdentifierForPayload(e,!0);return r?n[r]:undefined}async set(e,t,n){if(!this.canCacheResult(e,n))return;const r=i.cacheIdentifierForPayload(e,!0);if(!r)return;this.getBlockCacheForPayload(e,t)[r]=n}canCacheRequest(e){if(!i.canCache(e))return!1;return"pending"!==i.blockTagForPayload(e)}canCacheResult(e,t){return!a.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]))}}n.createBlockCacheMiddleware=function({blockTracker:e}={}){if(!e)throw new Error("createBlockCacheMiddleware - No PollingBlockTracker specified");const t=new c,n={perma:t,block:t,fork:t};return r.createAsyncMiddleware((async(r,s,a)=>{if(r.skipCache)return a();const c=i.cacheTypeForPayload(r),u=n[c];if(!u)return a();if(!u.canCacheRequest(r))return a();let l,d=i.blockTagForPayload(r);if(d||(d="latest"),o("blockTag = %o, req = %o",d,r),"earliest"===d)l="0x00";else if("latest"===d){o("Fetching latest block number to determine cache key");const n=await e.getLatestBlock();o("Clearing values stored under block numbers before %o",n),t.clearBefore(n),l=n}else l=d;const h=await u.get(r,l);return h===undefined?(o("No cache stored under block number %o, carrying request forward",l),await a(),o("Populating cache with",s),await u.set(r,l,s.result)):(o("Cache hit, reusing cache result stored under block number %o",l),s.result=h),undefined}))}}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/block-cache.js"}],[1126,{"./utils/cache":1137,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createBlockRefRewriteMiddleware=void 0;const r=e("json-rpc-engine"),s=e("./utils/cache");n.createBlockRefRewriteMiddleware=function({blockTracker:e}={}){if(!e)throw Error('BlockRefRewriteMiddleware - mandatory "blockTracker" option is missing.');return r.createAsyncMiddleware((async(t,n,r)=>{var i;const o=s.blockTagParamIndex(t);if(o===undefined)return r();let a=null===(i=t.params)||void 0===i?void 0:i[o];if(a===undefined&&(a="latest"),"latest"!==a)return r();const c=await e.getLatestBlock();return t.params&&(t.params[o]=c),r()}))}}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/block-ref-rewrite.js"}],[1127,{"./logging-utils":1132,"./utils/cache":1137,clone:1981,"json-rpc-engine":2724,pify:1139},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.createBlockRefMiddleware=void 0;const s=e("json-rpc-engine"),i=r(e("clone")),o=r(e("pify")),a=e("./logging-utils"),c=e("./utils/cache"),u=a.createModuleLogger(a.projectLogger,"block-ref");n.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 s.createAsyncMiddleware((async(n,r,s)=>{var a,l;const d=c.blockTagParamIndex(n);if(d===undefined)return s();if("latest"!==(null!==(l=null===(a=n.params)||void 0===a?void 0:a[d])&&void 0!==l?l:"latest"))return u('blockRef is not "latest", carrying request forward'),s();const h=await t.getLatestBlock();u(`blockRef is "latest", setting param ${d} to latest block ${h}`);const f=i.default(n);f.params&&(f.params[d]=h),u("Performing another request %o",f);const p=await o.default(e.sendAsync).call(e,f);return r.result=p.result,r.error=p.error,undefined}))}}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/block-ref.js"}],[1128,{"./logging-utils":1132,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createBlockTrackerInspectorMiddleware=void 0;const r=e("json-rpc-engine"),s=e("./logging-utils"),i=s.createModuleLogger(s.projectLogger,"block-tracker-inspector"),o=["eth_getTransactionByHash","eth_getTransactionReceipt"];n.createBlockTrackerInspectorMiddleware=function({blockTracker:e}){return r.createAsyncMiddleware((async(t,n,r)=>{var s;if(!o.includes(t.method))return r();if(await r(),!(null===(s=n.result)||void 0===s?void 0:s.blockNumber))return undefined;if(i("res.result.blockNumber exists, proceeding. res = %o",n),"string"==typeof n.result.blockNumber){Number.parseInt(n.result.blockNumber,16)>Number.parseInt(e.getCurrentBlock(),16)&&(i("blockNumber from response is greater than current block number, refreshing current block number"),await e.checkForLatestBlock())}return undefined}))}}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/block-tracker-inspector.js"}],[1129,{btoa:1942,"eth-rpc-errors":2170,"json-rpc-engine":2724,"node-fetch":1942},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createFetchConfigFromReq=n.createFetchMiddleware=void 0;const r=e("json-rpc-engine"),s=e("eth-rpc-errors"),i=global.fetch||e("node-fetch"),o=global.btoa||e("btoa"),a=["Gateway timeout","ETIMEDOUT","failed to parse response body","Failed to fetch"];function c(e){switch(e.status){case 405:throw s.ethErrors.rpc.methodNotFound();case 418:throw s.ethErrors.rpc.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.ethErrors.rpc.internal({message:e})}()}}function u(e,t){if(200!==e.status)throw s.ethErrors.rpc.internal({message:`Non-200 status code: '${e.status}'`,data:t});if(t.error)throw s.ethErrors.rpc.internal({data:t.error});return t.result}function l({req:e,rpcUrl:t,originHttpHeaderKey:n}){const r=new URL(t),s=function(e){let t="";t+=e.protocol,t+=`//${e.hostname}`,e.port&&(t+=`:${e.port}`);return t+=`${e.pathname}`,t+=`${e.search}`,t}(r),i={id:e.id,jsonrpc:e.jsonrpc,method:e.method,params:e.params},a=e.origin,c={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(i)};if(r.username&&r.password){const e=`${r.username}:${r.password}`,t=o(e);c.headers.Authorization=`Basic ${t}`}return n&&a&&(c.headers[n]=a),{fetchUrl:s,fetchParams:c}}function d(e){return new Promise((t=>setTimeout(t,e)))}n.createFetchMiddleware=function({rpcUrl:e,originHttpHeaderKey:t}){return r.createAsyncMiddleware((async(n,r,s)=>{const{fetchUrl:o,fetchParams:h}=l({req:n,rpcUrl:e,originHttpHeaderKey:t});for(let e=0;e<5;e++){try{const e=await i(o,h);c(e);const t=await e.text();let n;try{n=JSON.parse(t)}catch(e){throw new Error(`FetchMiddleware - failed to parse response body: "${t}"`)}const s=u(e,n);return void(r.result=s)}catch(e){const t=e.toString();if(!a.some((e=>t.includes(e))))throw e}await d(1e3)}}))},n.createFetchConfigFromReq=l}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/fetch.js"}],[113,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:31,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=31;const n=function(e){const{KeyringController:t,PreferencesController:n}=e;if(t&&n){const{vault:e}=t;n.completedOnboarding=Boolean(e)}return e}(t.data);return t.data=n,t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/031.js"}],[1130,{"./block-cache":1125,"./block-ref":1127,"./block-ref-rewrite":1126,"./block-tracker-inspector":1128,"./fetch":1129,"./inflight-cache":1131,"./providerAsMiddleware":1133,"./providerFromEngine":1134,"./providerFromMiddleware":1135,"./retryOnEmpty":1136,"./wallet":1138},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./block-cache"),n),s(e("./block-ref-rewrite"),n),s(e("./block-ref"),n),s(e("./block-tracker-inspector"),n),s(e("./fetch"),n),s(e("./inflight-cache"),n),s(e("./providerAsMiddleware"),n),s(e("./providerFromEngine"),n),s(e("./providerFromMiddleware"),n),s(e("./retryOnEmpty"),n),s(e("./wallet"),n)}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/index.js"}],[1131,{"./logging-utils":1132,"./utils/cache":1137,clone:1981,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.createInflightCacheMiddleware=void 0;const s=r(e("clone")),i=e("json-rpc-engine"),o=e("./logging-utils"),a=e("./utils/cache"),c=o.createModuleLogger(o.projectLogger,"inflight-cache");n.createInflightCacheMiddleware=function(){const e={};return i.createAsyncMiddleware((async(t,n,r)=>{if(t.skipCache)return r();const i=a.cacheIdentifierForPayload(t);if(!i)return c("Request is not cacheable, proceeding. req = %o",t),r();let o=e[i];return o?(c("Running %i handler(s) for request %o",o.length,t),await function(e,t){const{resolve:n,promise:r}=function(){let e;const t=new Promise((t=>{e=t}));return{resolve:e,promise:t}}();return t.push((t=>{e.result=s.default(t.result),e.error=s.default(t.error),n()})),r}(n,o),undefined):(o=[],e[i]=o,c("Carrying original request forward %o",t),await r(),delete e[i],c("Running %i collected handler(s) for request %o",o.length,t),function(e,t){setTimeout((()=>{t.forEach((t=>{try{t(e)}catch(e){console.error(e)}}))}))}(n,o),undefined)}))}}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/inflight-cache.js"}],[1132,{"@metamask/utils":1117},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.projectLogger=void 0;const r=e("@metamask/utils");Object.defineProperty(n,"createModuleLogger",{enumerable:!0,get:function(){return r.createModuleLogger}}),n.projectLogger=r.createProjectLogger("eth-json-rpc-middleware")}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/logging-utils.js"}],[1133,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ethersProviderAsMiddleware=n.providerAsMiddleware=void 0,n.providerAsMiddleware=function(e){return(t,n,r,s)=>{e.sendAsync(t,((e,t)=>e instanceof Error?s(e):(Object.assign(n,t),s())))}},n.ethersProviderAsMiddleware=function(e){return(t,n,r,s)=>{e.send(t,((e,t)=>e?s(e):(Object.assign(n,t),s())))}}}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/providerAsMiddleware.js"}],[1134,{"@metamask/safe-event-emitter":1325},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.providerFromEngine=void 0;const s=r(e("@metamask/safe-event-emitter"));n.providerFromEngine=function(e){const t=new s.default;return t.sendAsync=(t,n)=>{e.handle(t,n)},t.send=(t,n)=>{if("function"!=typeof n)throw new Error('Must provide callback to "send" method.');e.handle(t,n)},e.on&&e.on("notification",(e=>{t.emit("data",null,e)})),t}}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/providerFromEngine.js"}],[1135,{"./providerFromEngine":1134,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.providerFromMiddleware=void 0;const r=e("json-rpc-engine"),s=e("./providerFromEngine");n.providerFromMiddleware=function(e){const t=new r.JsonRpcEngine;return t.push(e),s.providerFromEngine(t)}}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/providerFromMiddleware.js"}],[1136,{"./logging-utils":1132,"./utils/cache":1137,clone:1981,"json-rpc-engine":2724,pify:1139},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.createRetryOnEmptyMiddleware=void 0;const s=r(e("clone")),i=e("json-rpc-engine"),o=r(e("pify")),a=e("./logging-utils"),c=e("./utils/cache"),u=a.createModuleLogger(a.projectLogger,"retry-on-empty"),l=[undefined,null,"<nil>"];function d(e){return new Promise((t=>setTimeout(t,e)))}n.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 i.createAsyncMiddleware((async(n,r,i)=>{var a;const h=c.blockTagParamIndex(n);if(h===undefined)return i();let f=null===(a=n.params)||void 0===a?void 0:a[h];if(f===undefined&&(f="latest"),["latest","pending"].includes(f))return i();const p=Number.parseInt(f.slice(2),16);if(Number.isNaN(p))return i();const m=await t.getLatestBlock(),g=Number.parseInt(m.slice(2),16);if(p>g)return u("Requested block number %o is higher than latest block number %o, falling through to original request",p,g),i();u("Requested block number %o is not higher than latest block number %o, trying request until non-empty response is received",p,g);const y=s.default(n),b=await async function(e,t){for(let n=0;n<e;n++)try{return await t()}catch(e){u("(call %i) Request failed, waiting 1s to retry again...",n+1),await d(1e3)}throw u("Retries exhausted"),new Error("RetryOnEmptyMiddleware - retries exhausted")}(10,(async()=>{u("Performing request %o",y);const t=await o.default(e.sendAsync).call(e,y);if(u("Response is %o",t),l.includes(t.result))throw new Error(`RetryOnEmptyMiddleware - empty response "${JSON.stringify(t)}" for request "${JSON.stringify(y)}"`);return t}));return u("Copying result %o and error %o",b.result,b.error),r.result=b.result,r.error=b.error,undefined}))}}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/retryOnEmpty.js"}],[1137,{"json-stable-stringify":2730},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.cacheTypeForPayload=n.blockTagParamIndex=n.paramsWithoutBlockTag=n.blockTagForPayload=n.canCache=n.cacheIdentifierForPayload=void 0;const s=r(e("json-stable-stringify"));function i(e){return"never"!==c(e)}function o(e){if(!e.params)return[];const t=a(e);return t===undefined||t>=e.params.length?e.params:"eth_getBlockByNumber"===e.method?e.params.slice(1):e.params.slice(0,t)}function a(e){switch(e.method){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 c(e){switch(e.method){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"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":case"test_forkCache":return"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"block";default:return"never"}}n.cacheIdentifierForPayload=function(e,t){var n;const r=t?o(e):null!==(n=e.params)&&void 0!==n?n:[];return i(e)?`${e.method}:${s.default(r)}`:null},n.canCache=i,n.blockTagForPayload=function(e){if(!e.params)return undefined;const t=a(e);return t===undefined||t>=e.params.length?undefined:e.params[t]},n.paramsWithoutBlockTag=o,n.blockTagParamIndex=a,n.cacheTypeForPayload=c}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/utils/cache.js"}],[1138,{"@metamask/eth-sig-util":1194,"eth-rpc-errors":2170,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),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 n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return s(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.createWalletMiddleware=void 0;const o=e("json-rpc-engine"),a=i(e("@metamask/eth-sig-util")),c=e("eth-rpc-errors");function u(e){return 42===e.length}n.createWalletMiddleware=function({getAccounts:e,processDecryptMessage:t,processEncryptionPublicKey:n,processEthSignMessage:r,processPersonalMessage:s,processTransaction:i,processSignTransaction:l,processTypedMessage:d,processTypedMessageV3:h,processTypedMessageV4:f}){if(!e)throw new Error("opts.getAccounts is required");return o.createScaffoldMiddleware({eth_accounts:o.createAsyncMiddleware((async function(t,n){n.result=await e(t)})),eth_coinbase:o.createAsyncMiddleware((async function(t,n){const r=await e(t);n.result=r[0]||null})),eth_sendTransaction:o.createAsyncMiddleware((async function(e,t){if(!i)throw c.ethErrors.rpc.methodNotSupported();const n=e.params[0]||{};n.from=await p(n.from,e),t.result=await i(n,e)})),eth_signTransaction:o.createAsyncMiddleware((async function(e,t){if(!l)throw c.ethErrors.rpc.methodNotSupported();const n=e.params[0]||{};n.from=await p(n.from,e),t.result=await l(n,e)})),eth_sign:o.createAsyncMiddleware((async function(e,t){if(!r)throw c.ethErrors.rpc.methodNotSupported();const n=await p(e.params[0],e),s=e.params[1],i=e.params[2]||{},o=Object.assign(Object.assign({},i),{from:n,data:s});t.result=await r(o,e)})),eth_signTypedData:o.createAsyncMiddleware((async function(e,t){if(!d)throw c.ethErrors.rpc.methodNotSupported();const n=e.params[0],r=await p(e.params[1],e),s=e.params[2]||{},i=Object.assign(Object.assign({},s),{from:r,data:n});t.result=await d(i,e,"V1")})),eth_signTypedData_v3:o.createAsyncMiddleware((async function(e,t){if(!h)throw c.ethErrors.rpc.methodNotSupported();const n=await p(e.params[0],e),r=e.params[1],s={data:r,from:n,version:"V3"};t.result=await h(s,e,"V3")})),eth_signTypedData_v4:o.createAsyncMiddleware((async function(e,t){if(!f)throw c.ethErrors.rpc.methodNotSupported();const n=await p(e.params[0],e),r=e.params[1],s={data:r,from:n,version:"V4"};t.result=await f(s,e,"V4")})),personal_sign:o.createAsyncMiddleware((async function(e,t){if(!s)throw c.ethErrors.rpc.methodNotSupported();const n=e.params[0],r=e.params[1],i=e.params[2]||{};let o,a;if(u(n)&&!u(r)){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,a=r}else a=n,o=r;o=await p(o,e);const l=Object.assign(Object.assign({},i),{from:o,data:a});t.result=await s(l,e)})),eth_getEncryptionPublicKey:o.createAsyncMiddleware((async function(e,t){if(!n)throw c.ethErrors.rpc.methodNotSupported();const r=await p(e.params[0],e);t.result=await n(r,e)})),eth_decrypt:o.createAsyncMiddleware((async function(e,n){if(!t)throw c.ethErrors.rpc.methodNotSupported();const r=e.params[0],s=await p(e.params[1],e),i=e.params[2]||{},o=Object.assign(Object.assign({},i),{from:s,data:r});n.result=await t(o,e)})),personal_ecRecover:o.createAsyncMiddleware((async function(e,t){const n=e.params[0],r=e.params[1],s=a.recoverPersonalSignature({data:n,signature:r});t.result=s}))});async function p(t,n){if("string"==typeof t&&t.length>0&&u(t)){const r=(await e(n,{suppressUnauthorized:!1})).map((e=>e.toLowerCase())),s=t.toLowerCase();if(r.includes(s))return s;throw c.ethErrors.provider.unauthorized()}throw c.ethErrors.rpc.invalidParams({message:"Invalid parameters: must provide an Ethereum address."})}}}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/eth-json-rpc-middleware/dist/wallet.js"}],[1139,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const r=(e,t)=>function(){const n=t.promiseModule,r=new Array(arguments.length);for(let e=0;e<arguments.length;e++)r[e]=arguments[e];return new n(((n,s)=>{t.errorFirst?r.push((function(e,r){if(t.multiArgs){const t=new Array(arguments.length-1);for(let e=1;e<arguments.length;e++)t[e-1]=arguments[e];e?(t.unshift(e),s(t)):n(t)}else e?s(e):n(r)})):r.push((function(e){if(t.multiArgs){const e=new Array(arguments.length-1);for(let t=0;t<arguments.length;t++)e[t]=arguments[t];n(e)}else n(e)})),e.apply(this,r)}))};t.exports=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const n=e=>{const n=t=>"string"==typeof t?e===t:t.test(e);return t.include?t.include.some(n):!t.exclude.some(n)};let s;s="function"==typeof e?function(){return t.excludeMain?e.apply(this,arguments):r(e,t).apply(this,arguments)}:Object.create(Object.getPrototypeOf(e));for(const i in e){const o=e[i];s[i]="function"==typeof o&&n(i)?r(o,t):o}return s}}}},{package:"@metamask/eth-json-rpc-infura>eth-json-rpc-middleware>pify",file:"node_modules/@metamask/eth-json-rpc-infura/node_modules/pify/index.js"}],[114,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:32,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=32;const n=t.data;return t.data=function(e){const{PreferencesController:t}=e;if(t){const{betaUI:e}=t.featureFlags||{};t.completedUiMigration=e}return e}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/032.js"}],[1140,{"./logging-utils":1147,"./utils/cache":1150,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createBlockCacheMiddleware=void 0;const r=e("json-rpc-engine"),s=e("./logging-utils"),i=e("./utils/cache"),o=s.createModuleLogger(s.projectLogger,"block-cache"),a=[undefined,null,"<nil>"];class c{constructor(){this.cache={}}getBlockCache(e){const t=Number.parseInt(e,16);let n=this.cache[t];if(!n){const e={};this.cache[t]=e,n=e}return n}async get(e,t){const n=this.getBlockCache(t),r=i.cacheIdentifierForRequest(e,!0);return r?n[r]:undefined}async set(e,t,n){if(!this.canCacheResult(e,n))return;const r=i.cacheIdentifierForRequest(e,!0);if(!r)return;this.getBlockCache(t)[r]=n}canCacheRequest(e){if(!i.canCache(e.method))return!1;return"pending"!==i.blockTagForRequest(e)}canCacheResult(e,t){return!a.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]))}}n.createBlockCacheMiddleware=function({blockTracker:e}={}){if(!e)throw new Error("createBlockCacheMiddleware - No PollingBlockTracker specified");const t=new c,n={[i.CacheStrategy.Permanent]:t,[i.CacheStrategy.Block]:t,[i.CacheStrategy.Fork]:t,[i.CacheStrategy.Never]:undefined};return r.createAsyncMiddleware((async(r,s,a)=>{if(r.skipCache)return a();const c=i.cacheTypeForMethod(r.method),u=n[c];if(!u)return a();if(!u.canCacheRequest(r))return a();const l=i.blockTagForRequest(r),d=l&&"string"==typeof l?l:"latest";let h;if(o("blockTag = %o, req = %o",d,r),"earliest"===d)h="0x00";else if("latest"===d){o("Fetching latest block number to determine cache key");const n=await e.getLatestBlock();o("Clearing values stored under block numbers before %o",n),t.clearBefore(n),h=n}else h=d;const f=await u.get(r,h);return f===undefined?(o("No cache stored under block number %o, carrying request forward",h),await a(),o("Populating cache with",s),await u.set(r,h,s.result)):(o("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"}],[1141,{"./utils/cache":1150,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createBlockRefRewriteMiddleware=void 0;const r=e("json-rpc-engine"),s=e("./utils/cache");n.createBlockRefRewriteMiddleware=function({blockTracker:e}={}){if(!e)throw Error('BlockRefRewriteMiddleware - mandatory "blockTracker" option is missing.');return r.createAsyncMiddleware((async(t,n,r)=>{const i=s.blockTagParamIndex(t.method);if(i===undefined)return r();let o=Array.isArray(t.params)?t.params[i]:undefined;if(o===undefined&&(o="latest"),"latest"!==o)return r();const a=await e.getLatestBlock();return Array.isArray(t.params)&&(t.params[i]=a),r()}))}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/block-ref-rewrite.js"}],[1142,{"./logging-utils":1147,"./utils/cache":1150,clone:1981,"json-rpc-engine":2724,pify:1168},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.createBlockRefMiddleware=void 0;const s=e("json-rpc-engine"),i=r(e("clone")),o=r(e("pify")),a=e("./logging-utils"),c=e("./utils/cache"),u=a.createModuleLogger(a.projectLogger,"block-ref");n.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 s.createAsyncMiddleware((async(n,r,s)=>{var a;const l=c.blockTagParamIndex(n.method);if(l===undefined)return s();if("latest"!==(Array.isArray(n.params)&&null!==(a=n.params[l])&&void 0!==a?a:"latest"))return u('blockRef is not "latest", carrying request forward'),s();const d=await t.getLatestBlock();u(`blockRef is "latest", setting param ${l} to latest block ${d}`);const h=i.default(n);Array.isArray(h.params)&&(h.params[l]=d),u("Performing another request %o",h);const f=await o.default(e.sendAsync).call(e,h);return r.result=f.result,r.error=f.error,undefined}))}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/block-ref.js"}],[1143,{"./logging-utils":1147,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createBlockTrackerInspectorMiddleware=void 0;const r=e("json-rpc-engine"),s=e("./logging-utils"),i=s.createModuleLogger(s.projectLogger,"block-tracker-inspector"),o=["eth_getTransactionByHash","eth_getTransactionReceipt"];function a(e){const{result:t}=e;return t&&"object"==typeof t&&(n=t,r="blockNumber",Object.hasOwnProperty.call(n,r))&&"string"==typeof t.blockNumber?t.blockNumber:undefined;var n,r}n.createBlockTrackerInspectorMiddleware=function({blockTracker:e}){return r.createAsyncMiddleware((async(t,n,r)=>{if(!o.includes(t.method))return r();await r();const s=a(n);if(!s)return undefined;i("res.result.blockNumber exists, proceeding. res = %o",n);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"}],[1144,{"./utils/timeout":1151,"eth-rpc-errors":2170,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createFetchConfigFromReq=n.createFetchMiddleware=void 0;const r=e("json-rpc-engine"),s=e("eth-rpc-errors"),i=e("./utils/timeout"),o=["Gateway timeout","ETIMEDOUT","failed to parse response body","Failed to fetch"];function a(e){switch(e.status){case 405:throw s.ethErrors.rpc.methodNotFound();case 418:throw s.ethErrors.rpc.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.ethErrors.rpc.internal({message:e})}()}}function c(e,t){if(200!==e.status)throw s.ethErrors.rpc.internal({message:`Non-200 status code: '${e.status}'`,data:t});if(t.error)throw s.ethErrors.rpc.internal({data:t.error});return t.result}function u({btoa:e,req:t,rpcUrl:n,originHttpHeaderKey:r}){const s=new URL(n),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),o={id:t.id,jsonrpc:t.jsonrpc,method:t.method,params:t.params},a=t.origin,c={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(o)};if(s.username&&s.password){const t=e(`${s.username}:${s.password}`);c.headers.Authorization=`Basic ${t}`}return r&&a&&(c.headers[r]=a),{fetchUrl:i,fetchParams:c}}n.createFetchMiddleware=function({btoa:e,fetch:t,rpcUrl:n,originHttpHeaderKey:s}){return r.createAsyncMiddleware((async(r,l,d)=>{const{fetchUrl:h,fetchParams:f}=u({btoa:e,req:r,rpcUrl:n,originHttpHeaderKey:s});for(let e=0;e<5;e++){try{const e=await t(h,f);a(e);const n=await e.text();let r;try{r=JSON.parse(n)}catch(e){throw new Error(`FetchMiddleware - failed to parse response body: "${n}"`)}const s=c(e,r);return void(l.result=s)}catch(e){const t=e.toString();if(!o.some((e=>t.includes(e))))throw e}await i.timeout(1e3)}}))},n.createFetchConfigFromReq=u}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/fetch.js"}],[1145,{"./block-cache":1140,"./block-ref":1142,"./block-ref-rewrite":1141,"./block-tracker-inspector":1143,"./fetch":1144,"./inflight-cache":1146,"./providerAsMiddleware":1148,"./retryOnEmpty":1149,"./wallet":1152},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./block-cache"),n),s(e("./block-ref-rewrite"),n),s(e("./block-ref"),n),s(e("./block-tracker-inspector"),n),s(e("./fetch"),n),s(e("./inflight-cache"),n),s(e("./providerAsMiddleware"),n),s(e("./retryOnEmpty"),n),s(e("./wallet"),n)}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/index.js"}],[1146,{"./logging-utils":1147,"./utils/cache":1150,clone:1981,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.createInflightCacheMiddleware=void 0;const s=r(e("clone")),i=e("json-rpc-engine"),o=e("./logging-utils"),a=e("./utils/cache"),c=o.createModuleLogger(o.projectLogger,"inflight-cache");n.createInflightCacheMiddleware=function(){const e={};return i.createAsyncMiddleware((async(t,n,r)=>{if(t.skipCache)return r();const i=a.cacheIdentifierForRequest(t);if(!i)return c("Request is not cacheable, proceeding. req = %o",t),r();let o=e[i];return o?(c("Running %i handler(s) for request %o",o.length,t),await function(e,t){const{resolve:n,promise:r}=function(){let e;const t=new Promise((t=>{e=t}));return{resolve:e,promise:t}}();return t.push((t=>{e.result=s.default(t.result),e.error=s.default(t.error),n()})),r}(n,o),undefined):(o=[],e[i]=o,c("Carrying original request forward %o",t),await r(),delete e[i],c("Running %i collected handler(s) for request %o",o.length,t),function(e,t){setTimeout((()=>{t.forEach((t=>{try{t(e)}catch(e){console.error(e)}}))}))}(n,o),undefined)}))}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/inflight-cache.js"}],[1147,{"@metamask/utils":1160},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.projectLogger=void 0;const r=e("@metamask/utils");Object.defineProperty(n,"createModuleLogger",{enumerable:!0,get:function(){return r.createModuleLogger}}),n.projectLogger=r.createProjectLogger("eth-json-rpc-middleware")}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/logging-utils.js"}],[1148,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ethersProviderAsMiddleware=n.providerAsMiddleware=void 0,n.providerAsMiddleware=function(e){return(t,n,r,s)=>{e.sendAsync(t,((e,t)=>e instanceof Error?s(e):(Object.assign(n,t),s())))}},n.ethersProviderAsMiddleware=function(e){return(t,n,r,s)=>{e.send(t,((e,t)=>e?s(e):(Object.assign(n,t),s())))}}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/providerAsMiddleware.js"}],[1149,{"./logging-utils":1147,"./utils/cache":1150,"./utils/timeout":1151,clone:1981,"json-rpc-engine":2724,pify:1168},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.createRetryOnEmptyMiddleware=void 0;const s=r(e("clone")),i=e("json-rpc-engine"),o=r(e("pify")),a=e("./logging-utils"),c=e("./utils/cache"),u=e("./utils/timeout"),l=a.createModuleLogger(a.projectLogger,"retry-on-empty"),d=[undefined,null,"<nil>"];n.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 i.createAsyncMiddleware((async(n,r,i)=>{const a=c.blockTagParamIndex(n.method);if(a===undefined)return i();let h=Array.isArray(n.params)?n.params[a]: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 l("Requested block number %o is higher than latest block number %o, falling through to original request",f,m),i();l("Requested block number %o is not higher than latest block number %o, trying request until non-empty response is received",f,m);const g=s.default(n),y=await async function(e,t){for(let n=0;n<e;n++)try{return await t()}catch(e){l("(call %i) Request failed, waiting 1s to retry again...",n+1),await u.timeout(1e3)}throw l("Retries exhausted"),new Error("RetryOnEmptyMiddleware - retries exhausted")}(10,(async()=>{l("Performing request %o",g);const t=await o.default(e.sendAsync).call(e,g);if(l("Response is %o",t),d.includes(t.result))throw new Error(`RetryOnEmptyMiddleware - empty response "${JSON.stringify(t)}" for request "${JSON.stringify(g)}"`);return t}));return l("Copying result %o and error %o",y.result,y.error),r.result=y.result,r.error=y.error,undefined}))}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/retryOnEmpty.js"}],[115,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:33,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=33;const n=function(e){const t=e;e.NoticeController&&delete t.NoticeController;return t}(t.data);return t.data=n,t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/033.js"}],[1150,{"safe-stable-stringify":3210},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.cacheTypeForMethod=n.blockTagParamIndex=n.blockTagForRequest=n.canCache=n.cacheIdentifierForRequest=n.CacheStrategy=void 0;const r=e("safe-stable-stringify").configure({bigint:!1,circularValue:Error});var s;function i(e){return a(e)!==s.Never}function o(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 a(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=n.CacheStrategy||(n.CacheStrategy={})),n.cacheIdentifierForRequest=function(e,t){var n;const s=t?function(e){if(!e.params)return[];const t=o(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!==(n=e.params)&&void 0!==n?n:[];return i(e.method)?`${e.method}:${r(s)}`:null},n.canCache=i,n.blockTagForRequest=function(e){if(!e.params)return undefined;const t=o(e.method);return t===undefined||!Array.isArray(e.params)||t>=e.params.length?undefined:e.params[t]},n.blockTagParamIndex=o,n.cacheTypeForMethod=a}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/utils/cache.js"}],[1151,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.timeout=void 0,n.timeout=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"}],[1152,{"@metamask/eth-sig-util":1194,"eth-rpc-errors":2170,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),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 n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return s(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.createWalletMiddleware=void 0;const o=e("json-rpc-engine"),a=i(e("@metamask/eth-sig-util")),c=e("eth-rpc-errors");function u(e){return 42===e.length}n.createWalletMiddleware=function({getAccounts:e,processDecryptMessage:t,processEncryptionPublicKey:n,processEthSignMessage:r,processPersonalMessage:s,processTransaction:i,processSignTransaction:l,processTypedMessage:d,processTypedMessageV3:h,processTypedMessageV4:f}){if(!e)throw new Error("opts.getAccounts is required");return o.createScaffoldMiddleware({eth_accounts:o.createAsyncMiddleware((async function(t,n){n.result=await e(t)})),eth_coinbase:o.createAsyncMiddleware((async function(t,n){const r=await e(t);n.result=r[0]||null})),eth_sendTransaction:o.createAsyncMiddleware((async function(e,t){if(!i)throw c.ethErrors.rpc.methodNotSupported();const n=e.params[0]||{};n.from=await p(n.from,e),t.result=await i(n,e)})),eth_signTransaction:o.createAsyncMiddleware((async function(e,t){if(!l)throw c.ethErrors.rpc.methodNotSupported();const n=e.params[0]||{};n.from=await p(n.from,e),t.result=await l(n,e)})),eth_sign:o.createAsyncMiddleware((async function(e,t){if(!r)throw c.ethErrors.rpc.methodNotSupported();const n=await p(e.params[0],e),s=e.params[1],i=e.params[2]||{},o=Object.assign(Object.assign({},i),{from:n,data:s});t.result=await r(o,e)})),eth_signTypedData:o.createAsyncMiddleware((async function(e,t){if(!d)throw c.ethErrors.rpc.methodNotSupported();const n=e.params[0],r=await p(e.params[1],e),s=e.params[2]||{},i=Object.assign(Object.assign({},s),{from:r,data:n});t.result=await d(i,e,"V1")})),eth_signTypedData_v3:o.createAsyncMiddleware((async function(e,t){if(!h)throw c.ethErrors.rpc.methodNotSupported();const n=await p(e.params[0],e),r=e.params[1],s={data:r,from:n,version:"V3"};t.result=await h(s,e,"V3")})),eth_signTypedData_v4:o.createAsyncMiddleware((async function(e,t){if(!f)throw c.ethErrors.rpc.methodNotSupported();const n=await p(e.params[0],e),r=e.params[1],s={data:r,from:n,version:"V4"};t.result=await f(s,e,"V4")})),personal_sign:o.createAsyncMiddleware((async function(e,t){if(!s)throw c.ethErrors.rpc.methodNotSupported();const n=e.params[0],r=e.params[1],i=e.params[2]||{};let o,a;if(u(n)&&!u(r)){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,a=r}else a=n,o=r;o=await p(o,e);const l=Object.assign(Object.assign({},i),{from:o,data:a});t.result=await s(l,e)})),eth_getEncryptionPublicKey:o.createAsyncMiddleware((async function(e,t){if(!n)throw c.ethErrors.rpc.methodNotSupported();const r=await p(e.params[0],e);t.result=await n(r,e)})),eth_decrypt:o.createAsyncMiddleware((async function(e,n){if(!t)throw c.ethErrors.rpc.methodNotSupported();const r=e.params[0],s=await p(e.params[1],e),i=e.params[2]||{},o=Object.assign(Object.assign({},i),{from:s,data:r});n.result=await t(o,e)})),personal_ecRecover:o.createAsyncMiddleware((async function(e,t){const n=e.params[0],r=e.params[1],s=a.recoverPersonalSignature({data:n,signature:r});t.result=s}))});async function p(t,n){if("string"==typeof t&&t.length>0&&u(t)){const r=(await e(n)).map((e=>e.toLowerCase())),s=t.toLowerCase();if(r.includes(s))return s;throw c.ethErrors.provider.unauthorized()}throw c.ethErrors.rpc.invalidParams({message:"Invalid parameters: must provide an Ethereum address."})}}}}},{package:"@metamask/eth-json-rpc-middleware",file:"node_modules/@metamask/eth-json-rpc-middleware/dist/wallet.js"}],[1153,{superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.assertExhaustive=n.assertStruct=n.assert=n.AssertionError=void 0;const r=e("superstruct");function s(e,t){return n=e,Boolean("string"==typeof(null===(s=null===(r=null==n?void 0:n.prototype)||void 0===r?void 0:r.constructor)||void 0===s?void 0:s.name))?new e({message:t}):e({message:t});var n,r,s}class i extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}n.AssertionError=i,n.assert=function(e,t="Assertion failed.",n=i){if(!e){if(t instanceof Error)throw t;throw s(n,t)}},n.assertStruct=function(e,t,n="Assertion failed",o=i){try{(0,r.assert)(e,t)}catch(e){throw s(o,`${n}: ${function(e){const t=function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}(e)}.`)}},n.assertExhaustive=function(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/assert.js"}],[1154,{"./assert":1153,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.base64=void 0;const r=e("superstruct"),s=e("./assert");n.base64=(e,t={})=>{var n,i;const o=null!==(n=t.paddingRequired)&&void 0!==n&&n,a=null!==(i=t.characterSet)&&void 0!==i?i:"base64";let c,u;return"base64"===a?c=String.raw`[A-Za-z0-9+\/]`:((0,s.assert)("base64url"===a),c=String.raw`[-_A-Za-z0-9]`),u=o?new RegExp(`^(?:${c}{4})*(?:${c}{3}=|${c}{2}==)?$`,"u"):new RegExp(`^(?:${c}{4})*(?:${c}{2,3}|${c}{3}=|${c}{2}==)?$`,"u"),(0,r.pattern)(e,u)}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/base64.js"}],[1155,{"./assert":1153,"./hex":1159,buffer:1943},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.createDataView=n.concatBytes=n.valueToBytes=n.stringToBytes=n.numberToBytes=n.signedBigIntToBytes=n.bigIntToBytes=n.hexToBytes=n.bytesToString=n.bytesToNumber=n.bytesToSignedBigInt=n.bytesToBigInt=n.bytesToHex=n.assertIsBytes=n.isBytes=void 0;const r=e("./assert"),s=e("./hex");const i=function(){const e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function o(e){return e instanceof Uint8Array}function a(e){(0,r.assert)(o(e),"Value must be a Uint8Array.")}function c(e){if(a(e),0===e.length)return"0x";const t=i(),n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=t[e[r]];return(0,s.add0x)(n.join(""))}function u(e){a(e);const t=c(e);return BigInt(t)}function l(e){var t;if("0x"===(null===(t=null==e?void 0:e.toLowerCase)||void 0===t?void 0:t.call(e)))return new Uint8Array;(0,s.assertIsHexString)(e);const n=(0,s.remove0x)(e).toLowerCase(),r=n.length%2==0?n:`0${n}`,i=new Uint8Array(r.length/2);for(let e=0;e<i.length;e++){const t=r.charCodeAt(2*e),n=r.charCodeAt(2*e+1),s=t-(t<58?48:87),o=n-(n<58?48:87);i[e]=16*s+o}return i}function d(e){(0,r.assert)("bigint"==typeof e,"Value must be a bigint."),(0,r.assert)(e>=BigInt(0),"Value must be a non-negative bigint.");return l(e.toString(16))}function h(e){(0,r.assert)("number"==typeof e,"Value must be a number."),(0,r.assert)(e>=0,"Value must be a non-negative number."),(0,r.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");return l(e.toString(16))}function f(e){return(0,r.assert)("string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function p(e){if("bigint"==typeof e)return d(e);if("number"==typeof e)return h(e);if("string"==typeof e)return e.startsWith("0x")?l(e):f(e);if(o(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}n.isBytes=o,n.assertIsBytes=a,n.bytesToHex=c,n.bytesToBigInt=u,n.bytesToSignedBigInt=function(e){a(e);let t=BigInt(0);for(const n of e)t=(t<<BigInt(8))+BigInt(n);return BigInt.asIntN(8*e.length,t)},n.bytesToNumber=function(e){a(e);const t=u(e);return(0,r.assert)(t<=BigInt(Number.MAX_SAFE_INTEGER),"Number is not a safe integer. Use `bytesToBigInt` instead."),Number(t)},n.bytesToString=function(e){return a(e),(new TextDecoder).decode(e)},n.hexToBytes=l,n.bigIntToBytes=d,n.signedBigIntToBytes=function(e,t){(0,r.assert)("bigint"==typeof e,"Value must be a bigint."),(0,r.assert)("number"==typeof t,"Byte length must be a number."),(0,r.assert)(t>0,"Byte length must be greater than 0."),(0,r.assert)(function(e,t){(0,r.assert)(t>0);const n=e>>BigInt(31);return!((~e&n)+(e&~n)>>BigInt(8*t-1))}(e,t),"Byte length is too small to represent the given value.");let n=e;const s=new Uint8Array(t);for(let e=0;e<s.length;e++)s[e]=Number(BigInt.asUintN(8,n)),n>>=BigInt(8);return s.reverse()},n.numberToBytes=h,n.stringToBytes=f,n.valueToBytes=p,n.concatBytes=function(e){const t=new Array(e.length);let n=0;for(let r=0;r<e.length;r++){const s=p(e[r]);t[r]=s,n+=s.length}const r=new Uint8Array(n);for(let e=0,n=0;e<t.length;e++)r.set(t[e],n),n+=t[e].length;return r},n.createDataView=function(e){if(void 0!==t&&e instanceof t){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new DataView(t)}return new DataView(e.buffer,e.byteOffset,e.byteLength)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/bytes.js"}],[1156,{"./base64":1154,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ChecksumStruct=void 0;const r=e("superstruct"),s=e("./base64");n.ChecksumStruct=(0,r.size)((0,s.base64)((0,r.string)(),{paddingRequired:!0}),44,44)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/checksum.js"}],[1157,{"./assert":1153,"./bytes":1155,"./hex":1159,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createHex=n.createBytes=n.createBigInt=n.createNumber=void 0;const r=e("superstruct"),s=e("./assert"),i=e("./bytes"),o=e("./hex"),a=(0,r.union)([(0,r.number)(),(0,r.bigint)(),(0,r.string)(),o.StrictHexStruct]),c=(0,r.coerce)((0,r.number)(),a,Number),u=(0,r.coerce)((0,r.bigint)(),a,BigInt),l=((0,r.union)([o.StrictHexStruct,(0,r.instance)(Uint8Array)]),(0,r.coerce)((0,r.instance)(Uint8Array),(0,r.union)([o.StrictHexStruct]),i.hexToBytes)),d=(0,r.coerce)(o.StrictHexStruct,(0,r.instance)(Uint8Array),i.bytesToHex);n.createNumber=function(e){try{const t=(0,r.create)(e,c);return(0,s.assert)(Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){if(t instanceof r.StructError)throw new Error(`Expected a number-like value, got "${e}".`);throw t}},n.createBigInt=function(e){try{return(0,r.create)(e,u)}catch(e){if(e instanceof r.StructError)throw new Error(`Expected a number-like value, got "${String(e.value)}".`);throw e}},n.createBytes=function(e){if("string"==typeof e&&"0x"===e.toLowerCase())return new Uint8Array;try{return(0,r.create)(e,l)}catch(e){if(e instanceof r.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}},n.createHex=function(e){if(e instanceof Uint8Array&&0===e.length||"string"==typeof e&&"0x"===e.toLowerCase())return"0x";try{return(0,r.create)(e,d)}catch(e){if(e instanceof r.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/coercers.js"}],[1158,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!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"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},o=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.FrozenSet=n.FrozenMap=void 0;class a{constructor(e){r.set(this,void 0),i(this,r,new Map(e),"f"),Object.freeze(this)}get size(){return o(this,r,"f").size}[(r=new WeakMap,Symbol.iterator)](){return o(this,r,"f")[Symbol.iterator]()}entries(){return o(this,r,"f").entries()}forEach(e,t){return o(this,r,"f").forEach(((n,r,s)=>e.call(t,n,r,this)))}get(e){return o(this,r,"f").get(e)}has(e){return o(this,r,"f").has(e)}keys(){return o(this,r,"f").keys()}values(){return o(this,r,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map((([e,t])=>`${String(e)} => ${String(t)}`)).join(", ")} `:""}}`}}n.FrozenMap=a;class c{constructor(e){s.set(this,void 0),i(this,s,new Set(e),"f"),Object.freeze(this)}get size(){return o(this,s,"f").size}[(s=new WeakMap,Symbol.iterator)](){return o(this,s,"f")[Symbol.iterator]()}entries(){return o(this,s,"f").entries()}forEach(e,t){return o(this,s,"f").forEach(((n,r,s)=>e.call(t,n,r,this)))}has(e){return o(this,s,"f").has(e)}keys(){return o(this,s,"f").keys()}values(){return o(this,s,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map((e=>String(e))).join(", ")} `:""}}`}}n.FrozenSet=c,Object.freeze(a),Object.freeze(a.prototype),Object.freeze(c),Object.freeze(c.prototype)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/collections.js"}],[1159,{"./assert":1153,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.remove0x=n.add0x=n.assertIsStrictHexString=n.assertIsHexString=n.isStrictHexString=n.isHexString=n.StrictHexStruct=n.HexStruct=void 0;const r=e("superstruct"),s=e("./assert");function i(e){return(0,r.is)(e,n.HexStruct)}function o(e){return(0,r.is)(e,n.StrictHexStruct)}n.HexStruct=(0,r.pattern)((0,r.string)(),/^(?:0x)?[0-9a-f]+$/iu),n.StrictHexStruct=(0,r.pattern)((0,r.string)(),/^0x[0-9a-f]+$/iu),n.isHexString=i,n.isStrictHexString=o,n.assertIsHexString=function(e){(0,s.assert)(i(e),"Value must be a hexadecimal string.")},n.assertIsStrictHexString=function(e){(0,s.assert)(o(e),'Value must be a hexadecimal string, starting with "0x".')},n.add0x=function(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`},n.remove0x=function(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/hex.js"}],[116,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:34,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=34;const n=t.data;return t.data=function(e){const{PreferencesController:t}=e;if(t){const e=t.featureFlags||{};e.privacyMode||void 0!==t.migratedPrivacyMode||(t.migratedPrivacyMode=!0,e.privacyMode=!0)}return e}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/034.js"}],[1160,{"./assert":1153,"./base64":1154,"./bytes":1155,"./checksum":1156,"./coercers":1157,"./collections":1158,"./hex":1159,"./json":1161,"./logging":1162,"./misc":1163,"./number":1164,"./opaque":1165,"./time":1166,"./versions":1167},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./assert"),n),s(e("./base64"),n),s(e("./bytes"),n),s(e("./checksum"),n),s(e("./coercers"),n),s(e("./collections"),n),s(e("./hex"),n),s(e("./json"),n),s(e("./logging"),n),s(e("./misc"),n),s(e("./number"),n),s(e("./opaque"),n),s(e("./time"),n),s(e("./versions"),n)}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/index.js"}],[1161,{"./assert":1153,"./misc":1163,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateJsonAndGetSize=n.getJsonRpcIdValidator=n.assertIsJsonRpcError=n.isJsonRpcError=n.assertIsJsonRpcFailure=n.isJsonRpcFailure=n.assertIsJsonRpcSuccess=n.isJsonRpcSuccess=n.assertIsJsonRpcResponse=n.isJsonRpcResponse=n.assertIsPendingJsonRpcResponse=n.isPendingJsonRpcResponse=n.JsonRpcResponseStruct=n.JsonRpcFailureStruct=n.JsonRpcSuccessStruct=n.PendingJsonRpcResponseStruct=n.assertIsJsonRpcRequest=n.isJsonRpcRequest=n.assertIsJsonRpcNotification=n.isJsonRpcNotification=n.JsonRpcNotificationStruct=n.JsonRpcRequestStruct=n.JsonRpcParamsStruct=n.JsonRpcErrorStruct=n.JsonRpcIdStruct=n.JsonRpcVersionStruct=n.jsonrpc2=n.isValidJson=n.JsonStruct=void 0;const r=e("superstruct"),s=e("./assert"),i=e("./misc");function o(e,t=!1){const n=new Set;return function e(t,r){if(t===undefined)return[!1,0];if(null===t)return[!0,r?0:i.JsonSize.Null];const s=typeof t;try{if("function"===s)return[!1,0];if("string"===s||t instanceof String)return[!0,r?0:(0,i.calculateStringSize)(t)+2*i.JsonSize.Quote];if("boolean"===s||t instanceof Boolean)return r?[!0,0]:[!0,1==t?i.JsonSize.True:i.JsonSize.False];if("number"===s||t instanceof Number)return r?[!0,0]:[!0,(0,i.calculateNumberSize)(t)];if(t instanceof Date)return r?[!0,0]:[!0,isNaN(t.getDate())?i.JsonSize.Null:i.JsonSize.Date+2*i.JsonSize.Quote]}catch(e){return[!1,0]}if(!(0,i.isPlainObject)(t)&&!Array.isArray(t))return[!1,0];if(n.has(t))return[!1,0];n.add(t);try{return[!0,Object.entries(t).reduce(((s,[o,a],c,u)=>{let[l,d]=e(a,r);if(!l)throw new Error("JSON validation did not pass. Validation process stopped.");if(n.delete(t),r)return 0;return s+(Array.isArray(t)?0:o.length+i.JsonSize.Comma+2*i.JsonSize.Colon)+d+(c<u.length-1?i.JsonSize.Comma:0)}),r?0:2*i.JsonSize.Wrapper)]}catch(e){return[!1,0]}}(e,t)}n.JsonStruct=(0,r.define)("Json",(e=>{const[t]=o(e,!0);return!!t||"Expected a valid JSON-serializable value"})),n.isValidJson=function(e){return(0,r.is)(e,n.JsonStruct)},n.jsonrpc2="2.0",n.JsonRpcVersionStruct=(0,r.literal)(n.jsonrpc2),n.JsonRpcIdStruct=(0,r.nullable)((0,r.union)([(0,r.number)(),(0,r.string)()])),n.JsonRpcErrorStruct=(0,r.object)({code:(0,r.integer)(),message:(0,r.string)(),data:(0,r.optional)(n.JsonStruct),stack:(0,r.optional)((0,r.string)())}),n.JsonRpcParamsStruct=(0,r.optional)((0,r.union)([(0,r.record)((0,r.string)(),n.JsonStruct),(0,r.array)(n.JsonStruct)])),n.JsonRpcRequestStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,method:(0,r.string)(),params:n.JsonRpcParamsStruct}),n.JsonRpcNotificationStruct=(0,r.omit)(n.JsonRpcRequestStruct,["id"]),n.isJsonRpcNotification=function(e){return(0,r.is)(e,n.JsonRpcNotificationStruct)},n.assertIsJsonRpcNotification=function(e,t){(0,s.assertStruct)(e,n.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",t)},n.isJsonRpcRequest=function(e){return(0,r.is)(e,n.JsonRpcRequestStruct)},n.assertIsJsonRpcRequest=function(e,t){(0,s.assertStruct)(e,n.JsonRpcRequestStruct,"Invalid JSON-RPC request",t)},n.PendingJsonRpcResponseStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,result:(0,r.optional)((0,r.unknown)()),error:(0,r.optional)(n.JsonRpcErrorStruct)}),n.JsonRpcSuccessStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,result:n.JsonStruct}),n.JsonRpcFailureStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,error:n.JsonRpcErrorStruct}),n.JsonRpcResponseStruct=(0,r.union)([n.JsonRpcSuccessStruct,n.JsonRpcFailureStruct]),n.isPendingJsonRpcResponse=function(e){return(0,r.is)(e,n.PendingJsonRpcResponseStruct)},n.assertIsPendingJsonRpcResponse=function(e,t){(0,s.assertStruct)(e,n.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",t)},n.isJsonRpcResponse=function(e){return(0,r.is)(e,n.JsonRpcResponseStruct)},n.assertIsJsonRpcResponse=function(e,t){(0,s.assertStruct)(e,n.JsonRpcResponseStruct,"Invalid JSON-RPC response",t)},n.isJsonRpcSuccess=function(e){return(0,r.is)(e,n.JsonRpcSuccessStruct)},n.assertIsJsonRpcSuccess=function(e,t){(0,s.assertStruct)(e,n.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",t)},n.isJsonRpcFailure=function(e){return(0,r.is)(e,n.JsonRpcFailureStruct)},n.assertIsJsonRpcFailure=function(e,t){(0,s.assertStruct)(e,n.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",t)},n.isJsonRpcError=function(e){return(0,r.is)(e,n.JsonRpcErrorStruct)},n.assertIsJsonRpcError=function(e,t){(0,s.assertStruct)(e,n.JsonRpcErrorStruct,"Invalid JSON-RPC error",t)},n.getJsonRpcIdValidator=function(e){const{permitEmptyString:t,permitFractions:n,permitNull:r}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},e);return e=>Boolean("number"==typeof e&&(n||Number.isInteger(e))||"string"==typeof e&&(t||e.length>0)||r&&null===e)},n.validateJsonAndGetSize=o}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/json.js"}],[1162,{debug:2075},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.createProjectLogger=void 0;const s=(0,r(e("debug")).default)("metamask");n.createProjectLogger=function(e){return s.extend(e)},n.createModuleLogger=function(e,t){return e.extend(t)}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/logging.js"}],[1163,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.calculateNumberSize=n.calculateStringSize=n.isASCII=n.isPlainObject=n.ESCAPE_CHARACTERS_REGEXP=n.JsonSize=n.hasProperty=n.isObject=n.isNullOrUndefined=n.isNonEmptyArray=void 0,n.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},n.isNullOrUndefined=function(e){return null===e||e===undefined},n.isObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)};function r(e){return e.charCodeAt(0)<=127}n.hasProperty=(e,t)=>Object.hasOwnProperty.call(e,t),function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(n.JsonSize||(n.JsonSize={})),n.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu,n.isPlainObject=function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}},n.isASCII=r,n.calculateStringSize=function(e){var t;return e.split("").reduce(((e,t)=>r(t)?e+1:e+2),0)+(null!==(t=e.match(n.ESCAPE_CHARACTERS_REGEXP))&&void 0!==t?t:[]).length},n.calculateNumberSize=function(e){return e.toString().length}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/misc.js"}],[1164,{"./assert":1153,"./hex":1159},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.hexToBigInt=n.hexToNumber=n.bigIntToHex=n.numberToHex=void 0;const r=e("./assert"),s=e("./hex");n.numberToHex=e=>((0,r.assert)("number"==typeof e,"Value must be a number."),(0,r.assert)(e>=0,"Value must be a non-negative number."),(0,r.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,s.add0x)(e.toString(16)));n.bigIntToHex=e=>((0,r.assert)("bigint"==typeof e,"Value must be a bigint."),(0,r.assert)(e>=0,"Value must be a non-negative bigint."),(0,s.add0x)(e.toString(16)));n.hexToNumber=e=>{(0,s.assertIsHexString)(e);const t=parseInt(e,16);return(0,r.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};n.hexToBigInt=e=>((0,s.assertIsHexString)(e),BigInt((0,s.add0x)(e)))}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/number.js"}],[1165,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0})}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/opaque.js"}],[1166,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.timeSince=n.inMilliseconds=n.Duration=void 0,function(e){e[e.Millisecond=1]="Millisecond",e[e.Second=1e3]="Second",e[e.Minute=6e4]="Minute",e[e.Hour=36e5]="Hour",e[e.Day=864e5]="Day",e[e.Week=6048e5]="Week",e[e.Year=31536e6]="Year"}(n.Duration||(n.Duration={}));const r=(e,t)=>{if(!(e=>Number.isInteger(e)&&e>=0)(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};n.inMilliseconds=function(e,t){return r(e,"count"),e*t},n.timeSince=function(e){return r(e,"timestamp"),Date.now()-e}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/time.js"}],[1167,{"./assert":1153,semver:3249,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.satisfiesVersionRange=n.gtRange=n.gtVersion=n.assertIsSemVerRange=n.assertIsSemVerVersion=n.isValidSemVerRange=n.isValidSemVerVersion=n.VersionRangeStruct=n.VersionStruct=void 0;const r=e("semver"),s=e("superstruct"),i=e("./assert");n.VersionStruct=(0,s.refine)((0,s.string)(),"Version",(e=>null!==(0,r.valid)(e)||`Expected SemVer version, got "${e}"`)),n.VersionRangeStruct=(0,s.refine)((0,s.string)(),"Version range",(e=>null!==(0,r.validRange)(e)||`Expected SemVer range, got "${e}"`)),n.isValidSemVerVersion=function(e){return(0,s.is)(e,n.VersionStruct)},n.isValidSemVerRange=function(e){return(0,s.is)(e,n.VersionRangeStruct)},n.assertIsSemVerVersion=function(e){(0,i.assertStruct)(e,n.VersionStruct)},n.assertIsSemVerRange=function(e){(0,i.assertStruct)(e,n.VersionRangeStruct)},n.gtVersion=function(e,t){return(0,r.gt)(e,t)},n.gtRange=function(e,t){return(0,r.gtr)(e,t)},n.satisfiesVersionRange=function(e,t){return(0,r.satisfies)(e,t,{includePrerelease:!0})}}}},{package:"@metamask/eth-json-rpc-middleware>@metamask/utils",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/@metamask/utils/dist/versions.js"}],[1168,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const r=(e,t)=>function(){const n=t.promiseModule,r=new Array(arguments.length);for(let e=0;e<arguments.length;e++)r[e]=arguments[e];return new n(((n,s)=>{t.errorFirst?r.push((function(e,r){if(t.multiArgs){const t=new Array(arguments.length-1);for(let e=1;e<arguments.length;e++)t[e-1]=arguments[e];e?(t.unshift(e),s(t)):n(t)}else e?s(e):n(r)})):r.push((function(e){if(t.multiArgs){const e=new Array(arguments.length-1);for(let t=0;t<arguments.length;t++)e[t]=arguments[t];n(e)}else n(e)})),e.apply(this,r)}))};t.exports=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const n=e=>{const n=t=>"string"==typeof t?e===t:t.test(e);return t.include?t.include.some(n):!t.exclude.some(n)};let s;s="function"==typeof e?function(){return t.excludeMain?e.apply(this,arguments):r(e,t).apply(this,arguments)}:Object.create(Object.getPrototypeOf(e));for(const i in e){const o=e[i];s[i]="function"==typeof o&&n(i)?r(o,t):o}return s}}}},{package:"@metamask/eth-json-rpc-middleware>pify",file:"node_modules/@metamask/eth-json-rpc-middleware/node_modules/pify/index.js"}],[1169,{"./provider-from-engine":1170,"./provider-from-middleware":1171},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./provider-from-engine"),n),s(e("./provider-from-middleware"),n)}}},{package:"@metamask/eth-json-rpc-provider",file:"node_modules/@metamask/eth-json-rpc-provider/dist/index.js"}],[117,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:35,async migrate(e){const t=(0,r.cloneDeep)(e);return t.meta.version=35,t.data=function(e){e.PreferencesController&&e.PreferencesController.seedWords!==undefined&&delete e.PreferencesController.seedWords;return e}(t.data),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/035.js"}],[1170,{"./safe-event-emitter-provider":1172},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.providerFromEngine=void 0;const r=e("./safe-event-emitter-provider");n.providerFromEngine=function(e){return new r.SafeEventEmitterProvider({engine:e})}}}},{package:"@metamask/eth-json-rpc-provider",file:"node_modules/@metamask/eth-json-rpc-provider/dist/provider-from-engine.js"}],[1171,{"./provider-from-engine":1170,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.providerFromMiddleware=void 0;const r=e("json-rpc-engine"),s=e("./provider-from-engine");n.providerFromMiddleware=function(e){const t=new r.JsonRpcEngine;return t.push(e),(0,s.providerFromEngine)(t)}}}},{package:"@metamask/eth-json-rpc-provider",file:"node_modules/@metamask/eth-json-rpc-provider/dist/provider-from-middleware.js"}],[1172,{"@metamask/safe-event-emitter":1325},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!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"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},i=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.SafeEventEmitterProvider=void 0;const a=o(e("@metamask/safe-event-emitter"));class c extends a.default{constructor({engine:e}){super(),r.set(this,void 0),this.sendAsync=(e,t)=>{i(this,r,"f").handle(e,t)},this.send=(e,t)=>{if("function"!=typeof t)throw new Error('Must provide callback to "send" method.');i(this,r,"f").handle(e,t)},s(this,r,e,"f"),e.on&&e.on("notification",(e=>{this.emit("data",null,e)}))}}n.SafeEventEmitterProvider=c,r=new WeakMap}}},{package:"@metamask/eth-json-rpc-provider",file:"node_modules/@metamask/eth-json-rpc-provider/dist/safe-event-emitter-provider.js"}],[1173,{"@metamask/browser-passworder":1080,"@metamask/eth-hd-keyring":1104,"@metamask/eth-sig-util":1194,"@metamask/eth-simple-keyring":1199,events:1944,"obs-store":3004},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const r=e("@metamask/browser-passworder"),s=e("@metamask/eth-hd-keyring"),{normalize:i}=e("@metamask/eth-sig-util"),o=e("@metamask/eth-simple-keyring"),{EventEmitter:a}=e("events"),c=e("obs-store"),u=[h(o),h(s)],l="HD Key Tree",d="Simple Key Pair";function h(e){const t=()=>new e;return t.type=e.type,t}t.exports={KeyringController:class extends a{constructor(e){super();const t=e.initState||{};this.keyringBuilders=e.keyringBuilders?u.concat(e.keyringBuilders):u,this.store=new c(t),this.memStore=new c({isUnlocked:!1,keyringTypes:this.keyringBuilders.map((e=>e.type)),keyrings:[],encryptionKey:null}),this.encryptor=e.encryptor||r,this.keyrings=[],this._unsupportedKeyrings=[],this.cacheEncryptionKey=Boolean(e.cacheEncryptionKey)}fullUpdate(){return this.emit("update",this.memStore.getState()),this.memStore.getState()}async createNewVaultAndKeychain(e){return this.password=e,await this.createFirstKeyTree(),this.setUnlocked(),this.fullUpdate()}async createNewVaultAndRestore(e,t){if("string"!=typeof e)throw new Error("Password must be text.");this.password=e,await this.clearKeyrings();const n=await this.addNewKeyring(l,{mnemonic:t,numberOfAccounts:1}),[r]=await n.getAccounts();if(!r)throw new Error("KeyringController - First Account not found.");return this.setUnlocked(),this.fullUpdate()}async setLocked(){return delete this.password,this.memStore.updateState({isUnlocked:!1,encryptionKey:null,encryptionSalt:null}),this.keyrings=[],await this._updateMemStoreKeyrings(),this.emit("lock"),this.fullUpdate()}async submitPassword(e){return this.keyrings=await this.unlockKeyrings(e),this.setUnlocked(),this.fullUpdate()}async submitEncryptionKey(e,t){return this.keyrings=await this.unlockKeyrings(undefined,e,t),this.setUnlocked(),this.fullUpdate()}async verifyPassword(e){const t=this.store.getState().vault;if(!t)throw new Error("Cannot unlock without a previous vault.");await this.encryptor.decrypt(e,t)}async addNewKeyring(e,t){const n=await this._newKeyring(e,t);t&&t.mnemonic||e!==l||(n.generateRandomMnemonic(),await n.addAccounts());const r=await n.getAccounts();return await this.checkForDuplicate(e,r),this.keyrings.push(n),await this.persistAllKeyrings(),this.fullUpdate(),n}async removeEmptyKeyrings(){const e=[];await Promise.all(this.keyrings.map((async t=>{(await t.getAccounts()).length>0&&e.push(t)}))),this.keyrings=e}async checkForDuplicate(e,t){const n=await this.getAccounts();if(e===d){if(Boolean(n.find((e=>{return e===t[0]||e===((n=t[0]).startsWith("0x")?n.slice(2):n);var n}))))throw new Error("The account you are trying to import is a duplicate");return t}return t}async addNewAccount(e){return(await e.addAccounts(1)).forEach((e=>{this.emit("newAccount",e)})),await this.persistAllKeyrings(),this.fullUpdate()}async exportAccount(e){const t=await this.getKeyringForAccount(e);return await t.exportAccount(i(e))}async removeAccount(e){const t=await this.getKeyringForAccount(e);if("function"!=typeof t.removeAccount)throw new Error(`Keyring ${t.type} doesn't support account removal operations`);t.removeAccount(e),this.emit("removedAccount",e);return 0===(await t.getAccounts()).length&&await this.removeEmptyKeyrings(),await this.persistAllKeyrings(),this.fullUpdate()}async signTransaction(e,t,n={}){const r=i(t),s=await this.getKeyringForAccount(r);return await s.signTransaction(r,e,n)}async signMessage(e,t={}){const n=i(e.from),r=await this.getKeyringForAccount(n);return await r.signMessage(n,e.data,t)}async signPersonalMessage(e,t={}){const n=i(e.from),r=await this.getKeyringForAccount(n);return await r.signPersonalMessage(n,e.data,t)}async getEncryptionPublicKey(e,t={}){const n=i(e),r=await this.getKeyringForAccount(e);return await r.getEncryptionPublicKey(n,t)}async decryptMessage(e,t={}){const n=i(e.from);return(await this.getKeyringForAccount(n)).decryptMessage(n,e.data,t)}async signTypedMessage(e,t={version:"V1"}){const n=i(e.from);return(await this.getKeyringForAccount(n)).signTypedData(n,e.data,t)}async getAppKeyAddress(e,t){const n=i(e);return(await this.getKeyringForAccount(n)).getAppKeyAddress(n,t)}async exportAppKeyForAddress(e,t){const n=i(e),r=await this.getKeyringForAccount(n);if(!("exportAccount"in r))throw new Error(`The keyring for address ${e} does not support exporting.`);return r.exportAccount(n,{withAppKeyOrigin:t})}async createFirstKeyTree(){this.clearKeyrings();const e=await this.addNewKeyring(l),[t]=await e.getAccounts();if(!t)throw new Error("KeyringController - No account found on keychain.");const n=i(t);return this.emit("newVault",n),null}async persistAllKeyrings(){const{encryptionKey:e,encryptionSalt:t}=this.memStore.getState();if(!this.password&&!e)throw new Error("Cannot persist vault without password and encryption key");const n=await Promise.all(this.keyrings.map((async e=>{const[t,n]=await Promise.all([e.type,e.serialize()]);return{type:t,data:n}})));let r,s;if(n.push(...this._unsupportedKeyrings),this.cacheEncryptionKey){if(this.password){const{vault:e,exportedKeyString:t}=await this.encryptor.encryptWithDetail(this.password,n);r=e,s=t}else if(e){const s=await this.encryptor.importKey(e),i=await this.encryptor.encryptWithKey(s,n);i.salt=t,r=JSON.stringify(i)}}else r=await this.encryptor.encrypt(this.password,n);if(!r)throw new Error("Cannot persist vault without vault information");return this.store.updateState({vault:r}),await this._updateMemStoreKeyrings(),s&&this.memStore.updateState({encryptionKey:s,encryptionSalt:JSON.parse(r).salt}),!0}async unlockKeyrings(e,t,n){const r=this.store.getState().vault;if(!r)throw new Error("Cannot unlock without a previous vault.");let s;if(await this.clearKeyrings(),this.cacheEncryptionKey)if(e){const t=await this.encryptor.decryptWithDetail(e,r);s=t.vault,this.password=e,this.memStore.updateState({encryptionKey:t.exportedKeyString,encryptionSalt:t.salt})}else{const e=JSON.parse(r);if(n!==e.salt)throw new Error("Encryption key and salt provided are expired");const i=await this.encryptor.importKey(t);s=await this.encryptor.decryptWithKey(i,e),this.memStore.updateState({encryptionKey:t,encryptionSalt:n})}else s=await this.encryptor.decrypt(e,r),this.password=e;return await Promise.all(s.map(this._restoreKeyring.bind(this))),await this._updateMemStoreKeyrings(),this.keyrings}async restoreKeyring(e){const t=await this._restoreKeyring(e);return t&&await this._updateMemStoreKeyrings(),t}async _restoreKeyring(e){const{type:t,data:n}=e,r=await this._newKeyring(t,n);return r?(await r.getAccounts(),this.keyrings.push(r),r):(this._unsupportedKeyrings.push(e),undefined)}getKeyringBuilderForType(e){return this.keyringBuilders.find((t=>t.type===e))}getKeyringsByType(e){return this.keyrings.filter((t=>t.type===e))}async getAccounts(){const e=this.keyrings||[];return(await Promise.all(e.map((e=>e.getAccounts())))).reduce(((e,t)=>e.concat(t)),[]).map(i)}async getKeyringForAccount(e){const t=i(e),n=await Promise.all(this.keyrings.map((e=>Promise.all([e,e.getAccounts()])))),r=n.filter((e=>e[1].map(i).includes(t)));if(r&&r.length>0)return r[0][0];let s="";throw e?n&&n.length?r&&r.length||(s="There are keyrings, but none match the address"):s="There are no keyrings":s="The address passed in is invalid/empty",new Error(`No keyring found for the requested account. Error info: ${s}`)}async displayForKeyring(e){const t=await e.getAccounts();return{type:e.type,accounts:t.map(i)}}async clearKeyrings(){this.keyrings=[],this.memStore.updateState({keyrings:[]})}async _updateMemStoreKeyrings(){const e=await Promise.all(this.keyrings.map(this.displayForKeyring));return this.memStore.updateState({keyrings:e})}setUnlocked(){this.memStore.updateState({isUnlocked:!0}),this.emit("unlock")}forgetKeyring(e){if(!e.forgetDevice)throw new Error(`KeyringController - keyring does not have method "forgetDevice", keyring type: ${e.type}`);e.forgetDevice(),this.persistAllKeyrings()}async _newKeyring(e,t){const n=this.getKeyringBuilderForType(e);if(!n)return undefined;const r=n();return await r.deserialize(t),r.init&&await r.init(),r}},keyringBuilderFactory:h}}}},{package:"@metamask/eth-keyring-controller",file:"node_modules/@metamask/eth-keyring-controller/index.js"}],[1174,{"@ethereumjs/tx":363,buffer:1943,"eth-sig-util":1175,"ethereumjs-util":2231,events:1944,hdkey:1185},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(n){(function(){const{EventEmitter:r}=e("events"),s=e("hdkey"),i=e("ethereumjs-util"),o=e("eth-sig-util"),{TransactionFactory:a}=e("@ethereumjs/tx"),c="m",u="Ledger Hardware",l={ropsten:"http://api-ropsten.etherscan.io",kovan:"http://api-kovan.etherscan.io",rinkeby:"https://api-rinkeby.etherscan.io",mainnet:"https://api.etherscan.io"};class d extends r{constructor(e={}){super(),this.accountDetails={},this.bridgeUrl=null,this.type=u,this.page=0,this.perPage=5,this.unlockedAccount=0,this.hdk=new s,this.paths={},this.iframe=null,this.network="mainnet",this.implementFullBIP44=!1,this.deserialize(e),this.iframeLoaded=!1,this._setupIframe(),this.currentMessageId=0,this.messageCallbacks={},this._setupListener()}serialize(){return Promise.resolve({hdPath:this.hdPath,accounts:this.accounts,accountDetails:this.accountDetails,bridgeUrl:this.bridgeUrl,implementFullBIP44:!1})}deserialize(e={}){return this.hdPath=e.hdPath||"m/44'/60'/0'",this.bridgeUrl=e.bridgeUrl||"https://metamask.github.io/eth-ledger-bridge-keyring",this.accounts=e.accounts||[],this.accountDetails=e.accountDetails||{},e.accountDetails||this._migrateAccountDetails(e),this.implementFullBIP44=e.implementFullBIP44||!1,this.accounts=this.accounts.filter((e=>Object.keys(this.accountDetails).includes(i.toChecksumAddress(e)))),Promise.resolve()}_migrateAccountDetails(e){if(this._isLedgerLiveHdPath()&&e.accountIndexes)for(const t of Object.keys(e.accountIndexes))this.accountDetails[t]={bip44:!0,hdPath:this._getPathForIndex(e.accountIndexes[t])};this._isLedgerLiveHdPath()||this.accounts.filter((e=>!Object.keys(this.accountDetails).includes(i.toChecksumAddress(e)))).forEach((e=>{try{this.accountDetails[i.toChecksumAddress(e)]={bip44:!1,hdPath:this._pathFromAddress(e)}}catch(t){console.log(`failed to migrate account ${e}`)}}))}isUnlocked(){return Boolean(this.hdk&&this.hdk.publicKey)}isConnected(){return this.isDeviceConnected}setAccountToUnlock(e){this.unlockedAccount=parseInt(e,10)}setHdPath(e){this.hdPath!==e&&(this.hdk=new s),this.hdPath=e}unlock(e,t=!0){if(this.isUnlocked()&&!e)return Promise.resolve("already unlocked");const r=e?this._toLedgerPath(e):this.hdPath;return new Promise(((e,s)=>{this._sendMessage({action:"ledger-unlock",params:{hdPath:r}},(({success:r,payload:i})=>{r?(t&&(this.hdk.publicKey=n.from(i.publicKey,"hex"),this.hdk.chainCode=n.from(i.chainCode,"hex")),e(i.address)):s(i.error||new Error("Unknown error"))}))}))}addAccounts(e=1){return new Promise(((t,n)=>{this.unlock().then((async n=>{const r=this.unlockedAccount,s=r+e;for(let e=r;e<s;e++){const t=this._getPathForIndex(e);let n;n=this._isLedgerLiveHdPath()?await this.unlock(t):this._addressFromIndex(c,e),this.accountDetails[i.toChecksumAddress(n)]={bip44:this._isLedgerLiveHdPath(),hdPath:t},this.accounts.includes(n)||this.accounts.push(n),this.page=0}t(this.accounts)})).catch(n)}))}getFirstPage(){return this.page=0,this.__getPage(1)}getNextPage(){return this.__getPage(1)}getPreviousPage(){return this.__getPage(-1)}getAccounts(){return Promise.resolve(this.accounts.slice())}removeAccount(e){if(!this.accounts.map((e=>e.toLowerCase())).includes(e.toLowerCase()))throw new Error(`Address ${e} not found in this keyring`);this.accounts=this.accounts.filter((t=>t.toLowerCase()!==e.toLowerCase())),delete this.accountDetails[i.toChecksumAddress(e)]}attemptMakeApp(){return new Promise(((e,t)=>{this._sendMessage({action:"ledger-make-app"},(({success:n,error:r})=>{n?e(!0):t(r)}))}))}updateTransportMethod(e){return new Promise(((t,n)=>{this.iframeLoaded?this._sendMessage({action:"ledger-update-transport",params:{transportType:e}},(({success:e})=>{e?t(!0):n(new Error("Ledger transport could not be updated"))})):this.delayedPromise={resolve:t,reject:n,transportType:e}}))}signTransaction(e,t){let r;if("function"==typeof t.getChainId)return t.v=i.bufferToHex(t.getChainId()),t.r="0x00",t.s="0x00",r=t.serialize().toString("hex"),this._signTransaction(e,r,(e=>(t.v=n.from(e.v,"hex"),t.r=n.from(e.r,"hex"),t.s=n.from(e.s,"hex"),t)));const s=t.getMessageToSign(!1);return r=n.isBuffer(s)?s.toString("hex"):i.rlp.encode(s).toString("hex"),this._signTransaction(e,r,(e=>{const n=t.toJSON();return n.type=t.type,n.v=i.addHexPrefix(e.v),n.r=i.addHexPrefix(e.r),n.s=i.addHexPrefix(e.s),a.fromTxData(n,{common:t.common,freeze:Object.isFrozen(t)})}))}_signTransaction(e,t,n){return new Promise(((r,s)=>{this.unlockAccountByAddress(e).then((e=>{this._sendMessage({action:"ledger-sign-transaction",params:{tx:t,hdPath:e}},(({success:e,payload:t})=>{if(e){const e=n(t);e.verifySignature()?r(e):s(new Error("Ledger: The transaction signature is not valid"))}else s(t.error||new Error("Ledger: Unknown error while signing transaction"))}))})).catch(s)}))}signMessage(e,t){return this.signPersonalMessage(e,t)}signPersonalMessage(e,t){return new Promise(((n,r)=>{this.unlockAccountByAddress(e).then((s=>{this._sendMessage({action:"ledger-sign-personal-message",params:{hdPath:s,message:i.stripHexPrefix(t)}},(({success:s,payload:a})=>{if(s){let s=a.v-27;s=s.toString(16),s.length<2&&(s=`0${s}`);const c=`0x${a.r}${a.s}${s}`,u=o.recoverPersonalSignature({data:t,sig:c});i.toChecksumAddress(u)!==i.toChecksumAddress(e)&&r(new Error("Ledger: The signature doesnt match the right address")),n(c)}else r(a.error||new Error("Ledger: Unknown error while signing message"))}))})).catch(r)}))}async unlockAccountByAddress(e){const t=i.toChecksumAddress(e);if(!Object.keys(this.accountDetails).includes(t))throw new Error(`Ledger: Account for address '${t}' not found`);const{hdPath:n}=this.accountDetails[t];if((await this.unlock(n,!1)).toLowerCase()!==e.toLowerCase())throw new Error(`Ledger: Account ${e} does not belong to the connected device`);return n}async signTypedData(e,t,n={}){const r="V4"===n.version;if(!r)throw new Error("Ledger: Only version 4 of typed data signing is supported");const{domain:s,types:a,primaryType:c,message:u}=o.TypedDataUtils.sanitizeData(t),l=o.TypedDataUtils.hashStruct("EIP712Domain",s,a,r).toString("hex"),d=o.TypedDataUtils.hashStruct(c,u,a,r).toString("hex"),h=await this.unlockAccountByAddress(e),{success:f,payload:p}=await new Promise((e=>{this._sendMessage({action:"ledger-sign-typed-data",params:{hdPath:h,domainSeparatorHex:l,hashStructMessageHex:d}},(t=>e(t)))}));if(f){let n=p.v-27;n=n.toString(16),n.length<2&&(n=`0${n}`);const r=`0x${p.r}${p.s}${n}`,s=o.recoverTypedSignature_v4({data:t,sig:r});if(i.toChecksumAddress(s)!==i.toChecksumAddress(e))throw new Error("Ledger: The signature doesnt match the right address");return r}throw p.error||new Error("Ledger: Unknown error while signing message")}exportAccount(){throw new Error("Not supported on this device")}forgetDevice(){this.accounts=[],this.page=0,this.unlockedAccount=0,this.paths={},this.accountDetails={},this.hdk=new s}_setupIframe(){this.iframe=document.createElement("iframe"),this.iframe.src=this.bridgeUrl,this.iframe.allow="hid 'src'",this.iframe.onload=async()=>{if(this.iframeLoaded=!0,this.delayedPromise)try{const e=await this.updateTransportMethod(this.delayedPromise.transportType);this.delayedPromise.resolve(e)}catch(e){this.delayedPromise.reject(e)}finally{delete this.delayedPromise}},document.head.appendChild(this.iframe)}_getOrigin(){const e=this.bridgeUrl.split("/");return e.splice(-1,1),e.join("/")}_sendMessage(e,t){e.target="LEDGER-IFRAME",this.currentMessageId+=1,e.messageId=this.currentMessageId,this.messageCallbacks[this.currentMessageId]=t,this.iframe.contentWindow.postMessage(e,"*")}_setupListener(){this._eventListener=({origin:e,data:t})=>e===this._getOrigin()&&(t&&(this.messageCallbacks[t.messageId]?this.messageCallbacks[t.messageId](t):"ledger-connection-change"===t.action&&(this.isDeviceConnected=t.payload.connected)),undefined),window.addEventListener("message",this._eventListener)}destroy(){window.removeEventListener("message",this._eventListener)}async __getPage(e){this.page+=e,this.page<=0&&(this.page=1);const t=(this.page-1)*this.perPage,n=t+this.perPage;let r;return await this.unlock(),r=this._isLedgerLiveHdPath()?await this._getAccountsBIP44(t,n):this._getAccountsLegacy(t,n),r}async _getAccountsBIP44(e,t){const n=[];for(let r=e;r<t;r++){const e=this._getPathForIndex(r),t=await this.unlock(e),s=!this.implementFullBIP44||await this._hasPreviousTransactions(t);if(n.push({address:t,balance:null,index:r}),!s)break}return n}_getAccountsLegacy(e,t){const n=[];for(let r=e;r<t;r++){const e=this._addressFromIndex(c,r);n.push({address:e,balance:null,index:r}),this.paths[i.toChecksumAddress(e)]=r}return n}_padLeftEven(e){return e.length%2==0?e:`0${e}`}_normalize(e){return this._padLeftEven(i.bufferToHex(e).toLowerCase())}_addressFromIndex(e,t){const n=this.hdk.derive(`${e}/${t}`),r=i.publicToAddress(n.publicKey,!0).toString("hex");return i.toChecksumAddress(`0x${r}`)}_pathFromAddress(e){const t=i.toChecksumAddress(e);let n=this.paths[t];if(void 0===n)for(let e=0;e<1e3;e++)if(t===this._addressFromIndex(c,e)){n=e;break}if(void 0===n)throw new Error("Unknown address");return this._getPathForIndex(n)}_toAscii(e){let t="",n=0;const r=e.length;for("0x"===e.substring(0,2)&&(n=2);n<r;n+=2){const r=parseInt(e.substr(n,2),16);t+=String.fromCharCode(r)}return t}_getPathForIndex(e){return this._isLedgerLiveHdPath()?`m/44'/60'/${e}'/0/0`:`${this.hdPath}/${e}`}_isLedgerLiveHdPath(){return"m/44'/60'/0'/0/0"===this.hdPath}_toLedgerPath(e){return e.toString().replace("m/","")}async _hasPreviousTransactions(e){const t=this._getApiUrl(),n=await window.fetch(`${t}/api?module=account&action=txlist&address=${e}&tag=latest&page=1&offset=1`),r=await n.json();return"0"!==r.status&&r.result.length>0}_getApiUrl(){return l[this.network]||l.mainnet}}d.type=u,t.exports=d}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/index.js"}],[1175,{buffer:1943,"ethereumjs-abi":2207,"ethereumjs-util":1176,tweetnacl:3338,"tweetnacl-util":3337},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const{Buffer:r}=e("buffer"),s=e("ethereumjs-util"),i=e("ethereumjs-abi"),o=e("tweetnacl");o.util=e("tweetnacl-util");const a={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"]},c={encodeData(e,t,n,o=!0){const a=["bytes32"],c=[this.hashType(e,n)];if(o){const u=(e,t,a)=>{if(n[t]!==undefined)return["bytes32",null===a||a===undefined?"0x0000000000000000000000000000000000000000000000000000000000000000":s.keccak(this.encodeData(t,a,n,o))];if(a===undefined)throw new Error(`missing value for field ${e} of type ${t}`);if("bytes"===t)return["bytes32",s.keccak(a)];if("string"===t)return"string"==typeof a&&(a=r.from(a,"utf8")),["bytes32",s.keccak(a)];if(t.lastIndexOf("]")===t.length-1){const n=t.slice(0,t.lastIndexOf("[")),r=a.map((t=>u(e,n,t)));return["bytes32",s.keccak(i.rawEncode(r.map((([e])=>e)),r.map((([,e])=>e))))]}return[t,a]};for(const r of n[e]){const[e,n]=u(r.name,r.type,t[r.name]);a.push(e),c.push(n)}}else for(const i of n[e]){let e=t[i.name];if(e!==undefined)if("bytes"===i.type)a.push("bytes32"),e=s.keccak(e),c.push(e);else if("string"===i.type)a.push("bytes32"),"string"==typeof e&&(e=r.from(e,"utf8")),e=s.keccak(e),c.push(e);else if(n[i.type]!==undefined)a.push("bytes32"),e=s.keccak(this.encodeData(i.type,e,n,o)),c.push(e);else{if(i.type.lastIndexOf("]")===i.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");a.push(i.type),c.push(e)}}return i.rawEncode(a,c)},encodeType(e,t){let n="",r=this.findTypeDependencies(e,t).filter((t=>t!==e));r=[e].concat(r.sort());for(const e of r){if(!t[e])throw new Error(`No type definition specified: ${e}`);n+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`}return n},findTypeDependencies(e,t,n=[]){const[r]=e.match(/^\w*/u);if(e=r,n.includes(e)||t[e]===undefined)return n;n.push(e);for(const r of t[e])for(const e of this.findTypeDependencies(r.type,t,n))!n.includes(e)&&n.push(e);return n},hashStruct(e,t,n,r=!0){return s.keccak(this.encodeData(e,t,n,r))},hashType(e,t){return s.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const n of Object.keys(a.properties))e[n]&&(t[n]=e[n]);return t.types&&(t.types={EIP712Domain:[],...t.types}),t},sign(e,t=!0){const n=this.sanitizeData(e),i=[r.from("1901","hex")];return i.push(this.hashStruct("EIP712Domain",n.domain,n.types,t)),"EIP712Domain"!==n.primaryType&&i.push(this.hashStruct(n.primaryType,n.message,n.types,t)),s.keccak(r.concat(i))}};function u(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;const n=e.map((function(e){return"bytes"===e.type?s.toBuffer(e.value):e.value})),r=e.map((function(e){return e.type})),o=e.map((function(e){if(!e.name)throw t;return`${e.type} ${e.name}`}));return i.soliditySHA3(["bytes32","bytes32"],[i.soliditySHA3(new Array(e.length).fill("string"),o),i.soliditySHA3(r,n)])}function l(e,t){const n=s.toBuffer(t),r=s.fromRpcSig(n);return s.ecrecover(e,r.v,r.r,r.s)}function d(e){const t=s.toBuffer(e.data);return l(s.hashPersonalMessage(t),e.sig)}function h(e,t){let n=`${e}`;for(;n.length<t;)n=`0${n}`;return n}function f(e){const t=r.from(e,"hex").toString("base64");return o.util.decodeBase64(t)}t.exports={TYPED_MESSAGE_SCHEMA:a,TypedDataUtils:c,concatSig(e,t,n){const r=s.fromSigned(t),i=s.fromSigned(n),o=s.bufferToInt(e),a=h(s.toUnsigned(r).toString("hex"),64),c=h(s.toUnsigned(i).toString("hex"),64),u=s.stripHexPrefix(s.intToHex(o));return s.addHexPrefix(a.concat(c,u)).toString("hex")},normalize(e){if(!e)return undefined;if("number"==typeof e){const t=s.toBuffer(e);e=s.bufferToHex(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 s.addHexPrefix(e.toLowerCase())},personalSign(e,t){const n=s.toBuffer(t.data),r=s.hashPersonalMessage(n),i=s.ecsign(r,e);return s.bufferToHex(this.concatSig(i.v,i.r,i.s))},recoverPersonalSignature(e){const t=d(e),n=s.publicToAddress(t);return s.bufferToHex(n)},extractPublicKey:e=>`0x${d(e).toString("hex")}`,typedSignatureHash(e){const t=u(e);return s.bufferToHex(t)},signTypedDataLegacy(e,t){const n=u(t.data),r=s.ecsign(n,e);return s.bufferToHex(this.concatSig(r.v,r.r,r.s))},recoverTypedSignatureLegacy(e){const t=l(u(e.data),e.sig),n=s.publicToAddress(t);return s.bufferToHex(n)},encrypt(e,t,n){if("x25519-xsalsa20-poly1305"===n){if(void 0===t.data)throw new Error('Cannot detect secret message, message params should be of the form {data: "secret message"} ');const n=o.box.keyPair();let r;try{r=o.util.decodeBase64(e)}catch(e){throw new Error("Bad public key")}const s=o.util.decodeUTF8(t.data),i=o.randomBytes(o.box.nonceLength),a=o.box(s,i,r,n.secretKey);return{version:"x25519-xsalsa20-poly1305",nonce:o.util.encodeBase64(i),ephemPublicKey:o.util.encodeBase64(n.publicKey),ciphertext:o.util.encodeBase64(a)}}throw new Error("Encryption type/version not supported")},encryptSafely(e,t,n){const{data:s}=t;if(!s)throw new Error("Cannot encrypt empty msg.data");if("object"==typeof s&&s.toJSON)throw new Error("Cannot encrypt with toJSON property.  Please remove toJSON property");const i={data:s,padding:""},o=r.byteLength(JSON.stringify(i),"utf-8")%2048;let a=0;o>0&&(a=2048-o-16),i.padding="0".repeat(a);const c={data:JSON.stringify(i)};return this.encrypt(e,c,n)},decrypt(e,t){if("x25519-xsalsa20-poly1305"===e.version){const n=f(t),r=o.box.keyPair.fromSecretKey(n).secretKey,s=o.util.decodeBase64(e.nonce),i=o.util.decodeBase64(e.ciphertext),a=o.util.decodeBase64(e.ephemPublicKey),c=o.box.open(i,s,a,r);let u;try{u=o.util.encodeUTF8(c)}catch(e){throw new Error("Decryption failed.")}if(u)return u;throw new Error("Decryption failed.")}throw new Error("Encryption type/version not supported.")},decryptSafely(e,t){return JSON.parse(this.decrypt(e,t)).data},getEncryptionPublicKey(e){const t=f(e),n=o.box.keyPair.fromSecretKey(t).publicKey;return o.util.encodeBase64(n)},signTypedMessage(e,t,n="V4"){switch(n){case"V1":return this.signTypedDataLegacy(e,t);case"V3":return this.signTypedData(e,t);default:return this.signTypedData_v4(e,t)}},recoverTypedMessage(e,t="V4"){switch(t){case"V1":return this.recoverTypedSignatureLegacy(e);case"V3":return this.recoverTypedSignature(e);default:return this.recoverTypedSignature_v4(e)}},signTypedData(e,t){const n=c.sign(t.data,!1),r=s.ecsign(n,e);return s.bufferToHex(this.concatSig(r.v,r.r,r.s))},signTypedData_v4(e,t){const n=c.sign(t.data),r=s.ecsign(n,e);return s.bufferToHex(this.concatSig(r.v,r.r,r.s))},recoverTypedSignature(e){const t=l(c.sign(e.data,!1),e.sig),n=s.publicToAddress(t);return s.bufferToHex(n)},recoverTypedSignature_v4(e){const t=l(c.sign(e.data),e.sig),n=s.publicToAddress(t);return s.bufferToHex(n)}}}}},{package:"@metamask/eth-ledger-bridge-keyring>eth-sig-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/eth-sig-util/index.js"}],[1176,{"./secp256k1-adapter":1177,assert:1710,"bn.js":1900,"create-hash":2061,"ethereum-cryptography/keccak":1181,"ethjs-util":1184,rlp:3206,"safe-buffer":3208},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=e("ethereum-cryptography/keccak"),i=s.keccak224,o=s.keccak384,a=s.keccak256,c=s.keccak512,u=e("./secp256k1-adapter"),l=e("assert"),d=e("rlp"),h=e("bn.js"),f=e("create-hash"),p=e("safe-buffer").Buffer;Object.assign(n,e("ethjs-util")),n.MAX_INTEGER=new h("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),n.TWO_POW256=new h("10000000000000000000000000000000000000000000000000000000000000000",16),n.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",n.SHA3_NULL_S=n.KECCAK256_NULL_S,n.KECCAK256_NULL=p.from(n.KECCAK256_NULL_S,"hex"),n.SHA3_NULL=n.KECCAK256_NULL,n.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",n.SHA3_RLP_ARRAY_S=n.KECCAK256_RLP_ARRAY_S,n.KECCAK256_RLP_ARRAY=p.from(n.KECCAK256_RLP_ARRAY_S,"hex"),n.SHA3_RLP_ARRAY=n.KECCAK256_RLP_ARRAY,n.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",n.SHA3_RLP_S=n.KECCAK256_RLP_S,n.KECCAK256_RLP=p.from(n.KECCAK256_RLP_S,"hex"),n.SHA3_RLP=n.KECCAK256_RLP,n.BN=h,n.rlp=d,n.secp256k1=u,n.zeros=function(e){return p.allocUnsafe(e).fill(0)},n.zeroAddress=function(){var e=n.zeros(20);return n.bufferToHex(e)},n.setLengthLeft=n.setLength=function(e,t,r){var s=n.zeros(t);return e=n.toBuffer(e),r?e.length<t?(e.copy(s),s):e.slice(0,t):e.length<t?(e.copy(s,t-e.length),s):e.slice(-t)},n.setLengthRight=function(e,t){return n.setLength(e,t,!0)},n.unpad=n.stripZeros=function(e){for(var t=(e=n.stripHexPrefix(e))[0];e.length>0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e},n.toBuffer=function(e){if(!p.isBuffer(e))if(Array.isArray(e))e=p.from(e);else if("string"==typeof e)e=n.isHexString(e)?p.from(n.padToEven(n.stripHexPrefix(e)),"hex"):p.from(e);else if("number"==typeof e)e=n.intToBuffer(e);else if(null===e||e===undefined)e=p.allocUnsafe(0);else if(h.isBN(e))e=e.toArrayLike(p);else{if(!e.toArray)throw new Error("invalid type");e=p.from(e.toArray())}return e},n.bufferToInt=function(e){return new h(n.toBuffer(e)).toNumber()},n.bufferToHex=function(e){return"0x"+(e=n.toBuffer(e)).toString("hex")},n.fromSigned=function(e){return new h(e).fromTwos(256)},n.toUnsigned=function(e){return p.from(e.toTwos(256).toArray())},n.keccak=function(e,t){switch(e=n.toBuffer(e),t||(t=256),t){case 224:return i(e);case 256:return a(e);case 384:return o(e);case 512:return c(e);default:throw new Error("Invald algorithm: keccak"+t)}},n.keccak256=function(e){return n.keccak(e)},n.sha3=n.keccak,n.sha256=function(e){return e=n.toBuffer(e),f("sha256").update(e).digest()},n.ripemd160=function(e,t){e=n.toBuffer(e);var r=f("rmd160").update(e).digest();return!0===t?n.setLength(r,32):r},n.rlphash=function(e){return n.keccak(d.encode(e))},n.isValidPrivate=function(e){return u.privateKeyVerify(e)},n.isValidPublic=function(e,t){return 64===e.length?u.publicKeyVerify(p.concat([p.from([4]),e])):!!t&&u.publicKeyVerify(e)},n.pubToAddress=n.publicToAddress=function(e,t){return e=n.toBuffer(e),t&&64!==e.length&&(e=u.publicKeyConvert(e,!1).slice(1)),l(64===e.length),n.keccak(e).slice(-20)};var m=n.privateToPublic=function(e){return e=n.toBuffer(e),u.publicKeyCreate(e,!1).slice(1)};n.importPublic=function(e){return 64!==(e=n.toBuffer(e)).length&&(e=u.publicKeyConvert(e,!1).slice(1)),e},n.ecsign=function(e,t){var n=u.sign(e,t),r={};return r.r=n.signature.slice(0,32),r.s=n.signature.slice(32,64),r.v=n.recovery+27,r},n.hashPersonalMessage=function(e){var t=n.toBuffer("Ethereum Signed Message:\n"+e.length.toString());return n.keccak(p.concat([t,e]))},n.ecrecover=function(e,t,r,s){var i=p.concat([n.setLength(r,32),n.setLength(s,32)],64),o=t-27;if(0!==o&&1!==o)throw new Error("Invalid signature v value");var a=u.recover(e,i,o);return u.publicKeyConvert(a,!1).slice(1)},n.toRpcSig=function(e,t,r){if(27!==e&&28!==e)throw new Error("Invalid recovery id");return n.bufferToHex(p.concat([n.setLengthLeft(t,32),n.setLengthLeft(r,32),n.toBuffer(e-27)]))},n.fromRpcSig=function(e){if(65!==(e=n.toBuffer(e)).length)throw new Error("Invalid signature length");var t=e[64];return t<27&&(t+=27),{v:t,r:e.slice(0,32),s:e.slice(32,64)}},n.privateToAddress=function(e){return n.publicToAddress(m(e))},n.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},n.isZeroAddress=function(e){return n.zeroAddress()===n.addHexPrefix(e)},n.toChecksumAddress=function(e){e=n.stripHexPrefix(e).toLowerCase();for(var t=n.keccak(e).toString("hex"),r="0x",s=0;s<e.length;s++)parseInt(t[s],16)>=8?r+=e[s].toUpperCase():r+=e[s];return r},n.isValidChecksumAddress=function(e){return n.isValidAddress(e)&&n.toChecksumAddress(e)===e},n.generateAddress=function(e,t){return e=n.toBuffer(e),t=(t=new h(t)).isZero()?null:p.from(t.toArray()),n.rlphash([e,t]).slice(-20)},n.isPrecompiled=function(e){var t=n.unpad(e);return 1===t.length&&t[0]>=1&&t[0]<=8},n.addHexPrefix=function(e){return"string"!=typeof e||n.isHexPrefixed(e)?e:"0x"+e},n.isValidSignature=function(e,t,n,r){var s=new h("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),i=new h("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===t.length&&32===n.length&&((27===e||28===e)&&(t=new h(t),n=new h(n),!(t.isZero()||t.gt(i)||n.isZero()||n.gt(i))&&(!1!==r||1!==new h(n).cmp(s))))},n.baToJSON=function(e){if(p.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var t=[],r=0;r<e.length;r++)t.push(n.baToJSON(e[r]));return t}},n.defineProperties=function(e,t,s){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(t){var r={};return e._fields.forEach((function(t){r[t]="0x"+e[t].toString("hex")})),r}return n.baToJSON(this.raw)},e.serialize=function(){return d.encode(e.raw)},t.forEach((function(t,r){function s(){return e.raw[r]}function i(s){"00"!==(s=n.toBuffer(s)).toString("hex")||t.allowZero||(s=p.allocUnsafe(0)),t.allowLess&&t.length?(s=n.stripZeros(s),l(t.length>=s.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===s.length||!t.length||l(t.length===s.length,"The field "+t.name+" must have byte length of "+t.length),e.raw[r]=s}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:s,set:i}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:i,get:s})})),s)if("string"==typeof s&&(s=p.from(n.stripHexPrefix(s),"hex")),p.isBuffer(s)&&(s=d.decode(s)),Array.isArray(s)){if(s.length>e._fields.length)throw new Error("wrong number of fields in data");s.forEach((function(t,r){e[e._fields[r]]=n.toBuffer(t)}))}else{if("object"!==(void 0===s?"undefined":r(s)))throw new Error("invalid data");var i=Object.keys(s);t.forEach((function(t){-1!==i.indexOf(t.name)&&(e[t.name]=s[t.name]),-1!==i.indexOf(t.alias)&&(e[t.alias]=s[t.alias])}))}}}}},{package:"@metamask/eth-ledger-bridge-keyring>eth-sig-util>ethereumjs-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/eth-sig-util/node_modules/ethereumjs-util/dist/index.js"}],[1177,{"./secp256k1-lib/der":1178,"./secp256k1-lib/index":1179,buffer:1943,"ethereum-cryptography/secp256k1":1183},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(n){(function(){var r=e("ethereum-cryptography/secp256k1");function s(){return e("./secp256k1-lib/index")}var i=e("./secp256k1-lib/der"),o=function(e){return 32===e.length&&r.privateKeyVerify(Uint8Array.from(e))};t.exports={privateKeyVerify:o,privateKeyExport:function(e,t){var n=s();if(32!==e.length)throw new RangeError("private key length is invalid");var r=n.privateKeyExport(e,t);return i.privateKeyExport(e,r,t)},privateKeyImport:function(e){if(null!==(e=i.privateKeyImport(e))&&32===e.length&&o(e))return e;throw new Error("couldn't import from DER format")},privateKeyNegate:function(e){return n.from(r.privateKeyNegate(Uint8Array.from(e)))},privateKeyModInverse:function(e){if(32!==e.length)throw new Error("private key length is invalid");var t=s();return n.from(t.privateKeyModInverse(Uint8Array.from(e)))},privateKeyTweakAdd:function(e,t){return n.from(r.privateKeyTweakAdd(Uint8Array.from(e),t))},privateKeyTweakMul:function(e,t){return n.from(r.privateKeyTweakMul(Uint8Array.from(e),Uint8Array.from(t)))},publicKeyCreate:function(e,t){return n.from(r.publicKeyCreate(Uint8Array.from(e),t))},publicKeyConvert:function(e,t){return n.from(r.publicKeyConvert(Uint8Array.from(e),t))},publicKeyVerify:function(e){return(33===e.length||65===e.length)&&r.publicKeyVerify(Uint8Array.from(e))},publicKeyTweakAdd:function(e,t,s){return n.from(r.publicKeyTweakAdd(Uint8Array.from(e),Uint8Array.from(t),s))},publicKeyTweakMul:function(e,t,s){return n.from(r.publicKeyTweakMul(Uint8Array.from(e),Uint8Array.from(t),s))},publicKeyCombine:function(e,t){var s=[];return e.forEach((function(e){s.push(Uint8Array.from(e))})),n.from(r.publicKeyCombine(s,t))},signatureNormalize:function(e){return n.from(r.signatureNormalize(Uint8Array.from(e)))},signatureExport:function(e){return n.from(r.signatureExport(Uint8Array.from(e)))},signatureImport:function(e){return n.from(r.signatureImport(Uint8Array.from(e)))},signatureImportLax:function(e){if(0===e.length)throw new RangeError("signature length is invalid");var t=s(),n=i.signatureImportLax(e);if(null===n)throw new Error("couldn't parse DER signature");return t.signatureImport(n)},sign:function(e,t,s){if(null===s)throw new TypeError("options should be an Object");var i=void 0;if(s){if(i={},null===s.data)throw new TypeError("options.data should be a Buffer");if(s.data){if(32!==s.data.length)throw new RangeError("options.data length is invalid");i.data=new Uint8Array(s.data)}if(null===s.noncefn)throw new TypeError("options.noncefn should be a Function");s.noncefn&&(i.noncefn=function(e,t,r,i,o){var a=null!=r?n.from(r):null,c=null!=i?n.from(i):null,u=n.from("");return s.noncefn&&(u=s.noncefn(n.from(e),n.from(t),a,c,o)),Uint8Array.from(u)})}var o=r.ecdsaSign(Uint8Array.from(e),Uint8Array.from(t),i);return{signature:n.from(o.signature),recovery:o.recid}},verify:function(e,t,n){return r.ecdsaVerify(Uint8Array.from(t),Uint8Array.from(e),n)},recover:function(e,t,s,i){return n.from(r.ecdsaRecover(Uint8Array.from(t),s,Uint8Array.from(e),i))},ecdh:function(e,t){return n.from(r.ecdh(Uint8Array.from(e),Uint8Array.from(t),{}))},ecdhUnsafe:function(e,t,r){if(33!==e.length&&65!==e.length)throw new RangeError("public key length is invalid");if(32!==t.length)throw new RangeError("private key length is invalid");var i=s();return n.from(i.ecdhUnsafe(Uint8Array.from(e),Uint8Array.from(t),r))}}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>eth-sig-util>ethereumjs-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/eth-sig-util/node_modules/ethereumjs-util/dist/secp256k1-adapter.js"}],[1178,{buffer:1943},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(e){(function(){var t=e.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),r=e.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);n.privateKeyExport=function(n,s,i){var o=e.from(i?t:r);return n.copy(o,i?8:9),s.copy(o,i?181:214),o},n.privateKeyImport=function(e){var t=e.length,n=0;if(t<n+1||48!==e[n])return null;if(t<(n+=1)+1||!(128&e[n]))return null;var r=127&e[n];if(r<1||r>2)return null;if(t<(n+=1)+r)return null;var s=e[n+r-1]|(r>1?e[n+r-2]<<8:0);return t<(n+=r)+s||t<n+3||2!==e[n]||1!==e[n+1]||1!==e[n+2]||t<(n+=3)+2||4!==e[n]||e[n+1]>32||t<n+2+e[n+1]?null:e.slice(n+2,n+2+e[n+1])},n.signatureImportLax=function(t){var n=e.alloc(32,0),r=e.alloc(32,0),s=t.length,i=0;if(48!==t[i++])return null;var o=t[i++];if(128&o&&(i+=o-128)>s)return null;if(2!==t[i++])return null;var a=t[i++];if(128&a){if(i+(o=a-128)>s)return null;for(;o>0&&0===t[i];i+=1,o-=1);for(a=0;o>0;i+=1,o-=1)a=(a<<8)+t[i]}if(a>s-i)return null;var c=i;if(i+=a,2!==t[i++])return null;var u=t[i++];if(128&u){if(i+(o=u-128)>s)return null;for(;o>0&&0===t[i];i+=1,o-=1);for(u=0;o>0;i+=1,o-=1)u=(u<<8)+t[i]}if(u>s-i)return null;var l=i;for(i+=u;a>0&&0===t[c];a-=1,c+=1);if(a>32)return null;var d=t.slice(c,c+a);for(d.copy(n,32-d.length);u>0&&0===t[l];u-=1,l+=1);if(u>32)return null;var h=t.slice(l,l+u);return h.copy(r,32-h.length),{r:n,s:r}}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>eth-sig-util>ethereumjs-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/eth-sig-util/node_modules/ethereumjs-util/dist/secp256k1-lib/der.js"}],[1179,{"bn.js":1900,buffer:1943,elliptic:2095},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){var r=e("bn.js"),s=new(0,e("elliptic").ec)("secp256k1"),i=s.curve;n.privateKeyExport=function(e,t){var n=new r(e);if(n.ucmp(i.n)>=0)throw new Error("couldn't export to DER format");var a=s.g.mul(n);return o(a.getX(),a.getY(),t)},n.privateKeyModInverse=function(e){var n=new r(e);if(n.ucmp(i.n)>=0||n.isZero())throw new Error("private key range is invalid");return n.invm(i.n).toArrayLike(t,"be",32)},n.signatureImport=function(e){var n=new r(e.r);n.ucmp(i.n)>=0&&(n=new r(0));var s=new r(e.s);return s.ucmp(i.n)>=0&&(s=new r(0)),t.concat([n.toArrayLike(t,"be",32),s.toArrayLike(t,"be",32)])},n.ecdhUnsafe=function(e,t,n){var a=s.keyFromPublic(e),c=new r(t);if(c.ucmp(i.n)>=0||c.isZero())throw new Error("scalar was invalid (zero or overflow)");var u=a.pub.mul(c);return o(u.getX(),u.getY(),n)};var o=function(e,n,r){var s=void 0;return r?((s=t.alloc(33))[0]=n.isOdd()?3:2,e.toArrayLike(t,"be",32).copy(s,1)):((s=t.alloc(65))[0]=4,e.toArrayLike(t,"be",32).copy(s,1),n.toArrayLike(t,"be",32).copy(s,33)),s}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>eth-sig-util>ethereumjs-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/eth-sig-util/node_modules/ethereumjs-util/dist/secp256k1-lib/index.js"}],[118,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:36,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=36;const n=t.data;return t.data=function(e){const{PreferencesController:t}=e;if(t){const e=t.featureFlags||{};void 0!==e.privacyMode&&delete e.privacyMode}return e}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/036.js"}],[1180,{buffer:1943},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(e){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.createHashFunction=function(t){return function(n){var r=t();return r.update(n),e.from(r.digest())}}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>eth-sig-util>ethereumjs-util>ethereum-cryptography",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/ethereum-cryptography/hash-utils.js"}],[1181,{"./hash-utils":1180,keccak:2747},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var r=e("./hash-utils"),s=e("keccak");n.keccak224=r.createHashFunction((function(){return s("keccak224")})),n.keccak256=r.createHashFunction((function(){return s("keccak256")})),n.keccak384=r.createHashFunction((function(){return s("keccak384")})),n.keccak512=r.createHashFunction((function(){return s("keccak512")}))}}},{package:"@metamask/eth-ledger-bridge-keyring>eth-sig-util>ethereumjs-util>ethereum-cryptography",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/ethereum-cryptography/keccak.js"}],[1182,{randombytes:3073},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var r=e("randombytes");n.getRandomBytes=function(e){return new Promise((function(t,n){r(e,(function(e,r){e?n(e):t(r)}))}))},n.getRandomBytesSync=function(e){return r(e)}}}},{package:"@metamask/eth-ledger-bridge-keyring>eth-sig-util>ethereumjs-util>ethereum-cryptography",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/ethereum-cryptography/random.js"}],[1183,{"./random":1182,secp256k1:3219},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(s=2&i[0]?r.return:i[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;switch(r=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(n,"__esModule",{value:!0});var i=e("secp256k1"),o=e("./random");n.createPrivateKey=function(){return r(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return[4,o.getRandomBytes(32)];case 1:return e=t.sent(),i.privateKeyVerify(e)?[2,e]:[3,0];case 2:return[2]}}))}))},n.createPrivateKeySync=function(){for(;;){var e=o.getRandomBytesSync(32);if(i.privateKeyVerify(e))return e}},function(e){for(var t in e)n.hasOwnProperty(t)||(n[t]=e[t])}(e("secp256k1"))}}},{package:"@metamask/eth-ledger-bridge-keyring>eth-sig-util>ethereumjs-util>ethereum-cryptography",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/ethereum-cryptography/secp256k1.js"}],[1184,{buffer:1943,"is-hex-prefixed":2701,"strip-hex-prefix":3281},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(n){(function(){var r=e("is-hex-prefixed"),s=e("strip-hex-prefix");function i(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function o(e){return"0x"+e.toString(16)}t.exports={arrayContainsArray:function(e,t,n){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(n)?"some":"every"]((function(t){return e.indexOf(t)>=0}))},intToBuffer:function(e){var t=o(e);return new n(i(t.slice(2)),"hex")},getBinarySize:function(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return n.byteLength(e,"utf8")},isHexPrefixed:r,stripHexPrefix:s,padToEven:i,intToHex:o,fromAscii:function(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n).toString(16);t+=r.length<2?"0"+r:r}return"0x"+t},fromUtf8:function(e){return"0x"+i(new n(e,"utf8").toString("hex")).replace(/^0+|0+$/g,"")},toAscii:function(e){var t="",n=0,r=e.length;for("0x"===e.substring(0,2)&&(n=2);n<r;n+=2){var s=parseInt(e.substr(n,2),16);t+=String.fromCharCode(s)}return t},toUtf8:function(e){return new n(i(s(e).replace(/^0+|0+$/g,"")),"hex").toString("utf8")},getKeys:function(e,t,n){if(!Array.isArray(e))throw new Error("[ethjs-util] method getKeys expecting type Array as 'params' input, got '"+typeof e+"'");if("string"!=typeof t)throw new Error("[ethjs-util] method getKeys expecting type String for input 'key' got '"+typeof t+"'.");for(var r=[],s=0;s<e.length;s++){var i=e[s][t];if(n&&!i)i="";else if("string"!=typeof i)throw new Error("invalid abi");r.push(i)}return r},isHexString:function(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-ledger-bridge-keyring>eth-sig-util>ethereumjs-util>ethjs-util",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/ethjs-util/lib/index.js"}],[1185,{assert:1710,coinstring:1983,crypto:2066,"safe-buffer":3208,secp256k1:1186},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=e("assert"),s=e("safe-buffer").Buffer,i=e("crypto"),o=e("coinstring"),a=e("secp256k1"),c=s.from("Bitcoin seed","utf8"),u=2147483648,l={private:76066276,public:76067358};function d(e){this.versions=e||l,this.depth=0,this.index=0,this._privateKey=null,this._publicKey=null,this.chainCode=null,this._fingerprint=0,this.parentFingerprint=0}function h(e,t,n){var r=s.allocUnsafe(78);r.writeUInt32BE(t,0),r.writeUInt8(e.depth,4);var i=e.depth?e.parentFingerprint:0;return r.writeUInt32BE(i,5),r.writeUInt32BE(e.index,9),e.chainCode.copy(r,13),n.copy(r,45),r}function f(e){var t=i.createHash("sha256").update(e).digest();return i.createHash("rmd160").update(t).digest()}Object.defineProperty(d.prototype,"fingerprint",{get:function(){return this._fingerprint}}),Object.defineProperty(d.prototype,"identifier",{get:function(){return this._identifier}}),Object.defineProperty(d.prototype,"pubKeyHash",{get:function(){return this.identifier}}),Object.defineProperty(d.prototype,"privateKey",{get:function(){return this._privateKey},set:function(e){r.equal(e.length,32,"Private key must be 32 bytes."),r(!0===a.privateKeyVerify(e),"Invalid private key"),this._privateKey=e,this._publicKey=a.publicKeyCreate(e,!0),this._identifier=f(this.publicKey),this._fingerprint=this._identifier.slice(0,4).readUInt32BE(0)}}),Object.defineProperty(d.prototype,"publicKey",{get:function(){return this._publicKey},set:function(e){r(33===e.length||65===e.length,"Public key must be 33 or 65 bytes."),r(!0===a.publicKeyVerify(e),"Invalid public key"),this._publicKey=a.publicKeyConvert(e,!0),this._identifier=f(this.publicKey),this._fingerprint=this._identifier.slice(0,4).readUInt32BE(0),this._privateKey=null}}),Object.defineProperty(d.prototype,"privateExtendedKey",{get:function(){return this._privateKey?o.encode(h(this,this.versions.private,s.concat([s.alloc(1,0),this.privateKey]))):null}}),Object.defineProperty(d.prototype,"publicExtendedKey",{get:function(){return o.encode(h(this,this.versions.public,this.publicKey))}}),d.prototype.derive=function(e){if("m"===e||"M"===e||"m'"===e||"M'"===e)return this;var t=e.split("/"),n=this;return t.forEach((function(e,t){if(0!==t){var s=e.length>1&&"'"===e[e.length-1],i=parseInt(e,10);r(i<u,"Invalid index"),s&&(i+=u),n=n.deriveChild(i)}else r(e,"m","Invalid path")})),n},d.prototype.deriveChild=function(e){var t,n=e>=u,o=s.allocUnsafe(4);if(o.writeUInt32BE(e,0),n){r(this.privateKey,"Could not derive hardened child key");var c=this.privateKey,l=s.alloc(1,0);c=s.concat([l,c]),t=s.concat([c,o])}else t=s.concat([this.publicKey,o]);var h=i.createHmac("sha512",this.chainCode).update(t).digest(),f=h.slice(0,32),p=h.slice(32),m=new d(this.versions);if(this.privateKey)try{m.privateKey=a.privateKeyTweakAdd(this.privateKey,f)}catch(t){return this.derive(e+1)}else try{m.publicKey=a.publicKeyTweakAdd(this.publicKey,f,!0)}catch(t){return this.derive(e+1,n)}return m.chainCode=p,m.depth=this.depth+1,m.parentFingerprint=this.fingerprint,m.index=e,m},d.prototype.sign=function(e){return a.sign(e,this.privateKey).signature},d.prototype.verify=function(e,t){return a.verify(e,t,this.publicKey)},d.prototype.toJSON=function(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}},d.fromMasterSeed=function(e,t){var n=i.createHmac("sha512",c).update(e).digest(),r=n.slice(0,32),s=n.slice(32),o=new d(t);return o.chainCode=s,o.privateKey=r,o},d.fromExtendedKey=function(e,t){var n=new d(t=t||l),s=o.decode(e),i=s.readUInt32BE(0);r(i===t.private||i===t.public,"Version mismatch: does not match private or public"),n.depth=s.readUInt8(4),n.parentFingerprint=s.readUInt32BE(5),n.index=s.readUInt32BE(9),n.chainCode=s.slice(13,45);var a=s.slice(45);return 0===a.readUInt8(0)?(r(i===t.private,"Version mismatch: version does not match private"),n.privateKey=a.slice(1)):(r(i===t.public,"Version mismatch: version does not match public"),n.publicKey=a),n},d.fromJSON=function(e){return d.fromExtendedKey(e.xpriv)},d.HARDENED_OFFSET=u,t.exports=d}}},{package:"@metamask/eth-ledger-bridge-keyring>hdkey",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/hdkey/lib/hdkey.js"}],[1186,{"./lib":1190,"./lib/elliptic":1189},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){t.exports=e("./lib")(e("./lib/elliptic"))}}},{package:"@metamask/eth-ledger-bridge-keyring>hdkey>secp256k1",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/hdkey/node_modules/secp256k1/elliptic.js"}],[1187,{"../../../../../../../is-buffer/index.js":2697},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(e){(function(){var t=Object.prototype.toString;n.isArray=function(e,t){if(!Array.isArray(e))throw TypeError(t)},n.isBoolean=function(e,n){if("[object Boolean]"!==t.call(e))throw TypeError(n)},n.isBuffer=function(t,n){if(!e.isBuffer(t))throw TypeError(n)},n.isFunction=function(e,n){if("[object Function]"!==t.call(e))throw TypeError(n)},n.isNumber=function(e,n){if("[object Number]"!==t.call(e))throw TypeError(n)},n.isObject=function(e,n){if("[object Object]"!==t.call(e))throw TypeError(n)},n.isBufferLength=function(e,t,n){if(e.length!==t)throw RangeError(n)},n.isBufferLength2=function(e,t,n,r){if(e.length!==t&&e.length!==n)throw RangeError(r)},n.isLengthGTZero=function(e,t){if(0===e.length)throw RangeError(t)},n.isNumberInInterval=function(e,t,n,r){if(e<=t||e>=n)throw RangeError(r)}}).call(this)}).call(this,{isBuffer:e("../../../../../../../is-buffer/index.js")})}}},{package:"@metamask/eth-ledger-bridge-keyring>hdkey>secp256k1",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/hdkey/node_modules/secp256k1/lib/assert.js"}],[1188,{bip66:1854,"safe-buffer":3208},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=e("safe-buffer").Buffer,s=e("bip66"),i=r.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),o=r.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);n.privateKeyExport=function(e,t,n){var s=r.from(n?i:o);return e.copy(s,n?8:9),t.copy(s,n?181:214),s},n.privateKeyImport=function(e){var t=e.length,n=0;if(!(t<n+1||48!==e[n])&&!(t<(n+=1)+1)&&128&e[n]){var r=127&e[n];if(n+=1,!(r<1||r>2||t<n+r)){var s=e[n+r-1]|(r>1?e[n+r-2]<<8:0);if(!(t<(n+=r)+s||t<n+3||2!==e[n]||1!==e[n+1]||1!==e[n+2]||t<(n+=3)+2||4!==e[n]||e[n+1]>32||t<n+2+e[n+1]))return e.slice(n+2,n+2+e[n+1])}}},n.signatureExport=function(e){for(var t=r.concat([r.from([0]),e.r]),n=33,i=0;n>1&&0===t[i]&&!(128&t[i+1]);--n,++i);for(var o=r.concat([r.from([0]),e.s]),a=33,c=0;a>1&&0===o[c]&&!(128&o[c+1]);--a,++c);return s.encode(t.slice(i),o.slice(c))},n.signatureImport=function(e){var t=r.alloc(32,0),n=r.alloc(32,0);try{var i=s.decode(e);if(33===i.r.length&&0===i.r[0]&&(i.r=i.r.slice(1)),i.r.length>32)throw new Error("R length is too long");if(33===i.s.length&&0===i.s[0]&&(i.s=i.s.slice(1)),i.s.length>32)throw new Error("S length is too long")}catch(e){return}return i.r.copy(t,32-i.r.length),i.s.copy(n,32-i.s.length),{r:t,s:n}},n.signatureImportLax=function(e){var t=r.alloc(32,0),n=r.alloc(32,0),s=e.length,i=0;if(48===e[i++]){var o=e[i++];if(!(128&o&&(i+=o-128)>s)&&2===e[i++]){var a=e[i++];if(128&a){if(i+(o=a-128)>s)return;for(;o>0&&0===e[i];i+=1,o-=1);for(a=0;o>0;i+=1,o-=1)a=(a<<8)+e[i]}if(!(a>s-i)){var c=i;if(i+=a,2===e[i++]){var u=e[i++];if(128&u){if(i+(o=u-128)>s)return;for(;o>0&&0===e[i];i+=1,o-=1);for(u=0;o>0;i+=1,o-=1)u=(u<<8)+e[i]}if(!(u>s-i)){var l=i;for(i+=u;a>0&&0===e[c];a-=1,c+=1);if(!(a>32)){var d=e.slice(c,c+a);for(d.copy(t,32-d.length);u>0&&0===e[l];u-=1,l+=1);if(!(u>32)){var h=e.slice(l,l+u);return h.copy(n,32-h.length),{r:t,s:n}}}}}}}}}}}},{package:"@metamask/eth-ledger-bridge-keyring>hdkey>secp256k1",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/hdkey/node_modules/secp256k1/lib/der.js"}],[1189,{"../messages.json":1191,"bn.js":1900,"create-hash":2061,elliptic:2095,"safe-buffer":3208},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=e("safe-buffer").Buffer,s=e("create-hash"),i=e("bn.js"),o=e("elliptic").ec,a=e("../messages.json"),c=new o("secp256k1"),u=c.curve;function l(e){var t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){var n=new i(t);if(n.cmp(u.p)>=0)return null;var r=(n=n.toRed(u.red)).redSqr().redIMul(n).redIAdd(u.b).redSqrt();return 3===e!==r.isOdd()&&(r=r.redNeg()),c.keyPair({pub:{x:n,y:r}})}(t,e.slice(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,n){var r=new i(t),s=new i(n);if(r.cmp(u.p)>=0||s.cmp(u.p)>=0)return null;if(r=r.toRed(u.red),s=s.toRed(u.red),(6===e||7===e)&&s.isOdd()!==(7===e))return null;var o=r.redSqr().redIMul(r);return s.redSqr().redISub(o.redIAdd(u.b)).isZero()?c.keyPair({pub:{x:r,y:s}}):null}(t,e.slice(1,33),e.slice(33,65));default:return null}}n.privateKeyVerify=function(e){var t=new i(e);return t.cmp(u.n)<0&&!t.isZero()},n.privateKeyExport=function(e,t){var n=new i(e);if(n.cmp(u.n)>=0||n.isZero())throw new Error(a.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return r.from(c.keyFromPrivate(e).getPublic(t,!0))},n.privateKeyNegate=function(e){var t=new i(e);return t.isZero()?r.alloc(32):u.n.sub(t).umod(u.n).toArrayLike(r,"be",32)},n.privateKeyModInverse=function(e){var t=new i(e);if(t.cmp(u.n)>=0||t.isZero())throw new Error(a.EC_PRIVATE_KEY_RANGE_INVALID);return t.invm(u.n).toArrayLike(r,"be",32)},n.privateKeyTweakAdd=function(e,t){var n=new i(t);if(n.cmp(u.n)>=0)throw new Error(a.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);if(n.iadd(new i(e)),n.cmp(u.n)>=0&&n.isub(u.n),n.isZero())throw new Error(a.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return n.toArrayLike(r,"be",32)},n.privateKeyTweakMul=function(e,t){var n=new i(t);if(n.cmp(u.n)>=0||n.isZero())throw new Error(a.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);return n.imul(new i(e)),n.cmp(u.n)&&(n=n.umod(u.n)),n.toArrayLike(r,"be",32)},n.publicKeyCreate=function(e,t){var n=new i(e);if(n.cmp(u.n)>=0||n.isZero())throw new Error(a.EC_PUBLIC_KEY_CREATE_FAIL);return r.from(c.keyFromPrivate(e).getPublic(t,!0))},n.publicKeyConvert=function(e,t){var n=l(e);if(null===n)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);return r.from(n.getPublic(t,!0))},n.publicKeyVerify=function(e){return null!==l(e)},n.publicKeyTweakAdd=function(e,t,n){var s=l(e);if(null===s)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);if((t=new i(t)).cmp(u.n)>=0)throw new Error(a.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);var o=u.g.mul(t).add(s.pub);if(o.isInfinity())throw new Error(a.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return r.from(o.encode(!0,n))},n.publicKeyTweakMul=function(e,t,n){var s=l(e);if(null===s)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);if((t=new i(t)).cmp(u.n)>=0||t.isZero())throw new Error(a.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return r.from(s.pub.mul(t).encode(!0,n))},n.publicKeyCombine=function(e,t){for(var n=new Array(e.length),s=0;s<e.length;++s)if(n[s]=l(e[s]),null===n[s])throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);for(var i=n[0].pub,o=1;o<n.length;++o)i=i.add(n[o].pub);if(i.isInfinity())throw new Error(a.EC_PUBLIC_KEY_COMBINE_FAIL);return r.from(i.encode(!0,t))},n.signatureNormalize=function(e){var t=new i(e.slice(0,32)),n=new i(e.slice(32,64));if(t.cmp(u.n)>=0||n.cmp(u.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);var s=r.from(e);return 1===n.cmp(c.nh)&&u.n.sub(n).toArrayLike(r,"be",32).copy(s,32),s},n.signatureExport=function(e){var t=e.slice(0,32),n=e.slice(32,64);if(new i(t).cmp(u.n)>=0||new i(n).cmp(u.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);return{r:t,s:n}},n.signatureImport=function(e){var t=new i(e.r);t.cmp(u.n)>=0&&(t=new i(0));var n=new i(e.s);return n.cmp(u.n)>=0&&(n=new i(0)),r.concat([t.toArrayLike(r,"be",32),n.toArrayLike(r,"be",32)])},n.sign=function(e,t,n,s){if("function"==typeof n){var o=n;n=function(n){var c=o(e,t,null,s,n);if(!r.isBuffer(c)||32!==c.length)throw new Error(a.ECDSA_SIGN_FAIL);return new i(c)}}var l=new i(t);if(l.cmp(u.n)>=0||l.isZero())throw new Error(a.ECDSA_SIGN_FAIL);var d=c.sign(e,t,{canonical:!0,k:n,pers:s});return{signature:r.concat([d.r.toArrayLike(r,"be",32),d.s.toArrayLike(r,"be",32)]),recovery:d.recoveryParam}},n.verify=function(e,t,n){var r={r:t.slice(0,32),s:t.slice(32,64)},s=new i(r.r),o=new i(r.s);if(s.cmp(u.n)>=0||o.cmp(u.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);if(1===o.cmp(c.nh)||s.isZero()||o.isZero())return!1;var d=l(n);if(null===d)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);return c.verify(e,r,{x:d.pub.x,y:d.pub.y})},n.recover=function(e,t,n,s){var o={r:t.slice(0,32),s:t.slice(32,64)},l=new i(o.r),d=new i(o.s);if(l.cmp(u.n)>=0||d.cmp(u.n)>=0)throw new Error(a.ECDSA_SIGNATURE_PARSE_FAIL);try{if(l.isZero()||d.isZero())throw new Error;var h=c.recoverPubKey(e,o,n);return r.from(h.encode(!0,s))}catch(e){throw new Error(a.ECDSA_RECOVER_FAIL)}},n.ecdh=function(e,t){var r=n.ecdhUnsafe(e,t,!0);return s("sha256").update(r).digest()},n.ecdhUnsafe=function(e,t,n){var s=l(e);if(null===s)throw new Error(a.EC_PUBLIC_KEY_PARSE_FAIL);var o=new i(t);if(o.cmp(u.n)>=0||o.isZero())throw new Error(a.ECDH_FAIL);return r.from(s.pub.mul(o).encode(!0,n))}}}},{package:"@metamask/eth-ledger-bridge-keyring>hdkey>secp256k1",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/hdkey/node_modules/secp256k1/lib/elliptic/index.js"}],[119,{"@metamask/controller-utils":1084,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("@metamask/controller-utils");var i={version:37,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=37;const n=t.data;return t.data=function(e){if(e.AddressBookController){const t=e.AddressBookController.addressBook,n=new Set,r={};Object.values(t).forEach((e=>{n.add(e.chainId)}));for(const e of n.values()){r[e]={};for(const n in t)t[n].chainId===e&&(t[n].isEns=!1,(0,s.normalizeEnsName)(t[n].name)&&(t[n].isEns=!0),r[e][n]=t[n])}e.AddressBookController.addressBook=r}return e}(n),t}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/037.js"}],[1190,{"./assert":1187,"./der":1188,"./messages.json":1191},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=e("./assert"),s=e("./der"),i=e("./messages.json");function o(e,t){return e===undefined?t:(r.isBoolean(e,i.COMPRESSED_TYPE_INVALID),e)}t.exports=function(e){return{privateKeyVerify:function(t){return r.isBuffer(t,i.EC_PRIVATE_KEY_TYPE_INVALID),32===t.length&&e.privateKeyVerify(t)},privateKeyExport:function(t,n){r.isBuffer(t,i.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,i.EC_PRIVATE_KEY_LENGTH_INVALID),n=o(n,!0);var a=e.privateKeyExport(t,n);return s.privateKeyExport(t,a,n)},privateKeyImport:function(t){if(r.isBuffer(t,i.EC_PRIVATE_KEY_TYPE_INVALID),(t=s.privateKeyImport(t))&&32===t.length&&e.privateKeyVerify(t))return t;throw new Error(i.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyNegate:function(t){return r.isBuffer(t,i.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,i.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyNegate(t)},privateKeyModInverse:function(t){return r.isBuffer(t,i.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,i.EC_PRIVATE_KEY_LENGTH_INVALID),e.privateKeyModInverse(t)},privateKeyTweakAdd:function(t,n){return r.isBuffer(t,i.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,i.EC_PRIVATE_KEY_LENGTH_INVALID),r.isBuffer(n,i.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,i.TWEAK_LENGTH_INVALID),e.privateKeyTweakAdd(t,n)},privateKeyTweakMul:function(t,n){return r.isBuffer(t,i.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,i.EC_PRIVATE_KEY_LENGTH_INVALID),r.isBuffer(n,i.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,i.TWEAK_LENGTH_INVALID),e.privateKeyTweakMul(t,n)},publicKeyCreate:function(t,n){return r.isBuffer(t,i.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(t,32,i.EC_PRIVATE_KEY_LENGTH_INVALID),n=o(n,!0),e.publicKeyCreate(t,n)},publicKeyConvert:function(t,n){return r.isBuffer(t,i.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t,33,65,i.EC_PUBLIC_KEY_LENGTH_INVALID),n=o(n,!0),e.publicKeyConvert(t,n)},publicKeyVerify:function(t){return r.isBuffer(t,i.EC_PUBLIC_KEY_TYPE_INVALID),e.publicKeyVerify(t)},publicKeyTweakAdd:function(t,n,s){return r.isBuffer(t,i.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t,33,65,i.EC_PUBLIC_KEY_LENGTH_INVALID),r.isBuffer(n,i.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,i.TWEAK_LENGTH_INVALID),s=o(s,!0),e.publicKeyTweakAdd(t,n,s)},publicKeyTweakMul:function(t,n,s){return r.isBuffer(t,i.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t,33,65,i.EC_PUBLIC_KEY_LENGTH_INVALID),r.isBuffer(n,i.TWEAK_TYPE_INVALID),r.isBufferLength(n,32,i.TWEAK_LENGTH_INVALID),s=o(s,!0),e.publicKeyTweakMul(t,n,s)},publicKeyCombine:function(t,n){r.isArray(t,i.EC_PUBLIC_KEYS_TYPE_INVALID),r.isLengthGTZero(t,i.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var s=0;s<t.length;++s)r.isBuffer(t[s],i.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t[s],33,65,i.EC_PUBLIC_KEY_LENGTH_INVALID);return n=o(n,!0),e.publicKeyCombine(t,n)},signatureNormalize:function(t){return r.isBuffer(t,i.ECDSA_SIGNATURE_TYPE_INVALID),r.isBufferLength(t,64,i.ECDSA_SIGNATURE_LENGTH_INVALID),e.signatureNormalize(t)},signatureExport:function(t){r.isBuffer(t,i.ECDSA_SIGNATURE_TYPE_INVALID),r.isBufferLength(t,64,i.ECDSA_SIGNATURE_LENGTH_INVALID);var n=e.signatureExport(t);return s.signatureExport(n)},signatureImport:function(t){r.isBuffer(t,i.ECDSA_SIGNATURE_TYPE_INVALID),r.isLengthGTZero(t,i.ECDSA_SIGNATURE_LENGTH_INVALID);var n=s.signatureImport(t);if(n)return e.signatureImport(n);throw new Error(i.ECDSA_SIGNATURE_PARSE_DER_FAIL)},signatureImportLax:function(t){r.isBuffer(t,i.ECDSA_SIGNATURE_TYPE_INVALID),r.isLengthGTZero(t,i.ECDSA_SIGNATURE_LENGTH_INVALID);var n=s.signatureImportLax(t);if(n)return e.signatureImport(n);throw new Error(i.ECDSA_SIGNATURE_PARSE_DER_FAIL)},sign:function(t,n,s){r.isBuffer(t,i.MSG32_TYPE_INVALID),r.isBufferLength(t,32,i.MSG32_LENGTH_INVALID),r.isBuffer(n,i.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(n,32,i.EC_PRIVATE_KEY_LENGTH_INVALID);var o=null,a=null;return s!==undefined&&(r.isObject(s,i.OPTIONS_TYPE_INVALID),s.data!==undefined&&(r.isBuffer(s.data,i.OPTIONS_DATA_TYPE_INVALID),r.isBufferLength(s.data,32,i.OPTIONS_DATA_LENGTH_INVALID),o=s.data),s.noncefn!==undefined&&(r.isFunction(s.noncefn,i.OPTIONS_NONCEFN_TYPE_INVALID),a=s.noncefn)),e.sign(t,n,a,o)},verify:function(t,n,s){return r.isBuffer(t,i.MSG32_TYPE_INVALID),r.isBufferLength(t,32,i.MSG32_LENGTH_INVALID),r.isBuffer(n,i.ECDSA_SIGNATURE_TYPE_INVALID),r.isBufferLength(n,64,i.ECDSA_SIGNATURE_LENGTH_INVALID),r.isBuffer(s,i.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(s,33,65,i.EC_PUBLIC_KEY_LENGTH_INVALID),e.verify(t,n,s)},recover:function(t,n,s,a){return r.isBuffer(t,i.MSG32_TYPE_INVALID),r.isBufferLength(t,32,i.MSG32_LENGTH_INVALID),r.isBuffer(n,i.ECDSA_SIGNATURE_TYPE_INVALID),r.isBufferLength(n,64,i.ECDSA_SIGNATURE_LENGTH_INVALID),r.isNumber(s,i.RECOVERY_ID_TYPE_INVALID),r.isNumberInInterval(s,-1,4,i.RECOVERY_ID_VALUE_INVALID),a=o(a,!0),e.recover(t,n,s,a)},ecdh:function(t,n){return r.isBuffer(t,i.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t,33,65,i.EC_PUBLIC_KEY_LENGTH_INVALID),r.isBuffer(n,i.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(n,32,i.EC_PRIVATE_KEY_LENGTH_INVALID),e.ecdh(t,n)},ecdhUnsafe:function(t,n,s){return r.isBuffer(t,i.EC_PUBLIC_KEY_TYPE_INVALID),r.isBufferLength2(t,33,65,i.EC_PUBLIC_KEY_LENGTH_INVALID),r.isBuffer(n,i.EC_PRIVATE_KEY_TYPE_INVALID),r.isBufferLength(n,32,i.EC_PRIVATE_KEY_LENGTH_INVALID),s=o(s,!0),e.ecdhUnsafe(t,n,s)}}}}}},{package:"@metamask/eth-ledger-bridge-keyring>hdkey>secp256k1",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/hdkey/node_modules/secp256k1/lib/index.js"}],[1191,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){t.exports={COMPRESSED_TYPE_INVALID:"compressed should be a boolean",EC_PRIVATE_KEY_TYPE_INVALID:"private key should be a Buffer",EC_PRIVATE_KEY_LENGTH_INVALID:"private key length is invalid",EC_PRIVATE_KEY_RANGE_INVALID:"private key range is invalid",EC_PRIVATE_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting private key is invalid",EC_PRIVATE_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PRIVATE_KEY_EXPORT_DER_FAIL:"couldn't export to DER format",EC_PRIVATE_KEY_IMPORT_DER_FAIL:"couldn't import from DER format",EC_PUBLIC_KEYS_TYPE_INVALID:"public keys should be an Array",EC_PUBLIC_KEYS_LENGTH_INVALID:"public keys Array should have at least 1 element",EC_PUBLIC_KEY_TYPE_INVALID:"public key should be a Buffer",EC_PUBLIC_KEY_LENGTH_INVALID:"public key length is invalid",EC_PUBLIC_KEY_PARSE_FAIL:"the public key could not be parsed or is invalid",EC_PUBLIC_KEY_CREATE_FAIL:"private was invalid, try again",EC_PUBLIC_KEY_TWEAK_ADD_FAIL:"tweak out of range or resulting public key is invalid",EC_PUBLIC_KEY_TWEAK_MUL_FAIL:"tweak out of range",EC_PUBLIC_KEY_COMBINE_FAIL:"the sum of the public keys is not valid",ECDH_FAIL:"scalar was invalid (zero or overflow)",ECDSA_SIGNATURE_TYPE_INVALID:"signature should be a Buffer",ECDSA_SIGNATURE_LENGTH_INVALID:"signature length is invalid",ECDSA_SIGNATURE_PARSE_FAIL:"couldn't parse signature",ECDSA_SIGNATURE_PARSE_DER_FAIL:"couldn't parse DER signature",ECDSA_SIGNATURE_SERIALIZE_DER_FAIL:"couldn't serialize signature to DER format",ECDSA_SIGN_FAIL:"nonce generation function failed or private key is invalid",ECDSA_RECOVER_FAIL:"couldn't recover public key from signature",MSG32_TYPE_INVALID:"message should be a Buffer",MSG32_LENGTH_INVALID:"message length is invalid",OPTIONS_TYPE_INVALID:"options should be an Object",OPTIONS_DATA_TYPE_INVALID:"options.data should be a Buffer",OPTIONS_DATA_LENGTH_INVALID:"options.data length is invalid",OPTIONS_NONCEFN_TYPE_INVALID:"options.noncefn should be a Function",RECOVERY_ID_TYPE_INVALID:"recovery should be a Number",RECOVERY_ID_VALUE_INVALID:"recovery should have value between -1 and 4",TWEAK_TYPE_INVALID:"tweak should be a Buffer",TWEAK_LENGTH_INVALID:"tweak length is invalid"}}}},{package:"@metamask/eth-ledger-bridge-keyring>hdkey>secp256k1",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/hdkey/node_modules/secp256k1/lib/messages.json"}],[1192,{"./utils":1197,buffer:1943,tweetnacl:3338,"tweetnacl-util":3337},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),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 n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return s(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.getEncryptionPublicKey=n.decryptSafely=n.decrypt=n.encryptSafely=n.encrypt=void 0;const o=i(e("tweetnacl")),a=i(e("tweetnacl-util")),c=e("./utils");function u({publicKey:e,data:t,version:n}){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)(n))throw new Error("Missing version parameter");if("x25519-xsalsa20-poly1305"===n){if("string"!=typeof t)throw new Error("Message data must be given as a string");const n=o.box.keyPair();let r;try{r=a.decodeBase64(e)}catch(e){throw new Error("Bad public key")}const s=a.decodeUTF8(t),i=o.randomBytes(o.box.nonceLength),c=o.box(s,i,r,n.secretKey);return{version:"x25519-xsalsa20-poly1305",nonce:a.encodeBase64(i),ephemPublicKey:a.encodeBase64(n.publicKey),ciphertext:a.encodeBase64(c)}}throw new Error("Encryption type/version not supported")}function l({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");if("x25519-xsalsa20-poly1305"===e.version){const n=d(t),r=o.box.keyPair.fromSecretKey(n).secretKey,s=a.decodeBase64(e.nonce),i=a.decodeBase64(e.ciphertext),c=a.decodeBase64(e.ephemPublicKey),u=o.box.open(i,s,c,r);let l;try{l=a.encodeUTF8(u)}catch(e){throw new Error("Decryption failed.")}if(l)return l;throw new Error("Decryption failed.")}throw new Error("Encryption type/version not supported.")}function d(e){const n=t.from(e,"hex").toString("base64");return a.decodeBase64(n)}n.encrypt=u,n.encryptSafely=function({publicKey:e,data:n,version:r}){if((0,c.isNullish)(e))throw new Error("Missing publicKey parameter");if((0,c.isNullish)(n))throw new Error("Missing data parameter");if((0,c.isNullish)(r))throw new Error("Missing version parameter");if("object"==typeof n&&"toJSON"in n)throw new Error("Cannot encrypt with toJSON property.  Please remove toJSON property");const s={data:n,padding:""},i=t.byteLength(JSON.stringify(s),"utf-8")%2048;let o=0;return i>0&&(o=2048-i-16),s.padding="0".repeat(o),u({publicKey:e,data:JSON.stringify(s),version:r})},n.decrypt=l,n.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},n.getEncryptionPublicKey=function(e){const t=d(e),n=o.box.keyPair.fromSecretKey(t).publicKey;return a.encodeBase64(n)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-keyring-controller>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-sig-util/dist/encryption.js"}],[1193,{"./utils":1197,"@ethereumjs/util":374,"bn.js":1900,buffer:1943,"ethjs-util":1198},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.rawEncode=n.parseNumber=n.solidityPack=void 0;const s=e("@ethereumjs/util"),i=e("ethjs-util"),o=r(e("bn.js")),a=e("./utils");function c(e){return e.lastIndexOf("]")===e.length-1}function u(e){const t=e.match(/(.*)\[(.*?)\]$/u);return t?""===t[2]?"dynamic":parseInt(t[2],10):null}function l(e){return parseInt(/^\D+(\d+)$/u.exec(e)[1],10)}function d(e){const t=typeof e;if("string"===t)return(0,s.isHexPrefixed)(e)?new o.default((0,i.stripHexPrefix)(e),16):new o.default(e,10);if("number"===t)return new o.default(e);if(e.toArray)return e;throw new Error("Argument is not a number")}function h(e,n,r){let i,o;if(c(e)){const r=e.replace(/\[.*?\]/u,"");if(!c(r)){const t=u(e);if("dynamic"!==t&&0!==t&&n.length>t)throw new Error(`Elements exceed array size: ${t}`)}const s=n.map((function(e){return h(r,e,256)}));return t.concat(s)}if("bytes"===e)return n;if("string"===e)return t.from(n,"utf8");if("bool"===e){r=r||8;const e=Array(r/4).join("0");return t.from(n?`${e}1`:`${e}0`,"hex")}if("address"===e){let e=20;return r&&(e=r/8),(0,s.setLengthLeft)((0,s.toBuffer)(n),e)}if(e.startsWith("bytes")){if(i=l(e),i<1||i>32)throw new Error(`Invalid bytes<N> width: ${i}`);return"number"==typeof n&&(n=(0,a.normalize)(n)),(0,s.setLengthRight)((0,s.toBuffer)(n),i)}if(e.startsWith("uint")){if(i=l(e),i%8||i<8||i>256)throw new Error(`Invalid uint<N> width: ${i}`);if(o=d(n),o.bitLength()>i)throw new Error(`Supplied uint exceeds width: ${i} vs ${o.bitLength()}`);return r=r||i,o.toArrayLike(t,"be",r/8)}if(e.startsWith("int")){if(i=l(e),i%8||i<8||i>256)throw new Error(`Invalid int<N> width: ${i}`);if(o=d(n),o.bitLength()>i)throw new Error(`Supplied int exceeds width: ${i} vs ${o.bitLength()}`);return r=r||i,o.toTwos(i).toArrayLike(t,"be",r/8)}throw new Error(`Unsupported or invalid type: ${e}`)}function f(e){return e.startsWith("int[")?`int256${e.slice(3)}`:"int"===e?"int256":e.startsWith("uint[")?`uint256${e.slice(4)}`:"uint"===e?"uint256":e.startsWith("fixed[")?`fixed128x128${e.slice(5)}`:"fixed"===e?"fixed128x128":e.startsWith("ufixed[")?`ufixed128x128${e.slice(6)}`:"ufixed"===e?"ufixed128x128":e}function p(e,n){let r,i,h,f;if("address"===e)return p("uint160",d(n));if("bool"===e)return p("uint8",n?1:0);if("string"===e)return p("bytes",t.from(n,"utf8"));if(c(e)){if(void 0===n.length)throw new Error("Not an array?");if(r=u(e),"dynamic"!==r&&0!==r&&n.length>r)throw new Error(`Elements exceed array size: ${r}`);for(f in h=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof n&&(n=JSON.parse(n)),n)Object.prototype.hasOwnProperty.call(n,f)&&h.push(p(e,n[f]));if("dynamic"===r){const e=p("uint256",n.length);h.unshift(e)}return t.concat(h)}if("bytes"===e)return n=t.from(n),h=t.concat([p("uint256",n.length),n]),n.length%32!=0&&(h=t.concat([h,(0,s.zeros)(32-n.length%32)])),h;if(e.startsWith("bytes")){if(r=l(e),r<1||r>32)throw new Error(`Invalid bytes<N> width: ${r}`);return"number"==typeof n&&(n=(0,a.normalize)(n)),(0,s.setLengthRight)((0,s.toBuffer)(n),32)}if(e.startsWith("uint")){if(r=l(e),r%8||r<8||r>256)throw new Error(`Invalid uint<N> width: ${r}`);if(i=d(n),i.bitLength()>r)throw new Error(`Supplied uint exceeds width: ${r} vs ${i.bitLength()}`);if(i<0)throw new Error("Supplied uint is negative");return i.toArrayLike(t,"be",32)}if(e.startsWith("int")){if(r=l(e),r%8||r<8||r>256)throw new Error(`Invalid int<N> width: ${r}`);if(i=d(n),i.bitLength()>r)throw new Error(`Supplied int exceeds width: ${r} vs ${i.bitLength()}`);return i.toTwos(256).toArrayLike(t,"be",32)}if(e.startsWith("ufixed")){if(r=g(e),i=d(n),i<0)throw new Error("Supplied ufixed is negative");return p("uint256",i.mul(new o.default(2).pow(new o.default(r[1]))))}if(e.startsWith("fixed"))return r=g(e),p("int256",d(n).mul(new o.default(2).pow(new o.default(r[1]))));throw new Error(`Unsupported or invalid type: ${e}`)}function m(e){return"string"===e||"bytes"===e||"dynamic"===u(e)}function g(e){const t=/^\D+(\d+)x(\d+)$/u.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}n.solidityPack=function(e,n){if(e.length!==n.length)throw new Error("Number of types are not matching the values");const r=[];for(let t=0;t<e.length;t++){const s=f(e[t]),i=n[t];r.push(h(s,i,null))}return t.concat(r)},n.parseNumber=d,n.rawEncode=function(e,n){const r=[],s=[];let i=0;e.forEach((function(e){if(c(e)){const t=u(e);i+="dynamic"!==t?32*t:32}else i+=32}));for(let t=0;t<e.length;t++){const o=f(e[t]),a=p(o,n[t]);m(o)?(r.push(p("uint256",i)),s.push(a),i+=a.length):r.push(a)}return t.concat(r.concat(s))}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-keyring-controller>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-sig-util/dist/ethereumjs-abi-utils.js"}],[1194,{"./encryption":1192,"./personal-sign":1195,"./sign-typed-data":1196,"./utils":1197},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.normalize=n.concatSig=void 0,s(e("./personal-sign"),n),s(e("./sign-typed-data"),n),s(e("./encryption"),n);var i=e("./utils");Object.defineProperty(n,"concatSig",{enumerable:!0,get:function(){return i.concatSig}}),Object.defineProperty(n,"normalize",{enumerable:!0,get:function(){return i.normalize}})}}},{package:"@metamask/eth-keyring-controller>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-sig-util/dist/index.js"}],[1195,{"./utils":1197,"@ethereumjs/util":374},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.extractPublicKey=n.recoverPersonalSignature=n.personalSign=void 0;const r=e("@ethereumjs/util"),s=e("./utils");function i(e,t){const n=(0,r.hashPersonalMessage)((0,s.legacyToBuffer)(e));return(0,s.recoverPublicKey)(n,t)}n.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 n=(0,s.legacyToBuffer)(t),i=(0,r.hashPersonalMessage)(n),o=(0,r.ecsign)(i,e);return(0,s.concatSig)((0,r.toBuffer)(o.v),o.r,o.s)},n.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 n=i(e,t),o=(0,r.publicToAddress)(n);return(0,r.bufferToHex)(o)},n.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-keyring-controller>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-sig-util/dist/personal-sign.js"}],[1196,{"./ethereumjs-abi-utils":1193,"./utils":1197,"@ethereumjs/util":374,buffer:1943,"ethereum-cryptography/keccak":2194,"ethjs-util":1198},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.recoverTypedSignature=n.signTypedData=n.typedSignatureHash=n.TypedDataUtils=n.TYPED_MESSAGE_SCHEMA=n.SignTypedDataVersion=void 0;const r=e("ethjs-util"),s=e("@ethereumjs/util"),i=e("ethereum-cryptography/keccak"),o=e("./ethereumjs-abi-utils"),a=e("./utils");var c;function u(e,t){if(!Object.keys(c).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 l(e,n,h,f,p){if(u(p,[c.V3,c.V4]),e[h]!==undefined)return["bytes32",p===c.V4&&null==f?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,s.arrToBufArr)((0,i.keccak256)(d(h,f,e,p)))];if(f===undefined)throw new Error(`missing value for field ${n} of type ${h}`);if("bytes"===h){if("number"==typeof f)f=(0,a.numberToBuffer)(f);else if((0,r.isHexString)(f)){const e=f.length%2?"0":"";f=t.from(e+f.slice(2),"hex")}else f=t.from(f,"utf8");return["bytes32",(0,s.arrToBufArr)((0,i.keccak256)(f))]}if("string"===h)return f="number"==typeof f?(0,a.numberToBuffer)(f):t.from(null!=f?f:"","utf8"),["bytes32",(0,s.arrToBufArr)((0,i.keccak256)(f))];if(h.lastIndexOf("]")===h.length-1){if(p===c.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const t=h.slice(0,h.lastIndexOf("[")),r=f.map((r=>l(e,n,t,r,p)));return["bytes32",(0,s.arrToBufArr)((0,i.keccak256)((0,o.rawEncode)(r.map((([e])=>e)),r.map((([,e])=>e)))))]}return[h,f]}function d(e,t,n,r){u(r,[c.V3,c.V4]);const s=["bytes32"],i=[m(e,n)];for(const o of n[e]){if(r===c.V3&&t[o.name]===undefined)continue;const[e,a]=l(n,o.name,o.type,t[o.name],r);s.push(e),i.push(a)}return(0,o.rawEncode)(s,i)}function h(e,t){let n="";const r=f(e,t);r.delete(e);const s=[e,...Array.from(r).sort()];for(const e of s){if(!t[e])throw new Error(`No type definition specified: ${e}`);n+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`}return n}function f(e,t,n=new Set){if([e]=e.match(/^\w*/u),n.has(e)||t[e]===undefined)return n;n.add(e);for(const r of t[e])f(r.type,t,n);return n}function p(e,t,n,r){return u(r,[c.V3,c.V4]),(0,s.arrToBufArr)((0,i.keccak256)(d(e,t,n,r)))}function m(e,n){const r=t.from(h(e,n),"utf-8");return(0,s.arrToBufArr)((0,i.keccak256)(r))}function g(e){const t={};for(const r in n.TYPED_MESSAGE_SCHEMA.properties)e[r]&&(t[r]=e[r]);return"types"in t&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t}function y(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!("length"in e)||!e.length)throw t;const n=e.map((function(e){return"bytes"!==e.type?e.value:(0,a.legacyToBuffer)(e.value)})),r=e.map((function(e){return e.type})),c=e.map((function(e){if(!e.name)throw t;return`${e.type} ${e.name}`}));return(0,s.arrToBufArr)((0,i.keccak256)((0,o.solidityPack)(["bytes32","bytes32"],[(0,i.keccak256)((0,o.solidityPack)(new Array(e.length).fill("string"),c)),(0,i.keccak256)((0,o.solidityPack)(r,n))])))}!function(e){e.V1="V1",e.V3="V3",e.V4="V4"}(c=n.SignTypedDataVersion||(n.SignTypedDataVersion={})),n.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"]},n.TypedDataUtils={encodeData:d,encodeType:h,findTypeDependencies:f,hashStruct:p,hashType:m,sanitizeData:g,eip712Hash:function(e,n){u(n,[c.V3,c.V4]);const r=g(e),o=[t.from("1901","hex")];return o.push(p("EIP712Domain",r.domain,r.types,n)),"EIP712Domain"!==r.primaryType&&o.push(p(r.primaryType,r.message,r.types,n)),(0,s.arrToBufArr)((0,i.keccak256)(t.concat(o)))}},n.typedSignatureHash=function(e){const t=y(e);return(0,s.bufferToHex)(t)},n.signTypedData=function({privateKey:e,data:t,version:r}){if(u(r),(0,a.isNullish)(t))throw new Error("Missing data parameter");if((0,a.isNullish)(e))throw new Error("Missing private key parameter");const i=r===c.V1?y(t):n.TypedDataUtils.eip712Hash(t,r),o=(0,s.ecsign)(i,e);return(0,a.concatSig)((0,s.toBuffer)(o.v),o.r,o.s)},n.recoverTypedSignature=function({data:e,signature:t,version:r}){if(u(r),(0,a.isNullish)(e))throw new Error("Missing data parameter");if((0,a.isNullish)(t))throw new Error("Missing signature parameter");const i=r===c.V1?y(e):n.TypedDataUtils.eip712Hash(e,r),o=(0,a.recoverPublicKey)(i,t),l=(0,s.publicToAddress)(o);return(0,s.bufferToHex)(l)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-keyring-controller>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-sig-util/dist/sign-typed-data.js"}],[1197,{"@ethereumjs/util":374,buffer:1943,"ethjs-util":1198},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.numberToBuffer=n.normalize=n.recoverPublicKey=n.concatSig=n.legacyToBuffer=n.isNullish=n.padWithZeroes=void 0;const r=e("@ethereumjs/util"),s=e("ethjs-util");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")}n.padWithZeroes=i,n.isNullish=function(e){return null===e||e===undefined},n.legacyToBuffer=function(e){return"string"!=typeof e||(0,s.isHexString)(e)?(0,r.toBuffer)(e):t.from(e)},n.concatSig=function(e,t,n){const o=(0,r.fromSigned)(t),a=(0,r.fromSigned)(n),c=(0,r.bufferToInt)(e),u=i((0,r.toUnsigned)(o).toString("hex"),64),l=i((0,r.toUnsigned)(a).toString("hex"),64),d=(0,s.stripHexPrefix)((0,s.intToHex)(c));return(0,r.addHexPrefix)(u.concat(l,d))},n.recoverPublicKey=function(e,t){const n=(0,r.fromRpcSig)(t);return(0,r.ecrecover)(e,n.v,n.r,n.s)},n.normalize=function(e){if(!e)return undefined;if("number"==typeof e){if(e<0)return"0x";const t=(0,r.toBuffer)(e);e=(0,r.bufferToHex)(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,r.addHexPrefix)(e.toLowerCase())},n.numberToBuffer=function(e){const n=e.toString(16),r=n.length%2?"0":"";return t.from(r+n,"hex")}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-keyring-controller>@metamask/eth-sig-util",file:"node_modules/@metamask/eth-sig-util/dist/utils.js"}],[1198,{buffer:1943,"is-hex-prefixed":2701,"strip-hex-prefix":3281},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(n){(function(){var r=e("is-hex-prefixed"),s=e("strip-hex-prefix");function i(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof t+", while padToEven.");return t.length%2&&(t="0"+t),t}function o(e){return"0x"+e.toString(16)}t.exports={arrayContainsArray:function(e,t,n){if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof e+"'");if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof t+"'");return t[Boolean(n)?"some":"every"]((function(t){return e.indexOf(t)>=0}))},intToBuffer:function(e){var t=o(e);return new n(i(t.slice(2)),"hex")},getBinarySize:function(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof e+"'.");return n.byteLength(e,"utf8")},isHexPrefixed:r,stripHexPrefix:s,padToEven:i,intToHex:o,fromAscii:function(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n).toString(16);t+=r.length<2?"0"+r:r}return"0x"+t},fromUtf8:function(e){return"0x"+i(new n(e,"utf8").toString("hex")).replace(/^0+|0+$/g,"")},toAscii:function(e){var t="",n=0,r=e.length;for("0x"===e.substring(0,2)&&(n=2);n<r;n+=2){var s=parseInt(e.substr(n,2),16);t+=String.fromCharCode(s)}return t},toUtf8:function(e){return new n(i(s(e).replace(/^0+|0+$/g,"")),"hex").toString("utf8")},getKeys:function(e,t,n){if(!Array.isArray(e))throw new Error("[ethjs-util] method getKeys expecting type Array as 'params' input, got '"+typeof e+"'");if("string"!=typeof t)throw new Error("[ethjs-util] method getKeys expecting type String for input 'key' got '"+typeof t+"'.");for(var r=[],s=0;s<e.length;s++){var i=e[s][t];if(n&&!i)i="";else if("string"!=typeof i)throw new Error("invalid abi");r.push(i)}return r},isHexString:function(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-keyring-controller>@metamask/eth-sig-util>ethjs-util",file:"node_modules/@metamask/eth-sig-util/node_modules/ethjs-util/lib/index.js"}],[1199,{"@ethereumjs/util":374,"@metamask/eth-sig-util":1194,buffer:1943,"ethereum-cryptography/keccak":2194,events:1944,randombytes:3073},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(n){(function(){const{EventEmitter:r}=e("events"),{isValidPrivate:s,stripHexPrefix:i,privateToPublic:o,bufferToHex:a,publicToAddress:c,ecsign:u,arrToBufArr:l}=e("@ethereumjs/util"),d=e("randombytes"),{keccak256:h}=e("ethereum-cryptography/keccak"),f="Simple Key Pair",{concatSig:p,decrypt:m,getEncryptionPublicKey:g,normalize:y,personalSign:b,signTypedData:w,SignTypedDataVersion:v}=e("@metamask/eth-sig-util");function _(){const e=d(32);if(!s(e))throw new Error("Private key does not satisfy the curve requirements (ie. it is invalid)");return e}class E extends r{constructor(e){super(),this.type=f,this._wallets=[],this.deserialize(e)}async serialize(){return this._wallets.map((({privateKey:e})=>e.toString("hex")))}async deserialize(e=[]){this._wallets=e.map((e=>{const t=i(e),r=n.from(t,"hex");return{privateKey:r,publicKey:o(r)}}))}async addAccounts(e=1){const t=[];for(let n=0;n<e;n++){const e=_(),n=o(e);t.push({privateKey:e,publicKey:n})}this._wallets=this._wallets.concat(t);return t.map((({publicKey:e})=>a(c(e))))}async getAccounts(){return this._wallets.map((({publicKey:e})=>a(c(e))))}async signTransaction(e,t,n={}){const r=this._getPrivateKeyFor(e,n),s=t.sign(r);return s===undefined?t:s}async signMessage(e,t,r={}){const s=i(t),o=this._getPrivateKeyFor(e,r),a=u(n.from(s,"hex"),o);return p(a.v,a.r,a.s)}async signPersonalMessage(e,t,r={}){const s=this._getPrivateKeyFor(e,r),i=n.from(s,"hex");return b({privateKey:i,data:t})}async decryptMessage(e,t){const n=this._getWalletForAccount(e),{privateKey:r}=n;return m({privateKey:r,encryptedData:t})}async signTypedData(e,t,n={version:v.V1}){const r=Object.keys(v).includes(n.version)?n.version:v.V1,s=this._getPrivateKeyFor(e,n);return w({privateKey:s,data:t,version:r})}async getEncryptionPublicKey(e,t={}){const n=this._getPrivateKeyFor(e,t);return g(n)}_getPrivateKeyFor(e,t={}){if(!e)throw new Error("Must specify address.");return this._getWalletForAccount(e,t).privateKey}async getAppKeyAddress(e,t){if(!t||"string"!=typeof t)throw new Error("'origin' must be a non-empty string");const n=this._getWalletForAccount(e,{withAppKeyOrigin:t});return y(c(n.publicKey).toString("hex"))}async exportAccount(e,t={}){return this._getWalletForAccount(e,t).privateKey.toString("hex")}removeAccount(e){if(!this._wallets.map((({publicKey:e})=>a(c(e)).toLowerCase())).includes(e.toLowerCase()))throw new Error(`Address ${e} not found in this keyring`);this._wallets=this._wallets.filter((({publicKey:t})=>a(c(t)).toLowerCase()!==e.toLowerCase()))}_getWalletForAccount(e,t={}){const r=y(e);let s=this._wallets.find((({publicKey:e})=>a(c(e))===r));if(!s)throw new Error("Simple Keyring - Unable to find matching address.");if(t.withAppKeyOrigin){const{privateKey:e}=s,r=n.from(t.withAppKeyOrigin,"utf8"),i=n.concat([e,r]),a=l(h(i,256));s={privateKey:a,publicKey:o(a)}}return s}}E.type=f,t.exports=E}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-keyring-controller>@metamask/eth-simple-keyring",file:"node_modules/@metamask/eth-simple-keyring/index.js"}],[12,{"../../../../shared/constants/network":3409,"../../../../shared/modules/hexstring-utils":3435,"./ens":11,"@metamask/obs-store":1298,loglevel:2944,"punycode/punycode":3042},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=u(e("punycode/punycode")),s=e("@metamask/obs-store"),i=u(e("loglevel")),o=e("../../../../shared/constants/network"),a=e("../../../../shared/modules/hexstring-utils"),c=u(e("./ens"));function u(e){return e&&e.__esModule?e:{default:e}}n.default=class{constructor({ens:e,provider:t,onNetworkDidChange:n,getCurrentChainId:r}={}){const i={ensResolutionsByAddress:{}};if(this._ens=e,!this._ens){const e=r(),n=o.CHAIN_ID_TO_NETWORK_ID_MAP[e];c.default.getNetworkEnsSupport(n)&&(this._ens=new c.default({network:n,provider:t}))}this.store=new s.ObservableStore(i),this.resetState=()=>{this.store.updateState(i)},n((()=>{this.store.putState(i);const e=r(),n=o.CHAIN_ID_TO_NETWORK_ID_MAP[e];c.default.getNetworkEnsSupport(n)?this._ens=new c.default({network:n,provider:t}):delete this._ens}))}reverseResolveAddress(e){return this._reverseResolveAddress((0,a.toChecksumHexAddress)(e))}async _reverseResolveAddress(e){if(!this._ens)return undefined;const t=this.store.getState();if(t.ensResolutionsByAddress[e])return t.ensResolutionsByAddress[e];let n,s;try{n=await this._ens.reverse(e)}catch(e){return i.default.debug(e),undefined}try{s=await this._ens.lookup(n)}catch(e){return i.default.debug(e),undefined}return"0x0000000000000000000000000000000000000000"===s||"0x"===s||(0,a.toChecksumHexAddress)(s)!==e?undefined:(this._updateResolutionsByAddress(e,r.default.toASCII(n)),n)}_updateResolutionsByAddress(e,t){const n=this.store.getState();this.store.putState({ensResolutionsByAddress:{...n.ensResolutionsByAddress,[e]:t}})}}}}},{package:"$root$",file:"app/scripts/controllers/ens/index.js"}],[120,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:38,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=38;const n=t.data;return t.data=function(e){const{ABTestController:t={}}=e,{abTests:n={}}=t;if(n.fullScreenVsPopup)return e;return{...e,ABTestController:{...t,abTests:{...n,fullScreenVsPopup:"control"}}}}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/038.js"}],[121,{"../../../shared/modules/hexstring-utils":3435,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../../../shared/modules/hexstring-utils");const i="SAI";function o(e={}){return e&&"object"==typeof e&&"DAI"===e.symbol&&"0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359"===(0,s.toChecksumHexAddress)(e.address)}var a={version:39,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=39;const n=t.data;return t.data=function(e){const{PreferencesController:t}=e;if(t){const e=t.tokens||[];if(Array.isArray(e))for(const t of e)o(t)&&(t.symbol=i);const n=t.accountTokens||{};if(n&&"object"==typeof n)for(const e of Object.keys(n)){const t=n[e];if(t&&"object"==typeof t)for(const e of Object.keys(t)){const n=t[e];if(Array.isArray(n))for(const e of n)o(e)&&(e.symbol=i)}}}return e}(n),t}};n.default=a}}},{package:"$root$",file:"app/scripts/migrations/039.js"}],[122,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:40,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=40;const n=t.data;return t.data=function(e){return delete e.ProviderApprovalController,e}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/040.js"}],[1225,{"./determineGasFeeCalculations":1226,"./fetchGasEstimatesViaEthFeeHistory":1228,"./gas-util":1232,"@metamask/base-controller":1237,"@metamask/controller-utils":1239,"eth-query":2166,"ethereumjs-util":2231,uuid:3351},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.GasFeeController=n.GAS_ESTIMATE_TYPES=n.LEGACY_GAS_PRICES_API_URL=void 0;const i=s(e("eth-query")),o=e("uuid"),a=e("ethereumjs-util"),c=e("@metamask/base-controller"),u=e("@metamask/controller-utils"),l=e("./gas-util"),d=s(e("./determineGasFeeCalculations")),h=s(e("./fetchGasEstimatesViaEthFeeHistory"));n.LEGACY_GAS_PRICES_API_URL="https://api.metaswap.codefi.network/gasPrices",n.GAS_ESTIMATE_TYPES={FEE_MARKET:"fee-market",LEGACY:"legacy",ETH_GASPRICE:"eth_gasPrice",NONE:"none"};const f={gasFeeEstimates:{persist:!0,anonymous:!1},estimatedGasFeeTimeBounds:{persist:!0,anonymous:!1},gasEstimateType:{persist:!0,anonymous:!1}},p={gasFeeEstimates:{},estimatedGasFeeTimeBounds:{},gasEstimateType:n.GAS_ESTIMATE_TYPES.NONE};class m extends c.BaseControllerV2{constructor({interval:e=15e3,messenger:t,state:s,getCurrentNetworkEIP1559Compatibility:o,getCurrentAccountEIP1559Compatibility:a,getChainId:c,getCurrentNetworkLegacyGasAPICompatibility:u,getProvider:l,onNetworkStateChange:d,legacyAPIEndpoint:h=n.LEGACY_GAS_PRICES_API_URL,EIP1559APIEndpoint:m="https://mock-gas-server.herokuapp.com/",clientId:g}){if(super({name:"GasFeeController",metadata:f,messenger:t,state:Object.assign(Object.assign({},p),s)}),this.intervalDelay=e,this.pollTokens=new Set,this.getCurrentNetworkEIP1559Compatibility=o,this.getCurrentNetworkLegacyGasAPICompatibility=u,this.getCurrentAccountEIP1559Compatibility=a,this.EIP1559APIEndpoint=m,this.legacyAPIEndpoint=h,this.clientId=g,d&&c){const e=l();this.ethQuery=new i.default(e),this.currentChainId=c(),d((()=>r(this,void 0,void 0,(function*(){const e=l(),t=c();this.ethQuery=new i.default(e),this.currentChainId!==t&&(this.currentChainId=t,yield this.resetPolling())}))))}else{const e=this.messagingSystem.call("NetworkController:getProviderConfig");this.currentChainId=e.chainId,this.ethQuery=this.messagingSystem.call("NetworkController:getEthQuery"),this.messagingSystem.subscribe("NetworkController:providerChange",(e=>r(this,void 0,void 0,(function*(){this.ethQuery=this.messagingSystem.call("NetworkController:getEthQuery"),this.currentChainId!==e.chainId&&(this.currentChainId=e.chainId,yield this.resetPolling())}))))}}resetPolling(){return r(this,void 0,void 0,(function*(){if(0!==this.pollTokens.size){const e=Array.from(this.pollTokens);this.stopPolling(),yield this.getGasFeeEstimatesAndStartPolling(e[0]),e.slice(1).forEach((e=>{this.pollTokens.add(e)}))}}))}fetchGasFeeEstimates(e){return r(this,void 0,void 0,(function*(){return yield this._fetchGasFeeEstimateData(e)}))}getGasFeeEstimatesAndStartPolling(e){return r(this,void 0,void 0,(function*(){const t=e||(0,o.v1)();return this.pollTokens.add(t),1===this.pollTokens.size&&(yield this._fetchGasFeeEstimateData(),this._poll()),t}))}_fetchGasFeeEstimateData(e={}){return r(this,void 0,void 0,(function*(){const{shouldUpdateState:t=!0}=e;let n;const r=this.getCurrentNetworkLegacyGasAPICompatibility();let s;s="string"==typeof this.currentChainId?(0,a.isHexString)(this.currentChainId)?parseInt(this.currentChainId,16):parseInt(this.currentChainId,10):this.currentChainId;try{n=yield this.getEIP1559Compatibility()}catch(e){console.error(e),n=!1}const i=yield(0,d.default)({isEIP1559Compatible:n,isLegacyGasAPICompatible:r,fetchGasEstimates:l.fetchGasEstimates,fetchGasEstimatesUrl:this.EIP1559APIEndpoint.replace("<chain_id>",`${s}`),fetchGasEstimatesViaEthFeeHistory:h.default,fetchLegacyGasPriceEstimates:l.fetchLegacyGasPriceEstimates,fetchLegacyGasPriceEstimatesUrl:this.legacyAPIEndpoint.replace("<chain_id>",`${s}`),fetchEthGasPriceEstimate:l.fetchEthGasPriceEstimate,calculateTimeEstimate:l.calculateTimeEstimate,clientId:this.clientId,ethQuery:this.ethQuery});return t&&this.update((e=>{e.gasFeeEstimates=i.gasFeeEstimates,e.estimatedGasFeeTimeBounds=i.estimatedGasFeeTimeBounds,e.gasEstimateType=i.gasEstimateType})),i}))}disconnectPoller(e){this.pollTokens.delete(e),0===this.pollTokens.size&&this.stopPolling()}stopPolling(){this.intervalId&&clearInterval(this.intervalId),this.pollTokens.clear(),this.resetState()}destroy(){super.destroy(),this.stopPolling()}_poll(){this.intervalId&&clearInterval(this.intervalId),this.intervalId=setInterval((()=>r(this,void 0,void 0,(function*(){yield(0,u.safelyExecute)((()=>this._fetchGasFeeEstimateData()))}))),this.intervalDelay)}resetState(){this.update((()=>p))}getEIP1559Compatibility(){var e,t;return r(this,void 0,void 0,(function*(){const n=yield this.getCurrentNetworkEIP1559Compatibility(),r=null===(t=null===(e=this.getCurrentAccountEIP1559Compatibility)||void 0===e?void 0:e.call(this))||void 0===t||t;return n&&r}))}getTimeEstimate(e,t){return this.state.gasFeeEstimates&&this.state.gasEstimateType===n.GAS_ESTIMATE_TYPES.FEE_MARKET?(0,l.calculateTimeEstimate)(e,t,this.state.gasFeeEstimates):{}}}n.GasFeeController=m,n.default=m}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/GasFeeController.js"}],[1226,{"./GasFeeController":1225},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(n,"__esModule",{value:!0});const s=e("./GasFeeController");n.default=function({isEIP1559Compatible:e,isLegacyGasAPICompatible:t,fetchGasEstimates:n,fetchGasEstimatesUrl:i,fetchGasEstimatesViaEthFeeHistory:o,fetchLegacyGasPriceEstimates:a,fetchLegacyGasPriceEstimatesUrl:c,fetchEthGasPriceEstimate:u,calculateTimeEstimate:l,clientId:d,ethQuery:h}){return r(this,void 0,void 0,(function*(){try{if(e){let e;try{e=yield n(i,d)}catch(t){e=yield o(h)}const{suggestedMaxPriorityFeePerGas:t,suggestedMaxFeePerGas:r}=e.medium;return{gasFeeEstimates:e,estimatedGasFeeTimeBounds:l(t,r,e),gasEstimateType:s.GAS_ESTIMATE_TYPES.FEE_MARKET}}if(t){return{gasFeeEstimates:yield a(c,d),estimatedGasFeeTimeBounds:{},gasEstimateType:s.GAS_ESTIMATE_TYPES.LEGACY}}throw new Error("Main gas fee/price estimation failed. Use fallback")}catch(e){try{return{gasFeeEstimates:yield u(h),estimatedGasFeeTimeBounds:{},gasEstimateType:s.GAS_ESTIMATE_TYPES.ETH_GASPRICE}}catch(e){if(e instanceof Error)throw new Error(`Gas fee/price estimation failed. Message: ${e.message}`);throw e}}}))}}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/determineGasFeeCalculations.js"}],[1227,{"@metamask/controller-utils":1239,"ethereumjs-util":2231},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(n,"__esModule",{value:!0});const s=e("ethereumjs-util"),i=e("@metamask/controller-utils"),o=1024;function a({ethQuery:e,numberOfBlocks:t,endBlockNumber:n,percentiles:s,includeNextBlock:o}){var a;return r(this,void 0,void 0,(function*(){const r=yield(0,i.query)(e,"eth_feeHistory",[(0,i.toHex)(t),(0,i.toHex)(n),s]),c=(0,i.fromHex)(r.oldestBlock);if(r.baseFeePerGas!==undefined&&r.baseFeePerGas.length>0&&r.gasUsedRatio.length>0&&(r.reward===undefined||r.reward.length>0)){const e=o?r.baseFeePerGas:r.baseFeePerGas.slice(0,t),n=r.gasUsedRatio,u=null!==(a=r.reward)&&void 0!==a?a:[],l=n.length;return e.map(((e,t)=>{const r=(0,i.fromHex)(e),o=c.addn(t);return t>=l?function({baseFeePerGas:e,number:t}){return{number:t,baseFeePerGas:e,gasUsedRatio:null,priorityFeesByPercentile:null}}({baseFeePerGas:r,number:o}):function({baseFeePerGas:e,number:t,blockIndex:n,gasUsedRatios:r,priorityFeePercentileGroups:s,percentiles:o}){const a=r[n],c=s[n];return{number:t,baseFeePerGas:e,gasUsedRatio:a,priorityFeesByPercentile:o.reduce(((e,t,n)=>{const r=c[n];return Object.assign(Object.assign({},e),{[t]:(0,i.fromHex)(r)})}),{})}}({baseFeePerGas:r,number:o,blockIndex:t,gasUsedRatios:n,priorityFeePercentileGroups:u,percentiles:s})}))}return[]}))}n.default=function({ethQuery:e,numberOfBlocks:t,endBlock:n="latest",percentiles:c=[],includeNextBlock:u=!1}){return r(this,void 0,void 0,(function*(){const r=c.length>0?Array.from(new Set(c)).sort(((e,t)=>e-t)):[],l=function(e,t){e.lt(new s.BN(t))&&(t=e.toNumber());const n=[];for(let r=e.subn(t);r.lt(e);r=r.addn(o)){const t=e.sub(r).toNumber(),s=t<o?t:o,i=r.addn(s);n.push({numberOfBlocks:s,endBlockNumber:i})}return n}("latest"===n?(0,i.fromHex)(yield(0,i.query)(e,"blockNumber")):n,t);return(yield Promise.all(l.map((({numberOfBlocks:t,endBlockNumber:n},s)=>s===l.length-1?a({ethQuery:e,numberOfBlocks:t,endBlockNumber:n,percentiles:r,includeNextBlock:u}):a({ethQuery:e,numberOfBlocks:t,endBlockNumber:n,percentiles:r,includeNextBlock:!1}))))).reduce(((e,t)=>[...e,...t]),[])}))}}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/fetchBlockFeeHistory.js"}],[1228,{"./fetchBlockFeeHistory":1227,"./fetchGasEstimatesViaEthFeeHistory/calculateGasFeeEstimatesForPriorityLevels":1229,"./fetchGasEstimatesViaEthFeeHistory/fetchLatestBlock":1230,"@metamask/controller-utils":1239,"ethjs-unit":2277},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});const i=e("ethjs-unit"),o=e("@metamask/controller-utils"),a=s(e("./fetchBlockFeeHistory")),c=s(e("./fetchGasEstimatesViaEthFeeHistory/fetchLatestBlock")),u=s(e("./fetchGasEstimatesViaEthFeeHistory/calculateGasFeeEstimatesForPriorityLevels"));n.default=function(e){return r(this,void 0,void 0,(function*(){const t=yield(0,c.default)(e),n=yield(0,a.default)({ethQuery:e,endBlock:t.number,numberOfBlocks:5,percentiles:[10,20,30]}),r=(0,i.fromWei)(t.baseFeePerGas,o.GWEI),s=(0,u.default)(n);return Object.assign(Object.assign({},s),{estimatedBaseFee:r,historicalBaseFeeRange:null,baseFeeTrend:null,latestPriorityFeeRange:null,historicalPriorityFeeRange:null,priorityFeeTrend:null,networkCongestion:null})}))}}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/fetchGasEstimatesViaEthFeeHistory.js"}],[1229,{"./medianOf":1231,"@metamask/controller-utils":1239,"ethereumjs-util":2231,"ethjs-unit":2277},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});const s=e("ethereumjs-util"),i=e("ethjs-unit"),o=e("@metamask/controller-utils"),a=r(e("./medianOf")),c=["low","medium","high"],u={low:{percentile:10,baseFeePercentageMultiplier:new s.BN(110),priorityFeePercentageMultiplier:new s.BN(94),minSuggestedMaxPriorityFeePerGas:new s.BN(1e9),estimatedWaitTimes:{minWaitTimeEstimate:15e3,maxWaitTimeEstimate:3e4}},medium:{percentile:20,baseFeePercentageMultiplier:new s.BN(120),priorityFeePercentageMultiplier:new s.BN(97),minSuggestedMaxPriorityFeePerGas:new s.BN(15e8),estimatedWaitTimes:{minWaitTimeEstimate:15e3,maxWaitTimeEstimate:45e3}},high:{percentile:30,baseFeePercentageMultiplier:new s.BN(125),priorityFeePercentageMultiplier:new s.BN(98),minSuggestedMaxPriorityFeePerGas:new s.BN(2e9),estimatedWaitTimes:{minWaitTimeEstimate:15e3,maxWaitTimeEstimate:6e4}}};n.default=function(e){return c.reduce(((t,n)=>{const r=function(e,t){const n=u[e],r=t[t.length-1].baseFeePerGas.mul(n.baseFeePercentageMultiplier).divn(100),c=t.map((e=>"priorityFeesByPercentile"in e?e.priorityFeesByPercentile[n.percentile]:null)).filter(s.BN.isBN),l=(0,a.default)(c).mul(n.priorityFeePercentageMultiplier).divn(100),d=s.BN.max(l,n.minSuggestedMaxPriorityFeePerGas),h=r.add(d);return Object.assign(Object.assign({},n.estimatedWaitTimes),{suggestedMaxPriorityFeePerGas:(0,i.fromWei)(d,o.GWEI),suggestedMaxFeePerGas:(0,i.fromWei)(h,o.GWEI)})}(n,e);return Object.assign(Object.assign({},t),{[n]:r})}),{})}}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/fetchGasEstimatesViaEthFeeHistory/calculateGasFeeEstimatesForPriorityLevels.js"}],[123,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:41,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=41;const n=t.data;return t.data=function(e){e.PreferencesController&&e.PreferencesController.preferences&&(e.PreferencesController.preferences.autoLockTimeLimit=e.PreferencesController.preferences.autoLogoutTimeLimit,delete e.PreferencesController.preferences.autoLogoutTimeLimit);return e}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/041.js"}],[1230,{"@metamask/controller-utils":1239},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(n,"__esModule",{value:!0});const s=e("@metamask/controller-utils");n.default=function(e,t=!1){return r(this,void 0,void 0,(function*(){const n=yield(0,s.query)(e,"blockNumber"),r=yield(0,s.query)(e,"getBlockByNumber",[n,t]);return Object.assign(Object.assign({},r),{number:(0,s.fromHex)(r.number),baseFeePerGas:(0,s.fromHex)(r.baseFeePerGas)})}))}}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/fetchGasEstimatesViaEthFeeHistory/fetchLatestBlock.js"}],[1231,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){const t=e.slice().sort(((e,t)=>e.cmp(t))),n=t.length;return t[Math.floor((n-1)/2)]}}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/fetchGasEstimatesViaEthFeeHistory/medianOf.js"}],[1232,{"@metamask/controller-utils":1239,"ethereumjs-util":2231},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(n,"__esModule",{value:!0}),n.calculateTimeEstimate=n.fetchEthGasPriceEstimate=n.fetchLegacyGasPriceEstimates=n.fetchGasEstimates=n.normalizeGWEIDecimalNumbers=void 0;const s=e("ethereumjs-util"),i=e("@metamask/controller-utils"),o=e=>({"X-Client-Id":e});function a(e){const t=(0,i.gweiDecToWEIBN)(e).toString(16);return(0,i.weiHexToGweiDec)(t).toString(10)}n.normalizeGWEIDecimalNumbers=a,n.fetchGasEstimates=function(e,t){return r(this,void 0,void 0,(function*(){const n=yield(0,i.handleFetch)(e,t?{headers:o(t)}:undefined);return{low:Object.assign(Object.assign({},n.low),{suggestedMaxPriorityFeePerGas:a(n.low.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:a(n.low.suggestedMaxFeePerGas)}),medium:Object.assign(Object.assign({},n.medium),{suggestedMaxPriorityFeePerGas:a(n.medium.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:a(n.medium.suggestedMaxFeePerGas)}),high:Object.assign(Object.assign({},n.high),{suggestedMaxPriorityFeePerGas:a(n.high.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:a(n.high.suggestedMaxFeePerGas)}),estimatedBaseFee:a(n.estimatedBaseFee),historicalBaseFeeRange:n.historicalBaseFeeRange,baseFeeTrend:n.baseFeeTrend,latestPriorityFeeRange:n.latestPriorityFeeRange,historicalPriorityFeeRange:n.historicalPriorityFeeRange,priorityFeeTrend:n.priorityFeeTrend,networkCongestion:n.networkCongestion}}))},n.fetchLegacyGasPriceEstimates=function(e,t){return r(this,void 0,void 0,(function*(){const n=yield(0,i.handleFetch)(e,{referrer:e,referrerPolicy:"no-referrer-when-downgrade",method:"GET",mode:"cors",headers:Object.assign({"Content-Type":"application/json"},t&&o(t))});return{low:n.SafeGasPrice,medium:n.ProposeGasPrice,high:n.FastGasPrice}}))},n.fetchEthGasPriceEstimate=function(e){return r(this,void 0,void 0,(function*(){const t=yield(0,i.query)(e,"gasPrice");return{gasPrice:(0,i.weiHexToGweiDec)(t).toString()}}))},n.calculateTimeEstimate=function(e,t,n){const{low:r,medium:o,high:a,estimatedBaseFee:c}=n,u=(0,i.gweiDecToWEIBN)(e),l=(0,i.gweiDecToWEIBN)(t),d=(0,i.gweiDecToWEIBN)(c),h=s.BN.min(u,l.sub(d)),f=(0,i.gweiDecToWEIBN)(r.suggestedMaxPriorityFeePerGas),p=(0,i.gweiDecToWEIBN)(o.suggestedMaxPriorityFeePerGas),m=(0,i.gweiDecToWEIBN)(a.suggestedMaxPriorityFeePerGas);let g,y;return h.lt(f)?(g=null,y="unknown"):h.gte(f)&&h.lt(p)?(g=r.minWaitTimeEstimate,y=r.maxWaitTimeEstimate):h.gte(p)&&h.lt(m)?(g=o.minWaitTimeEstimate,y=o.maxWaitTimeEstimate):h.eq(m)?(g=a.minWaitTimeEstimate,y=a.maxWaitTimeEstimate):(g=0,y=a.maxWaitTimeEstimate),{lowerTimeBound:g,upperTimeBound:y}}}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/gas-util.js"}],[1233,{"./GasFeeController":1225},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./GasFeeController"),n)}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/index.js"}],[1234,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BaseController=void 0;class r{constructor(e={},t={}){this.defaultConfig={},this.defaultState={},this.disabled=!1,this.name="BaseController",this.internalConfig=this.defaultConfig,this.internalState=this.defaultState,this.internalListeners=[],this.initialState=t,this.initialConfig=e}initialize(){return this.internalState=this.defaultState,this.internalConfig=this.defaultConfig,this.configure(this.initialConfig),this.update(this.initialState),this}get config(){return this.internalConfig}get state(){return this.internalState}configure(e,t=!1,n=!0){if(n){this.internalConfig=t?e:Object.assign(this.internalConfig,e);for(const e in this.internalConfig)void 0!==this.internalConfig[e]&&(this[e]=this.internalConfig[e])}else for(const t in e)void 0!==this.internalConfig[t]&&(this.internalConfig[t]=e[t],this[t]=e[t])}notify(){this.disabled||this.internalListeners.forEach((e=>{e(this.internalState)}))}subscribe(e){this.internalListeners.push(e)}unsubscribe(e){const t=this.internalListeners.findIndex((t=>e===t));return t>-1&&this.internalListeners.splice(t,1),t>-1}update(e,t=!1){this.internalState=t?Object.assign({},e):Object.assign({},this.internalState,e),this.notify()}}n.BaseController=r,n.default=r}}},{package:"@metamask/gas-fee-controller>@metamask/base-controller",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/base-controller/dist/BaseController.js"}],[1235,{immer:2694},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseController=void 0;const r=e("immer");(0,r.enablePatches)();function s(e,t,n){return Object.keys(e).reduce(((r,s)=>{const i=t[s][n],o=e[s];return"function"==typeof i?r[s]=i(o):i&&(r[s]=o),r}),{})}n.BaseController=class{constructor({messenger:e,metadata:t,name:n,state:r}){this.messagingSystem=e,this.name=n,this.internalState=r,this.metadata=t,this.messagingSystem.registerActionHandler(`${n}:getState`,(()=>this.state))}get state(){return this.internalState}set state(e){throw new Error("Controller state cannot be directly mutated; use 'update' method instead.")}update(e){const[t,n]=r.produceWithPatches(this.internalState,e);this.internalState=t,this.messagingSystem.publish(`${this.name}:stateChange`,t,n)}destroy(){this.messagingSystem.clearEventSubscriptions(`${this.name}:stateChange`)}},n.getAnonymizedState=function(e,t){return s(e,t,"anonymous")},n.getPersistentState=function(e,t){return s(e,t,"persist")}}}},{package:"@metamask/gas-fee-controller>@metamask/base-controller",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/base-controller/dist/BaseControllerV2.js"}],[1236,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ControllerMessenger=n.RestrictedControllerMessenger=void 0;class r{constructor({controllerMessenger:e,name:t,allowedActions:n,allowedEvents:r}){this.controllerMessenger=e,this.controllerName=t,this.allowedActions=n||null,this.allowedEvents=r||null}registerActionHandler(e,t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed registering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.registerActionHandler(e,t)}unregisterActionHandler(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed unregistering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.unregisterActionHandler(e)}call(e,...t){if(null===this.allowedActions)throw new Error("No actions allowed");if(!this.allowedActions.includes(e))throw new Error(`Action missing from allow list: ${e}`);return this.controllerMessenger.call(e,...t)}publish(e,...t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed publishing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.publish(e,...t)}subscribe(e,t,n){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);return n?this.controllerMessenger.subscribe(e,t,n):this.controllerMessenger.subscribe(e,t)}unsubscribe(e,t){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);this.controllerMessenger.unsubscribe(e,t)}clearEventSubscriptions(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed clearing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.clearEventSubscriptions(e)}}n.RestrictedControllerMessenger=r;n.ControllerMessenger=class{constructor(){this.actions=new Map,this.events=new Map,this.eventPayloadCache=new Map}registerActionHandler(e,t){if(this.actions.has(e))throw new Error(`A handler for ${e} has already been registered`);this.actions.set(e,t)}unregisterActionHandler(e){this.actions.delete(e)}clearActions(){this.actions.clear()}call(e,...t){const n=this.actions.get(e);if(!n)throw new Error(`A handler for ${e} has not been registered`);return n(...t)}publish(e,...t){const n=this.events.get(e);if(n)for(const[e,r]of n.entries())if(r){const n=this.eventPayloadCache.get(e),s=r(...t);s!==n&&(this.eventPayloadCache.set(e,s),e(s,n))}else e(...t)}subscribe(e,t,n){let r=this.events.get(e);r||(r=new Map,this.events.set(e,r)),r.set(t,n)}unsubscribe(e,t){const n=this.events.get(e);if(!n||!n.has(t))throw new Error(`Subscription not found for event: ${e}`);n.get(t)&&this.eventPayloadCache.delete(t),n.delete(t)}clearEventSubscriptions(e){this.events.delete(e)}clearSubscriptions(){this.events.clear()}getRestricted({name:e,allowedActions:t,allowedEvents:n}){return new r({controllerMessenger:this,name:e,allowedActions:t,allowedEvents:n})}}}}},{package:"@metamask/gas-fee-controller>@metamask/base-controller",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/base-controller/dist/ControllerMessenger.js"}],[1237,{"./BaseController":1234,"./BaseControllerV2":1235,"./ControllerMessenger":1236},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseControllerV2=n.BaseController=void 0;var i=e("./BaseController");Object.defineProperty(n,"BaseController",{enumerable:!0,get:function(){return i.BaseController}});var o=e("./BaseControllerV2");Object.defineProperty(n,"BaseControllerV2",{enumerable:!0,get:function(){return o.BaseController}}),Object.defineProperty(n,"getAnonymizedState",{enumerable:!0,get:function(){return o.getAnonymizedState}}),Object.defineProperty(n,"getPersistentState",{enumerable:!0,get:function(){return o.getPersistentState}}),s(e("./ControllerMessenger"),n)}}},{package:"@metamask/gas-fee-controller>@metamask/base-controller",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/base-controller/dist/index.js"}],[1238,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.OPENSEA_TEST_API_URL=n.OPENSEA_API_URL=n.OPENSEA_PROXY_URL=n.TESTNET_NETWORK_TYPE_TO_TICKER_SYMBOL=n.TESTNET_TICKER_SYMBOLS=n.ASSET_TYPES=n.GWEI=n.ERC1155_TOKEN_RECEIVER_INTERFACE_ID=n.ERC1155_METADATA_URI_INTERFACE_ID=n.ERC1155_INTERFACE_ID=n.ERC721_ENUMERABLE_INTERFACE_ID=n.ERC721_METADATA_INTERFACE_ID=n.ERC721_INTERFACE_ID=n.ERC20=n.ERC1155=n.ERC721=n.GANACHE_CHAIN_ID=n.RINKEBY_CHAIN_ID=n.IPFS_DEFAULT_GATEWAY_URL=n.FALL_BACK_VS_CURRENCY=n.RPC=n.MAINNET=void 0,n.MAINNET="mainnet",n.RPC="rpc",n.FALL_BACK_VS_CURRENCY="ETH",n.IPFS_DEFAULT_GATEWAY_URL="https://cloudflare-ipfs.com/ipfs/",n.RINKEBY_CHAIN_ID="4",n.GANACHE_CHAIN_ID="1337",n.ERC721="ERC721",n.ERC1155="ERC1155",n.ERC20="ERC20",n.ERC721_INTERFACE_ID="0x80ac58cd",n.ERC721_METADATA_INTERFACE_ID="0x5b5e139f",n.ERC721_ENUMERABLE_INTERFACE_ID="0x780e9d63",n.ERC1155_INTERFACE_ID="0xd9b67a26",n.ERC1155_METADATA_URI_INTERFACE_ID="0x0e89341c",n.ERC1155_TOKEN_RECEIVER_INTERFACE_ID="0x4e2312e0",n.GWEI="gwei",n.ASSET_TYPES={NATIVE:"NATIVE",TOKEN:"TOKEN",NFT:"NFT",UNKNOWN:"UNKNOWN"},n.TESTNET_TICKER_SYMBOLS={RINKEBY:"RinkebyETH",GOERLI:"GoerliETH",ROPSTEN:"RopstenETH",KOVAN:"KovanETH"},n.TESTNET_NETWORK_TYPE_TO_TICKER_SYMBOL={rinkeby:"RinkebyETH",goerli:"GoerliETH",ropsten:"RopstenETH",kovan:"KovanETH",mainnet:"",rpc:"",localhost:""},n.OPENSEA_PROXY_URL="https://proxy.metaswap.codefi.network/opensea/v1/api/v1",n.OPENSEA_API_URL="https://api.opensea.io/api/v1",n.OPENSEA_TEST_API_URL="https://testnets-api.opensea.io/api/v1"}}},{package:"@metamask/gas-fee-controller>@metamask/controller-utils",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/controller-utils/dist/constants.js"}],[1239,{"./constants":1238,"./types":1240,"./util":1241,"isomorphic-fetch":2713},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),e("isomorphic-fetch"),s(e("./constants"),n),s(e("./util"),n),s(e("./types"),n)}}},{package:"@metamask/gas-fee-controller>@metamask/controller-utils",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/controller-utils/dist/index.js"}],[124,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:42,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=42;const n=t.data;return t.data=function(e){e.AppStateController?e.AppStateController.connectedStatusPopoverHasBeenShown=!1:e.AppStateController={connectedStatusPopoverHasBeenShown:!1};return e}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/042.js"}],[1240,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.NetworksChainId=void 0,function(e){e.mainnet="1",e.kovan="42",e.rinkeby="4",e.goerli="5",e.ropsten="3",e.localhost="",e.rpc=""}(n.NetworksChainId||(n.NetworksChainId={}))}}},{package:"@metamask/gas-fee-controller>@metamask/controller-utils",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/controller-utils/dist/types.js"}],[1241,{buffer:1943,"eth-ens-namehash":2139,"ethereumjs-util":2231,"ethjs-unit":2277,"fast-deep-equal":2486},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.isValidJson=n.isNonEmptyArray=n.hasProperty=n.isPlainObject=n.convertHexToDecimal=n.query=n.normalizeEnsName=n.timeoutFetch=n.fetchWithErrorHandling=n.handleFetch=n.successfulFetch=n.isSmartContractCode=n.isValidHexAddress=n.toChecksumHexAddress=n.safelyExecuteWithTimeout=n.safelyExecute=n.toHex=n.fromHex=n.hexToText=n.hexToBN=n.getBuyURL=n.weiHexToGweiDec=n.gweiDecToWEIBN=n.fractionBN=n.BNToHex=void 0;const i=e("ethereumjs-util"),o=e("ethjs-unit"),a=s(e("eth-ens-namehash")),c=s(e("fast-deep-equal")),u=new Error("timeout");function l(e){return new i.BN((0,i.stripHexPrefix)(e),16)}function d(e,t){return r(this,void 0,void 0,(function*(){const n=yield fetch(e,t);if(!n.ok)throw new Error(`Fetch failed with status '${n.status}' for request '${e}'`);return n}))}function h(e,t){return r(this,void 0,void 0,(function*(){const n=yield d(e,t);return yield n.json()}))}n.BNToHex=function(e){return(0,i.addHexPrefix)(e.toString(16))},n.fractionBN=function(e,t,n){const r=new i.BN(t),s=new i.BN(n);return e.mul(r).div(s)},n.gweiDecToWEIBN=function(e){if(Number.isNaN(e))return new i.BN(0);const t=e.toString().split("."),n=t[0]||"0";let r=t[1]||"";if(!r)return(0,o.toWei)(n,"gwei");if(r.length<=9)return(0,o.toWei)(`${n}.${r}`,"gwei");const s=r.slice(9)[0];r=r.slice(0,9);let a=(0,o.toWei)(`${n}.${r}`,"gwei");return Number(s)>=5&&(a=a.add(new i.BN(1))),a},n.weiHexToGweiDec=function(e){const t=new i.BN((0,i.stripHexPrefix)(e),16);return(0,o.fromWei)(t,"gwei").toString(10)},n.getBuyURL=function(e="1",t,n=5){switch(e){case"1":return`https://buy.coinbase.com/?code=9ec56d01-7e81-5017-930c-513daa27bb6a&amount=${n}&address=${t}&crypto_currency=ETH`;case"3":return"https://faucet.metamask.io/";case"4":return"https://www.rinkeby.io/";case"5":return"https://goerli-faucet.slock.it/";case"42":return"https://github.com/kovan-testnet/faucet";default:return undefined}},n.hexToBN=l,n.hexToText=function(e){try{const n=(0,i.stripHexPrefix)(e);return t.from(n,"hex").toString("utf8")}catch(t){return e}},n.fromHex=function(e){return i.BN.isBN(e)?e:new i.BN(l(e).toString(10))},n.toHex=function(e){return"string"==typeof e&&(0,i.isHexString)(e)?e:`0x${i.BN.isBN(e)?e.toString(16):new i.BN(e.toString(),10).toString(16)}`},n.safelyExecute=function(e,t=!1){return r(this,void 0,void 0,(function*(){try{return yield e()}catch(e){return t&&console.error(e),undefined}}))},n.safelyExecuteWithTimeout=function(e,t=!1,n=500){return r(this,void 0,void 0,(function*(){try{return yield Promise.race([e(),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))])}catch(e){return t&&console.error(e),undefined}}))},n.toChecksumHexAddress=function(e){const t=(0,i.addHexPrefix)(e);return(0,i.isHexString)(t)?(0,i.toChecksumAddress)(t):t},n.isValidHexAddress=function(e,{allowNonPrefixed:t=!0}={}){const n=t?(0,i.addHexPrefix)(e):e;return!!(0,i.isHexString)(n)&&(0,i.isValidAddress)(n)},n.isSmartContractCode=function(e){return!!e&&("0x"!==e&&"0x0"!==e)},n.successfulFetch=d,n.handleFetch=h,n.fetchWithErrorHandling=function({url:e,options:t,timeout:n,errorCodesToCatch:s}){return r(this,void 0,void 0,(function*(){let r;try{r=n?Promise.race([yield h(e,t),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))]):yield h(e,t)}catch(e){!function(e,t=[]){var n;if(!e)return;const r=t.some((t=>{var n;return null===(n=e.message)||void 0===n?void 0:n.includes(`Fetch failed with status '${t}'`)}));if(!(e instanceof Error&&(r||(null===(n=e.message)||void 0===n?void 0:n.includes("Failed to fetch"))||e===u)))throw e;console.error(e)}(e,s)}return r}))},n.timeoutFetch=function(e,t,n=500){return r(this,void 0,void 0,(function*(){return Promise.race([d(e,t),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))])}))},n.normalizeEnsName=function(e){if(e&&"string"==typeof e)try{const t=a.default.normalize(e.trim());if(t.match(/^(([\w\d-]+)\.)*[\w\d-]{7,}\.(eth|test)$/u))return t}catch(e){}return null},n.query=function(e,t,n=[]){return new Promise(((r,s)=>{const i=(e,t)=>{e?s(e):r(t)};"function"==typeof e[t]?e[t](...n,i):e.sendAsync({method:t,params:n},i)}))};n.convertHexToDecimal=(e="0x0")=>(0,i.isHexString)(e)?parseInt(e,16):Number(e)?Number(e):0,n.isPlainObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)};n.hasProperty=(e,t)=>Reflect.hasOwnProperty.call(e,t),n.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},n.isValidJson=function(e){try{return(0,c.default)(e,JSON.parse(JSON.stringify(e)))}catch(e){return!1}}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/gas-fee-controller>@metamask/controller-utils",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/controller-utils/dist/util.js"}],[1245,{"./BIP44Node":1246,"./SLIP10Node":1247,"./constants":1248,"./utils":1261},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!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"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},i=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.getBIP44AddressKeyDeriver=n.deriveBIP44AddressKey=n.BIP44CoinTypeNode=n.BIP_44_COIN_TYPE_DEPTH=void 0;const o=e("./BIP44Node"),a=e("./constants"),c=e("./SLIP10Node"),u=e("./utils");n.BIP_44_COIN_TYPE_DEPTH=2;class l{constructor(e,t){r.set(this,void 0),s(this,r,e,"f"),this.coin_type=t,this.path=(0,u.getBIP44CoinTypePathString)(t),Object.freeze(this)}static async fromJSON(e,t){h(t),d(e.depth);const n=await o.BIP44Node.fromExtendedKey({depth:e.depth,index:e.index,parentFingerprint:e.parentFingerprint,chainCode:(0,u.hexStringToBytes)(e.chainCode),privateKey:(0,u.nullableHexStringToBytes)(e.privateKey),publicKey:(0,u.hexStringToBytes)(e.publicKey)});return new l(n,t)}static async fromDerivationPath(e){d(e.length-1);const t=await o.BIP44Node.fromDerivationPath({derivationPath:e}),r=Number.parseInt(e[n.BIP_44_COIN_TYPE_DEPTH].split(":")[1].replace("'",""),10);return new l(t,r)}static async fromNode(e,t){if(!(e instanceof o.BIP44Node))throw new Error("Invalid node: Expected an instance of BIP44Node.");return h(t),d(e.depth),Promise.resolve(new l(e,t))}get depth(){return i(this,r,"f").depth}get privateKeyBytes(){return i(this,r,"f").privateKeyBytes}get publicKeyBytes(){return i(this,r,"f").publicKeyBytes}get chainCodeBytes(){return i(this,r,"f").chainCodeBytes}get privateKey(){return i(this,r,"f").privateKey}get publicKey(){return i(this,r,"f").publicKey}get compressedPublicKey(){return i(this,r,"f").compressedPublicKey}get compressedPublicKeyBytes(){return i(this,r,"f").compressedPublicKeyBytes}get chainCode(){return i(this,r,"f").chainCode}get address(){return i(this,r,"f").address}get masterFingerprint(){return i(this,r,"f").masterFingerprint}get parentFingerprint(){return i(this,r,"f").parentFingerprint}get fingerprint(){return i(this,r,"f").fingerprint}get index(){return i(this,r,"f").index}get curve(){return i(this,r,"f").curve}get extendedKey(){return i(this,r,"f").extendedKey}async deriveBIP44AddressKey({account:e=0,change:t=0,address_index:n}){return await i(this,r,"f").derive((0,u.getBIP44CoinTypeToAddressPathTuple)({account:e,change:t,address_index:n}))}toJSON(){return Object.assign(Object.assign({},i(this,r,"f").toJSON()),{coin_type:this.coin_type,path:this.path})}}function d(e){if(e!==n.BIP_44_COIN_TYPE_DEPTH)throw new Error(`Invalid depth: Coin type nodes must be of depth ${n.BIP_44_COIN_TYPE_DEPTH}. Received: "${e}"`)}function h(e){if("number"!=typeof e||!Number.isInteger(e)||e<0)throw new Error("Invalid coin type: The specified coin type must be a non-negative integer number.")}async function f(e){if(e instanceof l)return d(e.depth),e;if("string"==typeof e){const t=await o.BIP44Node.fromExtendedKey(e),n=await l.fromNode(t,t.index-a.BIP_32_HARDENED_OFFSET);return d(n.depth),n}return l.fromJSON(e,e.coin_type)}n.BIP44CoinTypeNode=l,r=new WeakMap,n.deriveBIP44AddressKey=async function(e,{account:t=0,change:n=0,address_index:r}){const s=(0,u.getBIP44CoinTypeToAddressPathTuple)({account:t,change:n,address_index:r}),i=await f(e),a=await(0,c.deriveChildNode)({path:s,node:i});return new o.BIP44Node(a)},n.getBIP44AddressKeyDeriver=async function(e,t){const{account:n=0,change:r=0}=null!=t?t:{},s=await f(e),i=(0,u.getHardenedBIP32NodeToken)(n),a=(0,u.getBIP32NodeToken)(r),l=async(e,t=!1)=>{const n=await(0,c.deriveChildNode)({path:[i,a,t?(0,u.getHardenedBIP32NodeToken)(e):(0,u.getUnhardenedBIP32NodeToken)(e)],node:s});return new o.BIP44Node(n)};return l.coin_type=s.coin_type,l.path=(0,u.getBIP44ChangePathString)(s.path,{account:n,change:r}),Object.freeze(l),l}}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.js"}],[1246,{"./SLIP10Node":1247,"./constants":1248,"./extended-keys":1259,"./utils":1261,"@metamask/utils":1269},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!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"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},i=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.validateBIP44Depth=n.BIP44Node=void 0;const o=e("@metamask/utils"),a=e("./constants"),c=e("./extended-keys"),u=e("./SLIP10Node"),l=e("./utils");class d{constructor(e){r.set(this,void 0),s(this,r,e,"f"),Object.freeze(this)}static async fromJSON(e){return d.fromExtendedKey(e)}static async fromExtendedKey(e){if("string"==typeof e){const t=(0,c.decodeExtendedKey)(e),{chainCode:n,depth:r,parentFingerprint:s,index:i}=t;if(t.version===c.PRIVATE_KEY_VERSION){const{privateKey:e}=t;return d.fromExtendedKey({depth:r,parentFingerprint:s,index:i,privateKey:e,chainCode:n})}const{publicKey:o}=t;return d.fromExtendedKey({depth:r,parentFingerprint:s,index:i,publicKey:o,chainCode:n})}const{privateKey:t,publicKey:n,chainCode:r,depth:s,parentFingerprint:i,index:o}=e;h(s);const a=await u.SLIP10Node.fromExtendedKey({privateKey:t,publicKey:n,chainCode:r,depth:s,parentFingerprint:i,index:o,curve:"secp256k1"});return new d(a)}static async fromDerivationPath({derivationPath:e}){h(e.length-1),f(e,a.MIN_BIP_44_DEPTH);const t=await u.SLIP10Node.fromDerivationPath({derivationPath:e,curve:"secp256k1"});return new d(t)}get depth(){return i(this,r,"f").depth}get privateKeyBytes(){return i(this,r,"f").privateKeyBytes}get publicKeyBytes(){return i(this,r,"f").publicKeyBytes}get chainCodeBytes(){return i(this,r,"f").chainCodeBytes}get privateKey(){return i(this,r,"f").privateKey}get publicKey(){return i(this,r,"f").publicKey}get compressedPublicKey(){return i(this,r,"f").compressedPublicKey}get compressedPublicKeyBytes(){return i(this,r,"f").compressedPublicKeyBytes}get chainCode(){return i(this,r,"f").chainCode}get address(){return i(this,r,"f").address}get masterFingerprint(){return i(this,r,"f").masterFingerprint}get parentFingerprint(){return i(this,r,"f").parentFingerprint}get fingerprint(){return i(this,r,"f").fingerprint}get index(){return i(this,r,"f").index}get extendedKey(){const e={depth:this.depth,parentFingerprint:this.parentFingerprint,index:this.index,chainCode:this.chainCodeBytes};return this.privateKeyBytes?(0,c.encodeExtendedKey)(Object.assign(Object.assign({},e),{version:c.PRIVATE_KEY_VERSION,privateKey:this.privateKeyBytes})):(0,c.encodeExtendedKey)(Object.assign(Object.assign({},e),{version:c.PUBLIC_KEY_VERSION,publicKey:this.publicKeyBytes}))}get curve(){return i(this,r,"f").curve}neuter(){const e=i(this,r,"f").neuter();return new d(e)}async derive(e){if(this.depth===a.MAX_BIP_44_DEPTH)throw new Error("Illegal operation: This HD tree node is already a leaf node.");h(this.depth+e.length),f(e,this.depth+1);const t=await i(this,r,"f").derive(e);return new d(t)}toJSON(){return{depth:this.depth,masterFingerprint:this.masterFingerprint,parentFingerprint:this.parentFingerprint,index:this.index,privateKey:this.privateKey,publicKey:this.publicKey,chainCode:this.chainCode}}}function h(e){if((0,u.validateBIP32Depth)(e),e<a.MIN_BIP_44_DEPTH||e>a.MAX_BIP_44_DEPTH)throw new Error(`Invalid HD tree path depth: The depth must be a positive integer N such that 0 <= N <= 5. Received: "${e}"`)}function f(e,t){e.forEach(((e,n)=>{const r=t+n;if(r!==a.MIN_BIP_44_DEPTH)switch((0,o.assert)("string"==typeof e),r){case 1:if(e!==a.BIP44PurposeNodeToken)throw new Error(`Invalid derivation path: The "purpose" node (depth 1) must be the string "${a.BIP44PurposeNodeToken}".`);break;case 2:if(!a.BIP_32_PATH_REGEX.test(e)||!(0,l.isHardened)(e))throw new Error('Invalid derivation path: The "coin_type" node (depth 2) must be a hardened BIP-32 node.');break;case 3:if(!a.BIP_32_PATH_REGEX.test(e)||!(0,l.isHardened)(e))throw new Error('Invalid derivation path: The "account" node (depth 3) must be a hardened BIP-32 node.');break;case 4:if(!a.BIP_32_PATH_REGEX.test(e))throw new Error('Invalid derivation path: The "change" node (depth 4) must be a BIP-32 node.');break;case a.MAX_BIP_44_DEPTH:if(!a.BIP_32_PATH_REGEX.test(e))throw new Error('Invalid derivation path: The "address_index" node (depth 5) must be a BIP-32 node.')}else if(!(e instanceof Uint8Array||a.BIP_39_PATH_REGEX.test(e)))throw new Error('Invalid derivation path: The "m" / seed node (depth 0) must be a BIP-39 node.')}))}n.BIP44Node=d,r=new WeakMap,n.validateBIP44Depth=h}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/BIP44Node.js"}],[1247,{"./constants":1248,"./curves":1251,"./derivation":1253,"./derivers/bip32":1254,"./utils":1261,"@metamask/utils":1269},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.deriveChildNode=n.validateRootIndex=n.validateMasterParentFingerprint=n.validateParentFingerprint=n.validateBIP32Depth=n.SLIP10Node=void 0;const o=e("@metamask/utils"),a=e("./constants"),c=e("./curves"),u=e("./derivation"),l=e("./derivers/bip32"),d=e("./utils");class h{constructor({depth:e,masterFingerprint:t,parentFingerprint:n,index:a,chainCode:c,privateKey:u,publicKey:l,curve:d},f){(0,o.assert)(f===i(h,r,"f",s),"SLIP10Node can only be constructed using `SLIP10Node.fromJSON`, `SLIP10Node.fromExtendedKey`, or `SLIP10Node.fromDerivationPath`."),this.depth=e,this.masterFingerprint=t,this.parentFingerprint=n,this.index=a,this.chainCodeBytes=c,this.privateKeyBytes=u,this.publicKeyBytes=l,this.curve=d,Object.freeze(this)}static async fromJSON(e){return h.fromExtendedKey(e)}static async fromExtendedKey({depth:e,masterFingerprint:t,parentFingerprint:n,index:u,privateKey:l,publicKey:y,chainCode:b,curve:w}){const v=(0,d.getBytes)(b,a.BYTES_KEY_LENGTH);(0,d.validateCurve)(w),f(e),(0,d.validateBIP32Index)(u),g(u,e),p(n,e),m(t,n,e);const _=(0,c.getCurveByName)(w);if(l){const c=(0,d.getBytesUnsafe)(l,a.BYTES_KEY_LENGTH);return(0,o.assert)(_.isValidPrivateKey(c),`Invalid private key: Value is not a valid ${w} private key.`),new h({depth:e,masterFingerprint:t,parentFingerprint:n,index:u,chainCode:v,privateKey:c,publicKey:await _.getPublicKey(c),curve:w},i(this,r,"f",s))}if(y){const o=(0,d.getBytes)(y,_.publicKeyLength);return new h({depth:e,masterFingerprint:t,parentFingerprint:n,index:u,chainCode:v,publicKey:o,curve:w},i(this,r,"f",s))}throw new Error("Invalid options: Must provide either a private key or a public key.")}static async fromDerivationPath({derivationPath:e,curve:t}){if((0,d.validateCurve)(t),!e)throw new Error("Invalid options: Must provide a derivation path.");if(0===e.length)throw new Error("Invalid derivation path: May not specify an empty derivation path.");return await(0,u.deriveKeyFromPath)({path:e,depth:e.length-1,curve:t})}get chainCode(){return(0,o.bytesToHex)(this.chainCodeBytes)}get privateKey(){return this.privateKeyBytes?(0,o.bytesToHex)(this.privateKeyBytes):undefined}get publicKey(){return(0,o.bytesToHex)(this.publicKeyBytes)}get compressedPublicKeyBytes(){return(0,c.getCurveByName)(this.curve).compressPublicKey(this.publicKeyBytes)}get compressedPublicKey(){return(0,o.bytesToHex)(this.compressedPublicKeyBytes)}get address(){if("secp256k1"!==this.curve)throw new Error("Unable to get address for this node: Only secp256k1 is supported.");return(0,o.bytesToHex)((0,l.publicKeyToEthAddress)(this.publicKeyBytes))}get fingerprint(){return(0,d.getFingerprint)(this.compressedPublicKeyBytes)}neuter(){return new h({depth:this.depth,masterFingerprint:this.masterFingerprint,parentFingerprint:this.parentFingerprint,index:this.index,chainCode:this.chainCodeBytes,publicKey:this.publicKeyBytes,curve:this.curve},i(h,r,"f",s))}async derive(e){return await y({path:e,node:this})}toJSON(){return{depth:this.depth,masterFingerprint:this.masterFingerprint,parentFingerprint:this.parentFingerprint,index:this.index,curve:this.curve,privateKey:this.privateKey,publicKey:this.publicKey,chainCode:this.chainCode}}}function f(e){if(!(0,d.isValidInteger)(e))throw new Error(`Invalid HD tree path depth: The depth must be a positive integer. Received: "${String(e)}".`)}function p(e,t){if(!(0,d.isValidInteger)(e))throw new Error(`Invalid parent fingerprint: The fingerprint must be a positive integer. Received: "${String(e)}".`);if(0===t&&0!==e)throw new Error(`Invalid parent fingerprint: The fingerprint of the root node must be 0. Received: "${String(e)}".`);if(t>0&&0===e)throw new Error(`Invalid parent fingerprint: The fingerprint of a child node must not be 0. Received: "${String(e)}".`)}function m(e,t,n){if(e&&n>=2&&e===t)throw new Error(`Invalid parent fingerprint: The fingerprint of a child node cannot be equal to the master fingerprint. Received: "${String(t)}".`)}function g(e,t){if(0===t&&0!==e)throw new Error(`Invalid index: The index of the root node must be 0. Received: "${String(e)}".`)}async function y({path:e,node:t}){if(0===e.length)throw new Error("Invalid HD tree derivation path: Deriving a path of length 0 is not defined.");const n=t.depth+e.length;return f(n),await(0,u.deriveKeyFromPath)({path:e,node:t,depth:n})}n.SLIP10Node=h,r=h,s={value:Symbol("SLIP10Node.constructor")},n.validateBIP32Depth=f,n.validateParentFingerprint=p,n.validateMasterParentFingerprint=m,n.validateRootIndex=g,n.deriveChildNode=y}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/SLIP10Node.js"}],[1248,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BIP_32_HARDENED_OFFSET=n.BIP_39_PATH_REGEX=n.SLIP_10_PATH_REGEX=n.BIP_32_PATH_REGEX=n.UNPREFIXED_PATH_REGEX=n.BIP44PurposeNodeToken=n.MAX_BIP_32_INDEX=n.MAX_BIP_44_DEPTH=n.MIN_BIP_44_DEPTH=n.BYTES_KEY_LENGTH=void 0,n.BYTES_KEY_LENGTH=32,n.MIN_BIP_44_DEPTH=0,n.MAX_BIP_44_DEPTH=5,n.MAX_BIP_32_INDEX=4294967295,n.BIP44PurposeNodeToken="bip32:44'",n.UNPREFIXED_PATH_REGEX=/^\d+$/u,n.BIP_32_PATH_REGEX=/^bip32:\d+'?$/u,n.SLIP_10_PATH_REGEX=/^slip10:\d+'?$/u,n.BIP_39_PATH_REGEX=/^bip39:([a-z]+){1}( [a-z]+){11,23}$/u,n.BIP_32_HARDENED_OFFSET=2147483648}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/constants.js"}],[1249,{"./ed25519":1250,"./secp256k1":1252,"@noble/secp256k1":1389},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),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 n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return s(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.mod=n.getCurveByName=n.curves=void 0;const o=e("@noble/secp256k1"),a=i(e("./ed25519")),c=i(e("./secp256k1"));n.curves={secp256k1:c,ed25519:a},n.getCurveByName=function(e){return n.curves[e]},n.mod=o.utils.mod}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/curves/curve.js"}],[125,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:43,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=43;const n=t.data;return t.data=function(e){var t;null!=e&&null!==(t=e.PreferencesController)&&void 0!==t&&t.currentAccountTab&&delete e.PreferencesController.currentAccountTab;return e}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/043.js"}],[1250,{"@metamask/utils":1269,"@noble/ed25519":1377},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.decompressPublicKey=n.compressPublicKey=n.publicAdd=n.getPublicKey=n.publicKeyLength=n.deriveUnhardenedKeys=n.isValidPrivateKey=n.secret=n.name=n.curve=void 0;const r=e("@metamask/utils"),s=e("@noble/ed25519");var i=e("@noble/ed25519");Object.defineProperty(n,"curve",{enumerable:!0,get:function(){return i.CURVE}}),n.name="ed25519",n.secret=(0,r.stringToBytes)("ed25519 seed");n.isValidPrivateKey=e=>!0,n.deriveUnhardenedKeys=!1,n.publicKeyLength=33;n.getPublicKey=async(e,t)=>{const n=await(0,s.getPublicKey)(e);return(0,r.concatBytes)([new Uint8Array([0]),n])};n.publicAdd=(e,t)=>{throw new Error("Ed25519 does not support public key derivation.")};n.compressPublicKey=e=>e;n.decompressPublicKey=e=>e}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/curves/ed25519.js"}],[1251,{"./curve":1249,"./ed25519":1250,"./secp256k1":1252},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),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.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return s(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.ed25519=n.secp256k1=void 0,i(e("./curve"),n),n.secp256k1=o(e("./secp256k1")),n.ed25519=o(e("./ed25519"))}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/curves/index.js"}],[1252,{"../utils":1261,"@metamask/utils":1269,"@noble/secp256k1":1389},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.decompressPublicKey=n.compressPublicKey=n.publicAdd=n.getPublicKey=n.isValidPrivateKey=n.publicKeyLength=n.deriveUnhardenedKeys=n.secret=n.name=n.curve=void 0;const r=e("@metamask/utils"),s=e("@noble/secp256k1"),i=e("../utils");var o=e("@noble/secp256k1");Object.defineProperty(n,"curve",{enumerable:!0,get:function(){return o.CURVE}}),n.name="secp256k1",n.secret=(0,r.stringToBytes)("Bitcoin seed"),n.deriveUnhardenedKeys=!0,n.publicKeyLength=65;n.isValidPrivateKey=e=>s.utils.isValidPrivateKey(e);n.getPublicKey=(e,t)=>(0,s.getPublicKey)(e,t);n.publicAdd=(e,t)=>{(0,r.assert)((0,i.isValidBytesKey)(t,32),"Invalid tweak: Tweak must be a non-zero 32-byte Uint8Array.");const n=s.Point.fromHex(e).add(s.Point.fromPrivateKey(t));return n.assertValidity(),n.toRawBytes(!1)};n.compressPublicKey=e=>s.Point.fromHex(e).toRawBytes(!0);n.decompressPublicKey=e=>s.Point.fromHex(e).toRawBytes(!1)}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/curves/secp256k1.js"}],[1253,{"./BIP44CoinTypeNode":1245,"./BIP44Node":1246,"./SLIP10Node":1247,"./constants":1248,"./curves":1251,"./derivers":1256,"@metamask/utils":1269},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validatePathSegment=n.deriveKeyFromPath=void 0;const r=e("@metamask/utils"),s=e("./BIP44CoinTypeNode"),i=e("./BIP44Node"),o=e("./constants"),a=e("./curves"),c=e("./derivers"),u=e("./SLIP10Node");function l(e,t,n){if(0===e.length)throw new Error("Invalid HD path segment: The segment must not be empty.");let s=!1;if(e.forEach(((e,t)=>{if(0===t){if(s=e instanceof Uint8Array||o.BIP_39_PATH_REGEX.test(e),!(e instanceof Uint8Array||s||o.BIP_32_PATH_REGEX.test(e)||o.SLIP_10_PATH_REGEX.test(e)))throw d()}else if(e instanceof Uint8Array||!o.BIP_32_PATH_REGEX.test(e)&&!o.SLIP_10_PATH_REGEX.test(e))throw d()})),n===o.MIN_BIP_44_DEPTH&&(!s||1!==e.length))throw new Error(`Invalid HD path segment: The segment must consist of a single BIP-39 node for depths of ${o.MIN_BIP_44_DEPTH}. Received: "${String(e)}".`);if(!t&&!s)throw new Error("Invalid derivation parameters: Must specify parent key if the first node of the path segment is not a BIP-39 node.");if(t&&s)throw new Error("Invalid derivation parameters: May not specify parent key if the path segment starts with a BIP-39 node.");const i=s?e.slice(1):e;if(i.length>0){const e=i[0].split(":")[0];(0,r.assert)(i.every((t=>t.startsWith(`${e}:`))),"Invalid HD path segment: Cannot mix 'bip32' and 'slip10' path segments.")}}function d(){return new Error("Invalid HD path segment: The path segment is malformed.")}n.deriveKeyFromPath=async function(e){const{path:t,depth:n=t.length}=e,o="node"in e?e.node:undefined,h="curve"in e?e.curve:null==o?void 0:o.curve;if(o&&!(o instanceof u.SLIP10Node)&&!(o instanceof i.BIP44Node)&&!(o instanceof s.BIP44CoinTypeNode))throw new Error("Invalid arguments: Node must be a SLIP-10 node or a BIP-44 node when provided.");if(!h)throw new Error("Invalid arguments: Must specify either a parent node or curve.");return l(t,Boolean(null==o?void 0:o.privateKey)||Boolean(null==o?void 0:o.publicKey),n),await t.reduce((async(e,t,n)=>{const s=await e;if("string"==typeof t){const[e,n]=t.split(":");(0,r.assert)(function(e){return e in c.derivers}(e),`Unknown derivation type: "${e}".`);const i=c.derivers[e];return await i.deriveChildKey({path:n,node:s,curve:(0,a.getCurveByName)(h)})}return(0,r.assert)(0===n,d()),await c.derivers.bip39.deriveChildKey({path:t,node:s,curve:(0,a.getCurveByName)(h)})}),Promise.resolve(o))},n.validatePathSegment=l}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/derivation.js"}],[1254,{"../constants":1248,"../curves":1251,"../utils":1261,"./shared":1257,"@metamask/utils":1269,"@noble/hashes/sha3":1386},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.deriveChildKey=n.publicKeyToEthAddress=n.privateKeyToEthAddress=void 0;const r=e("@metamask/utils"),s=e("@noble/hashes/sha3"),i=e("../constants"),o=e("../curves"),a=e("../utils"),c=e("./shared");function u(e){return(0,r.assert)(e instanceof Uint8Array&&(0,a.isValidBytesKey)(e,o.secp256k1.publicKeyLength),"Invalid key: The key must be a 65-byte, non-zero Uint8Array."),(0,s.keccak_256)(e.slice(1)).slice(-20)}async function l(e,t){const{childIndex:n,privateKey:r,publicKey:s,isHardened:i,curve:o,chainCode:u}=t;if((0,a.validateBIP32Index)(n+1),r){const e=await(0,c.deriveSecretExtension)({privateKey:r,childIndex:n+1,isHardened:i,curve:o}),s=(0,c.generateEntropy)({chainCode:u,extension:e});return Object.assign(Object.assign({},t),{childIndex:n+1,entropy:s})}const l=(0,c.derivePublicExtension)({parentPublicKey:s,childIndex:n+1}),d=(0,c.generateEntropy)({chainCode:u,extension:l});return Object.assign(Object.assign({},t),{childIndex:n+1,entropy:d})}n.privateKeyToEthAddress=function(e){return(0,r.assert)(e instanceof Uint8Array&&(0,a.isValidBytesKey)(e,i.BYTES_KEY_LENGTH),"Invalid key: The key must be a 32-byte, non-zero Uint8Array."),u(o.secp256k1.getPublicKey(e,!1))},n.publicKeyToEthAddress=u,n.deriveChildKey=async function(e){return(0,r.assert)("secp256k1"===e.curve.name,"Invalid curve: Only secp256k1 is supported by BIP-32."),(0,c.deriveChildKey)(e,l)}}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/derivers/bip32.js"}],[1255,{"../SLIP10Node":1247,"../constants":1248,"../utils":1261,"@metamask/scure-bip39":1326,"@metamask/scure-bip39/dist/wordlists/english":1327,"@metamask/utils":1269,"@noble/hashes/hmac":1382,"@noble/hashes/sha512":1387},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createBip39KeyFromSeed=n.deriveChildKey=n.bip39MnemonicToMultipath=void 0;const r=e("@metamask/scure-bip39"),s=e("@metamask/scure-bip39/dist/wordlists/english"),i=e("@metamask/utils"),o=e("@noble/hashes/hmac"),a=e("@noble/hashes/sha512"),c=e("../constants"),u=e("../SLIP10Node"),l=e("../utils");async function d(e,t){(0,i.assert)(e.length>=16&&e.length<=64,"Invalid seed: The seed must be between 16 and 64 bytes long.");const n=(0,o.hmac)(a.sha512,t.secret,e),r=n.slice(0,c.BYTES_KEY_LENGTH),s=n.slice(c.BYTES_KEY_LENGTH);(0,i.assert)(t.isValidPrivateKey(r),"Invalid private key: The private key must greater than 0 and less than the curve order.");const d=(0,l.getFingerprint)(await t.getPublicKey(r,!0));return u.SLIP10Node.fromExtendedKey({privateKey:r,chainCode:s,masterFingerprint:d,depth:0,parentFingerprint:0,index:0,curve:t.name})}n.bip39MnemonicToMultipath=function(e){return`bip39:${e.toLowerCase().trim()}`},n.deriveChildKey=async function({path:e,curve:t}){return d(await(0,r.mnemonicToSeed)(e,s.wordlist),t)},n.createBip39KeyFromSeed=d}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/derivers/bip39.js"}],[1256,{"./bip32":1254,"./bip39":1255,"./slip10":1258},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),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 n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return s(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.derivers=void 0;const o=i(e("./bip32")),a=i(e("./bip39")),c=i(e("./slip10"));n.derivers={bip32:o,bip39:a,slip10:c}}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/derivers/index.js"}],[1257,{"../SLIP10Node":1247,"../constants":1248,"../curves":1251,"../utils":1261,"@metamask/utils":1269,"@noble/hashes/hmac":1382,"@noble/hashes/sha512":1387},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateNode=n.generateEntropy=n.privateAdd=n.derivePublicChildKey=n.derivePublicExtension=n.deriveSecretExtension=n.deriveChildKey=void 0;const r=e("@metamask/utils"),s=e("@noble/hashes/hmac"),i=e("@noble/hashes/sha512"),o=e("../constants"),a=e("../curves"),c=e("../SLIP10Node"),u=e("../utils");async function l(e,t){const{privateKey:n,publicKey:r,entropy:s,childIndex:i,isHardened:a,depth:u,parentFingerprint:d,masterFingerprint:h,curve:m}=e;try{return n?await async function({entropy:e,privateKey:t,depth:n,masterFingerprint:r,parentFingerprint:s,childIndex:i,isHardened:a,curve:u}){const l=i+(a?o.BIP_32_HARDENED_OFFSET:0),{privateKey:d,chainCode:h}=await async function({privateKey:e,entropy:t,curve:n}){const r=t.slice(0,32),s=t.slice(32);if("ed25519"===n.name){return{privateKey:r,publicKey:await n.getPublicKey(r),chainCode:s}}const i=p(e,r,n),o=await n.getPublicKey(i);return{privateKey:i,publicKey:o,chainCode:s}}({privateKey:t,entropy:e,curve:u});return await c.SLIP10Node.fromExtendedKey({privateKey:d,chainCode:h,depth:n+1,masterFingerprint:r,parentFingerprint:s,index:l,curve:u.name})}({entropy:s,privateKey:n,depth:u,masterFingerprint:h,parentFingerprint:d,childIndex:i,isHardened:a,curve:m}):await f({entropy:s,publicKey:r,depth:u,masterFingerprint:h,parentFingerprint:d,childIndex:i,curve:m})}catch(n){return await l(await t(n,e),t)}}async function d({privateKey:e,childIndex:t,isHardened:n,curve:s}){if(n)return(0,r.concatBytes)([new Uint8Array([0]),e,(0,u.numberToUint32)(t+o.BIP_32_HARDENED_OFFSET)]);return h({parentPublicKey:await s.getPublicKey(e,!0),childIndex:t})}function h({parentPublicKey:e,childIndex:t}){return(0,r.concatBytes)([e,(0,u.numberToUint32)(t)])}async function f({entropy:e,publicKey:t,depth:n,masterFingerprint:r,parentFingerprint:s,childIndex:i,curve:o}){const{publicKey:a,chainCode:u}=function({publicKey:e,entropy:t,curve:n}){const r=t.slice(0,32),s=t.slice(32);return{publicKey:n.publicAdd(e,r),chainCode:s}}({publicKey:t,entropy:e,curve:o});return await c.SLIP10Node.fromExtendedKey({publicKey:a,chainCode:u,depth:n+1,masterFingerprint:r,parentFingerprint:s,index:i,curve:o.name})}function p(e,t,n){(0,r.assert)((0,u.isValidBytesKey)(t,32),"Invalid tweak: Tweak must be a non-zero 32-byte Uint8Array.");const s=(0,r.bytesToBigInt)(e),i=(0,r.bytesToBigInt)(t);if(i>=n.curve.n)throw new Error("Invalid tweak: Tweak is larger than the curve order.");const o=(0,a.mod)(s+i,n.curve.n),c=(0,r.hexToBytes)(o.toString(16).padStart(64,"0"));if(!n.isValidPrivateKey(c))throw new Error("Invalid private key or tweak: The resulting private key is invalid.");return c}function m({chainCode:e,extension:t}){return(0,s.hmac)(i.sha512,e,t)}function g(e){(0,r.assert)(e,"Invalid parameters: Must specify a node to derive from.")}n.deriveChildKey=async function({path:e,node:t,curve:n},s){g(t);const{childIndex:i,isHardened:a}=function(e,t,n){!function(e,t,n){(0,r.assert)("string"==typeof e,"Invalid path: Must be a string.");const s=e.endsWith("'");(0,r.assert)(!s||t.privateKey,"Invalid parameters: Cannot derive hardened child keys without a private key."),(0,r.assert)(s||n.deriveUnhardenedKeys,`Invalid path: Cannot derive unhardened child keys with ${n.name}.`)}(e,t,n);const s=e.split("'")[0],i=parseInt(s,10);if(!o.UNPREFIXED_PATH_REGEX.test(s)||!Number.isInteger(i)||i<0||i>=o.BIP_32_HARDENED_OFFSET)throw new Error(`Invalid path: The index must be a non-negative decimal integer less than ${o.BIP_32_HARDENED_OFFSET}.`);return{childIndex:i,isHardened:e.includes("'")}}(e,t,n),c={chainCode:t.chainCodeBytes,childIndex:i,isHardened:a,depth:t.depth,parentFingerprint:t.fingerprint,masterFingerprint:t.masterFingerprint,curve:n};if(t.privateKeyBytes){const e=await d({privateKey:t.privateKeyBytes,childIndex:i,isHardened:a,curve:n}),r=m({chainCode:t.chainCodeBytes,extension:e});return await l(Object.assign({privateKey:t.privateKeyBytes,entropy:r},c),s)}const u=h({parentPublicKey:t.compressedPublicKeyBytes,childIndex:i}),f=m({chainCode:t.chainCodeBytes,extension:u});return await l(Object.assign({publicKey:t.compressedPublicKeyBytes,entropy:f},c),s)},n.deriveSecretExtension=d,n.derivePublicExtension=h,n.derivePublicChildKey=f,n.privateAdd=p,n.generateEntropy=m,n.validateNode=g}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/derivers/shared.js"}],[1258,{"../constants":1248,"../utils":1261,"./shared":1257,"@metamask/utils":1269},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.deriveChildKey=void 0;const r=e("@metamask/utils"),s=e("../constants"),i=e("../utils"),o=e("./shared");async function a(e,t){const{curve:n,isHardened:a,childIndex:c,entropy:u,chainCode:l}=t;if("ed25519"===n.name)throw e;const d=a?c+s.BIP_32_HARDENED_OFFSET:c,h=(0,o.generateEntropy)({chainCode:l,extension:(0,r.concatBytes)([1,u.slice(32,64),(0,i.numberToUint32)(d)])});return Object.assign(Object.assign({},t),{entropy:h})}n.deriveChildKey=async function(e){return await(0,o.deriveChildKey)(e,a)}}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/derivers/slip10.js"}],[1259,{"./BIP44Node":1246,"./curves/secp256k1":1252,"./utils":1261,"@metamask/utils":1269},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.encodeExtendedKey=n.decodeExtendedKey=n.PRIVATE_KEY_VERSION=n.PUBLIC_KEY_VERSION=void 0;const r=e("@metamask/utils"),s=e("./BIP44Node"),i=e("./curves/secp256k1"),o=e("./utils");n.PUBLIC_KEY_VERSION=76067358,n.PRIVATE_KEY_VERSION=76066276;n.decodeExtendedKey=e=>{const t=(0,o.decodeBase58check)(e);if(78!==t.length)throw new Error(`Invalid extended key: Expected a length of 78, got ${t.length}.`);const a=(0,r.createDataView)(t),c=a.getUint32(0,!1),u=a.getUint8(4);(0,s.validateBIP44Depth)(u);const l=a.getUint32(5,!1),d=a.getUint32(9,!1),h=t.slice(13,45);if(!(0,o.isValidBytesKey)(h,32))throw new Error("Invalid extended key: Chain code must be a 32-byte non-zero byte array.");const f=t.slice(45,78);if(!(0,o.isValidBytesKey)(f,33))throw new Error("Invalid extended key: Key must be a 33-byte non-zero byte array.");const p=(0,r.createDataView)(f);if(c===n.PUBLIC_KEY_VERSION){if(2!==p.getUint8(0)&&3!==p.getUint8(0))throw new Error("Invalid extended key: Public key must start with 0x02 or 0x03.");return{version:c,depth:u,parentFingerprint:l,index:d,chainCode:h,publicKey:(0,i.decompressPublicKey)(f)}}if(c===n.PRIVATE_KEY_VERSION){if(0!==p.getUint8(0))throw new Error("Invalid extended key: Private key must start with 0x00.");return{version:c,depth:u,parentFingerprint:l,index:d,chainCode:h,privateKey:f.slice(1)}}throw new Error("Invalid extended key: Expected a public (xpub) or private key (xprv) version.")};n.encodeExtendedKey=e=>{const{version:t,depth:s,parentFingerprint:a,index:c,chainCode:u}=e,l=new Uint8Array(78),d=(0,r.createDataView)(l);if(d.setUint32(0,t,!1),d.setUint8(4,s),d.setUint32(5,a,!1),d.setUint32(9,c,!1),l.set(u,13),e.version===n.PUBLIC_KEY_VERSION){const{publicKey:t}=e,n=(0,i.compressPublicKey)(t);l.set(n,45)}if(e.version===n.PRIVATE_KEY_VERSION){const{privateKey:t}=e;l.set(t,46)}return(0,o.encodeBase58check)(l)}}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/extended-keys.js"}],[126,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:44,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=44;const n=t.data;return t.data=function(e){var t;void 0!==(null==e||null===(t=e.AppStateController)||void 0===t?void 0:t.mkrMigrationReminderTimestamp)&&delete e.AppStateController.mkrMigrationReminderTimestamp;return e}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/044.js"}],[1260,{"./BIP44CoinTypeNode":1245,"./BIP44Node":1246,"./SLIP10Node":1247,"./constants":1248,"./curves":1251},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.getBIP44AddressKeyDeriver=n.deriveBIP44AddressKey=n.BIP_44_COIN_TYPE_DEPTH=n.BIP44CoinTypeNode=n.ed25519=n.secp256k1=n.SLIP10Node=n.BIP44Node=void 0;var i=e("./BIP44Node");Object.defineProperty(n,"BIP44Node",{enumerable:!0,get:function(){return i.BIP44Node}});var o=e("./SLIP10Node");Object.defineProperty(n,"SLIP10Node",{enumerable:!0,get:function(){return o.SLIP10Node}});var a=e("./curves");Object.defineProperty(n,"secp256k1",{enumerable:!0,get:function(){return a.secp256k1}}),Object.defineProperty(n,"ed25519",{enumerable:!0,get:function(){return a.ed25519}});var c=e("./BIP44CoinTypeNode");Object.defineProperty(n,"BIP44CoinTypeNode",{enumerable:!0,get:function(){return c.BIP44CoinTypeNode}}),Object.defineProperty(n,"BIP_44_COIN_TYPE_DEPTH",{enumerable:!0,get:function(){return c.BIP_44_COIN_TYPE_DEPTH}}),Object.defineProperty(n,"deriveBIP44AddressKey",{enumerable:!0,get:function(){return c.deriveBIP44AddressKey}}),Object.defineProperty(n,"getBIP44AddressKeyDeriver",{enumerable:!0,get:function(){return c.getBIP44AddressKeyDeriver}}),s(e("./constants"),n)}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/index.js"}],[1261,{"./constants":1248,"./curves":1251,"@metamask/scure-bip39/dist/wordlists/english":1327,"@metamask/utils":1269,"@noble/hashes/ripemd160":1384,"@noble/hashes/sha256":1385,"@scure/base":1394},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.numberToUint32=n.validateCurve=n.mnemonicPhraseToBytes=n.getFingerprint=n.encodeBase58check=n.decodeBase58check=n.getBytesUnsafe=n.getBytes=n.isValidInteger=n.isValidBytesKey=n.nullableHexStringToBytes=n.hexStringToBytes=n.isHardened=n.isValidBIP32Index=n.validateBIP32Index=n.getBIP32NodeToken=n.getUnhardenedBIP32NodeToken=n.getHardenedBIP32NodeToken=n.getBIP44CoinTypeToAddressPathTuple=n.getBIP44ChangePathString=n.getBIP44CoinTypePathString=void 0;const r=e("@metamask/scure-bip39/dist/wordlists/english"),s=e("@metamask/utils"),i=e("@noble/hashes/ripemd160"),o=e("@noble/hashes/sha256"),a=e("@scure/base"),c=e("./constants"),u=e("./curves");function l(e){return f(e),`${d(e)}'`}function d(e){return f(e),`bip32:${e}`}function h(e){if("number"==typeof e)return d(e);if(!e||!Number.isInteger(e.index)||"boolean"!=typeof e.hardened)throw new Error("Invalid BIP-32 index: Must be an object containing the index and whether it is hardened.");return e.hardened?l(e.index):d(e.index)}function f(e){if(!p(e))throw new Error("Invalid BIP-32 index: Must be a non-negative integer.")}function p(e){return y(e)&&e<=c.MAX_BIP_32_INDEX}function m(e){return e instanceof Uint8Array?e:(0,s.hexToBytes)(e)}function g(e,t){if(e.length!==t)return!1;for(const t of e)if(0!==t)return!0;return!1}function y(e){return"number"==typeof e&&Number.isInteger(e)&&e>=0}function b(e,t){if(!g(e,t))throw new Error(`Invalid value: Must be a non-zero ${t}-byte byte array.`)}n.getBIP44CoinTypePathString=function(e){return`m / ${c.BIP44PurposeNodeToken} / ${l(e)}`},n.getBIP44ChangePathString=function(e,t){var n,r;return`${e} / ${l(null!==(n=t.account)&&void 0!==n?n:0)} / ${h(null!==(r=t.change)&&void 0!==r?r:0)}`},n.getBIP44CoinTypeToAddressPathTuple=function({account:e=0,change:t=0,address_index:n}){return[l(e),h(t),h(n)]},n.getHardenedBIP32NodeToken=l,n.getUnhardenedBIP32NodeToken=d,n.getBIP32NodeToken=h,n.validateBIP32Index=f,n.isValidBIP32Index=p,n.isHardened=function(e){return e.endsWith("'")},n.hexStringToBytes=m,n.nullableHexStringToBytes=function(e){return e!==undefined?m(e):undefined},n.isValidBytesKey=g,n.isValidInteger=y,n.getBytes=function(e,t){if(e instanceof Uint8Array)return b(e,t),e;if("string"==typeof e){const n=(0,s.hexToBytes)(e);return b(n,t),n}throw new Error("Invalid value: Expected an instance of Uint8Array or hexadecimal string.")},n.getBytesUnsafe=function e(t,n){if(t instanceof Uint8Array)return(0,s.assert)(t.length===n,`Invalid value: Must be a ${n}-byte byte array.`),t;if("string"==typeof t)return e((0,s.hexToBytes)(t),n);throw new Error("Invalid value: Expected an instance of Uint8Array or hexadecimal string.")};n.decodeBase58check=e=>{const t=(0,a.base58check)(o.sha256);try{return t.decode(e)}catch(e){throw new Error("Invalid extended key: Value is not base58-encoded, or the checksum is invalid.")}};n.encodeBase58check=e=>(0,a.base58check)(o.sha256).encode(e);n.getFingerprint=e=>{if(!g(e,33))throw new Error("Invalid public key: The key must be a 33-byte, non-zero byte array.");const t=(0,i.ripemd160)((0,o.sha256)(e));return(0,s.createDataView)(t).getUint32(0,!1)},n.mnemonicPhraseToBytes=function(e){const t=e.split(" ").map((e=>{const t=r.wordlist.indexOf(e);return(0,s.assert)(-1!==t,`Invalid mnemonic phrase: Unknown word "${e}".`),t}));return new Uint8Array(new Uint16Array(t).buffer)},n.validateCurve=function(e){if(!e||"string"!=typeof e)throw new Error("Invalid curve: Must specify a curve.");if(!Object.keys(u.curves).includes(e))throw new Error(`Invalid curve: Only the following curves are supported: ${Object.keys(u.curves).join(", ")}.`)},n.numberToUint32=function(e){const t=new Uint8Array(4);return(0,s.createDataView)(t).setUint32(0,e,!1),t}}}},{package:"@metamask/key-tree",file:"node_modules/@metamask/key-tree/dist/utils.js"}],[1262,{superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.assertExhaustive=n.assertStruct=n.assert=n.AssertionError=void 0;const r=e("superstruct");function s(e,t){return n=e,Boolean("string"==typeof(null===(s=null===(r=null==n?void 0:n.prototype)||void 0===r?void 0:r.constructor)||void 0===s?void 0:s.name))?new e({message:t}):e({message:t});var n,r,s}class i extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}n.AssertionError=i,n.assert=function(e,t="Assertion failed.",n=i){if(!e){if(t instanceof Error)throw t;throw s(n,t)}},n.assertStruct=function(e,t,n="Assertion failed",o=i){try{(0,r.assert)(e,t)}catch(e){throw s(o,`${n}: ${function(e){const t=function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}(e)}.`)}},n.assertExhaustive=function(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/assert.js"}],[1263,{"./assert":1262,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.base64=void 0;const r=e("superstruct"),s=e("./assert");n.base64=(e,t={})=>{var n,i;const o=null!==(n=t.paddingRequired)&&void 0!==n&&n,a=null!==(i=t.characterSet)&&void 0!==i?i:"base64";let c,u;return"base64"===a?c=String.raw`[A-Za-z0-9+\/]`:((0,s.assert)("base64url"===a),c=String.raw`[-_A-Za-z0-9]`),u=o?new RegExp(`^(?:${c}{4})*(?:${c}{3}=|${c}{2}==)?$`,"u"):new RegExp(`^(?:${c}{4})*(?:${c}{2,3}|${c}{3}=|${c}{2}==)?$`,"u"),(0,r.pattern)(e,u)}}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/base64.js"}],[1264,{"./assert":1262,"./hex":1268,buffer:1943},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.createDataView=n.concatBytes=n.valueToBytes=n.stringToBytes=n.numberToBytes=n.signedBigIntToBytes=n.bigIntToBytes=n.hexToBytes=n.bytesToString=n.bytesToNumber=n.bytesToSignedBigInt=n.bytesToBigInt=n.bytesToHex=n.assertIsBytes=n.isBytes=void 0;const r=e("./assert"),s=e("./hex");const i=function(){const e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function o(e){return e instanceof Uint8Array}function a(e){(0,r.assert)(o(e),"Value must be a Uint8Array.")}function c(e){if(a(e),0===e.length)return"0x";const t=i(),n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=t[e[r]];return(0,s.add0x)(n.join(""))}function u(e){a(e);const t=c(e);return BigInt(t)}function l(e){var t;if("0x"===(null===(t=null==e?void 0:e.toLowerCase)||void 0===t?void 0:t.call(e)))return new Uint8Array;(0,s.assertIsHexString)(e);const n=(0,s.remove0x)(e).toLowerCase(),r=n.length%2==0?n:`0${n}`,i=new Uint8Array(r.length/2);for(let e=0;e<i.length;e++){const t=r.charCodeAt(2*e),n=r.charCodeAt(2*e+1),s=t-(t<58?48:87),o=n-(n<58?48:87);i[e]=16*s+o}return i}function d(e){(0,r.assert)("bigint"==typeof e,"Value must be a bigint."),(0,r.assert)(e>=BigInt(0),"Value must be a non-negative bigint.");return l(e.toString(16))}function h(e){(0,r.assert)("number"==typeof e,"Value must be a number."),(0,r.assert)(e>=0,"Value must be a non-negative number."),(0,r.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");return l(e.toString(16))}function f(e){return(0,r.assert)("string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function p(e){if("bigint"==typeof e)return d(e);if("number"==typeof e)return h(e);if("string"==typeof e)return e.startsWith("0x")?l(e):f(e);if(o(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}n.isBytes=o,n.assertIsBytes=a,n.bytesToHex=c,n.bytesToBigInt=u,n.bytesToSignedBigInt=function(e){a(e);let t=BigInt(0);for(const n of e)t=(t<<BigInt(8))+BigInt(n);return BigInt.asIntN(8*e.length,t)},n.bytesToNumber=function(e){a(e);const t=u(e);return(0,r.assert)(t<=BigInt(Number.MAX_SAFE_INTEGER),"Number is not a safe integer. Use `bytesToBigInt` instead."),Number(t)},n.bytesToString=function(e){return a(e),(new TextDecoder).decode(e)},n.hexToBytes=l,n.bigIntToBytes=d,n.signedBigIntToBytes=function(e,t){(0,r.assert)("bigint"==typeof e,"Value must be a bigint."),(0,r.assert)("number"==typeof t,"Byte length must be a number."),(0,r.assert)(t>0,"Byte length must be greater than 0."),(0,r.assert)(function(e,t){(0,r.assert)(t>0);const n=e>>BigInt(31);return!((~e&n)+(e&~n)>>BigInt(8*t-1))}(e,t),"Byte length is too small to represent the given value.");let n=e;const s=new Uint8Array(t);for(let e=0;e<s.length;e++)s[e]=Number(BigInt.asUintN(8,n)),n>>=BigInt(8);return s.reverse()},n.numberToBytes=h,n.stringToBytes=f,n.valueToBytes=p,n.concatBytes=function(e){const t=new Array(e.length);let n=0;for(let r=0;r<e.length;r++){const s=p(e[r]);t[r]=s,n+=s.length}const r=new Uint8Array(n);for(let e=0,n=0;e<t.length;e++)r.set(t[e],n),n+=t[e].length;return r},n.createDataView=function(e){if(void 0!==t&&e instanceof t){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new DataView(t)}return new DataView(e.buffer,e.byteOffset,e.byteLength)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/bytes.js"}],[1265,{"./base64":1263,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ChecksumStruct=void 0;const r=e("superstruct"),s=e("./base64");n.ChecksumStruct=(0,r.size)((0,s.base64)((0,r.string)(),{paddingRequired:!0}),44,44)}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/checksum.js"}],[1266,{"./assert":1262,"./bytes":1264,"./hex":1268,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createHex=n.createBytes=n.createBigInt=n.createNumber=void 0;const r=e("superstruct"),s=e("./assert"),i=e("./bytes"),o=e("./hex"),a=(0,r.union)([(0,r.number)(),(0,r.bigint)(),(0,r.string)(),o.StrictHexStruct]),c=(0,r.coerce)((0,r.number)(),a,Number),u=(0,r.coerce)((0,r.bigint)(),a,BigInt),l=((0,r.union)([o.StrictHexStruct,(0,r.instance)(Uint8Array)]),(0,r.coerce)((0,r.instance)(Uint8Array),(0,r.union)([o.StrictHexStruct]),i.hexToBytes)),d=(0,r.coerce)(o.StrictHexStruct,(0,r.instance)(Uint8Array),i.bytesToHex);n.createNumber=function(e){try{const t=(0,r.create)(e,c);return(0,s.assert)(Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){if(t instanceof r.StructError)throw new Error(`Expected a number-like value, got "${e}".`);throw t}},n.createBigInt=function(e){try{return(0,r.create)(e,u)}catch(e){if(e instanceof r.StructError)throw new Error(`Expected a number-like value, got "${String(e.value)}".`);throw e}},n.createBytes=function(e){if("string"==typeof e&&"0x"===e.toLowerCase())return new Uint8Array;try{return(0,r.create)(e,l)}catch(e){if(e instanceof r.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}},n.createHex=function(e){if(e instanceof Uint8Array&&0===e.length||"string"==typeof e&&"0x"===e.toLowerCase())return"0x";try{return(0,r.create)(e,d)}catch(e){if(e instanceof r.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}}}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/coercers.js"}],[1267,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!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"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},o=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.FrozenSet=n.FrozenMap=void 0;class a{constructor(e){r.set(this,void 0),i(this,r,new Map(e),"f"),Object.freeze(this)}get size(){return o(this,r,"f").size}[(r=new WeakMap,Symbol.iterator)](){return o(this,r,"f")[Symbol.iterator]()}entries(){return o(this,r,"f").entries()}forEach(e,t){return o(this,r,"f").forEach(((n,r,s)=>e.call(t,n,r,this)))}get(e){return o(this,r,"f").get(e)}has(e){return o(this,r,"f").has(e)}keys(){return o(this,r,"f").keys()}values(){return o(this,r,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map((([e,t])=>`${String(e)} => ${String(t)}`)).join(", ")} `:""}}`}}n.FrozenMap=a;class c{constructor(e){s.set(this,void 0),i(this,s,new Set(e),"f"),Object.freeze(this)}get size(){return o(this,s,"f").size}[(s=new WeakMap,Symbol.iterator)](){return o(this,s,"f")[Symbol.iterator]()}entries(){return o(this,s,"f").entries()}forEach(e,t){return o(this,s,"f").forEach(((n,r,s)=>e.call(t,n,r,this)))}has(e){return o(this,s,"f").has(e)}keys(){return o(this,s,"f").keys()}values(){return o(this,s,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map((e=>String(e))).join(", ")} `:""}}`}}n.FrozenSet=c,Object.freeze(a),Object.freeze(a.prototype),Object.freeze(c),Object.freeze(c.prototype)}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/collections.js"}],[1268,{"./assert":1262,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.remove0x=n.add0x=n.assertIsStrictHexString=n.assertIsHexString=n.isStrictHexString=n.isHexString=n.StrictHexStruct=n.HexStruct=void 0;const r=e("superstruct"),s=e("./assert");function i(e){return(0,r.is)(e,n.HexStruct)}function o(e){return(0,r.is)(e,n.StrictHexStruct)}n.HexStruct=(0,r.pattern)((0,r.string)(),/^(?:0x)?[0-9a-f]+$/iu),n.StrictHexStruct=(0,r.pattern)((0,r.string)(),/^0x[0-9a-f]+$/iu),n.isHexString=i,n.isStrictHexString=o,n.assertIsHexString=function(e){(0,s.assert)(i(e),"Value must be a hexadecimal string.")},n.assertIsStrictHexString=function(e){(0,s.assert)(o(e),'Value must be a hexadecimal string, starting with "0x".')},n.add0x=function(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`},n.remove0x=function(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/hex.js"}],[1269,{"./assert":1262,"./base64":1263,"./bytes":1264,"./checksum":1265,"./coercers":1266,"./collections":1267,"./hex":1268,"./json":1270,"./logging":1271,"./misc":1272,"./number":1273,"./opaque":1274,"./time":1275,"./versions":1276},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./assert"),n),s(e("./base64"),n),s(e("./bytes"),n),s(e("./checksum"),n),s(e("./coercers"),n),s(e("./collections"),n),s(e("./hex"),n),s(e("./json"),n),s(e("./logging"),n),s(e("./misc"),n),s(e("./number"),n),s(e("./opaque"),n),s(e("./time"),n),s(e("./versions"),n)}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/index.js"}],[127,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:45,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=45;const n=t.data;return t.data=function(e){var t;i.includes(null==e||null===(t=e.PreferencesController)||void 0===t?void 0:t.ipfsGateway)&&(e.PreferencesController.ipfsGateway="dweb.link");return e}(n),t}};n.default=s;const i=["ipfs.io","ipfs.dweb.link"]}}},{package:"$root$",file:"app/scripts/migrations/045.js"}],[1270,{"./assert":1262,"./misc":1272,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateJsonAndGetSize=n.getJsonRpcIdValidator=n.assertIsJsonRpcError=n.isJsonRpcError=n.assertIsJsonRpcFailure=n.isJsonRpcFailure=n.assertIsJsonRpcSuccess=n.isJsonRpcSuccess=n.assertIsJsonRpcResponse=n.isJsonRpcResponse=n.assertIsPendingJsonRpcResponse=n.isPendingJsonRpcResponse=n.JsonRpcResponseStruct=n.JsonRpcFailureStruct=n.JsonRpcSuccessStruct=n.PendingJsonRpcResponseStruct=n.assertIsJsonRpcRequest=n.isJsonRpcRequest=n.assertIsJsonRpcNotification=n.isJsonRpcNotification=n.JsonRpcNotificationStruct=n.JsonRpcRequestStruct=n.JsonRpcParamsStruct=n.JsonRpcErrorStruct=n.JsonRpcIdStruct=n.JsonRpcVersionStruct=n.jsonrpc2=n.isValidJson=n.JsonStruct=void 0;const r=e("superstruct"),s=e("./assert"),i=e("./misc");function o(e,t=!1){const n=new Set;return function e(t,r){if(t===undefined)return[!1,0];if(null===t)return[!0,r?0:i.JsonSize.Null];const s=typeof t;try{if("function"===s)return[!1,0];if("string"===s||t instanceof String)return[!0,r?0:(0,i.calculateStringSize)(t)+2*i.JsonSize.Quote];if("boolean"===s||t instanceof Boolean)return r?[!0,0]:[!0,1==t?i.JsonSize.True:i.JsonSize.False];if("number"===s||t instanceof Number)return r?[!0,0]:[!0,(0,i.calculateNumberSize)(t)];if(t instanceof Date)return r?[!0,0]:[!0,isNaN(t.getDate())?i.JsonSize.Null:i.JsonSize.Date+2*i.JsonSize.Quote]}catch(e){return[!1,0]}if(!(0,i.isPlainObject)(t)&&!Array.isArray(t))return[!1,0];if(n.has(t))return[!1,0];n.add(t);try{return[!0,Object.entries(t).reduce(((s,[o,a],c,u)=>{let[l,d]=e(a,r);if(!l)throw new Error("JSON validation did not pass. Validation process stopped.");if(n.delete(t),r)return 0;return s+(Array.isArray(t)?0:o.length+i.JsonSize.Comma+2*i.JsonSize.Colon)+d+(c<u.length-1?i.JsonSize.Comma:0)}),r?0:2*i.JsonSize.Wrapper)]}catch(e){return[!1,0]}}(e,t)}n.JsonStruct=(0,r.define)("Json",(e=>{const[t]=o(e,!0);return!!t||"Expected a valid JSON-serializable value"})),n.isValidJson=function(e){return(0,r.is)(e,n.JsonStruct)},n.jsonrpc2="2.0",n.JsonRpcVersionStruct=(0,r.literal)(n.jsonrpc2),n.JsonRpcIdStruct=(0,r.nullable)((0,r.union)([(0,r.number)(),(0,r.string)()])),n.JsonRpcErrorStruct=(0,r.object)({code:(0,r.integer)(),message:(0,r.string)(),data:(0,r.optional)(n.JsonStruct),stack:(0,r.optional)((0,r.string)())}),n.JsonRpcParamsStruct=(0,r.optional)((0,r.union)([(0,r.record)((0,r.string)(),n.JsonStruct),(0,r.array)(n.JsonStruct)])),n.JsonRpcRequestStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,method:(0,r.string)(),params:n.JsonRpcParamsStruct}),n.JsonRpcNotificationStruct=(0,r.omit)(n.JsonRpcRequestStruct,["id"]),n.isJsonRpcNotification=function(e){return(0,r.is)(e,n.JsonRpcNotificationStruct)},n.assertIsJsonRpcNotification=function(e,t){(0,s.assertStruct)(e,n.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",t)},n.isJsonRpcRequest=function(e){return(0,r.is)(e,n.JsonRpcRequestStruct)},n.assertIsJsonRpcRequest=function(e,t){(0,s.assertStruct)(e,n.JsonRpcRequestStruct,"Invalid JSON-RPC request",t)},n.PendingJsonRpcResponseStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,result:(0,r.optional)((0,r.unknown)()),error:(0,r.optional)(n.JsonRpcErrorStruct)}),n.JsonRpcSuccessStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,result:n.JsonStruct}),n.JsonRpcFailureStruct=(0,r.object)({id:n.JsonRpcIdStruct,jsonrpc:n.JsonRpcVersionStruct,error:n.JsonRpcErrorStruct}),n.JsonRpcResponseStruct=(0,r.union)([n.JsonRpcSuccessStruct,n.JsonRpcFailureStruct]),n.isPendingJsonRpcResponse=function(e){return(0,r.is)(e,n.PendingJsonRpcResponseStruct)},n.assertIsPendingJsonRpcResponse=function(e,t){(0,s.assertStruct)(e,n.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",t)},n.isJsonRpcResponse=function(e){return(0,r.is)(e,n.JsonRpcResponseStruct)},n.assertIsJsonRpcResponse=function(e,t){(0,s.assertStruct)(e,n.JsonRpcResponseStruct,"Invalid JSON-RPC response",t)},n.isJsonRpcSuccess=function(e){return(0,r.is)(e,n.JsonRpcSuccessStruct)},n.assertIsJsonRpcSuccess=function(e,t){(0,s.assertStruct)(e,n.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",t)},n.isJsonRpcFailure=function(e){return(0,r.is)(e,n.JsonRpcFailureStruct)},n.assertIsJsonRpcFailure=function(e,t){(0,s.assertStruct)(e,n.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",t)},n.isJsonRpcError=function(e){return(0,r.is)(e,n.JsonRpcErrorStruct)},n.assertIsJsonRpcError=function(e,t){(0,s.assertStruct)(e,n.JsonRpcErrorStruct,"Invalid JSON-RPC error",t)},n.getJsonRpcIdValidator=function(e){const{permitEmptyString:t,permitFractions:n,permitNull:r}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},e);return e=>Boolean("number"==typeof e&&(n||Number.isInteger(e))||"string"==typeof e&&(t||e.length>0)||r&&null===e)},n.validateJsonAndGetSize=o}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/json.js"}],[1271,{debug:2075},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.createModuleLogger=n.createProjectLogger=void 0;const s=(0,r(e("debug")).default)("metamask");n.createProjectLogger=function(e){return s.extend(e)},n.createModuleLogger=function(e,t){return e.extend(t)}}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/logging.js"}],[1272,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.calculateNumberSize=n.calculateStringSize=n.isASCII=n.isPlainObject=n.ESCAPE_CHARACTERS_REGEXP=n.JsonSize=n.hasProperty=n.isObject=n.isNullOrUndefined=n.isNonEmptyArray=void 0,n.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},n.isNullOrUndefined=function(e){return null===e||e===undefined},n.isObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)};function r(e){return e.charCodeAt(0)<=127}n.hasProperty=(e,t)=>Object.hasOwnProperty.call(e,t),function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(n.JsonSize||(n.JsonSize={})),n.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu,n.isPlainObject=function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}},n.isASCII=r,n.calculateStringSize=function(e){var t;return e.split("").reduce(((e,t)=>r(t)?e+1:e+2),0)+(null!==(t=e.match(n.ESCAPE_CHARACTERS_REGEXP))&&void 0!==t?t:[]).length},n.calculateNumberSize=function(e){return e.toString().length}}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/misc.js"}],[1273,{"./assert":1262,"./hex":1268},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.hexToBigInt=n.hexToNumber=n.bigIntToHex=n.numberToHex=void 0;const r=e("./assert"),s=e("./hex");n.numberToHex=e=>((0,r.assert)("number"==typeof e,"Value must be a number."),(0,r.assert)(e>=0,"Value must be a non-negative number."),(0,r.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,s.add0x)(e.toString(16)));n.bigIntToHex=e=>((0,r.assert)("bigint"==typeof e,"Value must be a bigint."),(0,r.assert)(e>=0,"Value must be a non-negative bigint."),(0,s.add0x)(e.toString(16)));n.hexToNumber=e=>{(0,s.assertIsHexString)(e);const t=parseInt(e,16);return(0,r.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};n.hexToBigInt=e=>((0,s.assertIsHexString)(e),BigInt((0,s.add0x)(e)))}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/number.js"}],[1274,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0})}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/opaque.js"}],[1275,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.timeSince=n.inMilliseconds=n.Duration=void 0,function(e){e[e.Millisecond=1]="Millisecond",e[e.Second=1e3]="Second",e[e.Minute=6e4]="Minute",e[e.Hour=36e5]="Hour",e[e.Day=864e5]="Day",e[e.Week=6048e5]="Week",e[e.Year=31536e6]="Year"}(n.Duration||(n.Duration={}));const r=(e,t)=>{if(!(e=>Number.isInteger(e)&&e>=0)(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};n.inMilliseconds=function(e,t){return r(e,"count"),e*t},n.timeSince=function(e){return r(e,"timestamp"),Date.now()-e}}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/time.js"}],[1276,{"./assert":1262,semver:3249,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.satisfiesVersionRange=n.gtRange=n.gtVersion=n.assertIsSemVerRange=n.assertIsSemVerVersion=n.isValidSemVerRange=n.isValidSemVerVersion=n.VersionRangeStruct=n.VersionStruct=void 0;const r=e("semver"),s=e("superstruct"),i=e("./assert");n.VersionStruct=(0,s.refine)((0,s.string)(),"Version",(e=>null!==(0,r.valid)(e)||`Expected SemVer version, got "${e}"`)),n.VersionRangeStruct=(0,s.refine)((0,s.string)(),"Version range",(e=>null!==(0,r.validRange)(e)||`Expected SemVer range, got "${e}"`)),n.isValidSemVerVersion=function(e){return(0,s.is)(e,n.VersionStruct)},n.isValidSemVerRange=function(e){return(0,s.is)(e,n.VersionRangeStruct)},n.assertIsSemVerVersion=function(e){(0,i.assertStruct)(e,n.VersionStruct)},n.assertIsSemVerRange=function(e){(0,i.assertStruct)(e,n.VersionRangeStruct)},n.gtVersion=function(e,t){return(0,r.gt)(e,t)},n.gtRange=function(e,t){return(0,r.gtr)(e,t)},n.satisfiesVersionRange=function(e,t){return(0,r.satisfies)(e,t,{includePrerelease:!0})}}}},{package:"@metamask/key-tree>@metamask/utils",file:"node_modules/@metamask/key-tree/node_modules/@metamask/utils/dist/versions.js"}],[128,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:46,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=46;const n=t.data;return t.data=function(e){void 0!==(null==e?void 0:e.ABTestController)&&delete e.ABTestController;return e}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/046.js"}],[1280,{"@metamask/base-controller":1289,events:1944},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AbstractMessageManager=void 0;const r=e("events"),s=e("@metamask/base-controller");class i extends s.BaseController{constructor(e,t){super(e,t),this.hub=new r.EventEmitter,this.name="AbstractMessageManager",this.defaultState={unapprovedMessages:{},unapprovedMessagesCount:0},this.messages=[],this.initialize()}saveMessageList(){const e=this.getUnapprovedMessages(),t=this.getUnapprovedMessagesCount();this.update({unapprovedMessages:e,unapprovedMessagesCount:t}),this.hub.emit("updateBadge")}setMessageStatus(e,t){const n=this.getMessage(e);if(!n)throw new Error(`${this.name}: Message not found for id: ${e}.`);n.status=t,this.updateMessage(n),this.hub.emit(`${e}:${t}`,n),"rejected"!==t&&"signed"!==t&&"errored"!==t||this.hub.emit(`${e}:finished`,n)}updateMessage(e){const t=this.messages.findIndex((t=>e.id===t.id));-1!==t&&(this.messages[t]=e),this.saveMessageList()}getUnapprovedMessagesCount(){return Object.keys(this.getUnapprovedMessages()).length}getUnapprovedMessages(){return this.messages.filter((e=>"unapproved"===e.status)).reduce(((e,t)=>(e[t.id]=t,e)),{})}addMessage(e){this.messages.push(e),this.saveMessageList()}getMessage(e){return this.messages.find((t=>t.id===e))}approveMessage(e){return this.setMessageStatusApproved(e.metamaskId),this.prepMessageForSigning(e)}setMessageStatusApproved(e){this.setMessageStatus(e,"approved")}setMessageStatusSigned(e,t){const n=this.getMessage(e);n&&(n.rawSig=t,this.updateMessage(n),this.setMessageStatus(e,"signed"))}rejectMessage(e){this.setMessageStatus(e,"rejected")}}n.AbstractMessageManager=i,n.default=i}}},{package:"@metamask/message-manager",file:"node_modules/@metamask/message-manager/dist/AbstractMessageManager.js"}],[1281,{"./AbstractMessageManager":1280,"./utils":1285,uuid:3351},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MessageManager=void 0;const r=e("uuid"),s=e("./AbstractMessageManager"),i=e("./utils");class o extends s.AbstractMessageManager{constructor(){super(...arguments),this.name="MessageManager"}addUnapprovedMessageAsync(e,t){return new Promise(((n,r)=>{(0,i.validateSignMessageData)(e);const s=this.addUnapprovedMessage(e,t);this.hub.once(`${s}:finished`,(t=>{switch(t.status){case"signed":return n(t.rawSig);case"rejected":return r(new Error("MetaMask Message Signature: User denied message signature."));default:return r(new Error(`MetaMask Message Signature: Unknown problem: ${JSON.stringify(e)}`))}}))}))}addUnapprovedMessage(e,t){t&&(e.origin=t.origin),e.data=(0,i.normalizeMessageData)(e.data);const n=(0,r.v1)(),s={id:n,messageParams:e,status:"unapproved",time:Date.now(),type:"eth_sign"};return this.addMessage(s),this.hub.emit("unapprovedMessage",Object.assign(Object.assign({},e),{metamaskId:n})),n}prepMessageForSigning(e){return delete e.metamaskId,Promise.resolve(e)}}n.MessageManager=o,n.default=o}}},{package:"@metamask/message-manager",file:"node_modules/@metamask/message-manager/dist/MessageManager.js"}],[1282,{"./AbstractMessageManager":1280,"./utils":1285,"@metamask/controller-utils":1084,uuid:3351},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.PersonalMessageManager=void 0;const r=e("uuid"),s=e("@metamask/controller-utils"),i=e("./utils"),o=e("./AbstractMessageManager");class a extends o.AbstractMessageManager{constructor(){super(...arguments),this.name="PersonalMessageManager"}addUnapprovedMessageAsync(e,t){return new Promise(((n,r)=>{(0,i.validateSignMessageData)(e);const s=this.addUnapprovedMessage(e,t);this.hub.once(`${s}:finished`,(t=>{switch(t.status){case"signed":return n(t.rawSig);case"rejected":return r(new Error("MetaMask Personal Message Signature: User denied message signature."));default:return r(new Error(`MetaMask Personal Message Signature: Unknown problem: ${JSON.stringify(e)}`))}}))}))}addUnapprovedMessage(e,t){t&&(e.origin=t.origin),e.data=(0,i.normalizeMessageData)(e.data);const n=(0,s.detectSIWE)(e),o=Object.assign(Object.assign({},e),{siwe:n}),a=(0,r.v1)(),c={id:a,messageParams:o,status:"unapproved",time:Date.now(),type:"personal_sign"};return this.addMessage(c),this.hub.emit("unapprovedMessage",Object.assign(Object.assign({},o),{metamaskId:a})),a}prepMessageForSigning(e){return delete e.metamaskId,Promise.resolve(e)}}n.PersonalMessageManager=a,n.default=a}}},{package:"@metamask/message-manager",file:"node_modules/@metamask/message-manager/dist/PersonalMessageManager.js"}],[1283,{"./AbstractMessageManager":1280,"./utils":1285,uuid:3351},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.TypedMessageManager=void 0;const r=e("uuid"),s=e("./utils"),i=e("./AbstractMessageManager");class o extends i.AbstractMessageManager{constructor(){super(...arguments),this.name="TypedMessageManager"}addUnapprovedMessageAsync(e,t,n){return new Promise(((r,i)=>{"V1"===t&&(0,s.validateTypedSignMessageDataV1)(e),"V3"===t&&(0,s.validateTypedSignMessageDataV3)(e);const o=this.addUnapprovedMessage(e,t,n);this.hub.once(`${o}:finished`,(t=>{switch(t.status){case"signed":return r(t.rawSig);case"rejected":return i(new Error("MetaMask Typed Message Signature: User denied message signature."));case"errored":return i(new Error(`MetaMask Typed Message Signature: ${t.error}`));default:return i(new Error(`MetaMask Typed Message Signature: Unknown problem: ${JSON.stringify(e)}`))}}))}))}addUnapprovedMessage(e,t,n){const s=(0,r.v1)(),i=Object.assign(Object.assign({},e),{metamaskId:s,version:t});n&&(e.origin=n.origin);const o={id:s,messageParams:e,status:"unapproved",time:Date.now(),type:"eth_signTypedData"};return this.addMessage(o),this.hub.emit("unapprovedMessage",i),s}setMessageStatusErrored(e,t){const n=this.getMessage(e);n&&(n.error=t,this.updateMessage(n),this.setMessageStatus(e,"errored"))}prepMessageForSigning(e){return delete e.metamaskId,delete e.version,Promise.resolve(e)}}n.TypedMessageManager=o,n.default=o}}},{package:"@metamask/message-manager",file:"node_modules/@metamask/message-manager/dist/TypedMessageManager.js"}],[1284,{"./MessageManager":1281,"./PersonalMessageManager":1282,"./TypedMessageManager":1283},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./MessageManager"),n),s(e("./PersonalMessageManager"),n),s(e("./TypedMessageManager"),n)}}},{package:"@metamask/message-manager",file:"node_modules/@metamask/message-manager/dist/index.js"}],[1285,{"@metamask/controller-utils":1084,buffer:1943,"eth-sig-util":2172,"ethereumjs-util":2231,jsonschema:2736},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.validateTypedSignMessageDataV3=n.validateTypedSignMessageDataV1=n.validateSignMessageData=n.normalizeMessageData=void 0;const r=e("ethereumjs-util"),s=e("eth-sig-util"),i=e("jsonschema"),o=e("@metamask/controller-utils"),a=/^[0-9A-Fa-f]+$/gu;n.normalizeMessageData=function(e){try{const t=(0,r.stripHexPrefix)(e);if(t.match(a))return(0,r.addHexPrefix)(t)}catch(e){}return(0,r.bufferToHex)(t.from(e,"utf8"))},n.validateSignMessageData=function(e){const{from:t,data:n}=e;if(!t||"string"!=typeof t||!(0,o.isValidHexAddress)(t))throw new Error(`Invalid "from" address: ${t} must be a valid string.`);if(!n||"string"!=typeof n)throw new Error(`Invalid message "data": ${n} must be a valid string.`)},n.validateTypedSignMessageDataV1=function(e){if(!e.from||"string"!=typeof e.from||!(0,o.isValidHexAddress)(e.from))throw new Error(`Invalid "from" address: ${e.from} must be a valid string.`);if(!e.data||!Array.isArray(e.data))throw new Error(`Invalid message "data": ${e.data} must be a valid array.`);try{(0,s.typedSignatureHash)(e.data)}catch(e){throw new Error("Expected EIP712 typed data.")}},n.validateTypedSignMessageDataV3=function(e){if(!e.from||"string"!=typeof e.from||!(0,o.isValidHexAddress)(e.from))throw new Error(`Invalid "from" address: ${e.from} must be a valid string.`);if(!e.data||"string"!=typeof e.data)throw new Error(`Invalid message "data": ${e.data} must be a valid array.`);let t;try{t=JSON.parse(e.data)}catch(e){throw new Error("Data must be passed as a valid JSON string.")}if((0,i.validate)(t,s.TYPED_MESSAGE_SCHEMA).errors.length>0)throw new Error("Data must conform to EIP-712 schema. See https://git.io/fNtcx.")}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/message-manager",file:"node_modules/@metamask/message-manager/dist/utils.js"}],[1286,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BaseController=void 0;class r{constructor(e={},t={}){this.defaultConfig={},this.defaultState={},this.disabled=!1,this.name="BaseController",this.internalConfig=this.defaultConfig,this.internalState=this.defaultState,this.internalListeners=[],this.initialState=t,this.initialConfig=e}initialize(){return this.internalState=this.defaultState,this.internalConfig=this.defaultConfig,this.configure(this.initialConfig),this.update(this.initialState),this}get config(){return this.internalConfig}get state(){return this.internalState}configure(e,t=!1,n=!0){if(n){this.internalConfig=t?e:Object.assign(this.internalConfig,e);for(const e in this.internalConfig)void 0!==this.internalConfig[e]&&(this[e]=this.internalConfig[e])}else for(const t in e)void 0!==this.internalConfig[t]&&(this.internalConfig[t]=e[t],this[t]=e[t])}notify(){this.disabled||this.internalListeners.forEach((e=>{e(this.internalState)}))}subscribe(e){this.internalListeners.push(e)}unsubscribe(e){const t=this.internalListeners.findIndex((t=>e===t));return t>-1&&this.internalListeners.splice(t,1),t>-1}update(e,t=!1){this.internalState=t?Object.assign({},e):Object.assign({},this.internalState,e),this.notify()}}n.BaseController=r,n.default=r}}},{package:"@metamask/message-manager>@metamask/base-controller",file:"node_modules/@metamask/message-manager/node_modules/@metamask/base-controller/dist/BaseController.js"}],[1287,{immer:2694},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseController=void 0;const r=e("immer");(0,r.enablePatches)();function s(e,t,n){return Object.keys(e).reduce(((r,s)=>{const i=t[s][n],o=e[s];return"function"==typeof i?r[s]=i(o):i&&(r[s]=o),r}),{})}n.BaseController=class{constructor({messenger:e,metadata:t,name:n,state:r}){this.messagingSystem=e,this.name=n,this.internalState=r,this.metadata=t,this.messagingSystem.registerActionHandler(`${n}:getState`,(()=>this.state))}get state(){return this.internalState}set state(e){throw new Error("Controller state cannot be directly mutated; use 'update' method instead.")}update(e){const[t,n,s]=r.produceWithPatches(this.internalState,e);return this.internalState=t,this.messagingSystem.publish(`${this.name}:stateChange`,t,n),{nextState:t,patches:n,inversePatches:s}}applyPatches(e){const t=(0,r.applyPatches)(this.internalState,e);this.internalState=t,this.messagingSystem.publish(`${this.name}:stateChange`,t,e)}destroy(){this.messagingSystem.clearEventSubscriptions(`${this.name}:stateChange`)}},n.getAnonymizedState=function(e,t){return s(e,t,"anonymous")},n.getPersistentState=function(e,t){return s(e,t,"persist")}}}},{package:"@metamask/message-manager>@metamask/base-controller",file:"node_modules/@metamask/message-manager/node_modules/@metamask/base-controller/dist/BaseControllerV2.js"}],[1288,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ControllerMessenger=n.RestrictedControllerMessenger=void 0;class r{constructor({controllerMessenger:e,name:t,allowedActions:n,allowedEvents:r}){this.controllerMessenger=e,this.controllerName=t,this.allowedActions=n||null,this.allowedEvents=r||null}registerActionHandler(e,t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed registering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.registerActionHandler(e,t)}unregisterActionHandler(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed unregistering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.unregisterActionHandler(e)}call(e,...t){if(null===this.allowedActions)throw new Error("No actions allowed");if(!this.allowedActions.includes(e))throw new Error(`Action missing from allow list: ${e}`);return this.controllerMessenger.call(e,...t)}publish(e,...t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed publishing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.publish(e,...t)}subscribe(e,t,n){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);return n?this.controllerMessenger.subscribe(e,t,n):this.controllerMessenger.subscribe(e,t)}unsubscribe(e,t){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);this.controllerMessenger.unsubscribe(e,t)}clearEventSubscriptions(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed clearing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.clearEventSubscriptions(e)}}n.RestrictedControllerMessenger=r;n.ControllerMessenger=class{constructor(){this.actions=new Map,this.events=new Map,this.eventPayloadCache=new Map}registerActionHandler(e,t){if(this.actions.has(e))throw new Error(`A handler for ${e} has already been registered`);this.actions.set(e,t)}unregisterActionHandler(e){this.actions.delete(e)}clearActions(){this.actions.clear()}call(e,...t){const n=this.actions.get(e);if(!n)throw new Error(`A handler for ${e} has not been registered`);return n(...t)}publish(e,...t){const n=this.events.get(e);if(n)for(const[e,r]of n.entries())if(r){const n=this.eventPayloadCache.get(e),s=r(...t);s!==n&&(this.eventPayloadCache.set(e,s),e(s,n))}else e(...t)}subscribe(e,t,n){let r=this.events.get(e);r||(r=new Map,this.events.set(e,r)),r.set(t,n)}unsubscribe(e,t){const n=this.events.get(e);if(!n||!n.has(t))throw new Error(`Subscription not found for event: ${e}`);n.get(t)&&this.eventPayloadCache.delete(t),n.delete(t)}clearEventSubscriptions(e){this.events.delete(e)}clearSubscriptions(){this.events.clear()}getRestricted({name:e,allowedActions:t,allowedEvents:n}){return new r({controllerMessenger:this,name:e,allowedActions:t,allowedEvents:n})}}}}},{package:"@metamask/message-manager>@metamask/base-controller",file:"node_modules/@metamask/message-manager/node_modules/@metamask/base-controller/dist/ControllerMessenger.js"}],[1289,{"./BaseController":1286,"./BaseControllerV2":1287,"./ControllerMessenger":1288},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseControllerV2=n.BaseController=void 0;var i=e("./BaseController");Object.defineProperty(n,"BaseController",{enumerable:!0,get:function(){return i.BaseController}});var o=e("./BaseControllerV2");Object.defineProperty(n,"BaseControllerV2",{enumerable:!0,get:function(){return o.BaseController}}),Object.defineProperty(n,"getAnonymizedState",{enumerable:!0,get:function(){return o.getAnonymizedState}}),Object.defineProperty(n,"getPersistentState",{enumerable:!0,get:function(){return o.getPersistentState}}),s(e("./ControllerMessenger"),n)}}},{package:"@metamask/message-manager>@metamask/base-controller",file:"node_modules/@metamask/message-manager/node_modules/@metamask/base-controller/dist/index.js"}],[129,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:47,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=47;const n=t.data;return t.data=function(e){var t;const n=null==e||null===(t=e.TransactionController)||void 0===t?void 0:t.transactions;Array.isArray(n)&&n.forEach((e=>{"number"==typeof e.metamaskNetworkId&&(e.metamaskNetworkId=e.metamaskNetworkId.toString())}));return e}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/047.js"}],[1294,{"./ObservableStore":1296},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ComposedStore=void 0;const r=e("./ObservableStore");class s extends r.ObservableStore{constructor(e){super({}),this._children=e||{},Object.keys(this._children).forEach((e=>{const t=this._children[e];this._addChild(e,t)}))}_addChild(e,t){const n=t=>{const n=this.getState();n[e]=t,this.putState(n)};t.subscribe(n),n(t.getState())}}n.ComposedStore=s}}},{package:"@metamask/obs-store",file:"node_modules/@metamask/obs-store/dist/ComposedStore.js"}],[1295,{"./ObservableStore":1296},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MergedStore=void 0;const r=e("./ObservableStore");class s extends r.ObservableStore{constructor(e=[]){super({}),this._children=e,e.forEach((e=>this._addChild(e))),this._updateWholeState()}_addChild(e){e.subscribe((()=>this._updateWholeState()))}_updateWholeState(){const e=this._children.map((e=>e.getState())),t=Object.assign({},...e);this.putState(t)}}n.MergedStore=s}}},{package:"@metamask/obs-store",file:"node_modules/@metamask/obs-store/dist/MergedStore.js"}],[1296,{"@metamask/safe-event-emitter":1325},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.ObservableStore=void 0;const s=r(e("@metamask/safe-event-emitter"));class i extends s.default{constructor(e){super(),e===undefined?this._state={}:this._state=e}getState(){return this._getState()}putState(e){this._putState(e),this.emit("update",e)}updateState(e){if(e&&"object"==typeof e){const t=this.getState();this.putState(Object.assign(Object.assign({},t),e))}else this.putState(e)}subscribe(e){this.on("update",e)}unsubscribe(e){this.removeListener("update",e)}_getState(){return this._state}_putState(e){this._state=e}}n.ObservableStore=i}}},{package:"@metamask/obs-store",file:"node_modules/@metamask/obs-store/dist/ObservableStore.js"}],[1297,{stream:1946},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.storeAsStream=void 0;const r=e("stream");class s extends r.Duplex{constructor(e){super({objectMode:!0}),this.resume(),this.handler=e=>this.push(e),this.obsStore=e,this.obsStore.subscribe(this.handler)}pipe(e,t){const n=super.pipe(e,t);return e.write(this.obsStore.getState()),n}_write(e,t,n){this.obsStore.putState(e),n()}_read(e){return undefined}_destroy(e,t){this.obsStore.unsubscribe(this.handler),super._destroy(e,t)}}n.storeAsStream=function(e){return new s(e)}}}},{package:"@metamask/obs-store",file:"node_modules/@metamask/obs-store/dist/asStream.js"}],[1298,{"./ComposedStore":1294,"./MergedStore":1295,"./ObservableStore":1296,"./asStream":1297,"./transform":1299},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./asStream"),n),s(e("./ComposedStore"),n),s(e("./MergedStore"),n),s(e("./ObservableStore"),n),s(e("./transform"),n)}}},{package:"@metamask/obs-store",file:"node_modules/@metamask/obs-store/dist/index.js"}],[1299,{through2:1300},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.storeTransformStream=void 0;const r=e("through2");n.storeTransformStream=function(e){return r.obj(((t,n,r)=>{try{return r(null,e(t)),undefined}catch(e){return r(e),undefined}}))}}}},{package:"@metamask/obs-store",file:"node_modules/@metamask/obs-store/dist/transform.js"}],[13,{"../../../shared/constants/network":3409,"../../../shared/constants/transaction":3417,"../../../shared/modules/conversion.utils":3431,"../../../shared/modules/fetch-with-timeout":3433,"../../../shared/modules/random-id":3439,"../lib/util":82,"@metamask/obs-store":1298,"bn.js":1900,loglevel:2944},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("@metamask/obs-store"),s=h(e("loglevel")),i=h(e("bn.js")),o=h(e("../../../shared/modules/random-id")),a=e("../lib/util"),c=h(e("../../../shared/modules/fetch-with-timeout")),u=e("../../../shared/constants/transaction"),l=e("../../../shared/constants/network"),d=e("../../../shared/modules/conversion.utils");function h(e){return e&&e.__esModule?e:{default:e}}const f=(0,c.default)();n.default=class{constructor(e={}){const{blockTracker:t,onNetworkDidChange:n,getCurrentChainId:s,preferencesController:i,onboardingController:o}=e;this.blockTracker=t,this.getCurrentChainId=s,this.preferencesController=i,this.onboardingController=o,this._onLatestBlock=async e=>{const t=this.preferencesController.getSelectedAddress(),n=parseInt(e,16);await this._update(t,n)};const c={incomingTransactions:{},incomingTxLastFetchedBlockByChainId:Object.keys(l.ETHERSCAN_SUPPORTED_NETWORKS).reduce(((e,t)=>(e[t]=null,e)),{}),...e.initState};this.store=new r.ObservableStore(c),this.preferencesController.store.subscribe((0,a.previousValueComparator)(((e,t)=>{const{featureFlags:{showIncomingTransactions:n}={}}=e,{featureFlags:{showIncomingTransactions:r}={}}=t;r!==n&&(!n||r?this.start():this.stop())}),this.preferencesController.store.getState())),this.preferencesController.store.subscribe((0,a.previousValueComparator)((async(e,t)=>{const{selectedAddress:n}=e,{selectedAddress:r}=t;r!==n&&await this._update(r)}),this.preferencesController.store.getState())),this.onboardingController.store.subscribe((0,a.previousValueComparator)((async(e,t)=>{const{completedOnboarding:n}=e,{completedOnboarding:r}=t;if(!n&&r){const e=this.preferencesController.getSelectedAddress();await this._update(e)}}),this.onboardingController.store.getState())),n((async()=>{const e=this.preferencesController.getSelectedAddress();await this._update(e)}))}start(){const{featureFlags:e={}}=this.preferencesController.store.getState(),{showIncomingTransactions:t}=e;t&&(this.blockTracker.removeListener("latest",this._onLatestBlock),this.blockTracker.addListener("latest",this._onLatestBlock))}stop(){this.blockTracker.removeListener("latest",this._onLatestBlock)}async _update(e,t){const{completedOnboarding:n}=this.onboardingController.store.getState(),r=this.getCurrentChainId();if(Object.hasOwnProperty.call(l.ETHERSCAN_SUPPORTED_NETWORKS,r)&&e&&n)try{const n=this.store.getState(),s=parseInt(this.blockTracker.getCurrentBlock(),16),i=n.incomingTxLastFetchedBlockByChainId[r]??t??s,o=await this._getNewIncomingTransactions(e,i,r);let a=i;o.forEach((e=>{e.blockNumber&&parseInt(a,10)<parseInt(e.blockNumber,10)&&(a=parseInt(e.blockNumber,10))})),this.store.updateState({incomingTxLastFetchedBlockByChainId:{...n.incomingTxLastFetchedBlockByChainId,[r]:a+1},incomingTransactions:o.reduce(((e,t)=>(e[t.hash]=t,e)),{...n.incomingTransactions})})}catch(e){s.default.error(e)}}async _getNewIncomingTransactions(e,t,n){const r=l.ETHERSCAN_SUPPORTED_NETWORKS[n].domain;let s=`${`https://${l.ETHERSCAN_SUPPORTED_NETWORKS[n].subdomain}.${r}`}/api?module=account&action=txlist&address=${e}&tag=latest&page=1`;t&&(s+=`&startBlock=${parseInt(t,10)}`);const i=await f(s),{status:o,result:a}=await i.json();let c=[];if("1"===o&&Array.isArray(a)&&a.length>0){const t={},r=[];a.forEach((e=>{t[e.hash]||(r.push(this._normalizeTxFromEtherscan(e,n)),t[e.hash]=1)})),c=r.filter((t=>{var n,r;return(null===(n=t.txParams)||void 0===n||null===(r=n.to)||void 0===r?void 0:r.toLowerCase())===e.toLowerCase()})),c.sort(((e,t)=>e.time<t.time?-1:1))}return c}_normalizeTxFromEtherscan(e,t){const n=1e3*parseInt(e.timeStamp,10),r="0"===e.isError?u.TransactionStatus.confirmed:u.TransactionStatus.failed,s={from:e.from,gas:(0,d.bnToHex)(new i.default(e.gas)),nonce:(0,d.bnToHex)(new i.default(e.nonce)),to:e.to,value:(0,d.bnToHex)(new i.default(e.value))};return e.gasPrice?s.gasPrice=(0,d.bnToHex)(new i.default(e.gasPrice)):e.maxFeePerGas&&(s.maxFeePerGas=(0,d.bnToHex)(new i.default(e.maxFeePerGas)),s.maxPriorityFeePerGas=(0,d.bnToHex)(new i.default(e.maxPriorityFeePerGas))),{blockNumber:e.blockNumber,id:(0,o.default)(),chainId:t,metamaskNetworkId:l.ETHERSCAN_SUPPORTED_NETWORKS[t].networkId,status:r,time:n,txParams:s,hash:e.hash,type:u.TransactionType.incoming}}}}}},{package:"$root$",file:"app/scripts/controllers/incoming-transactions.js"}],[130,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:48,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=48;const n=t.data;return t.data=function(e={}){var t,n,r,s,a,c,u,l,d;null===(t=e.NetworkController)||void 0===t||delete t.settings;const h=(null===(n=e.NetworkController)||void 0===n?void 0:n.provider)||{};if(("rpc"!==h.type||"string"==typeof h.chainId&&o.test(h.chainId))&&"localhost"!==h.type){if(null!==(r=e.NetworkController)&&void 0!==r&&r.provider){var f,p;if("rpcTarget"in e.NetworkController.provider){const t=e.NetworkController.provider.rpcTarget;e.NetworkController.provider.rpcUrl=t}null===(f=e.NetworkController)||void 0===f||(null===(p=f.provider)||void 0===p||delete p.rpcTarget)}}else e.NetworkController.provider={type:"rinkeby",rpcUrl:"",chainId:"0x4",nickname:"",rpcPrefs:{},ticker:"ETH"};e.PreferencesController||(e.PreferencesController={});e.PreferencesController.frequentRpcListDetail||(e.PreferencesController.frequentRpcListDetail=[]);e.PreferencesController.frequentRpcListDetail.unshift({rpcUrl:"http://localhost:8545",chainId:"0x539",ticker:"ETH",nickname:"Localhost 8545",rpcPrefs:{}}),null===(s=e.CachedBalancesController)||void 0===s||delete s.cachedBalances;const m=null===(a=e.TransactionController)||void 0===a?void 0:a.transactions;Array.isArray(m)&&m.forEach((e=>{const t=null==e?void 0:e.metamaskNetworkId;"string"==typeof t&&i.test(t)&&(e.metamaskNetworkId=parseInt(t,16).toString(10))}));const g=(null===(c=e.AddressBookController)||void 0===c?void 0:c.addressBook)||{};Object.keys(g).forEach((e=>{if(/^\d+$/iu.test(e)){const t=`0x${parseInt(e,10).toString(16)}`;!function(e,t){Object.values(e).forEach((e=>{e&&"object"==typeof e&&(e.chainId=t)}))}(g[e],t),g[t]?function(e,t,n){const r=e[t]||{},s={...e[n]};Object.keys(r).forEach((e=>{if(s[e]&&"object"==typeof s[e]){const t={};new Set([...Object.keys(s[e]),...Object.keys(r[e]||{})]).forEach((n=>{var i;t[n]=s[e][n]||(null===(i=r[e])||void 0===i?void 0:i[n])||""})),s[e]=t}else r[e]&&"object"==typeof r[e]&&(s[e]=r[e])})),e[n]=s}(g,e,t):g[t]=g[e],delete g[e]}})),null===(u=e.IncomingTransactionsController)||void 0===u||null===(l=u.incomingTxLastFetchedBlocksByNetwork)||void 0===l||delete l.localhost;const y=null===(d=e.PreferencesController)||void 0===d?void 0:d.accountTokens;y&&Object.keys(y).forEach((e=>{var t,n;const r=(null===(t=y[e])||void 0===t?void 0:t.localhost)||[];if(r.length>0){const t=y[e].rpc||[];t.length>0?y[e].rpc=function(e,t){const n=i(e),r=i(t),s=[];return new Set([...Object.keys(n),...Object.keys(r)]).forEach((e=>{s.push({...n[e],...r[e]})})),s;function i(e){return e.reduce(((e,t)=>(null!=t&&t.address&&"string"==typeof(null==t?void 0:t.address)&&(e[t.address]=t),e)),{})}}(r,t):y[e].rpc=r}null===(n=y[e])||void 0===n||delete n.localhost}));return e}(n),t}};n.default=s;const i=/^0x[0-9a-f]+$/iu,o=/^0x[1-9a-f]+[0-9a-f]*$/iu}}},{package:"$root$",file:"app/scripts/migrations/048.js"}],[1300,{_process:3027,"readable-stream":3190,util:1949,xtend:3389},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(n){(function(){var r=e("readable-stream").Transform,s=e("util").inherits,i=e("xtend");function o(e){r.call(this,e),this._destroyed=!1}function a(e,t,n){n(null,e)}function c(e){return function(t,n,r){return"function"==typeof t&&(r=n,n=t,t={}),"function"!=typeof n&&(n=a),"function"!=typeof r&&(r=null),e(t,n,r)}}s(o,r),o.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;n.nextTick((function(){e&&t.emit("error",e),t.emit("close")}))}},t.exports=c((function(e,t,n){var r=new o(e);return r._transform=t,n&&(r._flush=n),r})),t.exports.ctor=c((function(e,t,n){function r(t){if(!(this instanceof r))return new r(t);this.options=i(e,t),o.call(this,this.options)}return s(r,o),r.prototype._transform=t,n&&(r.prototype._flush=n),r})),t.exports.obj=c((function(e,t,n){var r=new o(i({objectMode:!0,highWaterMark:16},e));return r._transform=t,n&&(r._flush=n),r}))}).call(this)}).call(this,e("_process"))}}},{package:"@metamask/obs-store>through2",file:"node_modules/@metamask/obs-store/node_modules/through2/through2.js"}],[1301,{"./Permission":1302,"./errors":1304,"@metamask/controller-utils":1084},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(n,"__esModule",{value:!0}),n.decorateWithCaveats=n.isRestrictedMethodCaveatSpecification=void 0;const s=e("@metamask/controller-utils"),i=e("./errors"),o=e("./Permission");function a(e){return(0,s.hasProperty)(e,"decorator")}n.isRestrictedMethodCaveatSpecification=a,n.decorateWithCaveats=function(e,t,n){const{caveats:s}=t;if(!s)return e;let c=t=>r(this,void 0,void 0,(function*(){return e(t)}));for(const e of s){const t=n[e.type];if(!t)throw new i.UnrecognizedCaveatTypeError(e.type);if(!a(t))throw new i.CaveatSpecificationMismatchError(t,o.PermissionType.RestrictedMethod);c=t.decorator(c,e)}return c}}}},{package:"@metamask/permission-controller",file:"node_modules/@metamask/permission-controller/dist/Caveat.js"}],[1302,{nanoid:1315},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.hasSpecificationType=n.PermissionType=n.findCaveat=n.constructPermission=void 0;const r=e("nanoid");n.constructPermission=function(e){const{caveats:t=null,invoker:n,target:s}=e;return{id:(0,r.nanoid)(),parentCapability:s,invoker:n,caveats:t,date:(new Date).getTime()}},n.findCaveat=function(e,t){var n;return null===(n=e.caveats)||void 0===n?void 0:n.find((e=>e.type===t))},function(e){e.RestrictedMethod="RestrictedMethod",e.Endowment="Endowment"}(n.PermissionType||(n.PermissionType={})),n.hasSpecificationType=function(e,t){return e.permissionType===t}}}},{package:"@metamask/permission-controller",file:"node_modules/@metamask/permission-controller/dist/Permission.js"}],[1303,{"./Caveat":1301,"./Permission":1302,"./errors":1304,"./permission-middleware":1306,"./utils":1310,"@metamask/base-controller":1314,"@metamask/controller-utils":1084,"deep-freeze-strict":2078,"eth-rpc-errors":2170,immer:2694,nanoid:1315},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]])}return n},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.PermissionController=n.CaveatMutatorOperation=void 0;const o=i(e("deep-freeze-strict")),a=e("immer"),c=e("nanoid"),u=e("eth-rpc-errors"),l=e("@metamask/base-controller"),d=e("@metamask/controller-utils"),h=e("./Caveat"),f=e("./errors"),p=e("./Permission"),m=e("./permission-middleware"),g=e("./utils"),y="PermissionController";var b;!function(e){e[e.noop=0]="noop",e[e.updateValue=1]="updateValue",e[e.deleteCaveat=2]="deleteCaveat",e[e.revokePermission=3]="revokePermission"}(b=n.CaveatMutatorOperation||(n.CaveatMutatorOperation={}));class w extends l.BaseControllerV2{constructor(e){const{caveatSpecifications:t,permissionSpecifications:n,unrestrictedMethods:r,messenger:s,state:i={}}=e;super({name:y,metadata:{subjects:{anonymous:!0,persist:!0}},messenger:s,state:Object.assign(Object.assign({},{subjects:{}}),i)}),this._unrestrictedMethods=new Set(r),this._caveatSpecifications=(0,o.default)(Object.assign({},t)),this.validatePermissionSpecifications(n,this._caveatSpecifications),this._permissionSpecifications=(0,o.default)(Object.assign({},n)),this.registerMessageHandlers(),this.createPermissionMiddleware=(0,m.getPermissionMiddlewareFactory)({executeRestrictedMethod:this._executeRestrictedMethod.bind(this),getRestrictedMethod:this.getRestrictedMethod.bind(this),isUnrestrictedMethod:this.unrestrictedMethods.has.bind(this.unrestrictedMethods)})}get unrestrictedMethods(){return this._unrestrictedMethods}getPermissionSpecification(e){return this._permissionSpecifications[e]}getCaveatSpecification(e){return this._caveatSpecifications[e]}validatePermissionSpecifications(e,t){Object.entries(e).forEach((([e,{permissionType:n,targetKey:r,allowedCaveats:s}])=>{if(!n||!(0,d.hasProperty)(p.PermissionType,n))throw new Error(`Invalid permission type: "${n}"`);if(!e||/_$/u.test(e)||/[^_]\*$/u.test(e))throw new Error(`Invalid permission target key: "${e}"`);if(e!==r)throw new Error(`Invalid permission specification: key "${e}" must match specification.target value "${r}".`);s&&s.forEach((e=>{if(!(0,d.hasProperty)(t,e))throw new f.UnrecognizedCaveatTypeError(e);const r=t[e],s=(0,h.isRestrictedMethodCaveatSpecification)(r);if(n===p.PermissionType.RestrictedMethod&&!s||n===p.PermissionType.Endowment&&s)throw new f.CaveatSpecificationMismatchError(r,n)}))}))}registerMessageHandlers(){this.messagingSystem.registerActionHandler(`${y}:clearPermissions`,(()=>this.clearState())),this.messagingSystem.registerActionHandler(`${y}:getEndowments`,((e,t,n)=>this.getEndowments(e,t,n))),this.messagingSystem.registerActionHandler(`${y}:getSubjectNames`,(()=>this.getSubjectNames())),this.messagingSystem.registerActionHandler(`${y}:getPermissions`,(e=>this.getPermissions(e))),this.messagingSystem.registerActionHandler(`${y}:hasPermission`,((e,t)=>this.hasPermission(e,t))),this.messagingSystem.registerActionHandler(`${y}:hasPermissions`,(e=>this.hasPermissions(e))),this.messagingSystem.registerActionHandler(`${y}:grantPermissions`,this.grantPermissions.bind(this)),this.messagingSystem.registerActionHandler(`${y}:requestPermissions`,((e,t)=>this.requestPermissions(e,t))),this.messagingSystem.registerActionHandler(`${y}:revokeAllPermissions`,(e=>this.revokeAllPermissions(e))),this.messagingSystem.registerActionHandler(`${y}:revokePermissionForAllSubjects`,(e=>this.revokePermissionForAllSubjects(e))),this.messagingSystem.registerActionHandler(`${y}:revokePermissions`,this.revokePermissions.bind(this)),this.messagingSystem.registerActionHandler(`${y}:updateCaveat`,((e,t,n,r)=>{this.updateCaveat(e,t,n,r)}))}clearState(){this.update((e=>Object.assign({},{subjects:{}})))}getTypedPermissionSpecification(e,t,n){const r=e===p.PermissionType.RestrictedMethod?(0,f.methodNotFound)(t,n?{origin:n}:undefined):new f.EndowmentPermissionDoesNotExistError(t,n),s=this.getTargetKey(t);if(!s)throw r;const i=this.getPermissionSpecification(s);if(!(0,p.hasSpecificationType)(i,e))throw r;return i}getRestrictedMethod(e,t){return this.getTypedPermissionSpecification(p.PermissionType.RestrictedMethod,e,t).methodImplementation}getSubjectNames(){return Object.keys(this.state.subjects)}getPermission(e,t){var n;return null===(n=this.state.subjects[e])||void 0===n?void 0:n.permissions[t]}getPermissions(e){var t;return null===(t=this.state.subjects[e])||void 0===t?void 0:t.permissions}hasPermission(e,t){return Boolean(this.getPermission(e,t))}hasPermissions(e){return Boolean(this.state.subjects[e])}revokeAllPermissions(e){this.update((t=>{if(!t.subjects[e])throw new f.UnrecognizedSubjectError(e);delete t.subjects[e]}))}revokePermission(e,t){this.revokePermissions({[e]:[t]})}revokePermissions(e){this.update((t=>{Object.keys(e).forEach((n=>{if(!(0,d.hasProperty)(t.subjects,n))throw new f.UnrecognizedSubjectError(n);e[n].forEach((e=>{const{permissions:r}=t.subjects[n];if(!(0,d.hasProperty)(r,e))throw new f.PermissionDoesNotExistError(n,e);this.deletePermission(t.subjects,n,e)}))}))}))}revokePermissionForAllSubjects(e){0!==this.getSubjectNames().length&&this.update((t=>{Object.entries(t.subjects).forEach((([n,r])=>{const{permissions:s}=r;(0,d.hasProperty)(s,e)&&this.deletePermission(t.subjects,n,e)}))}))}deletePermission(e,t,n){const{permissions:r}=e[t];Object.keys(r).length>1?delete r[n]:delete e[t]}hasCaveat(e,t,n){return Boolean(this.getCaveat(e,t,n))}getCaveat(e,t,n){const r=this.getPermission(e,t);if(!r)throw new f.PermissionDoesNotExistError(e,t);return(0,p.findCaveat)(r,n)}addCaveat(e,t,n,r){if(this.hasCaveat(e,t,n))throw new f.CaveatAlreadyExistsError(e,t,n);this.setCaveat(e,t,n,r)}updateCaveat(e,t,n,r){if(!this.hasCaveat(e,t,n))throw new f.CaveatDoesNotExistError(e,t,n);this.setCaveat(e,t,n,r)}setCaveat(e,t,n,r){this.update((s=>{const i=s.subjects[e];if(!i)throw new f.UnrecognizedSubjectError(e);const o=i.permissions[t];if(!o)throw new f.PermissionDoesNotExistError(e,t);const a={type:n,value:r};if(this.validateCaveat(a,e,t),o.caveats){const e=o.caveats.findIndex((e=>e.type===a.type));-1===e?o.caveats.push(a):o.caveats.splice(e,1,a)}else o.caveats=[a];this.validateModifiedPermission(o,e,t)}))}updatePermissionsByCaveat(e,t){0!==Object.keys(this.state.subjects).length&&this.update((n=>{Object.values(n.subjects).forEach((r=>{Object.values(r.permissions).forEach((s=>{const{caveats:i}=s,o=null==i?void 0:i.find((({type:t})=>t===e));if(!o)return;const a=t(o.value);switch(a.operation){case b.noop:break;case b.updateValue:o.value=a.value,this.validateCaveat(o,r.origin,s.parentCapability);break;case b.deleteCaveat:this.deleteCaveat(s,e,r.origin,s.parentCapability);break;case b.revokePermission:this.deletePermission(n.subjects,r.origin,s.parentCapability);break;default:throw new Error(`Unrecognized mutation result: "${a.operation}"`)}}))}))}))}removeCaveat(e,t,n){this.update((r=>{var s;const i=null===(s=r.subjects[e])||void 0===s?void 0:s.permissions[t];if(!i)throw new f.PermissionDoesNotExistError(e,t);if(!i.caveats)throw new f.CaveatDoesNotExistError(e,t,n);this.deleteCaveat(i,n,e,t)}))}deleteCaveat(e,t,n,r){if(!e.caveats)throw new f.CaveatDoesNotExistError(n,r,t);const s=e.caveats.findIndex((e=>e.type===t));if(-1===s)throw new f.CaveatDoesNotExistError(n,r,t);1===e.caveats.length?e.caveats=null:e.caveats.splice(s,1),this.validateModifiedPermission(e,n,r)}validateModifiedPermission(e,t,n){const r=this.getTargetKey(e.parentCapability);if(!r)throw new Error(`Fatal: Existing permission target key "${r}" has no specification.`);this.validatePermission(this.getPermissionSpecification(r),e,t,n)}getTargetKey(e){if((0,d.hasProperty)(this._permissionSpecifications,e))return e;const t={};for(const e of Object.keys(this._permissionSpecifications)){const n=e.match(/(.+)\*$/u);n&&(t[n[1]]=!0)}const n=e.split("_");let r="";for(;n.length>0&&!(0,d.hasProperty)(this._permissionSpecifications,r)&&!t[r];)r+=`${n.shift()}_`;return t[r]?`${r}*`:undefined}grantPermissions({approvedPermissions:e,requestData:t,preserveExistingPermissions:n=!0,subject:r}){const{origin:s}=r;if(!s||"string"!=typeof s)throw new f.InvalidSubjectIdentifierError(s);const i=n?Object.assign({},this.getPermissions(s)):{};for(const[n,r]of Object.entries(e)){const e=this.getTargetKey(n);if(!e)throw(0,f.methodNotFound)(n);if(r.parentCapability!==undefined&&n!==r.parentCapability)throw new f.InvalidApprovedPermissionError(s,n,r);const o=n,a=this.getPermissionSpecification(e),c={caveats:this.constructCaveats(s,o,r.caveats),invoker:s,target:o};let u;a.factory?(u=a.factory(c,t),this.validatePermission(a,u,s,o)):(u=(0,p.constructPermission)(c),this.validatePermission(a,u,s,o,{invokePermissionValidator:!0,performCaveatValidation:!1})),i[o]=u}return this.setValidatedPermissions(s,i),i}validatePermission(e,t,n,r,{invokePermissionValidator:s,performCaveatValidation:i}={invokePermissionValidator:!0,performCaveatValidation:!0}){const{allowedCaveats:o,validator:a}=e;if((0,d.hasProperty)(t,"caveats")){const{caveats:e}=t;if(null!==e&&!(Array.isArray(e)&&e.length>0))throw new f.InvalidCaveatsPropertyError(n,r,e);const s=new Set;null==e||e.forEach((e=>{if(i&&this.validateCaveat(e,n,r),!(null==o?void 0:o.includes(e.type)))throw new f.ForbiddenCaveatError(e.type,n,r);if(s.has(e.type))throw new f.DuplicateCaveatError(e.type,n,r);s.add(e.type)}))}s&&a&&a(t,n,r)}setValidatedPermissions(e,t){this.update((n=>{n.subjects[e]||(n.subjects[e]={origin:e,permissions:{}}),n.subjects[e].permissions=(0,a.castDraft)(t)}))}constructCaveats(e,t,n){const r=null==n?void 0:n.map((n=>{this.validateCaveat(n,e,t);const{type:r,value:s}=n;return{type:r,value:s}}));return r&&(0,d.isNonEmptyArray)(r)?r:undefined}validateCaveat(e,t,n){var r;if(!(0,d.isPlainObject)(e))throw new f.InvalidCaveatError(e,t,n);if(2!==Object.keys(e).length)throw new f.InvalidCaveatFieldsError(e,t,n);if("string"!=typeof e.type)throw new f.InvalidCaveatTypeError(e,t,n);const s=this.getCaveatSpecification(e.type);if(!s)throw new f.UnrecognizedCaveatTypeError(e.type,t,n);if(!(0,d.hasProperty)(e,"value")||e.value===undefined)throw new f.CaveatMissingValueError(e,t,n);if(!(0,d.isValidJson)(e.value))throw new f.CaveatInvalidJsonError(e,t,n);null===(r=s.validator)||void 0===r||r.call(s,e,t,n)}requestPermissions(e,t,n={}){return r(this,void 0,void 0,(function*(){const{origin:r}=e,{id:i=(0,c.nanoid)(),preserveExistingPermissions:o=!0}=n;this.validateRequestedPermissions(r,t);const a={id:i,origin:r},u={metadata:a,permissions:t},l=yield this.requestUserApproval(u),{permissions:d}=l,h=s(l,["permissions"]),f=this.getSideEffects(d);if(Object.values(f.permittedHandlers).length>0){const t=yield this.executeSideEffects(f,l),n=Object.keys(f.permittedHandlers).reduce(((e,n,r)=>Object.assign({[n]:t[r]},e)),{});return[this.grantPermissions({subject:e,approvedPermissions:d,preserveExistingPermissions:o,requestData:h}),Object.assign({data:n},a)]}return[this.grantPermissions({subject:e,approvedPermissions:d,preserveExistingPermissions:o,requestData:h}),a]}))}validateRequestedPermissions(e,t){if(!(0,d.isPlainObject)(t))throw(0,f.invalidParams)({message:`Requested permissions for origin "${e}" is not a plain object.`,data:{origin:e,requestedPermissions:t}});if(0===Object.keys(t).length)throw(0,f.invalidParams)({message:`Permissions request for origin "${e}" contains no permissions.`,data:{requestedPermissions:t}});for(const n of Object.keys(t)){const r=t[n],s=this.getTargetKey(n);if(!s)throw(0,f.methodNotFound)(n,{origin:e,requestedPermissions:t});if(!(0,d.isPlainObject)(r)||r.parentCapability!==undefined&&n!==r.parentCapability)throw(0,f.invalidParams)({message:`Permissions request for origin "${e}" contains invalid requested permission(s).`,data:{origin:e,requestedPermissions:t}});this.validatePermission(this.getPermissionSpecification(s),r,e,n,{invokePermissionValidator:!1,performCaveatValidation:!0})}}requestUserApproval(e){return r(this,void 0,void 0,(function*(){const{origin:t,id:n}=e.metadata,r=yield this.messagingSystem.call("ApprovalController:addRequest",{id:n,origin:t,requestData:e,type:g.MethodNames.requestPermissions},!0);return this.validateApprovedPermissions(r,{id:n,origin:t}),r}))}getSideEffects(e){return Object.keys(e).reduce(((e,t)=>{const n=this.getTargetKey(t);if(n){const r=this.getPermissionSpecification(n);r.sideEffect&&(e.permittedHandlers[t]=r.sideEffect.onPermitted,r.sideEffect.onFailure&&(e.failureHandlers[t]=r.sideEffect.onFailure))}return e}),{permittedHandlers:{},failureHandlers:{}})}executeSideEffects(e,t){return r(this,void 0,void 0,(function*(){const{permittedHandlers:n,failureHandlers:r}=e,s={requestData:t,messagingSystem:this.messagingSystem},i=yield Promise.allSettled(Object.values(n).map((e=>e(s)))),o=i.filter((e=>"rejected"===e.status));if(o.length>0){const e=Object.values(r);if(e.length>0)try{yield Promise.all(e.map((e=>e(s))))}catch(e){throw(0,f.internalError)("Unexpected error in side-effects",{error:e})}const t=o.map((e=>e.reason));throw t.forEach((e=>{console.error(e)})),t.length>1?(0,f.internalError)("Multiple errors occurred during side-effects execution",{errors:t}):t[0]}return i.map((({value:e})=>e))}))}validateApprovedPermissions(e,t){const{id:n,origin:r}=t;if(!(0,d.isPlainObject)(e)||!(0,d.isPlainObject)(e.metadata))throw(0,f.internalError)(`Approved permissions request for subject "${r}" is invalid.`,{data:{approvedRequest:e}});const{metadata:{id:s,origin:i},permissions:o}=e;if(s!==n)throw(0,f.internalError)(`Approved permissions request for subject "${r}" mutated its id.`,{originalId:n,mutatedId:s});if(i!==r)throw(0,f.internalError)(`Approved permissions request for subject "${r}" mutated its origin.`,{originalOrigin:r,mutatedOrigin:i});try{this.validateRequestedPermissions(r,o)}catch(e){if(e instanceof u.EthereumRpcError)throw(0,f.internalError)(`Invalid approved permissions request: ${e.message}`,e.data);throw(0,f.internalError)("Unrecognized error type",{error:e})}}acceptPermissionsRequest(e){return r(this,void 0,void 0,(function*(){const{id:t}=e.metadata;if(!this.hasApprovalRequest({id:t}))throw new f.PermissionsRequestNotFoundError(t);if(0!==Object.keys(e.permissions).length)try{this.messagingSystem.call("ApprovalController:acceptRequest",t,e)}catch(e){throw this._rejectPermissionsRequest(t,e),e}else this._rejectPermissionsRequest(t,(0,f.invalidParams)({message:"Must request at least one permission."}))}))}rejectPermissionsRequest(e){return r(this,void 0,void 0,(function*(){if(!this.hasApprovalRequest({id:e}))throw new f.PermissionsRequestNotFoundError(e);this._rejectPermissionsRequest(e,(0,f.userRejectedRequest)())}))}hasApprovalRequest(e){return this.messagingSystem.call("ApprovalController:hasRequest",e)}_rejectPermissionsRequest(e,t){return this.messagingSystem.call("ApprovalController:rejectRequest",e,t)}getEndowments(e,t,n){return r(this,void 0,void 0,(function*(){if(!this.hasPermission(e,t))throw(0,f.unauthorized)({data:{origin:e,targetName:t}});return this.getTypedPermissionSpecification(p.PermissionType.Endowment,t,e).endowmentGetter({origin:e,requestData:n})}))}executeRestrictedMethod(e,t,n){return r(this,void 0,void 0,(function*(){const r=this.getRestrictedMethod(t,e),s=yield this._executeRestrictedMethod(r,{origin:e},t,n);if(s===undefined)throw new Error(`Internal request for method "${t}" as origin "${e}" returned no result.`);return s}))}_executeRestrictedMethod(e,t,n,r=[]){const{origin:s}=t,i=this.getPermission(s,n);if(!i)throw(0,f.unauthorized)({data:{origin:s,method:n}});return(0,h.decorateWithCaveats)(e,i,this._caveatSpecifications)({method:n,params:r,context:{origin:s}})}}n.PermissionController=w}}},{package:"@metamask/permission-controller",file:"node_modules/@metamask/permission-controller/dist/PermissionController.js"}],[1304,{"eth-rpc-errors":2170},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.PermissionsRequestNotFoundError=n.CaveatSpecificationMismatchError=n.DuplicateCaveatError=n.ForbiddenCaveatError=n.InvalidCaveatFieldsError=n.CaveatInvalidJsonError=n.CaveatMissingValueError=n.InvalidCaveatTypeError=n.InvalidCaveatError=n.CaveatAlreadyExistsError=n.CaveatDoesNotExistError=n.InvalidCaveatsPropertyError=n.UnrecognizedCaveatTypeError=n.EndowmentPermissionDoesNotExistError=n.PermissionDoesNotExistError=n.InvalidApprovedPermissionError=n.UnrecognizedSubjectError=n.InvalidSubjectIdentifierError=n.internalError=n.userRejectedRequest=n.invalidParams=n.methodNotFound=n.unauthorized=void 0;const r=e("eth-rpc-errors");n.unauthorized=function(e){return r.ethErrors.provider.unauthorized({message:"Unauthorized to perform action. Try requesting the required permission(s) first. For more information, see: https://docs.metamask.io/guide/rpc-api.html#permissions",data:e.data})},n.methodNotFound=function(e,t){const n={message:`The method "${e}" does not exist / is not available.`};return t!==undefined&&(n.data=t),r.ethErrors.rpc.methodNotFound(n)},n.invalidParams=function(e){return r.ethErrors.rpc.invalidParams({data:e.data,message:e.message})},n.userRejectedRequest=function(e){return r.ethErrors.provider.userRejectedRequest({data:e})},n.internalError=function(e,t){return r.ethErrors.rpc.internal({message:e,data:t})};class s extends Error{constructor(e){super(`Invalid subject identifier: "${"string"==typeof e?e:typeof e}"`)}}n.InvalidSubjectIdentifierError=s;class i extends Error{constructor(e){super(`Unrecognized subject: "${e}" has no permissions.`)}}n.UnrecognizedSubjectError=i;class o extends Error{constructor(e,t,n){super(`Invalid approved permission for origin "${e}" and target "${t}".`),this.data={origin:e,target:t,approvedPermission:n}}}n.InvalidApprovedPermissionError=o;class a extends Error{constructor(e,t){super(`Subject "${e}" has no permission for "${t}".`)}}n.PermissionDoesNotExistError=a;class c extends Error{constructor(e,t){super(`Subject "${t}" has no permission for "${e}".`),t&&(this.data={origin:t})}}n.EndowmentPermissionDoesNotExistError=c;class u extends Error{constructor(e,t,n){super(`Unrecognized caveat type: "${e}"`),this.data={caveatType:e},t!==undefined&&(this.data.origin=t),n!==undefined&&(this.data.target=n)}}n.UnrecognizedCaveatTypeError=u;class l extends Error{constructor(e,t,n){super(`The "caveats" property of permission for "${t}" of subject "${e}" is invalid. It must be a non-empty array if specified.`),this.data={origin:e,target:t,caveatsProperty:n}}}n.InvalidCaveatsPropertyError=l;class d extends Error{constructor(e,t,n){super(`Permission for "${t}" of subject "${e}" has no caveat of type "${n}".`)}}n.CaveatDoesNotExistError=d;class h extends Error{constructor(e,t,n){super(`Permission for "${t}" of subject "${e}" already has a caveat of type "${n}".`)}}n.CaveatAlreadyExistsError=h;class f extends r.EthereumRpcError{constructor(e,t,n){super(r.errorCodes.rpc.invalidParams,"Invalid caveat. Caveats must be plain objects.",{receivedCaveat:e}),this.data={origin:t,target:n}}}n.InvalidCaveatError=f;class p extends Error{constructor(e,t,n){super(`Caveat types must be strings. Received: "${typeof e.type}"`),this.data={caveat:e,origin:t,target:n}}}n.InvalidCaveatTypeError=p;class m extends Error{constructor(e,t,n){super('Caveat is missing "value" field.'),this.data={caveat:e,origin:t,target:n}}}n.CaveatMissingValueError=m;class g extends Error{constructor(e,t,n){super('Caveat "value" is invalid JSON.'),this.data={caveat:e,origin:t,target:n}}}n.CaveatInvalidJsonError=g;class y extends Error{constructor(e,t,n){super(`Caveat has unexpected number of fields: "${Object.keys(e).length}"`),this.data={caveat:e,origin:t,target:n}}}n.InvalidCaveatFieldsError=y;class b extends Error{constructor(e,t,n){super(`Permissions for target "${n}" may not have caveats of type "${e}".`),this.data={caveatType:e,origin:t,target:n}}}n.ForbiddenCaveatError=b;class w extends Error{constructor(e,t,n){super(`Permissions for target "${n}" contains multiple caveats of type "${e}".`),this.data={caveatType:e,origin:t,target:n}}}n.DuplicateCaveatError=w;class v extends Error{constructor(e,t){super(`Caveat specification uses a mismatched type. Expected caveats for ${t}`),this.data={caveatSpec:e,permissionType:t}}}n.CaveatSpecificationMismatchError=v;class _ extends Error{constructor(e){super(`Permissions request with id "${e}" not found.`)}}n.PermissionsRequestNotFoundError=_}}},{package:"@metamask/permission-controller",file:"node_modules/@metamask/permission-controller/dist/errors.js"}],[1305,{"./Caveat":1301,"./Permission":1302,"./PermissionController":1303,"./errors":1304,"./rpc-methods":1308,"./utils":1310},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),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.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return s(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.permissionRpcMethods=void 0,i(e("./Caveat"),n),i(e("./errors"),n),i(e("./Permission"),n),i(e("./PermissionController"),n),i(e("./utils"),n),n.permissionRpcMethods=o(e("./rpc-methods"))}}},{package:"@metamask/permission-controller",file:"node_modules/@metamask/permission-controller/dist/index.js"}],[1306,{"./errors":1304,"json-rpc-engine":2724},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(n,"__esModule",{value:!0}),n.getPermissionMiddlewareFactory=void 0;const s=e("json-rpc-engine"),i=e("./errors");n.getPermissionMiddlewareFactory=function({executeRestrictedMethod:e,getRestrictedMethod:t,isUnrestrictedMethod:n}){return function(o){const{origin:a}=o;if("string"!=typeof a||!a)throw new Error('The subject "origin" must be a non-empty string.');return(0,s.createAsyncMiddleware)(((s,c,u)=>r(this,void 0,void 0,(function*(){const{method:r,params:l}=s;if(n(r))return u();const d=t(r,a),h=yield e(d,o,r,l);return h===undefined?(c.error=(0,i.internalError)(`Request for method "${s.method}" returned undefined result.`,{request:s}),undefined):(c.result=h,undefined)}))))}}}}},{package:"@metamask/permission-controller",file:"node_modules/@metamask/permission-controller/dist/permission-middleware.js"}],[1307,{"../utils":1310},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(n,"__esModule",{value:!0}),n.getPermissionsHandler=void 0;const s=e("../utils");n.getPermissionsHandler={methodNames:[s.MethodNames.getPermissions],implementation:function(e,t,n,s,{getPermissionsForOrigin:i}){return r(this,void 0,void 0,(function*(){return t.result=Object.values(i()||{}),s()}))},hookNames:{getPermissionsForOrigin:!0}}}}},{package:"@metamask/permission-controller",file:"node_modules/@metamask/permission-controller/dist/rpc-methods/getPermissions.js"}],[1308,{"./getPermissions":1307,"./requestPermissions":1309},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.handlers=void 0;const r=e("./requestPermissions"),s=e("./getPermissions");n.handlers=[r.requestPermissionsHandler,s.getPermissionsHandler]}}},{package:"@metamask/permission-controller",file:"node_modules/@metamask/permission-controller/dist/rpc-methods/index.js"}],[1309,{"../errors":1304,"../utils":1310,"@metamask/controller-utils":1084,"eth-rpc-errors":2170},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(n,"__esModule",{value:!0}),n.requestPermissionsHandler=void 0;const s=e("eth-rpc-errors"),i=e("@metamask/controller-utils"),o=e("../utils"),a=e("../errors");n.requestPermissionsHandler={methodNames:[o.MethodNames.requestPermissions],implementation:function(e,t,n,o,{requestPermissionsForOrigin:c}){return r(this,void 0,void 0,(function*(){const{id:n,params:r}=e;if("number"!=typeof n&&"string"!=typeof n||"string"==typeof n&&!n)return o(s.ethErrors.rpc.invalidRequest({message:"Invalid request: Must specify a valid id.",data:{request:e}}));if(!Array.isArray(r)||!(0,i.isPlainObject)(r[0]))return o((0,a.invalidParams)({data:{request:e}}));const[u]=r,[l]=yield c(u,String(n));return t.result=Object.values(l),o()}))},hookNames:{requestPermissionsForOrigin:!0}}}}},{package:"@metamask/permission-controller",file:"node_modules/@metamask/permission-controller/dist/rpc-methods/requestPermissions.js"}],[131,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:49,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=49;const n=t.data;return t.data=function(e={}){if(e.PreferencesController){const{metaMetricsId:t,participateInMetaMetrics:n,metaMetricsSendCount:r}=e.PreferencesController;e.MetaMetricsController=e.MetaMetricsController??{},t!==undefined&&(e.MetaMetricsController.metaMetricsId=t,delete e.PreferencesController.metaMetricsId),n!==undefined&&(e.MetaMetricsController.participateInMetaMetrics=n,delete e.PreferencesController.participateInMetaMetrics),r!==undefined&&(e.MetaMetricsController.metaMetricsSendCount=r,delete e.PreferencesController.metaMetricsSendCount)}return e}(n),t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/049.js"}],[1310,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MethodNames=void 0,function(e){e.requestPermissions="wallet_requestPermissions",e.getPermissions="wallet_getPermissions"}(n.MethodNames||(n.MethodNames={}))}}},{package:"@metamask/permission-controller",file:"node_modules/@metamask/permission-controller/dist/utils.js"}],[1311,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.BaseController=void 0;class r{constructor(e={},t={}){this.defaultConfig={},this.defaultState={},this.disabled=!1,this.name="BaseController",this.internalConfig=this.defaultConfig,this.internalState=this.defaultState,this.internalListeners=[],this.initialState=t,this.initialConfig=e}initialize(){return this.internalState=this.defaultState,this.internalConfig=this.defaultConfig,this.configure(this.initialConfig),this.update(this.initialState),this}get config(){return this.internalConfig}get state(){return this.internalState}configure(e,t=!1,n=!0){if(n){this.internalConfig=t?e:Object.assign(this.internalConfig,e);for(const e in this.internalConfig)void 0!==this.internalConfig[e]&&(this[e]=this.internalConfig[e])}else for(const t in e)void 0!==this.internalConfig[t]&&(this.internalConfig[t]=e[t],this[t]=e[t])}notify(){this.disabled||this.internalListeners.forEach((e=>{e(this.internalState)}))}subscribe(e){this.internalListeners.push(e)}unsubscribe(e){const t=this.internalListeners.findIndex((t=>e===t));return t>-1&&this.internalListeners.splice(t,1),t>-1}update(e,t=!1){this.internalState=t?Object.assign({},e):Object.assign({},this.internalState,e),this.notify()}}n.BaseController=r,n.default=r}}},{package:"@metamask/permission-controller>@metamask/base-controller",file:"node_modules/@metamask/permission-controller/node_modules/@metamask/base-controller/dist/BaseController.js"}],[1312,{immer:2694},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseController=void 0;const r=e("immer");(0,r.enablePatches)();function s(e,t,n){return Object.keys(e).reduce(((r,s)=>{const i=t[s][n],o=e[s];return"function"==typeof i?r[s]=i(o):i&&(r[s]=o),r}),{})}n.BaseController=class{constructor({messenger:e,metadata:t,name:n,state:r}){this.messagingSystem=e,this.name=n,this.internalState=r,this.metadata=t,this.messagingSystem.registerActionHandler(`${n}:getState`,(()=>this.state))}get state(){return this.internalState}set state(e){throw new Error("Controller state cannot be directly mutated; use 'update' method instead.")}update(e){const[t,n,s]=r.produceWithPatches(this.internalState,e);return this.internalState=t,this.messagingSystem.publish(`${this.name}:stateChange`,t,n),{nextState:t,patches:n,inversePatches:s}}applyPatches(e){const t=(0,r.applyPatches)(this.internalState,e);this.internalState=t,this.messagingSystem.publish(`${this.name}:stateChange`,t,e)}destroy(){this.messagingSystem.clearEventSubscriptions(`${this.name}:stateChange`)}},n.getAnonymizedState=function(e,t){return s(e,t,"anonymous")},n.getPersistentState=function(e,t){return s(e,t,"persist")}}}},{package:"@metamask/permission-controller>@metamask/base-controller",file:"node_modules/@metamask/permission-controller/node_modules/@metamask/base-controller/dist/BaseControllerV2.js"}],[1313,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ControllerMessenger=n.RestrictedControllerMessenger=void 0;class r{constructor({controllerMessenger:e,name:t,allowedActions:n,allowedEvents:r}){this.controllerMessenger=e,this.controllerName=t,this.allowedActions=n||null,this.allowedEvents=r||null}registerActionHandler(e,t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed registering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.registerActionHandler(e,t)}unregisterActionHandler(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed unregistering action handlers prefixed by '${this.controllerName}:'`);this.controllerMessenger.unregisterActionHandler(e)}call(e,...t){if(null===this.allowedActions)throw new Error("No actions allowed");if(!this.allowedActions.includes(e))throw new Error(`Action missing from allow list: ${e}`);return this.controllerMessenger.call(e,...t)}publish(e,...t){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed publishing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.publish(e,...t)}subscribe(e,t,n){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);return n?this.controllerMessenger.subscribe(e,t,n):this.controllerMessenger.subscribe(e,t)}unsubscribe(e,t){if(null===this.allowedEvents)throw new Error("No events allowed");if(!this.allowedEvents.includes(e))throw new Error(`Event missing from allow list: ${e}`);this.controllerMessenger.unsubscribe(e,t)}clearEventSubscriptions(e){if(!e.startsWith(`${this.controllerName}:`))throw new Error(`Only allowed clearing events prefixed by '${this.controllerName}:'`);this.controllerMessenger.clearEventSubscriptions(e)}}n.RestrictedControllerMessenger=r;n.ControllerMessenger=class{constructor(){this.actions=new Map,this.events=new Map,this.eventPayloadCache=new Map}registerActionHandler(e,t){if(this.actions.has(e))throw new Error(`A handler for ${e} has already been registered`);this.actions.set(e,t)}unregisterActionHandler(e){this.actions.delete(e)}clearActions(){this.actions.clear()}call(e,...t){const n=this.actions.get(e);if(!n)throw new Error(`A handler for ${e} has not been registered`);return n(...t)}publish(e,...t){const n=this.events.get(e);if(n)for(const[e,r]of n.entries())if(r){const n=this.eventPayloadCache.get(e),s=r(...t);s!==n&&(this.eventPayloadCache.set(e,s),e(s,n))}else e(...t)}subscribe(e,t,n){let r=this.events.get(e);r||(r=new Map,this.events.set(e,r)),r.set(t,n)}unsubscribe(e,t){const n=this.events.get(e);if(!n||!n.has(t))throw new Error(`Subscription not found for event: ${e}`);n.get(t)&&this.eventPayloadCache.delete(t),n.delete(t)}clearEventSubscriptions(e){this.events.delete(e)}clearSubscriptions(){this.events.clear()}getRestricted({name:e,allowedActions:t,allowedEvents:n}){return new r({controllerMessenger:this,name:e,allowedActions:t,allowedEvents:n})}}}}},{package:"@metamask/permission-controller>@metamask/base-controller",file:"node_modules/@metamask/permission-controller/node_modules/@metamask/base-controller/dist/ControllerMessenger.js"}],[1314,{"./BaseController":1311,"./BaseControllerV2":1312,"./ControllerMessenger":1313},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.getPersistentState=n.getAnonymizedState=n.BaseControllerV2=n.BaseController=void 0;var i=e("./BaseController");Object.defineProperty(n,"BaseController",{enumerable:!0,get:function(){return i.BaseController}});var o=e("./BaseControllerV2");Object.defineProperty(n,"BaseControllerV2",{enumerable:!0,get:function(){return o.BaseController}}),Object.defineProperty(n,"getAnonymizedState",{enumerable:!0,get:function(){return o.getAnonymizedState}}),Object.defineProperty(n,"getPersistentState",{enumerable:!0,get:function(){return o.getPersistentState}}),s(e("./ControllerMessenger"),n)}}},{package:"@metamask/permission-controller>@metamask/base-controller",file:"node_modules/@metamask/permission-controller/node_modules/@metamask/base-controller/dist/index.js"}],[1315,{"./url-alphabet/index.cjs":1316},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){let{urlAlphabet:r}=e("./url-alphabet/index.cjs"),s=e=>crypto.getRandomValues(new Uint8Array(e)),i=(e,t,n)=>{let r=(2<<Math.log(e.length-1)/Math.LN2)-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let t=n(s),a=s;for(;a--;)if(o+=e[t[a]&r]||"",o.length===i)return o}}};t.exports={nanoid:(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),""),customAlphabet:(e,t=21)=>i(e,t,s),customRandom:i,urlAlphabet:r,random:s}}}},{package:"@metamask/permission-controller>nanoid",file:"node_modules/@metamask/permission-controller/node_modules/nanoid/index.browser.cjs"}],[1316,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){t.exports={urlAlphabet:"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"}}}},{package:"@metamask/permission-controller>nanoid",file:"node_modules/@metamask/permission-controller/node_modules/nanoid/url-alphabet/index.cjs"}],[1317,{"./utils":1319,"@metamask/base-controller":1079,"@metamask/controller-utils":1321,"eth-phishing-detect/src/config.json":2164,"eth-phishing-detect/src/detector":2165,"punycode/":3042},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s,i,o,a,c=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},u=this&&this.__classPrivateFieldGet||function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},l=this&&this.__classPrivateFieldSet||function(e,t,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!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"===r?s.call(e,n):s?s.value=n:t.set(e,n),n},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.PhishingController=n.METAMASK_HOTLIST_DIFF_URL=n.METAMASK_STALELIST_URL=n.STALELIST_REFRESH_INTERVAL=n.HOTLIST_REFRESH_INTERVAL=n.METAMASK_HOTLIST_DIFF_FILE=n.METAMASK_STALELIST_FILE=n.PHISHING_CONFIG_BASE_URL=void 0;const h=e("punycode/"),f=d(e("eth-phishing-detect/src/config.json")),p=d(e("eth-phishing-detect/src/detector")),m=e("@metamask/base-controller"),g=e("@metamask/controller-utils"),y=e("./utils");n.PHISHING_CONFIG_BASE_URL="https://static.metafi.codefi.network/api/v1/lists",n.METAMASK_STALELIST_FILE="/stalelist.json",n.METAMASK_HOTLIST_DIFF_FILE="/hotlist.json",n.HOTLIST_REFRESH_INTERVAL=1800,n.STALELIST_REFRESH_INTERVAL=345600,n.METAMASK_STALELIST_URL=`${n.PHISHING_CONFIG_BASE_URL}${n.METAMASK_STALELIST_FILE}`,n.METAMASK_HOTLIST_DIFF_URL=`${n.PHISHING_CONFIG_BASE_URL}${n.METAMASK_HOTLIST_DIFF_FILE}`;class b extends m.BaseController{constructor(e,t){super(e,t),r.add(this),s.set(this,void 0),i.set(this,void 0),this.name="PhishingController",this.defaultConfig={stalelistRefreshInterval:n.STALELIST_REFRESH_INTERVAL,hotlistRefreshInterval:n.HOTLIST_REFRESH_INTERVAL},this.defaultState={listState:{allowlist:f.default.whitelist,blocklist:f.default.blacklist,fuzzylist:f.default.fuzzylist,tolerance:f.default.tolerance,version:f.default.version,name:"MetaMask",lastUpdated:0},whitelist:[],hotlistLastFetched:0,stalelistLastFetched:0},this.initialize(),this.updatePhishingDetector()}updatePhishingDetector(){this.detector=new p.default([{allowlist:this.state.listState.allowlist,blocklist:this.state.listState.blocklist,fuzzylist:this.state.listState.fuzzylist,tolerance:this.state.listState.tolerance,name:"MetaMask",version:this.state.listState.version}])}setStalelistRefreshInterval(e){this.configure({stalelistRefreshInterval:e},!1,!1)}setHotlistRefreshInterval(e){this.configure({hotlistRefreshInterval:e},!1,!1)}isStalelistOutOfDate(){return(0,y.fetchTimeNow)()-this.state.stalelistLastFetched>=this.config.stalelistRefreshInterval}isHotlistOutOfDate(){return(0,y.fetchTimeNow)()-this.state.hotlistLastFetched>=this.config.hotlistRefreshInterval}maybeUpdateState(){return c(this,void 0,void 0,(function*(){if(this.isStalelistOutOfDate())return void(yield this.updateStalelist());this.isHotlistOutOfDate()&&(yield this.updateHotlist())}))}test(e){const t=(0,h.toASCII)(e);return-1!==this.state.whitelist.indexOf(t)?{result:!1,type:"all"}:this.detector.check(t)}bypass(e){const t=(0,h.toASCII)(e),{whitelist:n}=this.state;-1===n.indexOf(t)&&this.update({whitelist:[...n,t]})}updateHotlist(){return c(this,void 0,void 0,(function*(){if(u(this,s,"f"))yield u(this,s,"f");else try{l(this,s,u(this,r,"m",a).call(this),"f"),yield u(this,s,"f")}finally{l(this,s,undefined,"f")}}))}updateStalelist(){return c(this,void 0,void 0,(function*(){if(u(this,i,"f"))yield u(this,i,"f");else try{l(this,i,u(this,r,"m",o).call(this),"f"),yield u(this,i,"f")}finally{l(this,i,undefined,"f")}}))}queryConfig(e){return c(this,void 0,void 0,(function*(){const t=yield(0,g.safelyExecute)((()=>fetch(e,{cache:"no-cache"})),!0);return 200===(null==t?void 0:t.status)?yield t.json():null}))}}n.PhishingController=b,s=new WeakMap,i=new WeakMap,r=new WeakSet,o=function(){return c(this,void 0,void 0,(function*(){if(this.disabled)return;let e,t;try{[e,t]=yield Promise.all([this.queryConfig(n.METAMASK_STALELIST_URL),this.queryConfig(n.METAMASK_HOTLIST_DIFF_URL)])}finally{const e=(0,y.fetchTimeNow)();this.update({stalelistLastFetched:e,hotlistLastFetched:e})}if(!e||!t)return;const r=(0,y.applyDiffs)(e,t);this.update({listState:r}),this.updatePhishingDetector()}))},a=function(){return c(this,void 0,void 0,(function*(){if(this.disabled)return;let e;try{e=yield this.queryConfig(n.METAMASK_HOTLIST_DIFF_URL)}finally{this.update({hotlistLastFetched:(0,y.fetchTimeNow)()})}if(!e)return;const t=(0,y.applyDiffs)(this.state.listState,e);this.update({listState:t}),this.updatePhishingDetector()}))},n.default=b}}},{package:"@metamask/phishing-controller",file:"node_modules/@metamask/phishing-controller/dist/PhishingController.js"}],[1318,{"./PhishingController":1317,"isomorphic-fetch":2713},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),e("isomorphic-fetch"),s(e("./PhishingController"),n)}}},{package:"@metamask/phishing-controller",file:"node_modules/@metamask/phishing-controller/dist/index.js"}],[1319,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.applyDiffs=n.fetchTimeNow=void 0;n.fetchTimeNow=()=>Math.round(Date.now()/1e3);n.applyDiffs=(e,t)=>{const r=t.filter((({timestamp:t})=>t>e.lastUpdated)),s={allowlist:new Set(e.allowlist),blocklist:new Set(e.blocklist),fuzzylist:new Set(e.fuzzylist)};for(const{isRemoval:e,targetList:t,url:n}of r)e?s[t].delete(n):s[t].add(n);const i=(0,n.fetchTimeNow)();return{allowlist:Array.from(s.allowlist),blocklist:Array.from(s.blocklist),fuzzylist:Array.from(s.fuzzylist),version:e.version,name:"MetaMask",tolerance:e.tolerance,lastUpdated:i}}}}},{package:"@metamask/phishing-controller",file:"node_modules/@metamask/phishing-controller/dist/utils.js"}],[132,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");const s=["METASWAP_GAS_PRICE_ESTIMATES_LAST_RETRIEVED","METASWAP_GAS_PRICE_ESTIMATES","cachedFetch","BASIC_PRICE_ESTIMATES_LAST_RETRIEVED","BASIC_PRICE_ESTIMATES","BASIC_GAS_AND_TIME_API_ESTIMATES","BASIC_GAS_AND_TIME_API_ESTIMATES_LAST_RETRIEVED","GAS_API_ESTIMATES_LAST_RETRIEVED","GAS_API_ESTIMATES"];var i={version:50,async migrate(e){const t=(0,r.cloneDeep)(e);return t.meta.version=50,s.forEach((e=>{var t;return null===(t=window.localStorage)||void 0===t?void 0:t.removeItem(e)})),t}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/050.js"}],[1320,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.OPENSEA_TEST_API_URL=n.OPENSEA_API_URL=n.OPENSEA_PROXY_URL=n.TESTNET_NETWORK_TYPE_TO_TICKER_SYMBOL=n.TESTNET_TICKER_SYMBOLS=n.ASSET_TYPES=n.GWEI=n.ERC1155_TOKEN_RECEIVER_INTERFACE_ID=n.ERC1155_METADATA_URI_INTERFACE_ID=n.ERC1155_INTERFACE_ID=n.ERC721_ENUMERABLE_INTERFACE_ID=n.ERC721_METADATA_INTERFACE_ID=n.ERC721_INTERFACE_ID=n.ERC20=n.ERC1155=n.ERC721=n.GANACHE_CHAIN_ID=n.IPFS_DEFAULT_GATEWAY_URL=n.FALL_BACK_VS_CURRENCY=n.RPC=n.MAINNET=void 0,n.MAINNET="mainnet",n.RPC="rpc",n.FALL_BACK_VS_CURRENCY="ETH",n.IPFS_DEFAULT_GATEWAY_URL="https://cloudflare-ipfs.com/ipfs/",n.GANACHE_CHAIN_ID="1337",n.ERC721="ERC721",n.ERC1155="ERC1155",n.ERC20="ERC20",n.ERC721_INTERFACE_ID="0x80ac58cd",n.ERC721_METADATA_INTERFACE_ID="0x5b5e139f",n.ERC721_ENUMERABLE_INTERFACE_ID="0x780e9d63",n.ERC1155_INTERFACE_ID="0xd9b67a26",n.ERC1155_METADATA_URI_INTERFACE_ID="0x0e89341c",n.ERC1155_TOKEN_RECEIVER_INTERFACE_ID="0x4e2312e0",n.GWEI="gwei",n.ASSET_TYPES={NATIVE:"NATIVE",TOKEN:"TOKEN",NFT:"NFT",UNKNOWN:"UNKNOWN"},n.TESTNET_TICKER_SYMBOLS={GOERLI:"GoerliETH",SEPOLIA:"SepoliaETH"},n.TESTNET_NETWORK_TYPE_TO_TICKER_SYMBOL={goerli:"GoerliETH",sepolia:"SepoliaETH",mainnet:"",rpc:"",localhost:""},n.OPENSEA_PROXY_URL="https://proxy.metafi.codefi.network/opensea/v1/api/v1",n.OPENSEA_API_URL="https://api.opensea.io/api/v1",n.OPENSEA_TEST_API_URL="https://testnets-api.opensea.io/api/v1"}}},{package:"@metamask/phishing-controller>@metamask/controller-utils",file:"node_modules/@metamask/phishing-controller/node_modules/@metamask/controller-utils/dist/constants.js"}],[1321,{"./constants":1320,"./types":1322,"./util":1323,"isomorphic-fetch":2713},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),e("isomorphic-fetch"),s(e("./constants"),n),s(e("./util"),n),s(e("./types"),n)}}},{package:"@metamask/phishing-controller>@metamask/controller-utils",file:"node_modules/@metamask/phishing-controller/node_modules/@metamask/controller-utils/dist/index.js"}],[1322,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.NetworksChainId=void 0,function(e){e.mainnet="1",e.goerli="5",e.sepolia="11155111",e.localhost="",e.rpc=""}(n.NetworksChainId||(n.NetworksChainId={}))}}},{package:"@metamask/phishing-controller>@metamask/controller-utils",file:"node_modules/@metamask/phishing-controller/node_modules/@metamask/controller-utils/dist/types.js"}],[1323,{buffer:1943,"eth-ens-namehash":2139,"ethereumjs-util":2231,"ethjs-unit":2277,"fast-deep-equal":2486},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.isValidJson=n.isNonEmptyArray=n.hasProperty=n.isPlainObject=n.convertHexToDecimal=n.query=n.normalizeEnsName=n.timeoutFetch=n.fetchWithErrorHandling=n.handleFetch=n.successfulFetch=n.isSmartContractCode=n.isValidHexAddress=n.toChecksumHexAddress=n.safelyExecuteWithTimeout=n.safelyExecute=n.toHex=n.fromHex=n.hexToText=n.hexToBN=n.getBuyURL=n.weiHexToGweiDec=n.gweiDecToWEIBN=n.fractionBN=n.BNToHex=void 0;const i=e("ethereumjs-util"),o=e("ethjs-unit"),a=s(e("eth-ens-namehash")),c=s(e("fast-deep-equal")),u=new Error("timeout");function l(e){return new i.BN((0,i.stripHexPrefix)(e),16)}function d(e,t){return r(this,void 0,void 0,(function*(){const n=yield fetch(e,t);if(!n.ok)throw new Error(`Fetch failed with status '${n.status}' for request '${e}'`);return n}))}function h(e,t){return r(this,void 0,void 0,(function*(){const n=yield d(e,t);return yield n.json()}))}n.BNToHex=function(e){return(0,i.addHexPrefix)(e.toString(16))},n.fractionBN=function(e,t,n){const r=new i.BN(t),s=new i.BN(n);return e.mul(r).div(s)},n.gweiDecToWEIBN=function(e){if(Number.isNaN(e))return new i.BN(0);const t=e.toString().split("."),n=t[0]||"0";let r=t[1]||"";if(!r)return(0,o.toWei)(n,"gwei");if(r.length<=9)return(0,o.toWei)(`${n}.${r}`,"gwei");const s=r.slice(9)[0];r=r.slice(0,9);let a=(0,o.toWei)(`${n}.${r}`,"gwei");return Number(s)>=5&&(a=a.add(new i.BN(1))),a},n.weiHexToGweiDec=function(e){const t=new i.BN((0,i.stripHexPrefix)(e),16);return(0,o.fromWei)(t,"gwei").toString(10)},n.getBuyURL=function(e="1",t,n=5){switch(e){case"1":return`https://buy.coinbase.com/?code=9ec56d01-7e81-5017-930c-513daa27bb6a&amount=${n}&address=${t}&crypto_currency=ETH`;case"5":return"https://goerli-faucet.slock.it/";case"11155111":return"https://sepoliafaucet.net/";default:return undefined}},n.hexToBN=l,n.hexToText=function(e){try{const n=(0,i.stripHexPrefix)(e);return t.from(n,"hex").toString("utf8")}catch(t){return e}},n.fromHex=function(e){return i.BN.isBN(e)?e:new i.BN(l(e).toString(10))},n.toHex=function(e){return"string"==typeof e&&(0,i.isHexString)(e)?e:`0x${i.BN.isBN(e)?e.toString(16):new i.BN(e.toString(),10).toString(16)}`},n.safelyExecute=function(e,t=!1){return r(this,void 0,void 0,(function*(){try{return yield e()}catch(e){return t&&console.error(e),undefined}}))},n.safelyExecuteWithTimeout=function(e,t=!1,n=500){return r(this,void 0,void 0,(function*(){try{return yield Promise.race([e(),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))])}catch(e){return t&&console.error(e),undefined}}))},n.toChecksumHexAddress=function(e){const t=(0,i.addHexPrefix)(e);return(0,i.isHexString)(t)?(0,i.toChecksumAddress)(t):t},n.isValidHexAddress=function(e,{allowNonPrefixed:t=!0}={}){const n=t?(0,i.addHexPrefix)(e):e;return!!(0,i.isHexString)(n)&&(0,i.isValidAddress)(n)},n.isSmartContractCode=function(e){return!!e&&("0x"!==e&&"0x0"!==e)},n.successfulFetch=d,n.handleFetch=h,n.fetchWithErrorHandling=function({url:e,options:t,timeout:n,errorCodesToCatch:s}){return r(this,void 0,void 0,(function*(){let r;try{r=n?Promise.race([yield h(e,t),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))]):yield h(e,t)}catch(e){!function(e,t=[]){var n;if(!e)return;const r=t.some((t=>{var n;return null===(n=e.message)||void 0===n?void 0:n.includes(`Fetch failed with status '${t}'`)}));if(!(e instanceof Error&&(r||(null===(n=e.message)||void 0===n?void 0:n.includes("Failed to fetch"))||e===u)))throw e;console.error(e)}(e,s)}return r}))},n.timeoutFetch=function(e,t,n=500){return r(this,void 0,void 0,(function*(){return Promise.race([d(e,t),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))])}))},n.normalizeEnsName=function(e){if(e&&"string"==typeof e)try{const t=a.default.normalize(e.trim());if(t.match(/^(([\w\d-]+)\.)*[\w\d-]{7,}\.(eth|test)$/u))return t}catch(e){}return null},n.query=function(e,t,n=[]){return new Promise(((r,s)=>{const i=(e,t)=>{e?s(e):r(t)};"function"==typeof e[t]?e[t](...n,i):e.sendAsync({method:t,params:n},i)}))};n.convertHexToDecimal=(e="0x0")=>(0,i.isHexString)(e)?parseInt(e,16):Number(e)?Number(e):0,n.isPlainObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)};n.hasProperty=(e,t)=>Reflect.hasOwnProperty.call(e,t),n.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},n.isValidJson=function(e){try{return(0,c.default)(e,JSON.parse(JSON.stringify(e)))}catch(e){return!1}}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/phishing-controller>@metamask/controller-utils",file:"node_modules/@metamask/phishing-controller/node_modules/@metamask/controller-utils/dist/util.js"}],[1324,{"@metamask/key-tree":1260,"@metamask/utils":1353,"@noble/hashes/sha3":1386,superstruct:3282},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.enumValue=n.deriveEntropy=n.isEqual=n.selectHooks=void 0;const r=e("@metamask/key-tree"),s=e("@metamask/utils"),i=e("@noble/hashes/sha3"),o=e("superstruct"),a=2147483648;n.selectHooks=function(e,t){return t?Object.keys(t).reduce(((t,n)=>{const r=n;return t[r]=e[r],t}),{}):undefined},n.isEqual=function(e,t){return e.length===t.length&&e.every(((e,n)=>e===t[n]))},n.deriveEntropy=async function({input:e,salt:t="",mnemonicPhrase:n,magic:o}){const c=(0,s.stringToBytes)(e),u=(0,s.stringToBytes)(t),l=function(e){const t=[],n=(0,s.createDataView)(e);for(let e=0;e<8;e++){const r=(n.getUint32(4*e)|a)>>>0;t.push(`bip32:${r-a}'`)}return t}((0,i.keccak_256)((0,s.concatBytes)([c,(0,i.keccak_256)(u)]))),{privateKey:d}=await r.SLIP10Node.fromDerivationPath({derivationPath:[n,`bip32:${o}`,...l],curve:"secp256k1"});return(0,s.assert)(d,"Failed to derive the entropy."),(0,s.add0x)(d)},n.enumValue=function(e){return(0,o.literal)(e)}}}},{package:"@metamask/rpc-methods",file:"node_modules/@metamask/rpc-methods/dist/utils.js"}],[1326,{"@noble/hashes/_assert":1378,"@noble/hashes/pbkdf2":1383,"@noble/hashes/sha256":1385,"@noble/hashes/sha512":1387,"@noble/hashes/utils":1388,"@scure/base":1394},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.mnemonicToSeedSync=n.mnemonicToSeed=n.validateMnemonic=n.entropyToMnemonic=n.mnemonicToEntropy=n.generateMnemonic=void 0;
/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */
const r=e("@noble/hashes/_assert"),s=e("@noble/hashes/pbkdf2"),i=e("@noble/hashes/sha256"),o=e("@noble/hashes/sha512"),a=e("@noble/hashes/utils"),c=e("@scure/base");function u(e){if("string"!=typeof e)throw new TypeError("Invalid mnemonic type: "+typeof e);return e.normalize("NFKD")}function l(e){const t=u(e),n=t.split(" ");if(![12,15,18,21,24].includes(n.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:n}}function d(e){r.default.bytes(e,16,20,24,28,32)}n.generateMnemonic=function(e,t=128){if(r.default.number(t),t%32!=0||t>256)throw new TypeError("Invalid entropy");return m((0,a.randomBytes)(t/8),e)};const h=e=>{const t=8-e.length/4;return new Uint8Array([(0,i.sha256)(e)[0]>>t<<t])};function f(e){if(!Array.isArray(e)||2048!==e.length||"string"!=typeof e[0])throw new Error("Worlist: expected array of 2048 strings");return e.forEach((e=>{if("string"!=typeof e)throw new Error(`Wordlist: non-string element: ${e}`)})),c.utils.chain(c.utils.checksum(1,h),c.utils.radix2(11,!0),c.utils.alphabet(e))}function p(e,t){let n;if("string"==typeof e){const{words:r}=l(e);n=f(t).decode(r)}else n=f(t).decode(Array.from(new Uint16Array(e.buffer)).map((e=>t[e])));return d(n),n}function m(e,t){d(e);const n=f(t).encode(e).map((e=>t.indexOf(e)));return new Uint8Array(new Uint16Array(n).buffer)}n.mnemonicToEntropy=p,n.entropyToMnemonic=m,n.validateMnemonic=function(e,t){try{p(e,t)}catch(e){return!1}return!0};const g=e=>u(`mnemonic${e}`);function y(e,t){let n;return n="string"==typeof e?(new TextEncoder).encode(l(e).nfkd):(new TextEncoder).encode(Array.from(new Uint16Array(e.buffer)).map((e=>t[e])).join(" ")),n}n.mnemonicToSeed=function(e,t,n=""){const r=y(e,t);return(0,s.pbkdf2Async)(o.sha512,r,g(n),{c:2048,dkLen:64})},n.mnemonicToSeedSync=function(e,t,n=""){const r=y(e,t);return(0,s.pbkdf2)(o.sha512,r,g(n),{c:2048,dkLen:64})}}}},{package:"@metamask/scure-bip39",file:"node_modules/@metamask/scure-bip39/dist/index.js"}],[1327,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.wordlist=void 0,n.wordlist="abandon\nability\nable\nabout\nabove\nabsent\nabsorb\nabstract\nabsurd\nabuse\naccess\naccident\naccount\naccuse\nachieve\nacid\nacoustic\nacquire\nacross\nact\naction\nactor\nactress\nactual\nadapt\nadd\naddict\naddress\nadjust\nadmit\nadult\nadvance\nadvice\naerobic\naffair\nafford\nafraid\nagain\nage\nagent\nagree\nahead\naim\nair\nairport\naisle\nalarm\nalbum\nalcohol\nalert\nalien\nall\nalley\nallow\nalmost\nalone\nalpha\nalready\nalso\nalter\nalways\namateur\namazing\namong\namount\namused\nanalyst\nanchor\nancient\nanger\nangle\nangry\nanimal\nankle\nannounce\nannual\nanother\nanswer\nantenna\nantique\nanxiety\nany\napart\napology\nappear\napple\napprove\napril\narch\narctic\narea\narena\nargue\narm\narmed\narmor\narmy\naround\narrange\narrest\narrive\narrow\nart\nartefact\nartist\nartwork\nask\naspect\nassault\nasset\nassist\nassume\nasthma\nathlete\natom\nattack\nattend\nattitude\nattract\nauction\naudit\naugust\naunt\nauthor\nauto\nautumn\naverage\navocado\navoid\nawake\naware\naway\nawesome\nawful\nawkward\naxis\nbaby\nbachelor\nbacon\nbadge\nbag\nbalance\nbalcony\nball\nbamboo\nbanana\nbanner\nbar\nbarely\nbargain\nbarrel\nbase\nbasic\nbasket\nbattle\nbeach\nbean\nbeauty\nbecause\nbecome\nbeef\nbefore\nbegin\nbehave\nbehind\nbelieve\nbelow\nbelt\nbench\nbenefit\nbest\nbetray\nbetter\nbetween\nbeyond\nbicycle\nbid\nbike\nbind\nbiology\nbird\nbirth\nbitter\nblack\nblade\nblame\nblanket\nblast\nbleak\nbless\nblind\nblood\nblossom\nblouse\nblue\nblur\nblush\nboard\nboat\nbody\nboil\nbomb\nbone\nbonus\nbook\nboost\nborder\nboring\nborrow\nboss\nbottom\nbounce\nbox\nboy\nbracket\nbrain\nbrand\nbrass\nbrave\nbread\nbreeze\nbrick\nbridge\nbrief\nbright\nbring\nbrisk\nbroccoli\nbroken\nbronze\nbroom\nbrother\nbrown\nbrush\nbubble\nbuddy\nbudget\nbuffalo\nbuild\nbulb\nbulk\nbullet\nbundle\nbunker\nburden\nburger\nburst\nbus\nbusiness\nbusy\nbutter\nbuyer\nbuzz\ncabbage\ncabin\ncable\ncactus\ncage\ncake\ncall\ncalm\ncamera\ncamp\ncan\ncanal\ncancel\ncandy\ncannon\ncanoe\ncanvas\ncanyon\ncapable\ncapital\ncaptain\ncar\ncarbon\ncard\ncargo\ncarpet\ncarry\ncart\ncase\ncash\ncasino\ncastle\ncasual\ncat\ncatalog\ncatch\ncategory\ncattle\ncaught\ncause\ncaution\ncave\nceiling\ncelery\ncement\ncensus\ncentury\ncereal\ncertain\nchair\nchalk\nchampion\nchange\nchaos\nchapter\ncharge\nchase\nchat\ncheap\ncheck\ncheese\nchef\ncherry\nchest\nchicken\nchief\nchild\nchimney\nchoice\nchoose\nchronic\nchuckle\nchunk\nchurn\ncigar\ncinnamon\ncircle\ncitizen\ncity\ncivil\nclaim\nclap\nclarify\nclaw\nclay\nclean\nclerk\nclever\nclick\nclient\ncliff\nclimb\nclinic\nclip\nclock\nclog\nclose\ncloth\ncloud\nclown\nclub\nclump\ncluster\nclutch\ncoach\ncoast\ncoconut\ncode\ncoffee\ncoil\ncoin\ncollect\ncolor\ncolumn\ncombine\ncome\ncomfort\ncomic\ncommon\ncompany\nconcert\nconduct\nconfirm\ncongress\nconnect\nconsider\ncontrol\nconvince\ncook\ncool\ncopper\ncopy\ncoral\ncore\ncorn\ncorrect\ncost\ncotton\ncouch\ncountry\ncouple\ncourse\ncousin\ncover\ncoyote\ncrack\ncradle\ncraft\ncram\ncrane\ncrash\ncrater\ncrawl\ncrazy\ncream\ncredit\ncreek\ncrew\ncricket\ncrime\ncrisp\ncritic\ncrop\ncross\ncrouch\ncrowd\ncrucial\ncruel\ncruise\ncrumble\ncrunch\ncrush\ncry\ncrystal\ncube\nculture\ncup\ncupboard\ncurious\ncurrent\ncurtain\ncurve\ncushion\ncustom\ncute\ncycle\ndad\ndamage\ndamp\ndance\ndanger\ndaring\ndash\ndaughter\ndawn\nday\ndeal\ndebate\ndebris\ndecade\ndecember\ndecide\ndecline\ndecorate\ndecrease\ndeer\ndefense\ndefine\ndefy\ndegree\ndelay\ndeliver\ndemand\ndemise\ndenial\ndentist\ndeny\ndepart\ndepend\ndeposit\ndepth\ndeputy\nderive\ndescribe\ndesert\ndesign\ndesk\ndespair\ndestroy\ndetail\ndetect\ndevelop\ndevice\ndevote\ndiagram\ndial\ndiamond\ndiary\ndice\ndiesel\ndiet\ndiffer\ndigital\ndignity\ndilemma\ndinner\ndinosaur\ndirect\ndirt\ndisagree\ndiscover\ndisease\ndish\ndismiss\ndisorder\ndisplay\ndistance\ndivert\ndivide\ndivorce\ndizzy\ndoctor\ndocument\ndog\ndoll\ndolphin\ndomain\ndonate\ndonkey\ndonor\ndoor\ndose\ndouble\ndove\ndraft\ndragon\ndrama\ndrastic\ndraw\ndream\ndress\ndrift\ndrill\ndrink\ndrip\ndrive\ndrop\ndrum\ndry\nduck\ndumb\ndune\nduring\ndust\ndutch\nduty\ndwarf\ndynamic\neager\neagle\nearly\nearn\nearth\neasily\neast\neasy\necho\necology\neconomy\nedge\nedit\neducate\neffort\negg\neight\neither\nelbow\nelder\nelectric\nelegant\nelement\nelephant\nelevator\nelite\nelse\nembark\nembody\nembrace\nemerge\nemotion\nemploy\nempower\nempty\nenable\nenact\nend\nendless\nendorse\nenemy\nenergy\nenforce\nengage\nengine\nenhance\nenjoy\nenlist\nenough\nenrich\nenroll\nensure\nenter\nentire\nentry\nenvelope\nepisode\nequal\nequip\nera\nerase\nerode\nerosion\nerror\nerupt\nescape\nessay\nessence\nestate\neternal\nethics\nevidence\nevil\nevoke\nevolve\nexact\nexample\nexcess\nexchange\nexcite\nexclude\nexcuse\nexecute\nexercise\nexhaust\nexhibit\nexile\nexist\nexit\nexotic\nexpand\nexpect\nexpire\nexplain\nexpose\nexpress\nextend\nextra\neye\neyebrow\nfabric\nface\nfaculty\nfade\nfaint\nfaith\nfall\nfalse\nfame\nfamily\nfamous\nfan\nfancy\nfantasy\nfarm\nfashion\nfat\nfatal\nfather\nfatigue\nfault\nfavorite\nfeature\nfebruary\nfederal\nfee\nfeed\nfeel\nfemale\nfence\nfestival\nfetch\nfever\nfew\nfiber\nfiction\nfield\nfigure\nfile\nfilm\nfilter\nfinal\nfind\nfine\nfinger\nfinish\nfire\nfirm\nfirst\nfiscal\nfish\nfit\nfitness\nfix\nflag\nflame\nflash\nflat\nflavor\nflee\nflight\nflip\nfloat\nflock\nfloor\nflower\nfluid\nflush\nfly\nfoam\nfocus\nfog\nfoil\nfold\nfollow\nfood\nfoot\nforce\nforest\nforget\nfork\nfortune\nforum\nforward\nfossil\nfoster\nfound\nfox\nfragile\nframe\nfrequent\nfresh\nfriend\nfringe\nfrog\nfront\nfrost\nfrown\nfrozen\nfruit\nfuel\nfun\nfunny\nfurnace\nfury\nfuture\ngadget\ngain\ngalaxy\ngallery\ngame\ngap\ngarage\ngarbage\ngarden\ngarlic\ngarment\ngas\ngasp\ngate\ngather\ngauge\ngaze\ngeneral\ngenius\ngenre\ngentle\ngenuine\ngesture\nghost\ngiant\ngift\ngiggle\nginger\ngiraffe\ngirl\ngive\nglad\nglance\nglare\nglass\nglide\nglimpse\nglobe\ngloom\nglory\nglove\nglow\nglue\ngoat\ngoddess\ngold\ngood\ngoose\ngorilla\ngospel\ngossip\ngovern\ngown\ngrab\ngrace\ngrain\ngrant\ngrape\ngrass\ngravity\ngreat\ngreen\ngrid\ngrief\ngrit\ngrocery\ngroup\ngrow\ngrunt\nguard\nguess\nguide\nguilt\nguitar\ngun\ngym\nhabit\nhair\nhalf\nhammer\nhamster\nhand\nhappy\nharbor\nhard\nharsh\nharvest\nhat\nhave\nhawk\nhazard\nhead\nhealth\nheart\nheavy\nhedgehog\nheight\nhello\nhelmet\nhelp\nhen\nhero\nhidden\nhigh\nhill\nhint\nhip\nhire\nhistory\nhobby\nhockey\nhold\nhole\nholiday\nhollow\nhome\nhoney\nhood\nhope\nhorn\nhorror\nhorse\nhospital\nhost\nhotel\nhour\nhover\nhub\nhuge\nhuman\nhumble\nhumor\nhundred\nhungry\nhunt\nhurdle\nhurry\nhurt\nhusband\nhybrid\nice\nicon\nidea\nidentify\nidle\nignore\nill\nillegal\nillness\nimage\nimitate\nimmense\nimmune\nimpact\nimpose\nimprove\nimpulse\ninch\ninclude\nincome\nincrease\nindex\nindicate\nindoor\nindustry\ninfant\ninflict\ninform\ninhale\ninherit\ninitial\ninject\ninjury\ninmate\ninner\ninnocent\ninput\ninquiry\ninsane\ninsect\ninside\ninspire\ninstall\nintact\ninterest\ninto\ninvest\ninvite\ninvolve\niron\nisland\nisolate\nissue\nitem\nivory\njacket\njaguar\njar\njazz\njealous\njeans\njelly\njewel\njob\njoin\njoke\njourney\njoy\njudge\njuice\njump\njungle\njunior\njunk\njust\nkangaroo\nkeen\nkeep\nketchup\nkey\nkick\nkid\nkidney\nkind\nkingdom\nkiss\nkit\nkitchen\nkite\nkitten\nkiwi\nknee\nknife\nknock\nknow\nlab\nlabel\nlabor\nladder\nlady\nlake\nlamp\nlanguage\nlaptop\nlarge\nlater\nlatin\nlaugh\nlaundry\nlava\nlaw\nlawn\nlawsuit\nlayer\nlazy\nleader\nleaf\nlearn\nleave\nlecture\nleft\nleg\nlegal\nlegend\nleisure\nlemon\nlend\nlength\nlens\nleopard\nlesson\nletter\nlevel\nliar\nliberty\nlibrary\nlicense\nlife\nlift\nlight\nlike\nlimb\nlimit\nlink\nlion\nliquid\nlist\nlittle\nlive\nlizard\nload\nloan\nlobster\nlocal\nlock\nlogic\nlonely\nlong\nloop\nlottery\nloud\nlounge\nlove\nloyal\nlucky\nluggage\nlumber\nlunar\nlunch\nluxury\nlyrics\nmachine\nmad\nmagic\nmagnet\nmaid\nmail\nmain\nmajor\nmake\nmammal\nman\nmanage\nmandate\nmango\nmansion\nmanual\nmaple\nmarble\nmarch\nmargin\nmarine\nmarket\nmarriage\nmask\nmass\nmaster\nmatch\nmaterial\nmath\nmatrix\nmatter\nmaximum\nmaze\nmeadow\nmean\nmeasure\nmeat\nmechanic\nmedal\nmedia\nmelody\nmelt\nmember\nmemory\nmention\nmenu\nmercy\nmerge\nmerit\nmerry\nmesh\nmessage\nmetal\nmethod\nmiddle\nmidnight\nmilk\nmillion\nmimic\nmind\nminimum\nminor\nminute\nmiracle\nmirror\nmisery\nmiss\nmistake\nmix\nmixed\nmixture\nmobile\nmodel\nmodify\nmom\nmoment\nmonitor\nmonkey\nmonster\nmonth\nmoon\nmoral\nmore\nmorning\nmosquito\nmother\nmotion\nmotor\nmountain\nmouse\nmove\nmovie\nmuch\nmuffin\nmule\nmultiply\nmuscle\nmuseum\nmushroom\nmusic\nmust\nmutual\nmyself\nmystery\nmyth\nnaive\nname\nnapkin\nnarrow\nnasty\nnation\nnature\nnear\nneck\nneed\nnegative\nneglect\nneither\nnephew\nnerve\nnest\nnet\nnetwork\nneutral\nnever\nnews\nnext\nnice\nnight\nnoble\nnoise\nnominee\nnoodle\nnormal\nnorth\nnose\nnotable\nnote\nnothing\nnotice\nnovel\nnow\nnuclear\nnumber\nnurse\nnut\noak\nobey\nobject\noblige\nobscure\nobserve\nobtain\nobvious\noccur\nocean\noctober\nodor\noff\noffer\noffice\noften\noil\nokay\nold\nolive\nolympic\nomit\nonce\none\nonion\nonline\nonly\nopen\nopera\nopinion\noppose\noption\norange\norbit\norchard\norder\nordinary\norgan\norient\noriginal\norphan\nostrich\nother\noutdoor\nouter\noutput\noutside\noval\noven\nover\nown\nowner\noxygen\noyster\nozone\npact\npaddle\npage\npair\npalace\npalm\npanda\npanel\npanic\npanther\npaper\nparade\nparent\npark\nparrot\nparty\npass\npatch\npath\npatient\npatrol\npattern\npause\npave\npayment\npeace\npeanut\npear\npeasant\npelican\npen\npenalty\npencil\npeople\npepper\nperfect\npermit\nperson\npet\nphone\nphoto\nphrase\nphysical\npiano\npicnic\npicture\npiece\npig\npigeon\npill\npilot\npink\npioneer\npipe\npistol\npitch\npizza\nplace\nplanet\nplastic\nplate\nplay\nplease\npledge\npluck\nplug\nplunge\npoem\npoet\npoint\npolar\npole\npolice\npond\npony\npool\npopular\nportion\nposition\npossible\npost\npotato\npottery\npoverty\npowder\npower\npractice\npraise\npredict\nprefer\nprepare\npresent\npretty\nprevent\nprice\npride\nprimary\nprint\npriority\nprison\nprivate\nprize\nproblem\nprocess\nproduce\nprofit\nprogram\nproject\npromote\nproof\nproperty\nprosper\nprotect\nproud\nprovide\npublic\npudding\npull\npulp\npulse\npumpkin\npunch\npupil\npuppy\npurchase\npurity\npurpose\npurse\npush\nput\npuzzle\npyramid\nquality\nquantum\nquarter\nquestion\nquick\nquit\nquiz\nquote\nrabbit\nraccoon\nrace\nrack\nradar\nradio\nrail\nrain\nraise\nrally\nramp\nranch\nrandom\nrange\nrapid\nrare\nrate\nrather\nraven\nraw\nrazor\nready\nreal\nreason\nrebel\nrebuild\nrecall\nreceive\nrecipe\nrecord\nrecycle\nreduce\nreflect\nreform\nrefuse\nregion\nregret\nregular\nreject\nrelax\nrelease\nrelief\nrely\nremain\nremember\nremind\nremove\nrender\nrenew\nrent\nreopen\nrepair\nrepeat\nreplace\nreport\nrequire\nrescue\nresemble\nresist\nresource\nresponse\nresult\nretire\nretreat\nreturn\nreunion\nreveal\nreview\nreward\nrhythm\nrib\nribbon\nrice\nrich\nride\nridge\nrifle\nright\nrigid\nring\nriot\nripple\nrisk\nritual\nrival\nriver\nroad\nroast\nrobot\nrobust\nrocket\nromance\nroof\nrookie\nroom\nrose\nrotate\nrough\nround\nroute\nroyal\nrubber\nrude\nrug\nrule\nrun\nrunway\nrural\nsad\nsaddle\nsadness\nsafe\nsail\nsalad\nsalmon\nsalon\nsalt\nsalute\nsame\nsample\nsand\nsatisfy\nsatoshi\nsauce\nsausage\nsave\nsay\nscale\nscan\nscare\nscatter\nscene\nscheme\nschool\nscience\nscissors\nscorpion\nscout\nscrap\nscreen\nscript\nscrub\nsea\nsearch\nseason\nseat\nsecond\nsecret\nsection\nsecurity\nseed\nseek\nsegment\nselect\nsell\nseminar\nsenior\nsense\nsentence\nseries\nservice\nsession\nsettle\nsetup\nseven\nshadow\nshaft\nshallow\nshare\nshed\nshell\nsheriff\nshield\nshift\nshine\nship\nshiver\nshock\nshoe\nshoot\nshop\nshort\nshoulder\nshove\nshrimp\nshrug\nshuffle\nshy\nsibling\nsick\nside\nsiege\nsight\nsign\nsilent\nsilk\nsilly\nsilver\nsimilar\nsimple\nsince\nsing\nsiren\nsister\nsituate\nsix\nsize\nskate\nsketch\nski\nskill\nskin\nskirt\nskull\nslab\nslam\nsleep\nslender\nslice\nslide\nslight\nslim\nslogan\nslot\nslow\nslush\nsmall\nsmart\nsmile\nsmoke\nsmooth\nsnack\nsnake\nsnap\nsniff\nsnow\nsoap\nsoccer\nsocial\nsock\nsoda\nsoft\nsolar\nsoldier\nsolid\nsolution\nsolve\nsomeone\nsong\nsoon\nsorry\nsort\nsoul\nsound\nsoup\nsource\nsouth\nspace\nspare\nspatial\nspawn\nspeak\nspecial\nspeed\nspell\nspend\nsphere\nspice\nspider\nspike\nspin\nspirit\nsplit\nspoil\nsponsor\nspoon\nsport\nspot\nspray\nspread\nspring\nspy\nsquare\nsqueeze\nsquirrel\nstable\nstadium\nstaff\nstage\nstairs\nstamp\nstand\nstart\nstate\nstay\nsteak\nsteel\nstem\nstep\nstereo\nstick\nstill\nsting\nstock\nstomach\nstone\nstool\nstory\nstove\nstrategy\nstreet\nstrike\nstrong\nstruggle\nstudent\nstuff\nstumble\nstyle\nsubject\nsubmit\nsubway\nsuccess\nsuch\nsudden\nsuffer\nsugar\nsuggest\nsuit\nsummer\nsun\nsunny\nsunset\nsuper\nsupply\nsupreme\nsure\nsurface\nsurge\nsurprise\nsurround\nsurvey\nsuspect\nsustain\nswallow\nswamp\nswap\nswarm\nswear\nsweet\nswift\nswim\nswing\nswitch\nsword\nsymbol\nsymptom\nsyrup\nsystem\ntable\ntackle\ntag\ntail\ntalent\ntalk\ntank\ntape\ntarget\ntask\ntaste\ntattoo\ntaxi\nteach\nteam\ntell\nten\ntenant\ntennis\ntent\nterm\ntest\ntext\nthank\nthat\ntheme\nthen\ntheory\nthere\nthey\nthing\nthis\nthought\nthree\nthrive\nthrow\nthumb\nthunder\nticket\ntide\ntiger\ntilt\ntimber\ntime\ntiny\ntip\ntired\ntissue\ntitle\ntoast\ntobacco\ntoday\ntoddler\ntoe\ntogether\ntoilet\ntoken\ntomato\ntomorrow\ntone\ntongue\ntonight\ntool\ntooth\ntop\ntopic\ntopple\ntorch\ntornado\ntortoise\ntoss\ntotal\ntourist\ntoward\ntower\ntown\ntoy\ntrack\ntrade\ntraffic\ntragic\ntrain\ntransfer\ntrap\ntrash\ntravel\ntray\ntreat\ntree\ntrend\ntrial\ntribe\ntrick\ntrigger\ntrim\ntrip\ntrophy\ntrouble\ntruck\ntrue\ntruly\ntrumpet\ntrust\ntruth\ntry\ntube\ntuition\ntumble\ntuna\ntunnel\nturkey\nturn\nturtle\ntwelve\ntwenty\ntwice\ntwin\ntwist\ntwo\ntype\ntypical\nugly\numbrella\nunable\nunaware\nuncle\nuncover\nunder\nundo\nunfair\nunfold\nunhappy\nuniform\nunique\nunit\nuniverse\nunknown\nunlock\nuntil\nunusual\nunveil\nupdate\nupgrade\nuphold\nupon\nupper\nupset\nurban\nurge\nusage\nuse\nused\nuseful\nuseless\nusual\nutility\nvacant\nvacuum\nvague\nvalid\nvalley\nvalve\nvan\nvanish\nvapor\nvarious\nvast\nvault\nvehicle\nvelvet\nvendor\nventure\nvenue\nverb\nverify\nversion\nvery\nvessel\nveteran\nviable\nvibrant\nvicious\nvictory\nvideo\nview\nvillage\nvintage\nviolin\nvirtual\nvirus\nvisa\nvisit\nvisual\nvital\nvivid\nvocal\nvoice\nvoid\nvolcano\nvolume\nvote\nvoyage\nwage\nwagon\nwait\nwalk\nwall\nwalnut\nwant\nwarfare\nwarm\nwarrior\nwash\nwasp\nwaste\nwater\nwave\nway\nwealth\nweapon\nwear\nweasel\nweather\nweb\nwedding\nweekend\nweird\nwelcome\nwest\nwet\nwhale\nwhat\nwheat\nwheel\nwhen\nwhere\nwhip\nwhisper\nwide\nwidth\nwife\nwild\nwill\nwin\nwindow\nwine\nwing\nwink\nwinner\nwinter\nwire\nwisdom\nwise\nwish\nwitness\nwolf\nwoman\nwonder\nwood\nwool\nword\nwork\nworld\nworry\nworth\nwrap\nwreck\nwrestle\nwrist\nwrite\nwrong\nyard\nyear\nyellow\nyou\nyoung\nyouth\nzebra\nzero\nzone\nzoo".split("\n")}}},{package:"@metamask/scure-bip39",file:"node_modules/@metamask/scure-bip39/dist/wordlists/english.js"}],[1329,{"./constants":1330,"./types":1332,"./utils":1333,"@ethersproject/bignumber":410,"@ethersproject/bytes":413,"@ethersproject/providers":459,"@metamask/base-controller":1079,"@metamask/controller-utils":1335,"bignumber.js":1338,"lodash/cloneDeep":2905,"lodash/mapValues":2933},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.DEFAULT_INTERVAL=void 0;const s=e("@metamask/base-controller"),i=e("@metamask/controller-utils"),o=e("bignumber.js"),a=e("@ethersproject/bignumber"),c=e("@ethersproject/providers"),u=e("@ethersproject/bytes"),l=r(e("lodash/mapValues")),d=r(e("lodash/cloneDeep")),h=e("./types"),f=e("./utils"),p=e("./constants");n.DEFAULT_INTERVAL=5e3;class m extends s.BaseController{constructor({onNetworkStateChange:e,getNonceLock:t,getNetwork:r,provider:s,confirmExternalTransaction:i,trackMetaMetricsEvent:o},a,u){super(a,u),this.defaultConfig={interval:n.DEFAULT_INTERVAL,chainId:p.CHAIN_IDS.ETHEREUM,clientId:"default",supportedChainIds:[p.CHAIN_IDS.ETHEREUM,p.CHAIN_IDS.RINKEBY]},this.defaultState={smartTransactionsState:{smartTransactions:{},userOptIn:undefined,fees:{approvalTxFees:undefined,tradeTxFees:undefined},liveness:!0}},this.getNonceLock=t,this.getNetwork=r,this.ethersProvider=new c.Web3Provider(s),this.confirmExternalTransaction=i,this.trackMetaMetricsEvent=o,this.initialize(),this.initializeSmartTransactionsForChainId(),e((({providerConfig:e})=>{const{chainId:t}=e;this.configure({chainId:t}),this.initializeSmartTransactionsForChainId(),this.checkPoll(this.state),this.ethersProvider=new c.Web3Provider(s)})),this.subscribe((e=>this.checkPoll(e)))}async fetch(e,t){const{clientId:n}=this.config,r=Object.assign(Object.assign({},t),{headers:Object.assign({"Content-Type":"application/json"},n&&{"X-Client-Id":n})});return f.handleFetch(e,r)}checkPoll(e){const{smartTransactions:t}=e.smartTransactionsState,n=t[this.config.chainId],r=null==n?void 0:n.filter(f.isSmartTransactionPending);!this.timeoutHandle&&(null==r?void 0:r.length)>0?this.poll():this.timeoutHandle&&0===(null==r?void 0:r.length)&&this.stop()}initializeSmartTransactionsForChainId(){var e;if(this.config.supportedChainIds.includes(this.config.chainId)){const{smartTransactionsState:t}=this.state;this.update({smartTransactionsState:Object.assign(Object.assign({},t),{smartTransactions:Object.assign(Object.assign({},t.smartTransactions),{[this.config.chainId]:null!==(e=t.smartTransactions[this.config.chainId])&&void 0!==e?e:[]})})})}}async poll(e){const{chainId:t,supportedChainIds:n}=this.config;e&&this.configure({interval:e},!1,!1),this.timeoutHandle&&clearInterval(this.timeoutHandle),n.includes(t)&&(await i.safelyExecute((()=>this.updateSmartTransactions())),this.timeoutHandle=setInterval((()=>{i.safelyExecute((()=>this.updateSmartTransactions()))}),this.config.interval))}async stop(){this.timeoutHandle&&clearInterval(this.timeoutHandle),this.timeoutHandle=undefined}setOptInState(e){this.update({smartTransactionsState:Object.assign(Object.assign({},this.state.smartTransactionsState),{userOptIn:e})})}trackStxStatusChange(e,t){if(!t)return;let n=d.default(e);if(n=Object.assign(Object.assign({},d.default(t)),n),!n.swapMetaData||n.status===t.status&&t.swapMetaData)return;const r={stx_status:n.status,token_from_symbol:n.sourceTokenSymbol,token_to_symbol:n.destinationTokenSymbol,processing_time:f.getStxProcessingTime(n.time),stx_enabled:!0,current_stx_enabled:!0,stx_user_opt_in:!0};this.trackMetaMetricsEvent({event:"STX Status Updated",category:"swaps",sensitiveProperties:r})}isNewSmartTransaction(e){const{chainId:t}=this.config,{smartTransactionsState:n}=this.state,{smartTransactions:r}=n,s=r[t],i=null==s?void 0:s.findIndex((t=>t.uuid===e));return-1===i||i===undefined}updateSmartTransaction(e){const{chainId:t}=this.config,{smartTransactionsState:n}=this.state,{smartTransactions:r}=n,s=r[t],i=null==s?void 0:s.findIndex((t=>t.uuid===e.uuid)),o=this.isNewSmartTransaction(e.uuid);if(this.trackStxStatusChange(e,o?undefined:s[i]),o){const r=s.findIndex((t=>{var n,r,s;return(null===(n=t.txParams)||void 0===n?void 0:n.nonce)===(null===(r=e.txParams)||void 0===r?void 0:r.nonce)&&(null===(s=t.status)||void 0===s?void 0:s.startsWith("cancelled"))})),i=[d.default(e)],o=Object.assign(Object.assign({},e),{history:i}),a=r>-1?s.slice(0,r).concat(s.slice(r+1)).concat(o):s.concat(o);this.update({smartTransactionsState:Object.assign(Object.assign({},n),{smartTransactions:Object.assign(Object.assign({},n.smartTransactions),{[t]:a})})})}else{if((e.status===h.SmartTransactionStatuses.SUCCESS||e.status===h.SmartTransactionStatuses.REVERTED)&&!e.confirmed){const t=s[i],n=Object.assign(Object.assign({},t),e);this.confirmSmartTransaction(n)}this.update({smartTransactionsState:Object.assign(Object.assign({},n),{smartTransactions:Object.assign(Object.assign({},n.smartTransactions),{[t]:n.smartTransactions[t].map(((t,n)=>n===i?Object.assign(Object.assign({},t),e):t))})})})}}async updateSmartTransactions(){const{smartTransactions:e}=this.state.smartTransactionsState,{chainId:t}=this.config,n=(null==e?void 0:e[t]).filter(f.isSmartTransactionPending).map((e=>e.uuid));n.length>0&&this.fetchSmartTransactionsStatus(n)}async confirmSmartTransaction(e){var t,n,r;const s=null===(t=e.statusMetadata)||void 0===t?void 0:t.minedHash;try{const t=await this.ethersProvider.getTransactionReceipt(s),i=await this.ethersProvider.getTransaction(s),o=null===(n=i.maxFeePerGas)||void 0===n?void 0:n.toHexString(),c=null===(r=i.maxPriorityFeePerGas)||void 0===r?void 0:r.toHexString();if(null==t?void 0:t.blockNumber){const n=await this.ethersProvider.getBlock(null==t?void 0:t.blockNumber,!1),r=null==n?void 0:n.baseFeePerGas.toHexString(),i=l.default(t,(e=>e instanceof a.BigNumber?e.toHexString():e)),u=Object.assign(Object.assign({},e.txParams),{maxFeePerGas:o,maxPriorityFeePerGas:c}),d=Object.assign(Object.assign({},e),{id:e.uuid,status:"confirmed",hash:s,txParams:u}),h=f.snapshotFromTxMeta(d),p=f.replayHistory(d.history),m=f.generateHistoryEntry(p,h,"txStateManager: setting status to confirmed"),g=m.length>0?Object.assign(Object.assign({},d),{history:d.history.concat(m)}):d;this.confirmExternalTransaction(g,i,r),this.trackMetaMetricsEvent({event:"STX Confirmed",category:"swaps"}),this.updateSmartTransaction(Object.assign(Object.assign({},e),{confirmed:!0}))}}catch(e){this.trackMetaMetricsEvent({event:"STX Confirmation Failed",category:"swaps"}),console.error("confirm error",e)}}async fetchSmartTransactionsStatus(e){const{chainId:t}=this.config,n=new URLSearchParams({uuids:e.join(",")}),r=`${f.getAPIRequestURL(h.APIType.BATCH_STATUS,t)}?${n.toString()}`,s=await this.fetch(r);return Object.entries(s).forEach((([e,t])=>{this.updateSmartTransaction({statusMetadata:t,status:f.calculateStatus(t),cancellable:f.isSmartTransactionCancellable(t),uuid:e})})),s}async addNonceToTransaction(e){const t=await this.getNonceLock(e.from),n=t.nextNonce;return t.releaseLock(),Object.assign(Object.assign({},e),{nonce:`0x${n.toString(16)}`})}clearFees(){const e={approvalTxFees:undefined,tradeTxFees:undefined};return this.update({smartTransactionsState:Object.assign(Object.assign({},this.state.smartTransactionsState),{fees:e})}),e}async getFees(e,t){const{chainId:n}=this.config,r=[];let s;if(t){const n=await this.addNonceToTransaction(t);r.push(n),s=Object.assign(Object.assign({},e),{nonce:f.incrementNonceInHex(n.nonce)})}else s=await this.addNonceToTransaction(e);r.push(s);const i=await this.fetch(f.getAPIRequestURL(h.APIType.GET_FEES,n),{method:"POST",body:JSON.stringify({txs:r})});let o,a;return t?(o=null==i?void 0:i.txs[0],a=null==i?void 0:i.txs[1]):a=null==i?void 0:i.txs[0],this.update({smartTransactionsState:Object.assign(Object.assign({},this.state.smartTransactionsState),{fees:{approvalTxFees:o,tradeTxFees:a}})}),{approvalTxFees:o,tradeTxFees:a}}async submitSignedTransactions({txParams:e,signedTransactions:t,signedCanceledTransactions:n}){const{chainId:r}=this.config,s=await this.fetch(f.getAPIRequestURL(h.APIType.SUBMIT_TRANSACTIONS,r),{method:"POST",body:JSON.stringify({rawTxs:t,rawCancelTxs:n})}),i=Date.now(),a=this.getNetwork();let c;try{const t=await this.ethersProvider.getBalance(null==e?void 0:e.from);c=new o.BigNumber(t.toHexString()).toString(16)}catch(e){console.error("ethers error",e)}const l=await this.getNonceLock(null==e?void 0:e.from);try{const t=u.hexlify(l.nextNonce);e&&!(null==e?void 0:e.nonce)&&(e.nonce=t);const{nonceDetails:n}=l;this.updateSmartTransaction({chainId:r,nonceDetails:n,metamaskNetworkId:a,preTxBalance:c,status:h.SmartTransactionStatuses.PENDING,time:i,txParams:e,uuid:s.uuid,cancellable:!0})}finally{l.releaseLock()}return s}async cancelSmartTransaction(e){const{chainId:t}=this.config;await this.fetch(f.getAPIRequestURL(h.APIType.CANCEL,t),{method:"POST",body:JSON.stringify({uuid:e})})}async fetchLiveness(){const{chainId:e}=this.config;let t=!1;try{const n=await this.fetch(f.getAPIRequestURL(h.APIType.LIVENESS,e));t=Boolean(n.lastBlock)}catch(e){console.log('"fetchLiveness" API call failed')}return this.update({smartTransactionsState:Object.assign(Object.assign({},this.state.smartTransactionsState),{liveness:t})}),t}async setStatusRefreshInterval(e){e!==this.config.interval&&this.configure({interval:e},!1,!1)}getTransactions({addressFrom:e,status:t}){const{smartTransactions:n}=this.state.smartTransactionsState,{chainId:r}=this.config,s=null==n?void 0:n[r];return s&&0!==s.length?s.filter((n=>{var r;return n.status===t&&(null===(r=n.txParams)||void 0===r?void 0:r.from)===e})):[]}}n.default=m}}},{package:"@metamask/smart-transactions-controller",file:"node_modules/@metamask/smart-transactions-controller/dist/SmartTransactionsController.js"}],[133,{"../../../shared/constants/network":3409,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../../../shared/constants/network");var i={version:51,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=51;const n=t.data;return t.data=function(e){var t,n;const{chainId:r,type:i}=(null==e||null===(t=e.NetworkController)||void 0===t?void 0:t.provider)||{},o=null===(n=s.BUILT_IN_NETWORKS[i])||void 0===n?void 0:n.chainId;o&&r!==o&&(e.NetworkController.provider.chainId=o);return e}(n),t}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/051.js"}],[1330,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.CHAIN_IDS=n.API_BASE_URL=void 0,n.API_BASE_URL="https://transaction.metaswap.codefi.network",n.CHAIN_IDS={ETHEREUM:"0x1",RINKEBY:"0x4",BSC:"0x38"}}}},{package:"@metamask/smart-transactions-controller",file:"node_modules/@metamask/smart-transactions-controller/dist/constants.js"}],[1331,{"./SmartTransactionsController":1329,"isomorphic-fetch":2713},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),e("isomorphic-fetch");const s=r(e("./SmartTransactionsController"));n.default=s.default}}},{package:"@metamask/smart-transactions-controller",file:"node_modules/@metamask/smart-transactions-controller/dist/index.js"}],[1332,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r,s;Object.defineProperty(n,"__esModule",{value:!0}),n.cancellationReasonToStatusMap=n.SmartTransactionStatuses=n.SmartTransactionCancellationReason=n.SmartTransactionMinedTx=n.APIType=void 0,function(e){e[e.GET_FEES=0]="GET_FEES",e[e.ESTIMATE_GAS=1]="ESTIMATE_GAS",e[e.SUBMIT_TRANSACTIONS=2]="SUBMIT_TRANSACTIONS",e[e.CANCEL=3]="CANCEL",e[e.BATCH_STATUS=4]="BATCH_STATUS",e[e.LIVENESS=5]="LIVENESS"}(n.APIType||(n.APIType={})),function(e){e.NOT_MINED="not_mined",e.SUCCESS="success",e.CANCELLED="cancelled",e.REVERTED="reverted",e.UNKNOWN="unknown"}(n.SmartTransactionMinedTx||(n.SmartTransactionMinedTx={})),function(e){e.WOULD_REVERT="would_revert",e.TOO_CHEAP="too_cheap",e.DEADLINE_MISSED="deadline_missed",e.INVALID_NONCE="invalid_nonce",e.USER_CANCELLED="user_cancelled",e.NOT_CANCELLED="not_cancelled",e.PREVIOUS_TX_CANCELLED="previous_tx_cancelled"}(r=n.SmartTransactionCancellationReason||(n.SmartTransactionCancellationReason={})),function(e){e.PENDING="pending",e.SUCCESS="success",e.REVERTED="reverted",e.UNKNOWN="unknown",e.CANCELLED="cancelled",e.CANCELLED_WOULD_REVERT="cancelled_would_revert",e.CANCELLED_TOO_CHEAP="cancelled_too_cheap",e.CANCELLED_DEADLINE_MISSED="cancelled_deadline_missed",e.CANCELLED_INVALID_NONCE="cancelled_invalid_nonce",e.CANCELLED_USER_CANCELLED="cancelled_user_cancelled",e.CANCELLED_PREVIOUS_TX_CANCELLED="cancelled_previous_tx_cancelled",e.RESOLVED="resolved"}(s=n.SmartTransactionStatuses||(n.SmartTransactionStatuses={})),n.cancellationReasonToStatusMap={[r.WOULD_REVERT]:s.CANCELLED_WOULD_REVERT,[r.TOO_CHEAP]:s.CANCELLED_TOO_CHEAP,[r.DEADLINE_MISSED]:s.CANCELLED_DEADLINE_MISSED,[r.INVALID_NONCE]:s.CANCELLED_INVALID_NONCE,[r.USER_CANCELLED]:s.CANCELLED_USER_CANCELLED,[r.PREVIOUS_TX_CANCELLED]:s.CANCELLED_PREVIOUS_TX_CANCELLED}}}},{package:"@metamask/smart-transactions-controller",file:"node_modules/@metamask/smart-transactions-controller/dist/types.js"}],[1333,{"./constants":1330,"./types":1332,"@ethersproject/bytes":413,"bignumber.js":1338,"fast-json-patch":2490,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.incrementNonceInHex=n.isSmartTransactionCancellable=n.handleFetch=n.mapKeysToCamel=n.getStxProcessingTime=n.snapshotFromTxMeta=n.replayHistory=n.generateHistoryEntry=n.calculateStatus=n.getAPIRequestURL=n.isSmartTransactionStatusResolved=n.isSmartTransactionPending=void 0;const s=r(e("fast-json-patch")),i=r(e("lodash")),o=e("bignumber.js"),a=e("@ethersproject/bytes"),c=e("./types"),u=e("./constants");n.isSmartTransactionPending=function(e){return e.status===c.SmartTransactionStatuses.PENDING};n.isSmartTransactionStatusResolved=e=>"uuid_not_found"===e,n.getAPIRequestURL=function(e,t){const n=parseInt(t,16);switch(e){case c.APIType.GET_FEES:return`${u.API_BASE_URL}/networks/${n}/getFees`;case c.APIType.ESTIMATE_GAS:return`${u.API_BASE_URL}/networks/${n}/estimateGas`;case c.APIType.SUBMIT_TRANSACTIONS:return`${u.API_BASE_URL}/networks/${n}/submitTransactions`;case c.APIType.CANCEL:return`${u.API_BASE_URL}/networks/${n}/cancel`;case c.APIType.BATCH_STATUS:return`${u.API_BASE_URL}/networks/${n}/batchStatus`;case c.APIType.LIVENESS:return`${u.API_BASE_URL}/networks/${n}/health`;default:throw new Error("Invalid APIType")}};n.calculateStatus=e=>{if(n.isSmartTransactionStatusResolved(e))return c.SmartTransactionStatuses.RESOLVED;const t=[c.SmartTransactionCancellationReason.WOULD_REVERT,c.SmartTransactionCancellationReason.TOO_CHEAP,c.SmartTransactionCancellationReason.DEADLINE_MISSED,c.SmartTransactionCancellationReason.INVALID_NONCE,c.SmartTransactionCancellationReason.USER_CANCELLED,c.SmartTransactionCancellationReason.PREVIOUS_TX_CANCELLED];if((null==e?void 0:e.minedTx)===c.SmartTransactionMinedTx.NOT_MINED){if(e.cancellationReason===c.SmartTransactionCancellationReason.NOT_CANCELLED)return c.SmartTransactionStatuses.PENDING;const n=t.findIndex((t=>t===e.cancellationReason))>-1;if(e.cancellationReason&&n)return e.isSettled?c.cancellationReasonToStatusMap[e.cancellationReason]:c.SmartTransactionStatuses.PENDING}else{if((null==e?void 0:e.minedTx)===c.SmartTransactionMinedTx.SUCCESS)return c.SmartTransactionStatuses.SUCCESS;if((null==e?void 0:e.minedTx)===c.SmartTransactionMinedTx.CANCELLED)return c.SmartTransactionStatuses.CANCELLED;if((null==e?void 0:e.minedTx)===c.SmartTransactionMinedTx.REVERTED)return c.SmartTransactionStatuses.REVERTED;if((null==e?void 0:e.minedTx)===c.SmartTransactionMinedTx.UNKNOWN)return c.SmartTransactionStatuses.UNKNOWN}return c.SmartTransactionStatuses.UNKNOWN},n.generateHistoryEntry=function(e,t,n){const r=s.default.compare(e,t);return r[0]&&(n&&(r[0].note=n),r[0].timestamp=Date.now()),r},n.replayHistory=function(e){return i.default.cloneDeep(e).reduce(((e,t)=>s.default.applyPatch(e,t).newDocument))},n.snapshotFromTxMeta=function(e){const t=Object.assign({},e);return delete t.history,i.default.cloneDeep(t)};n.getStxProcessingTime=e=>e?Math.round((Date.now()-e)/1e3):undefined;n.mapKeysToCamel=e=>{if(!i.default.isObject(e))return e;const t=i.default.mapValues(e,(e=>i.default.isArray(e)?e.map(n.mapKeysToCamel):i.default.isObject(e)?n.mapKeysToCamel(e):e));return i.default.mapKeys(t,((e,t)=>i.default.camelCase(t)))},n.handleFetch=async function(e,t){const r=await fetch(e,t),s=await r.json();if(!r.ok)throw console.log("response",r),new Error(`Fetch error:${JSON.stringify(Object.assign({status:r.status},n.mapKeysToCamel(s)))}`);return s};n.isSmartTransactionCancellable=e=>e.minedTx===c.SmartTransactionMinedTx.NOT_MINED&&(!e.cancellationReason||e.cancellationReason===c.SmartTransactionCancellationReason.NOT_CANCELLED);n.incrementNonceInHex=e=>{const t=new o.BigNumber(e,16).toString(10);return a.hexlify(Number(t)+1)}}}},{package:"@metamask/smart-transactions-controller",file:"node_modules/@metamask/smart-transactions-controller/dist/utils.js"}],[1334,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.OPENSEA_TEST_API_URL=n.OPENSEA_API_URL=n.OPENSEA_PROXY_URL=n.TESTNET_NETWORK_TYPE_TO_TICKER_SYMBOL=n.TESTNET_TICKER_SYMBOLS=n.ASSET_TYPES=n.GWEI=n.ERC1155_TOKEN_RECEIVER_INTERFACE_ID=n.ERC1155_METADATA_URI_INTERFACE_ID=n.ERC1155_INTERFACE_ID=n.ERC721_ENUMERABLE_INTERFACE_ID=n.ERC721_METADATA_INTERFACE_ID=n.ERC721_INTERFACE_ID=n.ERC20=n.ERC1155=n.ERC721=n.GANACHE_CHAIN_ID=n.RINKEBY_CHAIN_ID=n.IPFS_DEFAULT_GATEWAY_URL=n.FALL_BACK_VS_CURRENCY=n.RPC=n.MAINNET=void 0,n.MAINNET="mainnet",n.RPC="rpc",n.FALL_BACK_VS_CURRENCY="ETH",n.IPFS_DEFAULT_GATEWAY_URL="https://cloudflare-ipfs.com/ipfs/",n.RINKEBY_CHAIN_ID="4",n.GANACHE_CHAIN_ID="1337",n.ERC721="ERC721",n.ERC1155="ERC1155",n.ERC20="ERC20",n.ERC721_INTERFACE_ID="0x80ac58cd",n.ERC721_METADATA_INTERFACE_ID="0x5b5e139f",n.ERC721_ENUMERABLE_INTERFACE_ID="0x780e9d63",n.ERC1155_INTERFACE_ID="0xd9b67a26",n.ERC1155_METADATA_URI_INTERFACE_ID="0x0e89341c",n.ERC1155_TOKEN_RECEIVER_INTERFACE_ID="0x4e2312e0",n.GWEI="gwei",n.ASSET_TYPES={NATIVE:"NATIVE",TOKEN:"TOKEN",NFT:"NFT",UNKNOWN:"UNKNOWN"},n.TESTNET_TICKER_SYMBOLS={RINKEBY:"RinkebyETH",GOERLI:"GoerliETH",ROPSTEN:"RopstenETH",KOVAN:"KovanETH"},n.TESTNET_NETWORK_TYPE_TO_TICKER_SYMBOL={rinkeby:"RinkebyETH",goerli:"GoerliETH",ropsten:"RopstenETH",kovan:"KovanETH",mainnet:"",rpc:"",localhost:""},n.OPENSEA_PROXY_URL="https://proxy.metaswap.codefi.network/opensea/v1/api/v1",n.OPENSEA_API_URL="https://api.opensea.io/api/v1",n.OPENSEA_TEST_API_URL="https://testnets-api.opensea.io/api/v1"}}},{package:"@metamask/smart-transactions-controller>@metamask/controller-utils",file:"node_modules/@metamask/smart-transactions-controller/node_modules/@metamask/controller-utils/dist/constants.js"}],[1335,{"./constants":1334,"./types":1336,"./util":1337,"isomorphic-fetch":2713},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),e("isomorphic-fetch"),s(e("./constants"),n),s(e("./util"),n),s(e("./types"),n)}}},{package:"@metamask/smart-transactions-controller>@metamask/controller-utils",file:"node_modules/@metamask/smart-transactions-controller/node_modules/@metamask/controller-utils/dist/index.js"}],[1336,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.NetworksChainId=void 0,function(e){e.mainnet="1",e.kovan="42",e.rinkeby="4",e.goerli="5",e.ropsten="3",e.localhost="",e.rpc=""}(n.NetworksChainId||(n.NetworksChainId={}))}}},{package:"@metamask/smart-transactions-controller>@metamask/controller-utils",file:"node_modules/@metamask/smart-transactions-controller/node_modules/@metamask/controller-utils/dist/types.js"}],[1337,{buffer:1943,"eth-ens-namehash":2139,"ethereumjs-util":2231,"ethjs-unit":2277,"fast-deep-equal":2486},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.isValidJson=n.isNonEmptyArray=n.hasProperty=n.isPlainObject=n.convertHexToDecimal=n.query=n.normalizeEnsName=n.timeoutFetch=n.fetchWithErrorHandling=n.handleFetch=n.successfulFetch=n.isSmartContractCode=n.isValidHexAddress=n.toChecksumHexAddress=n.safelyExecuteWithTimeout=n.safelyExecute=n.toHex=n.fromHex=n.hexToText=n.hexToBN=n.getBuyURL=n.weiHexToGweiDec=n.gweiDecToWEIBN=n.fractionBN=n.BNToHex=void 0;const i=e("ethereumjs-util"),o=e("ethjs-unit"),a=s(e("eth-ens-namehash")),c=s(e("fast-deep-equal")),u=new Error("timeout");function l(e){return new i.BN((0,i.stripHexPrefix)(e),16)}function d(e,t){return r(this,void 0,void 0,(function*(){const n=yield fetch(e,t);if(!n.ok)throw new Error(`Fetch failed with status '${n.status}' for request '${e}'`);return n}))}function h(e,t){return r(this,void 0,void 0,(function*(){const n=yield d(e,t);return yield n.json()}))}n.BNToHex=function(e){return(0,i.addHexPrefix)(e.toString(16))},n.fractionBN=function(e,t,n){const r=new i.BN(t),s=new i.BN(n);return e.mul(r).div(s)},n.gweiDecToWEIBN=function(e){if(Number.isNaN(e))return new i.BN(0);const t=e.toString().split("."),n=t[0]||"0";let r=t[1]||"";if(!r)return(0,o.toWei)(n,"gwei");if(r.length<=9)return(0,o.toWei)(`${n}.${r}`,"gwei");const s=r.slice(9)[0];r=r.slice(0,9);let a=(0,o.toWei)(`${n}.${r}`,"gwei");return Number(s)>=5&&(a=a.add(new i.BN(1))),a},n.weiHexToGweiDec=function(e){const t=new i.BN((0,i.stripHexPrefix)(e),16);return(0,o.fromWei)(t,"gwei").toString(10)},n.getBuyURL=function(e="1",t,n=5){switch(e){case"1":return`https://buy.coinbase.com/?code=9ec56d01-7e81-5017-930c-513daa27bb6a&amount=${n}&address=${t}&crypto_currency=ETH`;case"3":return"https://faucet.metamask.io/";case"4":return"https://www.rinkeby.io/";case"5":return"https://goerli-faucet.slock.it/";case"42":return"https://github.com/kovan-testnet/faucet";default:return undefined}},n.hexToBN=l,n.hexToText=function(e){try{const n=(0,i.stripHexPrefix)(e);return t.from(n,"hex").toString("utf8")}catch(t){return e}},n.fromHex=function(e){return i.BN.isBN(e)?e:new i.BN(l(e).toString(10))},n.toHex=function(e){return"string"==typeof e&&(0,i.isHexString)(e)?e:`0x${i.BN.isBN(e)?e.toString(16):new i.BN(e.toString(),10).toString(16)}`},n.safelyExecute=function(e,t=!1){return r(this,void 0,void 0,(function*(){try{return yield e()}catch(e){return t&&console.error(e),undefined}}))},n.safelyExecuteWithTimeout=function(e,t=!1,n=500){return r(this,void 0,void 0,(function*(){try{return yield Promise.race([e(),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))])}catch(e){return t&&console.error(e),undefined}}))},n.toChecksumHexAddress=function(e){const t=(0,i.addHexPrefix)(e);return(0,i.isHexString)(t)?(0,i.toChecksumAddress)(t):t},n.isValidHexAddress=function(e,{allowNonPrefixed:t=!0}={}){const n=t?(0,i.addHexPrefix)(e):e;return!!(0,i.isHexString)(n)&&(0,i.isValidAddress)(n)},n.isSmartContractCode=function(e){return!!e&&("0x"!==e&&"0x0"!==e)},n.successfulFetch=d,n.handleFetch=h,n.fetchWithErrorHandling=function({url:e,options:t,timeout:n,errorCodesToCatch:s}){return r(this,void 0,void 0,(function*(){let r;try{r=n?Promise.race([yield h(e,t),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))]):yield h(e,t)}catch(e){!function(e,t=[]){var n;if(!e)return;const r=t.some((t=>{var n;return null===(n=e.message)||void 0===n?void 0:n.includes(`Fetch failed with status '${t}'`)}));if(!(e instanceof Error&&(r||(null===(n=e.message)||void 0===n?void 0:n.includes("Failed to fetch"))||e===u)))throw e;console.error(e)}(e,s)}return r}))},n.timeoutFetch=function(e,t,n=500){return r(this,void 0,void 0,(function*(){return Promise.race([d(e,t),new Promise(((e,t)=>setTimeout((()=>{t(u)}),n)))])}))},n.normalizeEnsName=function(e){if(e&&"string"==typeof e)try{const t=a.default.normalize(e.trim());if(t.match(/^(([\w\d-]+)\.)*[\w\d-]{7,}\.(eth|test)$/u))return t}catch(e){}return null},n.query=function(e,t,n=[]){return new Promise(((r,s)=>{const i=(e,t)=>{e?s(e):r(t)};"function"==typeof e[t]?e[t](...n,i):e.sendAsync({method:t,params:n},i)}))};n.convertHexToDecimal=(e="0x0")=>(0,i.isHexString)(e)?parseInt(e,16):Number(e)?Number(e):0,n.isPlainObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)};n.hasProperty=(e,t)=>Reflect.hasOwnProperty.call(e,t),n.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},n.isValidJson=function(e){try{return(0,c.default)(e,JSON.parse(JSON.stringify(e)))}catch(e){return!1}}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/smart-transactions-controller>@metamask/controller-utils",file:"node_modules/@metamask/smart-transactions-controller/node_modules/@metamask/controller-utils/dist/util.js"}],[1338,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){!function(e){var n,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,i=Math.floor,o="[BigNumber Error] ",a=o+"Number primitive has more than 15 significant digits: ",c=1e14,u=14,l=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,f=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function m(e){for(var t,n,r=1,s=e.length,i=e[0]+"";r<s;){for(t=e[r++]+"",n=u-t.length;n--;t="0"+t);i+=t}for(s=i.length;48===i.charCodeAt(--s););return i.slice(0,s+1||1)}function g(e,t){var n,r,s=e.c,i=t.c,o=e.s,a=t.s,c=e.e,u=t.e;if(!o||!a)return null;if(n=s&&!s[0],r=i&&!i[0],n||r)return n?r?0:-a:o;if(o!=a)return o;if(n=o<0,r=c==u,!s||!i)return r?0:!s^n?1:-1;if(!r)return c>u^n?1:-1;for(a=(c=s.length)<(u=i.length)?c:u,o=0;o<a;o++)if(s[o]!=i[o])return s[o]>i[o]^n?1:-1;return c==u?0:c>u^n?1:-1}function y(e,t,n,r){if(e<t||e>n||e!==i(e))throw Error(o+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function b(e){var t=e.c.length-1;return p(e.e/u)==t&&e.c[t]%2!=0}function w(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function v(e,t,n){var r,s;if(t<0){for(s=n+".";++t;s+=n);e=s+e}else if(++t>(r=e.length)){for(s=n,t-=r;--t;s+=n);e+=s}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}n=function e(t){var n,_,E,k,T,S,P,A,I,C,j=$.prototype={constructor:$,toString:null,valueOf:null},x=new $(1),N=20,R=4,O=-7,B=21,M=-1e7,L=1e7,D=!1,K=1,H=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},U="0123456789abcdefghijklmnopqrstuvwxyz",V=!0;function $(e,t){var n,s,o,c,d,h,f,p,m=this;if(!(m instanceof $))return new $(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>L?m.c=m.e=null:e.e<M?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,d=e;d>=10;d/=10,c++);return void(c>L?m.c=m.e=null:(m.e=c,m.c=[e]))}p=String(e)}else{if(!r.test(p=String(e)))return E(m,p,h);m.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(c=p.indexOf("."))>-1&&(p=p.replace(".","")),(d=p.search(/e/i))>0?(c<0&&(c=d),c+=+p.slice(d+1),p=p.substring(0,d)):c<0&&(c=p.length)}else{if(y(t,2,U.length,"Base"),10==t&&V)return q(m=new $(e),N+m.e+1,R);if(p=String(e),h="number"==typeof e){if(0*e!=0)return E(m,p,h,t);if(m.s=1/e<0?(p=p.slice(1),-1):1,$.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else m.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(n=U.slice(0,t),c=d=0,f=p.length;d<f;d++)if(n.indexOf(s=p.charAt(d))<0){if("."==s){if(d>c){c=f;continue}}else if(!o&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){o=!0,d=-1,c=0;continue}return E(m,String(e),h,t)}h=!1,(c=(p=_(p,t,10,m.s)).indexOf("."))>-1?p=p.replace(".",""):c=p.length}for(d=0;48===p.charCodeAt(d);d++);for(f=p.length;48===p.charCodeAt(--f););if(p=p.slice(d,++f)){if(f-=d,h&&$.DEBUG&&f>15&&(e>l||e!==i(e)))throw Error(a+m.s*e);if((c=c-d-1)>L)m.c=m.e=null;else if(c<M)m.c=[m.e=0];else{if(m.e=c,m.c=[],d=(c+1)%u,c<0&&(d+=u),d<f){for(d&&m.c.push(+p.slice(0,d)),f-=u;d<f;)m.c.push(+p.slice(d,d+=u));d=u-(p=p.slice(d)).length}else d-=f;for(;d--;p+="0");m.c.push(+p)}}else m.c=[m.e=0]}function J(e,t,n,r){var s,i,o,a,c;if(null==n?n=R:y(n,0,8),!e.c)return e.toString();if(s=e.c[0],o=e.e,null==t)c=m(e.c),c=1==r||2==r&&(o<=O||o>=B)?w(c,o):v(c,o,"0");else if(i=(e=q(new $(e),t,n)).e,a=(c=m(e.c)).length,1==r||2==r&&(t<=i||i<=O)){for(;a<t;c+="0",a++);c=w(c,i)}else if(t-=o,c=v(c,i,"0"),i+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=i-a)>0)for(i+1==a&&(c+=".");t--;c+="0");return e.s<0&&s?"-"+c:c}function G(e,t){for(var n,r=1,s=new $(e[0]);r<e.length;r++){if(!(n=new $(e[r])).s){s=n;break}t.call(s,n)&&(s=n)}return s}function z(e,t,n){for(var r=1,s=t.length;!t[--s];t.pop());for(s=t[0];s>=10;s/=10,r++);return(n=r+n*u-1)>L?e.c=e.e=null:n<M?e.c=[e.e=0]:(e.e=n,e.c=t),e}function q(e,t,n,r){var o,a,l,h,f,p,m,g=e.c,y=d;if(g){e:{for(o=1,h=g[0];h>=10;h/=10,o++);if((a=t-o)<0)a+=u,l=t,m=(f=g[p=0])/y[o-l-1]%10|0;else if((p=s((a+1)/u))>=g.length){if(!r)break e;for(;g.length<=p;g.push(0));f=m=0,o=1,l=(a%=u)-u+1}else{for(f=h=g[p],o=1;h>=10;h/=10,o++);m=(l=(a%=u)-u+o)<0?0:f/y[o-l-1]%10|0}if(r=r||t<0||null!=g[p+1]||(l<0?f:f%y[o-l-1]),r=n<4?(m||r)&&(0==n||n==(e.s<0?3:2)):m>5||5==m&&(4==n||r||6==n&&(a>0?l>0?f/y[o-l]:0:g[p-1])%10&1||n==(e.s<0?8:7)),t<1||!g[0])return g.length=0,r?(t-=e.e+1,g[0]=y[(u-t%u)%u],e.e=-t||0):g[0]=e.e=0,e;if(0==a?(g.length=p,h=1,p--):(g.length=p+1,h=y[u-a],g[p]=l>0?i(f/y[o-l]%y[l])*h:0),r)for(;;){if(0==p){for(a=1,l=g[0];l>=10;l/=10,a++);for(l=g[0]+=h,h=1;l>=10;l/=10,h++);a!=h&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[p]+=h,g[p]!=c)break;g[p--]=0,h=1}for(a=g.length;0===g[--a];g.pop());}e.e>L?e.c=e.e=null:e.e<M&&(e.c=[e.e=0])}return e}function W(e){var t,n=e.e;return null===n?e.toString():(t=m(e.c),t=n<=O||n>=B?w(t,n):v(t,n,"0"),e.s<0?"-"+t:t)}return $.clone=e,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(o+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(y(n=e[t],0,f,t),N=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(y(n=e[t],0,8,t),R=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(y(n[0],-f,0,t),y(n[1],0,f,t),O=n[0],B=n[1]):(y(n,-f,f,t),O=-(B=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)y(n[0],-f,-1,t),y(n[1],1,f,t),M=n[0],L=n[1];else{if(y(n,-f,f,t),!n)throw Error(o+t+" cannot be zero: "+n);M=-(L=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(o+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw D=!n,Error(o+"crypto unavailable");D=n}else D=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(y(n=e[t],0,9,t),K=n),e.hasOwnProperty(t="POW_PRECISION")&&(y(n=e[t],0,f,t),H=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(o+t+" not an object: "+n);F=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(o+t+" invalid: "+n);V="0123456789"==n.slice(0,10),U=n}}return{DECIMAL_PLACES:N,ROUNDING_MODE:R,EXPONENTIAL_AT:[O,B],RANGE:[M,L],CRYPTO:D,MODULO_MODE:K,POW_PRECISION:H,FORMAT:F,ALPHABET:U}},$.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!$.DEBUG)return!0;var t,n,r=e.c,s=e.e,a=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===a||-1===a)&&s>=-f&&s<=f&&s===i(s)){if(0===r[0]){if(0===s&&1===r.length)return!0;break e}if((t=(s+1)%u)<1&&(t+=u),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=c||n!==i(n))break e;if(0!==n)return!0}}}else if(null===r&&null===s&&(null===a||1===a||-1===a))return!0;throw Error(o+"Invalid BigNumber: "+e)},$.maximum=$.max=function(){return G(arguments,j.lt)},$.minimum=$.min=function(){return G(arguments,j.gt)},$.random=(k=9007199254740992,T=Math.random()*k&2097151?function(){return i(Math.random()*k)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,a,c,l=0,h=[],p=new $(x);if(null==e?e=N:y(e,0,f),a=s(e/u),D)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(a*=2));l<a;)(c=131072*t[l]+(t[l+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[l]=n[0],t[l+1]=n[1]):(h.push(c%1e14),l+=2);l=a/2}else{if(!crypto.randomBytes)throw D=!1,Error(o+"crypto unavailable");for(t=crypto.randomBytes(a*=7);l<a;)(c=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(h.push(c%1e14),l+=7);l=a/7}if(!D)for(;l<a;)(c=T())<9e15&&(h[l++]=c%1e14);for(a=h[--l],e%=u,a&&e&&(c=d[u-e],h[l]=i(a/c)*c);0===h[l];h.pop(),l--);if(l<0)h=[r=0];else{for(r=-1;0===h[0];h.splice(0,1),r-=u);for(l=1,c=h[0];c>=10;c/=10,l++);l<u&&(r-=u-l)}return p.e=r,p.c=h,p}),$.sum=function(){for(var e=1,t=arguments,n=new $(t[0]);e<t.length;)n=n.plus(t[e++]);return n},_=function(){var e="0123456789";function t(e,t,n,r){for(var s,i,o=[0],a=0,c=e.length;a<c;){for(i=o.length;i--;o[i]*=t);for(o[0]+=r.indexOf(e.charAt(a++)),s=0;s<o.length;s++)o[s]>n-1&&(null==o[s+1]&&(o[s+1]=0),o[s+1]+=o[s]/n|0,o[s]%=n)}return o.reverse()}return function(r,s,i,o,a){var c,u,l,d,h,f,p,g,y=r.indexOf("."),b=N,w=R;for(y>=0&&(d=H,H=0,r=r.replace(".",""),f=(g=new $(s)).pow(r.length-y),H=d,g.c=t(v(m(f.c),f.e,"0"),10,i,e),g.e=g.c.length),l=d=(p=t(r,s,i,a?(c=U,e):(c=e,U))).length;0==p[--d];p.pop());if(!p[0])return c.charAt(0);if(y<0?--l:(f.c=p,f.e=l,f.s=o,p=(f=n(f,g,b,w,i)).c,h=f.r,l=f.e),y=p[u=l+b+1],d=i/2,h=h||u<0||null!=p[u+1],h=w<4?(null!=y||h)&&(0==w||w==(f.s<0?3:2)):y>d||y==d&&(4==w||h||6==w&&1&p[u-1]||w==(f.s<0?8:7)),u<1||!p[0])r=h?v(c.charAt(1),-b,c.charAt(0)):c.charAt(0);else{if(p.length=u,h)for(--i;++p[--u]>i;)p[u]=0,u||(++l,p=[1].concat(p));for(d=p.length;!p[--d];);for(y=0,r="";y<=d;r+=c.charAt(p[y++]));r=v(r,l,c.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,s,i,o,a=0,c=e.length,u=t%h,l=t/h|0;for(e=e.slice();c--;)a=((s=u*(i=e[c]%h)+(r=l*i+(o=e[c]/h|0)*u)%h*h+a)/n|0)+(r/h|0)+l*o,e[c]=s%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var s,i;if(n!=r)i=n>r?1:-1;else for(s=i=0;s<n;s++)if(e[s]!=t[s]){i=e[s]>t[s]?1:-1;break}return i}function n(e,t,n,r){for(var s=0;n--;)e[n]-=s,s=e[n]<t[n]?1:0,e[n]=s*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,s,o,a,l){var d,h,f,m,g,y,b,w,v,_,E,k,T,S,P,A,I,C=r.s==s.s?1:-1,j=r.c,x=s.c;if(!(j&&j[0]&&x&&x[0]))return new $(r.s&&s.s&&(j?!x||j[0]!=x[0]:x)?j&&0==j[0]||!x?0*C:C/0:NaN);for(v=(w=new $(C)).c=[],C=o+(h=r.e-s.e)+1,l||(l=c,h=p(r.e/u)-p(s.e/u),C=C/u|0),f=0;x[f]==(j[f]||0);f++);if(x[f]>(j[f]||0)&&h--,C<0)v.push(1),m=!0;else{for(S=j.length,A=x.length,f=0,C+=2,(g=i(l/(x[0]+1)))>1&&(x=e(x,g,l),j=e(j,g,l),A=x.length,S=j.length),T=A,E=(_=j.slice(0,A)).length;E<A;_[E++]=0);I=x.slice(),I=[0].concat(I),P=x[0],x[1]>=l/2&&P++;do{if(g=0,(d=t(x,_,A,E))<0){if(k=_[0],A!=E&&(k=k*l+(_[1]||0)),(g=i(k/P))>1)for(g>=l&&(g=l-1),b=(y=e(x,g,l)).length,E=_.length;1==t(y,_,b,E);)g--,n(y,A<b?I:x,b,l),b=y.length,d=1;else 0==g&&(d=g=1),b=(y=x.slice()).length;if(b<E&&(y=[0].concat(y)),n(_,y,E,l),E=_.length,-1==d)for(;t(x,_,A,E)<1;)g++,n(_,A<E?I:x,E,l),E=_.length}else 0===d&&(g++,_=[0]);v[f++]=g,_[0]?_[E++]=j[T]||0:(_=[j[T]],E=1)}while((T++<S||null!=_[0])&&C--);m=null!=_[0],v[0]||v.splice(0,1)}if(l==c){for(f=1,C=v[0];C>=10;C/=10,f++);q(w,o+(w.e=f+h*u-1)+1,a,m)}else w.e=h,w.r=+m;return w}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,P=/^([^.]+)\.$/,A=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g,E=function(e,t,n,r){var s,i=n?t:t.replace(C,"");if(I.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!n&&(i=i.replace(S,(function(e,t,n){return s="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=s?e:t})),r&&(s=r,i=i.replace(P,"$1").replace(A,"0.$1")),t!=i))return new $(i,s);if($.DEBUG)throw Error(o+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},j.absoluteValue=j.abs=function(){var e=new $(this);return e.s<0&&(e.s=1),e},j.comparedTo=function(e,t){return g(this,new $(e,t))},j.decimalPlaces=j.dp=function(e,t){var n,r,s,i=this;if(null!=e)return y(e,0,f),null==t?t=R:y(t,0,8),q(new $(i),e+i.e+1,t);if(!(n=i.c))return null;if(r=((s=n.length-1)-p(this.e/u))*u,s=n[s])for(;s%10==0;s/=10,r--);return r<0&&(r=0),r},j.dividedBy=j.div=function(e,t){return n(this,new $(e,t),N,R)},j.dividedToIntegerBy=j.idiv=function(e,t){return n(this,new $(e,t),0,1)},j.exponentiatedBy=j.pow=function(e,t){var n,r,a,c,l,d,h,f,p=this;if((e=new $(e)).c&&!e.isInteger())throw Error(o+"Exponent not an integer: "+W(e));if(null!=t&&(t=new $(t)),l=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return f=new $(Math.pow(+W(p),l?2-b(e):+W(e))),t?f.mod(t):f;if(d=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new $(NaN);(r=!d&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return c=p.s<0&&b(e)?-0:0,p.e>-1&&(c=1/c),new $(d?1/c:c);H&&(c=s(H/u+2))}for(l?(n=new $(.5),d&&(e.s=1),h=b(e)):h=(a=Math.abs(+W(e)))%2,f=new $(x);;){if(h){if(!(f=f.times(p)).c)break;c?f.c.length>c&&(f.c.length=c):r&&(f=f.mod(t))}if(a){if(0===(a=i(a/2)))break;h=a%2}else if(q(e=e.times(n),e.e+1,1),e.e>14)h=b(e);else{if(0===(a=+W(e)))break;h=a%2}p=p.times(p),c?p.c&&p.c.length>c&&(p.c.length=c):r&&(p=p.mod(t))}return r?f:(d&&(f=x.div(f)),t?f.mod(t):c?q(f,H,R,undefined):f)},j.integerValue=function(e){var t=new $(this);return null==e?e=R:y(e,0,8),q(t,t.e+1,e)},j.isEqualTo=j.eq=function(e,t){return 0===g(this,new $(e,t))},j.isFinite=function(){return!!this.c},j.isGreaterThan=j.gt=function(e,t){return g(this,new $(e,t))>0},j.isGreaterThanOrEqualTo=j.gte=function(e,t){return 1===(t=g(this,new $(e,t)))||0===t},j.isInteger=function(){return!!this.c&&p(this.e/u)>this.c.length-2},j.isLessThan=j.lt=function(e,t){return g(this,new $(e,t))<0},j.isLessThanOrEqualTo=j.lte=function(e,t){return-1===(t=g(this,new $(e,t)))||0===t},j.isNaN=function(){return!this.s},j.isNegative=function(){return this.s<0},j.isPositive=function(){return this.s>0},j.isZero=function(){return!!this.c&&0==this.c[0]},j.minus=function(e,t){var n,r,s,i,o=this,a=o.s;if(t=(e=new $(e,t)).s,!a||!t)return new $(NaN);if(a!=t)return e.s=-t,o.plus(e);var l=o.e/u,d=e.e/u,h=o.c,f=e.c;if(!l||!d){if(!h||!f)return h?(e.s=-t,e):new $(f?o:NaN);if(!h[0]||!f[0])return f[0]?(e.s=-t,e):new $(h[0]?o:3==R?-0:0)}if(l=p(l),d=p(d),h=h.slice(),a=l-d){for((i=a<0)?(a=-a,s=h):(d=l,s=f),s.reverse(),t=a;t--;s.push(0));s.reverse()}else for(r=(i=(a=h.length)<(t=f.length))?a:t,a=t=0;t<r;t++)if(h[t]!=f[t]){i=h[t]<f[t];break}if(i&&(s=h,h=f,f=s,e.s=-e.s),(t=(r=f.length)-(n=h.length))>0)for(;t--;h[n++]=0);for(t=c-1;r>a;){if(h[--r]<f[r]){for(n=r;n&&!h[--n];h[n]=t);--h[n],h[r]+=c}h[r]-=f[r]}for(;0==h[0];h.splice(0,1),--d);return h[0]?z(e,h,d):(e.s=3==R?-1:1,e.c=[e.e=0],e)},j.modulo=j.mod=function(e,t){var r,s,i=this;return e=new $(e,t),!i.c||!e.s||e.c&&!e.c[0]?new $(NaN):!e.c||i.c&&!i.c[0]?new $(i):(9==K?(s=e.s,e.s=1,r=n(i,e,0,3),e.s=s,r.s*=s):r=n(i,e,0,K),(e=i.minus(r.times(e))).c[0]||1!=K||(e.s=i.s),e)},j.multipliedBy=j.times=function(e,t){var n,r,s,i,o,a,l,d,f,m,g,y,b,w,v,_=this,E=_.c,k=(e=new $(e,t)).c;if(!(E&&k&&E[0]&&k[0]))return!_.s||!e.s||E&&!E[0]&&!k||k&&!k[0]&&!E?e.c=e.e=e.s=null:(e.s*=_.s,E&&k?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=p(_.e/u)+p(e.e/u),e.s*=_.s,(l=E.length)<(m=k.length)&&(b=E,E=k,k=b,s=l,l=m,m=s),s=l+m,b=[];s--;b.push(0));for(w=c,v=h,s=m;--s>=0;){for(n=0,g=k[s]%v,y=k[s]/v|0,i=s+(o=l);i>s;)n=((d=g*(d=E[--o]%v)+(a=y*d+(f=E[o]/v|0)*g)%v*v+b[i]+n)/w|0)+(a/v|0)+y*f,b[i--]=d%w;b[i]=n}return n?++r:b.splice(0,1),z(e,b,r)},j.negated=function(){var e=new $(this);return e.s=-e.s||null,e},j.plus=function(e,t){var n,r=this,s=r.s;if(t=(e=new $(e,t)).s,!s||!t)return new $(NaN);if(s!=t)return e.s=-t,r.minus(e);var i=r.e/u,o=e.e/u,a=r.c,l=e.c;if(!i||!o){if(!a||!l)return new $(s/0);if(!a[0]||!l[0])return l[0]?e:new $(a[0]?r:0*s)}if(i=p(i),o=p(o),a=a.slice(),s=i-o){for(s>0?(o=i,n=l):(s=-s,n=a),n.reverse();s--;n.push(0));n.reverse()}for((s=a.length)-(t=l.length)<0&&(n=l,l=a,a=n,t=s),s=0;t;)s=(a[--t]=a[t]+l[t]+s)/c|0,a[t]=c===a[t]?0:a[t]%c;return s&&(a=[s].concat(a),++o),z(e,a,o)},j.precision=j.sd=function(e,t){var n,r,s,i=this;if(null!=e&&e!==!!e)return y(e,1,f),null==t?t=R:y(t,0,8),q(new $(i),e,t);if(!(n=i.c))return null;if(r=(s=n.length-1)*u+1,s=n[s]){for(;s%10==0;s/=10,r--);for(s=n[0];s>=10;s/=10,r++);}return e&&i.e+1>r&&(r=i.e+1),r},j.shiftedBy=function(e){return y(e,-9007199254740991,l),this.times("1e"+e)},j.squareRoot=j.sqrt=function(){var e,t,r,s,i,o=this,a=o.c,c=o.s,u=o.e,l=N+4,d=new $("0.5");if(1!==c||!a||!a[0])return new $(!c||c<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(c=Math.sqrt(+W(o)))||c==1/0?(((t=m(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=p((u+1)/2)-(u<0||u%2),r=new $(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new $(c+""),r.c[0])for((c=(u=r.e)+l)<3&&(c=0);;)if(i=r,r=d.times(i.plus(n(o,i,l,1))),m(i.c).slice(0,c)===(t=m(r.c)).slice(0,c)){if(r.e<u&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(s||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(q(r,r.e+N+2,1),e=!r.times(r).eq(o));break}if(!s&&(q(i,i.e+N+2,0),i.times(i).eq(o))){r=i;break}l+=4,c+=4,s=1}return q(r,r.e+N+1,R,e)},j.toExponential=function(e,t){return null!=e&&(y(e,0,f),e++),J(this,e,t,1)},j.toFixed=function(e,t){return null!=e&&(y(e,0,f),e=e+this.e+1),J(this,e,t)},j.toFormat=function(e,t,n){var r,s=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=F;else if("object"!=typeof n)throw Error(o+"Argument not an object: "+n);if(r=s.toFixed(e,t),s.c){var i,a=r.split("."),c=+n.groupSize,u=+n.secondaryGroupSize,l=n.groupSeparator||"",d=a[0],h=a[1],f=s.s<0,p=f?d.slice(1):d,m=p.length;if(u&&(i=c,c=u,u=i,m-=i),c>0&&m>0){for(i=m%c||c,d=p.substr(0,i);i<m;i+=c)d+=l+p.substr(i,c);u>0&&(d+=l+p.slice(i)),f&&(d="-"+d)}r=h?d+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):d}return(n.prefix||"")+r+(n.suffix||"")},j.toFraction=function(e){var t,r,s,i,a,c,l,h,f,p,g,y,b=this,w=b.c;if(null!=e&&(!(l=new $(e)).isInteger()&&(l.c||1!==l.s)||l.lt(x)))throw Error(o+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+W(l));if(!w)return new $(b);for(t=new $(x),f=r=new $(x),s=h=new $(x),y=m(w),a=t.e=y.length-b.e-1,t.c[0]=d[(c=a%u)<0?u+c:c],e=!e||l.comparedTo(t)>0?a>0?t:f:l,c=L,L=1/0,l=new $(y),h.c[0]=0;p=n(l,t,0,1),1!=(i=r.plus(p.times(s))).comparedTo(e);)r=s,s=i,f=h.plus(p.times(i=f)),h=i,t=l.minus(p.times(i=t)),l=i;return i=n(e.minus(r),s,0,1),h=h.plus(i.times(f)),r=r.plus(i.times(s)),h.s=f.s=b.s,g=n(f,s,a*=2,R).minus(b).abs().comparedTo(n(h,r,a,R).minus(b).abs())<1?[f,s]:[h,r],L=c,g},j.toNumber=function(){return+W(this)},j.toPrecision=function(e,t){return null!=e&&y(e,1,f),J(this,e,t,2)},j.toString=function(e){var t,n=this,r=n.s,s=n.e;return null===s?r?(t="Infinity",r<0&&(t="-"+t)):t="NaN":(null==e?t=s<=O||s>=B?w(m(n.c),s):v(m(n.c),s,"0"):10===e&&V?t=v(m((n=q(new $(n),N+s+1,R)).c),n.e,"0"):(y(e,2,U.length,"Base"),t=_(v(m(n.c),s,"0"),10,e,r,!0)),r<0&&n.c[0]&&(t="-"+t)),t},j.valueOf=j.toJSON=function(){return W(this)},j._isBigNumber=!0,null!=t&&$.set(t),$}(),n.default=n.BigNumber=n,"function"==typeof define&&define.amd?define((function(){return n})):void 0!==t&&t.exports?t.exports=n:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=n)}(this)}}},{package:"@metamask/smart-transactions-controller>bignumber.js",file:"node_modules/@metamask/smart-transactions-controller/node_modules/bignumber.js/bignumber.js"}],[134,{"../../../shared/constants/network":3409,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../../../shared/constants/network");var i={version:52,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=52;const n=t.data;return t.data=function(e={}){if(e.PreferencesController){const{accountTokens:t,accountHiddenTokens:n,frequentRpcListDetail:r}=e.PreferencesController,i={},o={};if(t&&Object.keys(t).length>0){for(const e of Object.keys(t)){i[e]={},t[e][s.NETWORK_TYPES.RPC]&&r.forEach((n=>{i[e][n.chainId]=t[e][s.NETWORK_TYPES.RPC]}));for(const n of Object.keys(t[e]))switch(n){case s.NETWORK_TYPES.MAINNET:i[e][s.CHAIN_IDS.MAINNET]=t[e][s.NETWORK_TYPES.MAINNET];break;case"ropsten":i[e]["0x3"]=t[e].ropsten;break;case"rinkeby":i[e]["0x4"]=t[e].rinkeby;break;case s.NETWORK_TYPES.GOERLI:i[e][s.CHAIN_IDS.GOERLI]=t[e][s.NETWORK_TYPES.GOERLI];break;case"kovan":i[e]["0x2a"]=t[e].kovan}}e.PreferencesController.accountTokens=i}if(n&&Object.keys(n).length>0){for(const e of Object.keys(n)){o[e]={},n[e][s.NETWORK_TYPES.RPC]&&r.forEach((t=>{o[e][t.chainId]=n[e][s.NETWORK_TYPES.RPC]}));for(const t of Object.keys(n[e]))switch(t){case s.NETWORK_TYPES.MAINNET:o[e][s.CHAIN_IDS.MAINNET]=n[e][s.NETWORK_TYPES.MAINNET];break;case"ropsten":o[e]["0x3"]=n[e].ropsten;break;case"rinkeby":o[e]["0x4"]=n[e].rinkeby;break;case s.NETWORK_TYPES.GOERLI:o[e][s.CHAIN_IDS.GOERLI]=n[e][s.NETWORK_TYPES.GOERLI];break;case"kovan":o[e]["0x2a"]=n[e].kovan}}e.PreferencesController.accountHiddenTokens=o}}return e}(n),t}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/052.js"}],[1341,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createEventEmitterProxy=void 0;const r=()=>!0,s=["newListener","removeListener"],i=e=>!s.includes(e);n.createEventEmitterProxy=function(e,{eventFilter:t=r}={}){const n="skipInternal"===t?i:t;if("function"!=typeof n)throw new Error("createEventEmitterProxy - Invalid eventFilter");let s=e,o=e=>{const t=s;s=e,t.eventNames().filter(n).forEach((n=>{t.rawListeners(n).forEach((t=>{e.on(n,t)}))})),t.removeAllListeners()};return new Proxy(s,{get(e,t,n){if("setTarget"===t)return o;const r=s[t];return r instanceof Function?function(...e){return r.apply(this===n?s:this,e)}:r},set:(e,t,n)=>"setTarget"===t?(o=n,!0):(s[t]=n,!0)})}}}},{package:"@metamask/swappable-obj-proxy",file:"node_modules/@metamask/swappable-obj-proxy/dist/createEventEmitterProxy.js"}],[1342,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createSwappableProxy=void 0,n.createSwappableProxy=function(e){let t=e,n=e=>{t=e};return new Proxy(t,{get(e,r,s){if("setTarget"===r)return n;const i=t[r];return i instanceof Function?function(...e){return i.apply(this===s?t:this,e)}:i},set:(e,r,s)=>"setTarget"===r?(n=s,!0):(t[r]=s,!0)})}}}},{package:"@metamask/swappable-obj-proxy",file:"node_modules/@metamask/swappable-obj-proxy/dist/createSwappableProxy.js"}],[1343,{"./createEventEmitterProxy":1341,"./createSwappableProxy":1342,"./types":1344},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===undefined&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===undefined&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),s(e("./createEventEmitterProxy"),n),s(e("./createSwappableProxy"),n),s(e("./types"),n)}}},{package:"@metamask/swappable-obj-proxy",file:"node_modules/@metamask/swappable-obj-proxy/dist/index.js"}],[1344,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0})}}},{package:"@metamask/swappable-obj-proxy",file:"node_modules/@metamask/swappable-obj-proxy/dist/types.js"}],[135,{"../../../shared/constants/transaction":3417,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../../../shared/constants/transaction");var i={version:53,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=53;const n=t.data;return t.data=function(e){var t,n;const r=null==e||null===(t=e.TransactionController)||void 0===t?void 0:t.transactions,i=null==e||null===(n=e.IncomingTransactionsController)||void 0===n?void 0:n.incomingTransactions;Array.isArray(r)&&r.forEach((e=>{e&&(e.type!==s.TransactionType.retry&&e.type!==s.TransactionType.cancel&&(e.type=e.transactionCategory),delete e.transactionCategory)}));if(i){Object.entries(i).forEach((([t,n])=>{n&&(delete n.transactionCategory,e.IncomingTransactionsController.incomingTransactions[t]={...n,type:s.TransactionType.incoming})}))}return e}(n),t}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/053.js"}],[136,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");function s(e){return"number"==typeof e||"string"==typeof e&&e.match(/^(0x)?\d+$/u)}var i={version:54,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=54;const n=function(e){const t=e;if(!t.PreferencesController)return t;const n=(t.PreferencesController.tokens||[]).filter((({decimals:e})=>s(e)));for(const e of n)"string"==typeof e.decimals&&(e.decimals=parseInt(e.decimals));t.PreferencesController.tokens=n;const{accountTokens:r}=t.PreferencesController;if(r&&"object"==typeof r)for(const e of Object.keys(r)){const t=r[e];if(t&&"object"==typeof t)for(const e of Object.keys(t)){const n=(t[e]||[]).filter((({decimals:e})=>s(e)));for(const e of n)"string"==typeof e.decimals&&(e.decimals=parseInt(e.decimals));t[e]=n}}return t.PreferencesController.accountTokens=r,t}(t.data);return t.data=n,t}};n.default=i}}},{package:"$root$",file:"app/scripts/migrations/054.js"}],[1363,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){t.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var r=0;r<e.length;r++){var s=e.charAt(r),i=s.charCodeAt(0);if(255!==t[i])throw new TypeError(s+" is ambiguous");t[i]=r}var o=e.length,a=e.charAt(0),c=Math.log(o)/Math.log(256),u=Math.log(256)/Math.log(o);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var n=0;if(" "!==e[n]){for(var r=0,s=0;e[n]===a;)r++,n++;for(var i=(e.length-n)*c+1>>>0,u=new Uint8Array(i);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var d=0,h=i-1;(0!==l||d<s)&&-1!==h;h--,d++)l+=o*u[h]>>>0,u[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");s=d,n++}if(" "!==e[n]){for(var f=i-s;f!==i&&0===u[f];)f++;for(var p=new Uint8Array(r+(i-f)),m=r;f!==i;)p[m++]=u[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,s=0,i=t.length;s!==i&&0===t[s];)s++,n++;for(var c=(i-s)*u+1>>>0,l=new Uint8Array(c);s!==i;){for(var d=t[s],h=0,f=c-1;(0!==d||h<r)&&-1!==f;f--,h++)d+=256*l[f]>>>0,l[f]=d%o>>>0,d=d/o>>>0;if(0!==d)throw new Error("Non-zero carry");r=h,s++}for(var p=c-r;p!==c&&0===l[p];)p++;for(var m=a.repeat(n);p<c;++p)m+=e.charAt(l[p]);return m},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+o+" character")}}}}}},{package:"@ensdomains/content-hash>cids>multibase>@multiformats/base-x",file:"node_modules/@multiformats/base-x/src/index.js"}],[137,{"../../../shared/constants/network":3409,lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash"),s=e("../../../shared/constants/network");var i={version:55,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=55;const n=t.data;return t.data=function(e){var t;null!=e&&null!==(t=e.IncomingTransactionsController)&&void 0!==t&&t.incomingTxLastFetchedBlocksByNetwork&&(e.IncomingTransactionsController.incomingTxLastFetchedBlockByChainId=(0,r.mapKeys)(e.IncomingTransactionsController.incomingTxLastFetchedBlocksByNetwork,((e,t)=>{var n;return(null===(n=s.BUILT_IN_NETWORKS[t])||void 0===n?void 0:n.chainId)??o})),delete e.IncomingTransactionsController.incomingTxLastFetchedBlockByChainId.UNKNOWN,delete e.IncomingTransactionsController.incomingTxLastFetchedBlocksByNetwork);return e}(n),t}};n.default=i;const o="UNKNOWN";s.BUILT_IN_NETWORKS.rinkeby={networkId:"4",chainId:"0x4",ticker:"ETH"},s.BUILT_IN_NETWORKS.ropsten={networkId:"3",chainId:"0x3",ticker:"ETH"},s.BUILT_IN_NETWORKS.kovan={networkId:"42",chainId:"0x2a",ticker:"ETH"}}}},{package:"$root$",file:"app/scripts/migrations/055.js"}],[1377,{crypto:1942},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){
/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.utils=n.curve25519=n.getSharedSecret=n.verify=n.sign=n.getPublicKey=n.Signature=n.Point=n.RistrettoPoint=n.ExtendedPoint=n.CURVE=void 0;const s=r(e("crypto")),i=BigInt(0),o=BigInt(1),a=BigInt(2),c=BigInt(255),u=a**BigInt(252)+BigInt("27742317777372353535851937790883648493"),l={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:a**c-BigInt(19),l:u,n:u,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")};n.CURVE=l;const d=a**BigInt(256),h=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),f=(BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742"),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235")),p=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),m=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),g=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class y{constructor(e,t,n,r){this.x=e,this.y=t,this.z=n,this.t=r}static fromAffine(e){if(!(e instanceof k))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(k.ZERO)?y.ZERO:new y(e.x,e.y,o,R(e.x*e.y))}static toAffineBatch(e){const t=function(e,t=l.P){const n=new Array(e.length),r=O(e.reduce(((e,r,s)=>r===i?e:(n[s]=e,R(e*r,t))),o),t);return e.reduceRight(((e,r,s)=>r===i?e:(n[s]=R(e*n[s],t),R(e*r,t))),r),n}(e.map((e=>e.z)));return e.map(((e,n)=>e.toAffine(t[n])))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){b(e);const{x:t,y:n,z:r}=this,{x:s,y:i,z:o}=e,a=R(t*o),c=R(s*r),u=R(n*o),l=R(i*r);return a===c&&u===l}negate(){return new y(R(-this.x),this.y,this.z,R(-this.t))}double(){const{x:e,y:t,z:n}=this,{a:r}=l,s=R(e**a),i=R(t**a),o=R(a*R(n**a)),c=R(r*s),u=R(R((e+t)**a)-s-i),d=c+i,h=d-o,f=c-i,p=R(u*h),m=R(d*f),g=R(u*f),b=R(h*d);return new y(p,m,b,g)}add(e){b(e);const{x:t,y:n,z:r,t:s}=this,{x:o,y:c,z:u,t:l}=e,d=R((n-t)*(c+o)),h=R((n+t)*(c-o)),f=R(h-d);if(f===i)return this.double();const p=R(r*a*l),m=R(s*a*u),g=m+p,w=h+d,v=m-p,_=R(g*f),E=R(w*v),k=R(g*v),T=R(f*w);return new y(_,E,T,k)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,n=[];let r=this,s=r;for(let i=0;i<t;i++){s=r,n.push(s);for(let t=1;t<2**(e-1);t++)s=s.add(r),n.push(s);r=s.double()}return n}wNAF(e,t){!t&&this.equals(y.BASE)&&(t=k.BASE);const n=t&&t._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let r=t&&E.get(t);r||(r=this.precomputeWindow(n),t&&1!==n&&(r=y.normalizeZ(r),E.set(t,r)));let s=y.ZERO,i=y.ZERO;const a=1+256/n,c=2**(n-1),u=BigInt(2**n-1),l=2**n,d=BigInt(n);for(let t=0;t<a;t++){const n=t*c;let a=Number(e&u);if(e>>=d,a>c&&(a-=l,e+=o),0===a){let e=r[n];t%2&&(e=e.negate()),i=i.add(e)}else{let e=r[n+Math.abs(a)-1];a<0&&(e=e.negate()),s=s.add(e)}}return y.normalizeZ([s,i])[0]}multiply(e,t){return this.wNAF(F(e,l.l),t)}multiplyUnsafe(e){let t=F(e,l.l,!1);const n=y.BASE,r=y.ZERO;if(t===i)return r;if(this.equals(r)||t===o)return this;if(this.equals(n))return this.wNAF(t);let s=r,a=this;for(;t>i;)t&o&&(s=s.add(a)),a=a.double(),t>>=o;return s}isSmallOrder(){return this.multiplyUnsafe(l.h).equals(y.ZERO)}isTorsionFree(){return this.multiplyUnsafe(l.l).equals(y.ZERO)}toAffine(e=O(this.z)){const{x:t,y:n,z:r}=this,s=R(t*e),i=R(n*e);if(R(r*e)!==o)throw new Error("invZ was invalid");return new k(s,i)}fromRistrettoBytes(){v()}toRistrettoBytes(){v()}fromRistrettoHash(){v()}}function b(e){if(!(e instanceof y))throw new TypeError("ExtendedPoint expected")}function w(e){if(!(e instanceof _))throw new TypeError("RistrettoPoint expected")}function v(){throw new Error("Legacy method: switch to RistrettoPoint")}n.ExtendedPoint=y,y.BASE=new y(l.Gx,l.Gy,o,R(l.Gx*l.Gy)),y.ZERO=new y(i,o,o,i);class _{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=l,n=R(h*e*e),r=R((n+o)*m);let s=BigInt(-1);const i=R((s-t*n)*R(n+t));let{isValid:a,value:c}=L(r,i),u=R(c*e);j(u)||(u=R(-u)),a||(c=u),a||(s=n);const d=R(s*(n-o)*g-i),p=c*c,b=R((c+c)*i),w=R(d*f),v=R(o-p),_=R(o+p);return new y(R(b*_),R(v*w),R(w*_),R(b*v))}static hashToCurve(e){const t=N((e=H(e,64)).slice(0,32)),n=this.calcElligatorRistrettoMap(t),r=N(e.slice(32,64)),s=this.calcElligatorRistrettoMap(r);return new _(n.add(s))}static fromHex(e){e=H(e,32);const{a:t,d:n}=l,r="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",s=N(e);if(!function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(C(s),e)||j(s))throw new Error(r);const a=R(s*s),c=R(o+t*a),u=R(o-t*a),d=R(c*c),h=R(u*u),f=R(t*n*d-h),{isValid:p,value:m}=D(R(f*h)),g=R(m*u),b=R(m*g*f);let w=R((s+s)*g);j(w)&&(w=R(-w));const v=R(c*b),E=R(w*v);if(!p||j(E)||v===i)throw new Error(r);return new _(new y(w,v,o,E))}toRawBytes(){let{x:e,y:t,z:n,t:r}=this.ep;const s=R(R(n+t)*R(n-t)),i=R(e*t),{value:o}=D(R(s*i**a)),c=R(o*s),u=R(o*i),l=R(c*u*r);let d;if(j(r*l)){let n=R(t*h),r=R(e*h);e=n,t=r,d=R(c*p)}else d=u;j(e*l)&&(t=R(-t));let f=R((n-t)*d);return j(f)&&(f=R(-f)),C(f)}toHex(){return P(this.toRawBytes())}toString(){return this.toHex()}equals(e){w(e);const t=this.ep,n=e.ep,r=R(t.x*n.y)===R(t.y*n.x),s=R(t.y*n.y)===R(t.x*n.x);return r||s}add(e){return w(e),new _(this.ep.add(e.ep))}subtract(e){return w(e),new _(this.ep.subtract(e.ep))}multiply(e){return new _(this.ep.multiply(e))}multiplyUnsafe(e){return new _(this.ep.multiplyUnsafe(e))}}n.RistrettoPoint=_,_.BASE=new _(y.BASE),_.ZERO=new _(y.ZERO);const E=new WeakMap;class k{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,E.delete(this)}static fromHex(e,t=!0){const{d:n,P:r}=l,s=(e=H(e,32)).slice();s[31]=-129&e[31];const i=x(s);if(t&&i>=r)throw new Error("Expected 0 < hex < P");if(!t&&i>=d)throw new Error("Expected 0 < hex < 2**256");const a=R(i*i),c=R(a-o),u=R(n*a+o);let{isValid:h,value:f}=L(c,u);if(!h)throw new Error("Point.fromHex: invalid y coordinate");const p=(f&o)===o;return 0!=(128&e[31])!==p&&(f=R(-f)),new k(f,i)}static async fromPrivateKey(e){return(await V(e)).point}toRawBytes(){const e=C(this.y);return e[31]|=this.x&o?128:0,e}toHex(){return P(this.toRawBytes())}toX25519(){const{y:e}=this;return C(R((o+e)*O(o-e)))}isTorsionFree(){return y.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new k(R(-this.x),this.y)}add(e){return y.fromAffine(this).add(y.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return y.fromAffine(this).multiply(e,this).toAffine()}}n.Point=k,k.BASE=new k(l.Gx,l.Gy),k.ZERO=new k(i,o);class T{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=H(e,64),n=k.fromHex(t.slice(0,32),!1),r=x(t.slice(32,64));return new T(n,r)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof k))throw new Error("Expected Point instance");return F(t,l.l,!1),this}toRawBytes(){const e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(C(this.s),32),e}toHex(){return P(this.toRawBytes())}}n.Signature=T;const S=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function P(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=S[e[n]];return t}function A(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 n=0;n<t.length;n++){const r=2*n,s=e.slice(r,r+2),i=Number.parseInt(s,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");t[n]=i}return t}function I(e){return A(e.toString(16).padStart(64,"0"))}function C(e){return I(e).reverse()}function j(e){return(R(e)&o)===o}function x(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+P(Uint8Array.from(e).reverse()))}function N(e){return R(x(e)&a**c-o)}function R(e,t=l.P){const n=e%t;return n>=i?n:t+n}function O(e,t=l.P){if(e===i||t<=i)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=R(e,t),r=t,s=i,a=o,c=o,u=i;for(;n!==i;){const e=r/n,t=r%n,i=s-c*e,o=a-u*e;r=n,n=t,s=c,a=u,c=i,u=o}if(r!==o)throw new Error("invert: does not exist");return R(s,t)}function B(e,t){const{P:n}=l;let r=e;for(;t-- >i;)r*=r,r%=n;return r}function M(e){const{P:t}=l,n=BigInt(5),r=BigInt(10),s=BigInt(20),i=BigInt(40),c=BigInt(80),u=e*e%t*e%t,d=B(u,a)*u%t,h=B(d,o)*e%t,f=B(h,n)*h%t,p=B(f,r)*f%t,m=B(p,s)*p%t,g=B(m,i)*m%t,y=B(g,c)*g%t,b=B(y,c)*g%t,w=B(b,r)*f%t;return{pow_p_5_8:B(w,a)*e%t,b2:u}}function L(e,t){const n=R(t*t*t),r=R(n*n*t);let s=R(e*n*M(e*r).pow_p_5_8);const i=R(t*s*s),o=s,a=R(s*h),c=i===e,u=i===R(-e),l=i===R(-e*h);return c&&(s=o),(u||l)&&(s=a),j(s)&&(s=R(-s)),{isValid:c||u,value:s}}function D(e){return L(o,e)}async function K(...e){return R(x(await n.utils.sha512(function(...e){if(!e.every((e=>e instanceof Uint8Array)))throw new Error("Expected Uint8Array list");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){const s=e[t];n.set(s,r),r+=s.length}return n}(...e))),l.l)}function H(e,t){const n=e instanceof Uint8Array?Uint8Array.from(e):A(e);if("number"==typeof t&&n.length!==t)throw new Error(`Expected ${t} bytes`);return n}function F(e,t,n=!0){if(!t)throw new TypeError("Specify max value");if("number"==typeof e&&Number.isSafeInteger(e)&&(e=BigInt(e)),"bigint"==typeof e&&e<t)if(n){if(i<e)return e}else if(i<=e)return e;throw new TypeError("Expected valid scalar: 0 < scalar < max")}function U(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}async function V(e){if(32!==(e="bigint"==typeof e||"number"==typeof e?I(F(e,d)):H(e)).length)throw new Error("Expected 32 bytes");const t=await n.utils.sha512(e),r=U(t.slice(0,32)),s=t.slice(32,64),i=R(x(r),l.l),o=k.BASE.multiply(i),a=o.toRawBytes();return{head:r,prefix:s,scalar:i,point:o,pointBytes:a}}function $(e,t,n){const r=R(e*(t-n));return[t=R(t-r),n=R(n+r)]}n.getPublicKey=async function(e){return(await V(e)).pointBytes},n.sign=async function(e,t){e=H(e);const{prefix:n,scalar:r,pointBytes:s}=await V(t),i=await K(n,e),o=k.BASE.multiply(i),a=R(i+await K(o.toRawBytes(),s,e)*r,l.l);return new T(o,a).toRawBytes()},n.verify=async function(e,t,n){t=H(t),n instanceof k||(n=k.fromHex(n,!1));const{r:r,s:s}=e instanceof T?e.assertValidity():T.fromHex(e),i=y.BASE.multiplyUnsafe(s),o=await K(r.toRawBytes(),n.toRawBytes(),t),a=y.fromAffine(n).multiplyUnsafe(o);return y.fromAffine(r).add(a).subtract(i).multiplyUnsafe(l.h).equals(y.ZERO)},n.getSharedSecret=async function(e,t){const{head:r}=await V(e),s=k.fromHex(t).toX25519();return n.curve25519.scalarMult(r,s)},k.BASE._setWindowSize(8),n.curve25519={BASE_POINT_U:"0900000000000000000000000000000000000000000000000000000000000000",scalarMult(e,t){const n=function(e,t){const{P:n}=l,r=F(e,n),s=F(t,n),c=BigInt(121665),u=r;let d,h=o,f=i,p=r,m=o,g=i;for(let e=BigInt(254);e>=i;e--){const t=s>>e&o;g^=t,d=$(g,h,p),h=d[0],p=d[1],d=$(g,f,m),f=d[0],m=d[1],g=t;const n=h+f,r=R(n*n),i=h-f,l=R(i*i),y=r-l,b=p+m,w=R((p-m)*n),v=R(b*i);p=R((w+v)**a),m=R(u*(w-v)**a),h=R(r*l),f=R(y*(r+R(c*y)))}d=$(g,h,p),h=d[0],p=d[1],d=$(g,f,m),f=d[0],m=d[1];const{pow_p_5_8:y,b2:b}=M(f),w=R(B(y,BigInt(3))*b);return R(h*w)}(function(e){const t=H(e,32);return t[31]&=127,x(t)}(t),x(U(H(e,32))));if(n===i)throw new Error("Invalid private or public key received");return function(e){return C(R(e,l.P))}(n)},scalarMultBase:e=>n.curve25519.scalarMult(e,n.curve25519.BASE_POINT_U)};const J={node:s.default,web:"object"==typeof self&&"crypto"in self?self.crypto:undefined};n.utils={TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],bytesToHex:P,getExtendedPublicKey:V,mod:R,invert:O,hashToPrivateScalar:e=>{if((e=H(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");const t=R(x(e),l.l);if(t===i||t===o)throw new Error("Invalid private key");return t},randomBytes:(e=32)=>{if(J.web)return J.web.getRandomValues(new Uint8Array(e));if(J.node){const{randomBytes:t}=J.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>n.utils.randomBytes(32),sha512:async e=>{if(J.web){const t=await J.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(J.node)return Uint8Array.from(J.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")},precompute(e=8,t=k.BASE){const n=t.equals(k.BASE)?t:new k(t.x,t.y);return n._setWindowSize(e),n.multiply(a),n}}}}},{package:"@metamask/key-tree>@noble/ed25519",file:"node_modules/@noble/ed25519/lib/index.js"}],[1378,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function s(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function i(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function o(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function a(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function c(e,t){i(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(n,"__esModule",{value:!0}),n.output=n.exists=n.hash=n.bytes=n.bool=n.number=void 0,n.number=r,n.bool=s,n.bytes=i,n.hash=o,n.exists=a,n.output=c;const u={number:r,bool:s,bytes:i,hash:o,exists:a,output:c};n.default=u}}},{package:"@metamask/key-tree>@noble/hashes",file:"node_modules/@noble/hashes/_assert.js"}],[1379,{"./_assert.js":1378,"./utils.js":1388},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SHA2=void 0;const r=e("./_assert.js"),s=e("./utils.js");class i extends s.Hash{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,s.createView)(this.buffer)}update(e){r.default.exists(this);const{view:t,buffer:n,blockLen:i}=this,o=(e=(0,s.toBytes)(e)).length;for(let r=0;r<o;){const a=Math.min(i-this.pos,o-r);if(a!==i)n.set(e.subarray(r,r+a),this.pos),this.pos+=a,r+=a,this.pos===i&&(this.process(t,0),this.pos=0);else{const t=(0,s.createView)(e);for(;i<=o-r;r+=i)this.process(t,r)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){r.default.exists(this),r.default.output(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:i,isLE:o}=this;let{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>i-a&&(this.process(n,0),a=0);for(let e=a;e<i;e++)t[e]=0;!function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}(n,i-8,BigInt(8*this.length),o),this.process(n,0);const c=(0,s.createView)(e);this.get().forEach(((e,t)=>c.setUint32(4*t,e,o)))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:s,destroyed:i,pos:o}=this;return e.length=r,e.pos=o,e.finished=s,e.destroyed=i,r%t&&e.buffer.set(n),e}}n.SHA2=i}}},{package:"@metamask/key-tree>@noble/hashes",file:"node_modules/@noble/hashes/_sha2.js"}],[138,{lodash:2932},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=e("lodash");var s={version:56,async migrate(e){const t=(0,r.cloneDeep)(e);t.meta.version=56;const{PreferencesController:n}=t.data;return Array.isArray(null==n?void 0:n.tokens)&&(n.tokens=n.tokens.filter((({address:e})=>e))),null!=n&&n.accountTokens&&"object"==typeof n.accountTokens&&Object.keys(n.accountTokens).forEach((e=>{Object.keys(n.accountTokens[e]).forEach((t=>{n.accountTokens[e][t]=n.accountTokens[e][t].filter((({address:e})=>e))}))})),null!=n&&n.assetImages&&"undefined"in n.assetImages&&delete n.assetImages.undefined,t}};n.default=s}}},{package:"$root$",file:"app/scripts/migrations/056.js"}],[1380,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.add=n.toBig=n.split=n.fromBig=void 0;const r=BigInt(2**32-1),s=BigInt(32);function i(e,t=!1){return t?{h:Number(e&r),l:Number(e>>s&r)}:{h:0|Number(e>>s&r),l:0|Number(e&r)}}function o(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:o,l:a}=i(e[s],t);[n[s],r[s]]=[o,a]}return[n,r]}n.fromBig=i,n.split=o;n.toBig=(e,t)=>BigInt(e>>>0)<<s|BigInt(t>>>0);function a(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:0|s}}n.add=a;const c={fromBig:i,split:o,toBig:n.toBig,shrSH:(e,t,n)=>e>>>n,shrSL:(e,t,n)=>e<<32-n|t>>>n,rotrSH:(e,t,n)=>e>>>n|t<<32-n,rotrSL:(e,t,n)=>e<<32-n|t>>>n,rotrBH:(e,t,n)=>e<<64-n|t>>>n-32,rotrBL:(e,t,n)=>e>>>n-32|t<<64-n,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,n)=>e<<n|t>>>32-n,rotlSL:(e,t,n)=>t<<n|e>>>32-n,rotlBH:(e,t,n)=>t<<n-32|e>>>64-n,rotlBL:(e,t,n)=>e<<n-32|t>>>64-n,add:a,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,s)=>t+n+r+s+(e/2**32|0)|0,add5H:(e,t,n,r,s,i)=>t+n+r+s+i+(e/2**32|0)|0,add5L:(e,t,n,r,s)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(s>>>0)};n.default=c}}},{package:"@metamask/key-tree>@noble/hashes",file:"node_modules/@noble/hashes/_u64.js"}],[1381,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.crypto=void 0,n.crypto={node:undefined,web:"object"==typeof self&&"crypto"in self?self.crypto:undefined}}}},{package:"@metamask/key-tree>@noble/hashes",file:"node_modules/@noble/hashes/cryptoBrowser.js"}],[1382,{"./_assert.js":1378,"./utils.js":1388},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.hmac=void 0;const r=e("./_assert.js"),s=e("./utils.js");class i extends s.Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,r.default.hash(e);const n=(0,s.toBytes)(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let e=0;e<o.length;e++)o[e]^=54;this.iHash.update(o),this.oHash=e.create();for(let e=0;e<o.length;e++)o[e]^=106;this.oHash.update(o),o.fill(0)}update(e){return r.default.exists(this),this.iHash.update(e),this}digestInto(e){r.default.exists(this),r.default.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:s,blockLen:i,outputLen:o}=this;return e.finished=r,e.destroyed=s,e.blockLen=i,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}n.hmac=(e,t,n)=>new i(e,t).update(n).digest(),n.hmac.create=(e,t)=>new i(e,t)}}},{package:"@metamask/key-tree>@noble/hashes",file:"node_modules/@noble/hashes/hmac.js"}],[1383,{"./_assert.js":1378,"./hmac.js":1382,"./utils.js":1388},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.pbkdf2Async=n.pbkdf2=void 0;const r=e("./_assert.js"),s=e("./hmac.js"),i=e("./utils.js");function o(e,t,n,o){r.default.hash(e);const a=(0,i.checkOpts)({dkLen:32,asyncTick:10},o),{c:c,dkLen:u,asyncTick:l}=a;if(r.default.number(c),r.default.number(u),r.default.number(l),c<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const d=(0,i.toBytes)(t),h=(0,i.toBytes)(n),f=new Uint8Array(u),p=s.hmac.create(e,d),m=p._cloneInto().update(h);return{c:c,dkLen:u,asyncTick:l,DK:f,PRF:p,PRFSalt:m}}function a(e,t,n,r,s){return e.destroy(),t.destroy(),r&&r.destroy(),s.fill(0),n}n.pbkdf2=function(e,t,n,r){const{c:s,dkLen:c,DK:u,PRF:l,PRFSalt:d}=o(e,t,n,r);let h;const f=new Uint8Array(4),p=(0,i.createView)(f),m=new Uint8Array(l.outputLen);for(let e=1,t=0;t<c;e++,t+=l.outputLen){const n=u.subarray(t,t+l.outputLen);p.setInt32(0,e,!1),(h=d._cloneInto(h)).update(f).digestInto(m),n.set(m.subarray(0,n.length));for(let e=1;e<s;e++){l._cloneInto(h).update(m).digestInto(m);for(let e=0;e<n.length;e++)n[e]^=m[e]}}return a(l,d,u,h,m)},n.pbkdf2Async=async function(e,t,n,r){const{c:s,dkLen:c,asyncTick:u,DK:l,PRF:d,PRFSalt:h}=o(e,t,n,r);let f;const p=new Uint8Array(4),m=(0,i.createView)(p),g=new Uint8Array(d.outputLen);for(let e=1,t=0;t<c;e++,t+=d.outputLen){const n=l.subarray(t,t+d.outputLen);m.setInt32(0,e,!1),(f=h._cloneInto(f)).update(p).digestInto(g),n.set(g.subarray(0,n.length)),await(0,i.asyncLoop)(s-1,u,(e=>{d._cloneInto(f).update(g).digestInto(g);for(let e=0;e<n.length;e++)n[e]^=g[e]}))}return a(d,h,l,f,g)}}}},{package:"@metamask/key-tree>@noble/hashes",file:"node_modules/@noble/hashes/pbkdf2.js"}],[1384,{"./_sha2.js":1379,"./utils.js":1388},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ripemd160=n.RIPEMD160=void 0;const r=e("./_sha2.js"),s=e("./utils.js"),i=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),o=Uint8Array.from({length:16},((e,t)=>t)),a=o.map((e=>(9*e+5)%16));let c=[o],u=[a];for(let e=0;e<4;e++)for(let t of[c,u])t.push(t[e].map((e=>i[e])));const l=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((e=>new Uint8Array(e))),d=c.map(((e,t)=>e.map((e=>l[t][e])))),h=u.map(((e,t)=>e.map((e=>l[t][e])))),f=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),p=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),m=(e,t)=>e<<t|e>>>32-t;function g(e,t,n,r){return 0===e?t^n^r:1===e?t&n|~t&r:2===e?(t|~n)^r:3===e?t&r|n&~r:t^(n|~r)}const y=new Uint32Array(16);class b extends r.SHA2{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:n,h3:r,h4:s}=this;return[e,t,n,r,s]}set(e,t,n,r,s){this.h0=0|e,this.h1=0|t,this.h2=0|n,this.h3=0|r,this.h4=0|s}process(e,t){for(let n=0;n<16;n++,t+=4)y[n]=e.getUint32(t,!0);let n=0|this.h0,r=n,s=0|this.h1,i=s,o=0|this.h2,a=o,l=0|this.h3,b=l,w=0|this.h4,v=w;for(let e=0;e<5;e++){const t=4-e,_=f[e],E=p[e],k=c[e],T=u[e],S=d[e],P=h[e];for(let t=0;t<16;t++){const r=m(n+g(e,s,o,l)+y[k[t]]+_,S[t])+w|0;n=w,w=l,l=0|m(o,10),o=s,s=r}for(let e=0;e<16;e++){const n=m(r+g(t,i,a,b)+y[T[e]]+E,P[e])+v|0;r=v,v=b,b=0|m(a,10),a=i,i=n}}this.set(this.h1+o+b|0,this.h2+l+v|0,this.h3+w+r|0,this.h4+n+i|0,this.h0+s+a|0)}roundClean(){y.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}n.RIPEMD160=b,n.ripemd160=(0,s.wrapConstructor)((()=>new b))}}},{package:"@metamask/key-tree>@noble/hashes",file:"node_modules/@noble/hashes/ripemd160.js"}],[1385,{"./_sha2.js":1379,"./utils.js":1388},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.sha256=void 0;const r=e("./_sha2.js"),s=e("./utils.js"),i=(e,t,n)=>e&t^e&n^t&n,o=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]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint32Array(64);class u extends r.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:n,D:r,E:s,F:i,G:o,H:a}=this;return[e,t,n,r,s,i,o,a]}set(e,t,n,r,s,i,o,a){this.A=0|e,this.B=0|t,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(e,t){for(let n=0;n<16;n++,t+=4)c[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=c[e-15],n=c[e-2],r=(0,s.rotr)(t,7)^(0,s.rotr)(t,18)^t>>>3,i=(0,s.rotr)(n,17)^(0,s.rotr)(n,19)^n>>>10;c[e]=i+c[e-7]+r+c[e-16]|0}let{A:n,B:r,C:a,D:u,E:l,F:d,G:h,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,s.rotr)(l,6)^(0,s.rotr)(l,11)^(0,s.rotr)(l,25))+((p=l)&d^~p&h)+o[e]+c[e]|0,m=((0,s.rotr)(n,2)^(0,s.rotr)(n,13)^(0,s.rotr)(n,22))+i(n,r,a)|0;f=h,h=d,d=l,l=u+t|0,u=a,a=r,r=n,n=t+m|0}var p;n=n+this.A|0,r=r+this.B|0,a=a+this.C|0,u=u+this.D|0,l=l+this.E|0,d=d+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(n,r,a,u,l,d,h,f)}roundClean(){c.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}n.sha256=(0,s.wrapConstructor)((()=>new u))}}},{package:"@metamask/key-tree>@noble/hashes",file:"node_modules/@noble/hashes/sha256.js"}]],[],{});