LavaPack.loadBundle([["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js",{"@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/logger":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/logger/dist/index.cjs.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"FirebaseError",{enumerable:!0,get:function(){return o.FirebaseError}}),n._DEFAULT_ENTRY_NAME=n.SDK_VERSION=void 0,n._addComponent=G,n._addOrOverwriteComponent=function(e,t){e.container.addOrOverwriteComponent(t)},n._apps=void 0,n._clearComponents=function(){H.clear()}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n._components=void 0,n._getProvider=W,n._isFirebaseApp=$,n._isFirebaseServerApp=function(e){return e.settings!==undefined},n._registerComponent=q,n._removeServiceInstance=function(e,t,n=B){W(e,t).clearInstance(n)},n._serverApps=void 0,n.deleteApp=J,n.getApp=function(e=B){const t=F.get(e);if(!t&&e===B&&(0,o.getDefaultAppConfig)())return Q();if(!t)throw K.create("no-app",{appName:e});return t},n.getApps=function(){return Array.from(F.values())},n.initializeApp=Q,n.initializeServerApp=function(e,t){if((0,o.isBrowser)()&&!(0,o.isWebWorker)())throw K.create("invalid-server-app-environment");t.automaticDataCollectionEnabled===undefined&&(t.automaticDataCollectionEnabled=!1);let n;n=$(e)?e.options:e;const r=Object.assign(Object.assign({},t),n);r.releaseOnDeref!==undefined&&delete r.releaseOnDeref;if(t.releaseOnDeref!==undefined&&"undefined"==typeof FinalizationRegistry)throw K.create("finalization-registry-not-supported",{});const a=""+(c=JSON.stringify(r),[...c].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0)),i=U.get(a);var c;if(i)return i.incRefCount(t.releaseOnDeref),i;const l=new s.ComponentContainer(a);for(const e of H.values())l.addComponent(e);const d=new z(n,t,a,l);return U.set(a,d),d},n.onLog=function(e,t){if(null!==e&&"function"!=typeof e)throw K.create("invalid-log-argument");(0,r.setUserLogHandler)(e,t)},n.registerVersion=X,n.setLogLevel=function(e){(0,r.setLogLevel)(e)}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */;var s=e("@firebase/component"),r=e("@firebase/logger"),o=e("@firebase/util"),a=e("idb");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class i{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const c="@firebase/app",l="0.10.18",d=new r.Logger("@firebase/app"),u="@firebase/app-compat",m="@firebase/analytics-compat",h="@firebase/analytics",p="@firebase/app-check-compat",f="@firebase/app-check",g="@firebase/auth",k="@firebase/auth-compat",w="@firebase/database",b="@firebase/data-connect",_="@firebase/database-compat",E="@firebase/functions",y="@firebase/functions-compat",S="@firebase/installations",I="@firebase/installations-compat",C="@firebase/messaging",A="@firebase/messaging-compat",T="@firebase/performance",v="@firebase/performance-compat",x="@firebase/remote-config",N="@firebase/remote-config-compat",j="@firebase/storage",P="@firebase/storage-compat",D="@firebase/firestore",R="@firebase/vertexai",O="@firebase/firestore-compat",M="firebase",B=n._DEFAULT_ENTRY_NAME="[DEFAULT]",L={[c]:"fire-core",[u]:"fire-core-compat",[h]:"fire-analytics",[m]:"fire-analytics-compat",[f]:"fire-app-check",[p]:"fire-app-check-compat",[g]:"fire-auth",[k]:"fire-auth-compat",[w]:"fire-rtdb",[b]:"fire-data-connect",[_]:"fire-rtdb-compat",[E]:"fire-fn",[y]:"fire-fn-compat",[S]:"fire-iid",[I]:"fire-iid-compat",[C]:"fire-fcm",[A]:"fire-fcm-compat",[T]:"fire-perf",[v]:"fire-perf-compat",[x]:"fire-rc",[N]:"fire-rc-compat",[j]:"fire-gcs",[P]:"fire-gcs-compat",[D]:"fire-fst",[O]:"fire-fst-compat",[R]:"fire-vertex","fire-js":"fire-js",[M]:"fire-js-all"},F=n._apps=new Map,U=n._serverApps=new Map,H=n._components=new Map;function G(e,t){try{e.container.addComponent(t)}catch(n){d.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function q(e){const t=e.name;if(H.has(t))return d.debug(`There were multiple attempts to register component ${t}.`),!1;H.set(t,e);for(const t of F.values())G(t,e);for(const t of U.values())G(t,e);return!0}function W(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function $(e){return e.options!==undefined}const V={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},K=new o.ErrorFactory("app","Firebase",V);
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class Y{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new s.Component("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw K.create("app-deleted",{appName:this._name})}}
/**
 * @license
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class z extends Y{constructor(e,t,n,s){const r=t.automaticDataCollectionEnabled!==undefined&&t.automaticDataCollectionEnabled,o={name:n,automaticDataCollectionEnabled:r};if(e.apiKey!==undefined)super(e,o,s);else{super(e.options,o,s)}this._serverConfig=Object.assign({automaticDataCollectionEnabled:r},t),this._finalizationRegistry=null,"undefined"!=typeof FinalizationRegistry&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=undefined,t.releaseOnDeref=undefined,X(c,l,"serverapp")}toJSON(){return undefined}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==undefined&&null!==this._finalizationRegistry&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){J(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw K.create("server-app-deleted")}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.SDK_VERSION="11.2.0";function Q(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const r=Object.assign({name:B,automaticDataCollectionEnabled:!1},t),a=r.name;if("string"!=typeof a||!a)throw K.create("bad-app-name",{appName:String(a)});if(n||(n=(0,o.getDefaultAppConfig)()),!n)throw K.create("no-options");const i=F.get(a);if(i){if((0,o.deepEqual)(n,i.options)&&(0,o.deepEqual)(r,i.config))return i;throw K.create("duplicate-app",{appName:a})}const c=new s.ComponentContainer(a);for(const e of H.values())c.addComponent(e);const l=new Y(n,r,c);return F.set(a,l),l}async function J(e){let t=!1;const n=e.name;if(F.has(n))t=!0,F.delete(n);else if(U.has(n)){e.decRefCount()<=0&&(U.delete(n),t=!0)}t&&(await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function X(e,t,n){var r;let o=null!==(r=L[e])&&void 0!==r?r:e;n&&(o+=`-${n}`);const a=o.match(/\s|\//),i=t.match(/\s|\//);if(a||i){const e=[`Unable to register library "${o}" with version "${t}":`];return a&&e.push(`library name "${o}" contains illegal characters (whitespace or "/")`),a&&i&&e.push("and"),i&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void d.warn(e.join(" "))}q(new s.Component(`${o}-version`,()=>({library:o,version:t}),"VERSION"))}const Z="firebase-heartbeat-store";let ee=null;function te(){return ee||(ee=(0,a.openDB)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Z)}catch(e){console.warn(e)}}}).catch(e=>{throw K.create("idb-open",{originalErrorMessage:e.message})})),ee}async function ne(e,t){try{const n=(await te()).transaction(Z,"readwrite"),s=n.objectStore(Z);await s.put(t,se(e)),await n.done}catch(e){if(e instanceof o.FirebaseError)d.warn(e.message);else{const t=K.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});d.warn(t.message)}}}function se(e){return`${e.name}!${e.options.appId}`}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class re{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new ae(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=oe();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(e=>e.date===s))return;return this._heartbeatsCache.heartbeats.push({date:s,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),this._storage.overwrite(this._heartbeatsCache)}catch(e){d.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=oe(),{heartbeatsToSend:n,unsentEntries:s}=function(e,t=1024){const n=[];let s=e.slice();for(const r of e){const e=n.find(e=>e.agent===r.agent);if(e){if(e.dates.push(r.date),ie(n)>t){e.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),ie(n)>t){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}(this._heartbeatsCache.heartbeats),r=(0,o.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}catch(e){return d.warn(e),""}}}function oe(){return(new Date).toISOString().substring(0,10)}class ae{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,o.isIndexedDBAvailable)()&&(0,o.validateIndexedDBOpenable)().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await te()).transaction(Z),n=await t.objectStore(Z).get(se(e));return await t.done,n}catch(e){if(e instanceof o.FirebaseError)d.warn(e.message);else{const t=K.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});d.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return ne(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return ne(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function ie(e){return(0,o.base64urlEncodeWithoutPadding)(JSON.stringify({version:2,heartbeats:e})).length}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var ce;ce="",q(new s.Component("platform-logger",e=>new i(e),"PRIVATE")),q(new s.Component("heartbeat",e=>new re(e),"PRIVATE")),X(c,l,ce),X(c,l,"esm2017"),X("fire-js","")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app",file:"node_modules/@firebase/app/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js",{"@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.Provider=n.ComponentContainer=n.Component=void 0;var s=e("@firebase/util");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.Component=class{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};const r="[DEFAULT]";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class o{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new s.Deferred;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),s=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(s)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(s)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e))try{this.getOrInitializeService({instanceIdentifier:r})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=r){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=r){return this.instances.has(e)}getOptions(e=r){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(s)}return s}onInit(e,t){var n;const s=this.normalizeInstanceIdentifier(t),r=null!==(n=this.onInitCallbacks.get(s))&&void 0!==n?n:new Set;r.add(e),this.onInitCallbacks.set(s,r);const o=this.instances.get(s);return o&&e(o,s),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const s of n)try{s(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(s=e,s===r?undefined:s),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}var s;return n||null}normalizeInstanceIdentifier(e=r){return this.component?this.component.multipleInstances?e:r:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}n.Provider=o;n.ComponentContainer=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new o(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/component",file:"node_modules/@firebase/component/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.deleteInstallations=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function(e){const{appConfig:t}=e,n=await H(t,e=>e&&0===e.registrationStatus?undefined:e);if(n){if(1===n.registrationStatus)throw f.create("delete-pending-registration");if(2===n.registrationStatus){if(!navigator.onLine)throw f.create("app-offline");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
await async function(e,t){const n=function(e,{fid:t}){return`${k(e)}/${t}`}(e,t),s=E(e,t),r={method:"DELETE",headers:s},o=await y(()=>fetch(n,r));if(!o.ok)throw await b("Delete Installation",o)}(t,n),await U(t)}}}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getId=Q,n.getInstallations=
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e=(0,s.getApp)()){return(0,s._getProvider)(e,"installations").getImmediate()}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getToken=J,n.onIdChange=function(e,t){const{appConfig:n}=e;return function(e,t){P();const n=T(e);let s=v.get(n);s||(s=new Set,v.set(n,s));s.add(t)}(n,t),()=>{!function(e,t){const n=T(e),s=v.get(n);if(!s)return;s.delete(t),0===s.size&&v.delete(n);D()}(n,t)}};var s=e("@firebase/app"),r=e("@firebase/component"),o=e("@firebase/util"),a=e("idb");const i="@firebase/installations",c="0.6.12",l=1e4,d=`w:${c}`,u="FIS_v2",m="https://firebaseinstallations.googleapis.com/v1",h=36e5,p={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},f=new o.ErrorFactory("installations","Installations",p);function g(e){return e instanceof o.FirebaseError&&e.code.includes("request-failed")}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function k({projectId:e}){return`${m}/projects/${e}/installations`}function w(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function b(e,t){const n=(await t.json()).error;return f.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function _({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function E(e,{refreshToken:t}){const n=_(e);return n.append("Authorization",function(e){return`${u} ${e}`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t)),n}async function y(e){const t=await e();return t.status>=500&&t.status<600?e():t}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function S(e){return new Promise(t=>{setTimeout(t,e)})}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const I=/^[cdef][\w-]{21}$/,C="";function A(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(n=e,btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return t.substr(0,22)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e);return I.test(t)?t:C}catch(e){return C}}function T(e){return`${e.appName}!${e.appId}`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const v=new Map;function x(e,t){const n=T(e);N(n,t),function(e,t){const n=P();n&&n.postMessage({key:e,fid:t});D()}(n,t)}function N(e,t){const n=v.get(e);if(n)for(const e of n)e(t)}let j=null;function P(){return!j&&"BroadcastChannel"in self&&(j=new BroadcastChannel("[Firebase] FID Change"),j.onmessage=e=>{N(e.data.key,e.data.fid)}),j}function D(){0===v.size&&j&&(j.close(),j=null)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const R="firebase-installations-database",O=1,M="firebase-installations-store";let B=null;function L(){return B||(B=(0,a.openDB)(R,O,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(M)}})),B}async function F(e,t){const n=T(e),s=(await L()).transaction(M,"readwrite"),r=s.objectStore(M),o=await r.get(n);return await r.put(t,n),await s.done,o&&o.fid===t.fid||x(e,t.fid),t}async function U(e){const t=T(e),n=(await L()).transaction(M,"readwrite");await n.objectStore(M).delete(t),await n.done}async function H(e,t){const n=T(e),s=(await L()).transaction(M,"readwrite"),r=s.objectStore(M),o=await r.get(n),a=t(o);return a===undefined?await r.delete(n):await r.put(a,n),await s.done,!a||o&&o.fid===a.fid||x(e,a.fid),a}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function G(e){let t;const n=await H(e.appConfig,n=>{const s=function(e){const t=e||{fid:A(),registrationStatus:0};return $(t)}(n),r=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(f.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},s=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const s=k(e),r=_(e),o=t.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&r.append("x-firebase-client",e)}const a={fid:n,authVersion:u,appId:e.appId,sdkVersion:d},i={method:"POST",headers:r,body:JSON.stringify(a)},c=await y(()=>fetch(s,i));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:w(e.authToken)}}throw await b("Create Installation",c)}(e,t);return F(e.appConfig,n)}catch(n){throw g(n)&&409===n.customData.serverCode?await U(e.appConfig):await F(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:s}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:q(e)}:{installationEntry:t}}(e,s);return t=r.registrationPromise,r.installationEntry});return n.fid===C?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function q(e){let t=await W(e.appConfig);for(;1===t.registrationStatus;)await S(100),t=await W(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await G(e);return n||t}return t}function W(e){return H(e,e=>{if(!e)throw f.create("installation-not-found");return $(e)})}function $(e){return 1===(t=e).registrationStatus&&t.registrationTime+l<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}async function V({appConfig:e,heartbeatServiceProvider:t},n){const s=function(e,{fid:t}){return`${k(e)}/${t}/authTokens:generate`}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e,n),r=E(e,n),o=t.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&r.append("x-firebase-client",e)}const a={installation:{sdkVersion:d,appId:e.appId}},i={method:"POST",headers:r,body:JSON.stringify(a)},c=await y(()=>fetch(s,i));if(c.ok){return w(await c.json())}throw await b("Generate Auth Token",c)}async function K(e,t=!1){let n;const s=await H(e.appConfig,s=>{if(!z(s))throw f.create("not-registered");const r=s.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+h}(e)}(r))return s;if(1===r.requestStatus)return n=async function(e,t){let n=await Y(e.appConfig);for(;1===n.authToken.requestStatus;)await S(100),n=await Y(e.appConfig);const s=n.authToken;return 0===s.requestStatus?K(e,t):s}(e,t),s;{if(!navigator.onLine)throw f.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(s);return n=async function(e,t){try{const n=await V(e,t),s=Object.assign(Object.assign({},t),{authToken:n});return await F(e.appConfig,s),n}catch(n){if(!g(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await F(e.appConfig,n)}else await U(e.appConfig);throw n}}(e,t),t}});return n?await n:s.authToken}function Y(e){return H(e,e=>{if(!z(e))throw f.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+l<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */})}function z(e){return e!==undefined&&2===e.registrationStatus}async function Q(e){const t=e,{installationEntry:n,registrationPromise:s}=await G(t);return s?s.catch(console.error):K(t).catch(console.error),n.fid}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function J(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await G(e);t&&await t}(n);return(await K(n,t)).token}function X(e){return f.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Z="installations",ee=e=>{const t=e.getProvider("app").getImmediate(),n=function(e){if(!e||!e.options)throw X("App Configuration");if(!e.name)throw X("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw X(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:(0,s._getProvider)(t,"heartbeat"),_delete:()=>Promise.resolve()}},te=e=>{const t=e.getProvider("app").getImmediate(),n=(0,s._getProvider)(t,Z).getImmediate();return{getId:()=>Q(n),getToken:e=>J(n,e)}};(0,s._registerComponent)(new r.Component(Z,ee,"PUBLIC")),(0,s._registerComponent)(new r.Component("installations-internal",te,"PRIVATE")),(0,s.registerVersion)(i,c),(0,s.registerVersion)(i,c,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/installations",file:"node_modules/@firebase/installations/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/logger/dist/index.cjs.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const s=[];var r;n.LogLevel=void 0,(r=n.LogLevel||(n.LogLevel={}))[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT";const o={debug:n.LogLevel.DEBUG,verbose:n.LogLevel.VERBOSE,info:n.LogLevel.INFO,warn:n.LogLevel.WARN,error:n.LogLevel.ERROR,silent:n.LogLevel.SILENT},a=n.LogLevel.INFO,i={[n.LogLevel.DEBUG]:"log",[n.LogLevel.VERBOSE]:"log",[n.LogLevel.INFO]:"info",[n.LogLevel.WARN]:"warn",[n.LogLevel.ERROR]:"error"},c=(e,t,...n)=>{if(t<e.logLevel)return;const s=(new Date).toISOString(),r=i[t];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[r](`[${s}]  ${e.name}:`,...n)};n.Logger=class{constructor(e){this.name=e,this._logLevel=a,this._logHandler=c,this._userLogHandler=null,s.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in n.LogLevel))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?o[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.DEBUG,...e),this._logHandler(this,n.LogLevel.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.VERBOSE,...e),this._logHandler(this,n.LogLevel.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.INFO,...e),this._logHandler(this,n.LogLevel.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.WARN,...e),this._logHandler(this,n.LogLevel.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,n.LogLevel.ERROR,...e),this._logHandler(this,n.LogLevel.ERROR,...e)}},n.setLogLevel=function(e){s.forEach(t=>{t.setLogLevel(e)})},n.setUserLogHandler=function(e,t){for(const r of s){let s=null;t&&t.level&&(s=o[t.level]),r.userLogHandler=null===e?null:(t,r,...o)=>{const a=o.map(e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(e=>e).join(" ");r>=(null!=s?s:t.logLevel)&&e({level:n.LogLevel[r].toLowerCase(),message:a,args:o,type:t.name})}}}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/app>@firebase/logger",file:"node_modules/@firebase/logger/dist/index.cjs.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/messaging/dist/esm/index.esm2017.js",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/installations":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.deleteToken=function(e){
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return async function(e){if(!navigator)throw x.create("only-available-in-window");e.swRegistration||await U(e);return async function(e){const t=await C(e.firebaseDependencies);t&&(await N(e.firebaseDependencies,t.token),await async function(e){const t=T(e),n=(await I()).transaction(y,"readwrite");await n.objectStore(y).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();if(n)return n.unsubscribe();return!0}(e)}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e=(0,o.getModularInstance)(e))},n.getMessaging=
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e=(0,a.getApp)()){return Y().then(e=>{if(!e)throw x.create("unsupported-browser")},e=>{throw x.create("indexed-db-unsupported")}),(0,a._getProvider)((0,o.getModularInstance)(e),"messaging").getImmediate()},n.getToken=async function(e,t){return H(e=(0,o.getModularInstance)(e),t)},n.isSupported=Y,n.onMessage=function(e,t){return function(e,t){if(!navigator)throw x.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=(0,o.getModularInstance)(e),t)},e("@firebase/installations");var s=e("@firebase/component"),r=e("idb"),o=e("@firebase/util"),a=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const i="/firebase-messaging-sw.js",c="/firebase-cloud-messaging-push-scope",l="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",d="https://fcmregistrations.googleapis.com/v1",u="google.c.a.c_id",m=1e4;var h,p;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function f(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function g(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),s=new Uint8Array(n.length);for(let e=0;e<n.length;++e)s[e]=n.charCodeAt(e);return s}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(h||(h={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(p||(p={}));const k="fcm_token_details_db",w=5,b="fcm_token_object_Store";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const _="firebase-messaging-database",E=1,y="firebase-messaging-store";let S=null;function I(){return S||(S=(0,r.openDB)(_,E,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(y)}})),S}async function C(e){const t=T(e),n=await I(),s=await n.transaction(y).objectStore(y).get(t);if(s)return s;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(k))return null}let t=null;return(await(0,r.openDB)(k,w,{upgrade:async(n,s,r,o)=>{var a;if(s<2)return;if(!n.objectStoreNames.contains(b))return;const i=o.objectStore(b),c=await i.index("fcmSenderId").get(e);if(await i.clear(),c)if(2===s){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(a=e.createTime)&&void 0!==a?a:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:f(e.vapidKey)}}}else if(3===s){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:f(e.auth),p256dh:f(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:f(e.vapidKey)}}}else if(4===s){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:f(e.auth),p256dh:f(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:f(e.vapidKey)}}}}})).close(),await(0,r.deleteDB)(k),await(0,r.deleteDB)("fcm_vapid_details_db"),await(0,r.deleteDB)("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await A(e,t),t}}async function A(e,t){const n=T(e),s=(await I()).transaction(y,"readwrite");return await s.objectStore(y).put(t,n),await s.done,t}function T({appConfig:e}){return e.appId}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const v={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},x=new o.ErrorFactory("messaging","Messaging",v);async function N(e,t){const n={method:"DELETE",headers:await P(e)};try{const s=await fetch(`${j(e.appConfig)}/${t}`,n),r=await s.json();if(r.error){const e=r.error.message;throw x.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw x.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function j({projectId:e}){return`${d}/projects/${e}/registrations`}async function P({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function D({p256dh:e,auth:t,endpoint:n,vapidKey:s}){const r={web:{endpoint:n,auth:t,p256dh:e}};return s!==l&&(r.web.applicationPubKey=s),r}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const R=6048e5;async function O(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:g(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:f(t.getKey("auth")),p256dh:f(t.getKey("p256dh"))},s=await C(e.firebaseDependencies);if(s){if(function(e,t){const n=t.vapidKey===e.vapidKey,s=t.endpoint===e.endpoint,r=t.auth===e.auth,o=t.p256dh===e.p256dh;return n&&s&&r&&o}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(s.subscriptionOptions,n))return Date.now()>=s.createTime+R?async function(e,t){try{const n=await async function(e,t){const n=await P(e),s=D(t.subscriptionOptions),r={method:"PATCH",headers:n,body:JSON.stringify(s)};let o;try{const n=await fetch(`${j(e.appConfig)}/${t.token}`,r);o=await n.json()}catch(e){throw x.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw x.create("token-update-failed",{errorInfo:e})}if(!o.token)throw x.create("token-update-no-token");return o.token}(e.firebaseDependencies,t),s=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await A(e.firebaseDependencies,s),n}catch(e){throw e}}(e,{token:s.token,createTime:Date.now(),subscriptionOptions:n}):s.token;try{await N(e.firebaseDependencies,s.token)}catch(e){console.warn(e)}return M(e.firebaseDependencies,n)}return M(e.firebaseDependencies,n)}async function M(e,t){const n=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */await async function(e,t){const n=await P(e),s=D(t),r={method:"POST",headers:n,body:JSON.stringify(s)};let o;try{const t=await fetch(j(e.appConfig),r);o=await t.json()}catch(e){throw x.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw x.create("token-subscribe-failed",{errorInfo:e})}if(!o.token)throw x.create("token-subscribe-no-token");return o.token}(e,t),s={token:n,createTime:Date.now(),subscriptionOptions:t};return await A(e,s),s.token}function B(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const s=t.notification.body;s&&(e.notification.body=s);const r=t.notification.image;r&&(e.notification.image=r);const o=t.notification.icon;o&&(e.notification.icon=o)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var n,s,r,o,a;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const i=null!==(r=null===(s=t.fcmOptions)||void 0===s?void 0:s.link)&&void 0!==r?r:null===(o=t.notification)||void 0===o?void 0:o.click_action;i&&(e.fcmOptions.link=i);const c=null===(a=t.fcmOptions)||void 0===a?void 0:a.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}function L(e){return x.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
!function(e,t){const n=[];for(let s=0;s<e.length;s++)n.push(e.charAt(s)),s<t.length&&n.push(t.charAt(s));n.join("")}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class F{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const s=function(e){if(!e||!e.options)throw L("App Configuration Object");if(!e.name)throw L("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw L(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:s,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function U(e){try{e.swRegistration=await navigator.serviceWorker.register(i,{scope:c}),e.swRegistration.update().catch(()=>{}),await async function(e){return new Promise((t,n)=>{const s=setTimeout(()=>n(new Error(`Service worker not registered after ${m} ms`)),m),r=e.installing||e.waiting;e.active?(clearTimeout(s),t()):r?r.onstatechange=e=>{var n;"activated"===(null===(n=e.target)||void 0===n?void 0:n.state)&&(r.onstatechange=null,clearTimeout(s),t())}:(clearTimeout(s),n(new Error("No incoming service worker found.")))})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e.swRegistration)}catch(e){throw x.create("failed-service-worker-registration",{browserErrorMessage:null==e?void 0:e.message})}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function H(e,t){if(!navigator)throw x.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw x.create("permission-blocked");
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=l)}(e,null==t?void 0:t.vapidKey),await async function(e,t){if(t||e.swRegistration||await U(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw x.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),O(e)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function G(e,t,n){const s=function(e){switch(e){case p.NOTIFICATION_CLICKED:return"notification_open";case p.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(s,{message_id:n[u],message_name:n["google.c.a.c_l"],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function q(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===p.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(B(n)):e.onMessageHandler.next(B(n)));const s=n.data;var r;"object"==typeof(r=s)&&r&&u in r&&"1"===s["google.c.a.e"]&&await G(e,n.messageType,s)}const W="@firebase/messaging",$="0.12.16",V=e=>{const t=new F(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>q(t,e)),t},K=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>H(t,e)}};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function Y(){try{await(0,o.validateIndexedDBOpenable)()}catch(e){return!1}return"undefined"!=typeof window&&(0,o.isIndexedDBAvailable)()&&(0,o.areCookiesEnabled)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}(0,a._registerComponent)(new s.Component("messaging",V,"PUBLIC")),(0,a._registerComponent)(new s.Component("messaging-internal",K,"PRIVATE")),(0,a.registerVersion)(W,$),(0,a.registerVersion)(W,$,"esm2017")}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/esm/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/messaging/dist/index.sw.cjs",{"@firebase/app":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/app/dist/esm/index.esm2017.js","@firebase/component":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/component/dist/esm/index.esm2017.js","@firebase/installations":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/installations/dist/esm/index.esm2017.js","@firebase/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",idb:"/home/runner/work/metamask-extension/metamask-extension/node_modules/idb/build/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),e("@firebase/installations");var s=e("@firebase/component"),r=e("idb"),o=e("@firebase/util"),a=e("@firebase/app");
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const i="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",c="FCM_MSG";var l,d;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function u(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function m(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),s=new Uint8Array(n.length);for(let e=0;e<n.length;++e)s[e]=n.charCodeAt(e);return s}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(l||(l={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(d||(d={}));const h="fcm_token_details_db",p="fcm_token_object_Store";
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const f="firebase-messaging-store";let g=null;function k(){return g||(g=r.openDB("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(f)}})),g}async function w(e){const t=_(e),n=await k(),s=await n.transaction(f).objectStore(f).get(t);if(s)return s;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(h))return null}let t=null;return(await r.openDB(h,5,{upgrade:async(n,s,r,o)=>{var a;if(s<2)return;if(!n.objectStoreNames.contains(p))return;const i=o.objectStore(p),c=await i.index("fcmSenderId").get(e);if(await i.clear(),c)if(2===s){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(a=e.createTime)&&void 0!==a?a:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:u(e.vapidKey)}}}else if(3===s){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:u(e.auth),p256dh:u(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:u(e.vapidKey)}}}else if(4===s){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:u(e.auth),p256dh:u(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:u(e.vapidKey)}}}}})).close(),await r.deleteDB(h),await r.deleteDB("fcm_vapid_details_db"),await r.deleteDB("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await b(e,t),t}}async function b(e,t){const n=_(e),s=(await k()).transaction(f,"readwrite");return await s.objectStore(f).put(t,n),await s.done,t}function _({appConfig:e}){return e.appId}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const E={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},y=new o.ErrorFactory("messaging","Messaging",E);async function S(e,t){const n={method:"DELETE",headers:await C(e)};try{const s=await fetch(`${I(e.appConfig)}/${t}`,n),r=await s.json();if(r.error){const e=r.error.message;throw y.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw y.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function I({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function C({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function A({p256dh:e,auth:t,endpoint:n,vapidKey:s}){const r={web:{endpoint:n,auth:t,p256dh:e}};return s!==i&&(r.web.applicationPubKey=s),r}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */async function T(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:m(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:u(t.getKey("auth")),p256dh:u(t.getKey("p256dh"))},s=await w(e.firebaseDependencies);if(s){if(function(e,t){const n=t.vapidKey===e.vapidKey,s=t.endpoint===e.endpoint,r=t.auth===e.auth,o=t.p256dh===e.p256dh;return n&&s&&r&&o}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(s.subscriptionOptions,n))return Date.now()>=s.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await C(e),s=A(t.subscriptionOptions),r={method:"PATCH",headers:n,body:JSON.stringify(s)};let o;try{const n=await fetch(`${I(e.appConfig)}/${t.token}`,r);o=await n.json()}catch(e){throw y.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw y.create("token-update-failed",{errorInfo:e})}if(!o.token)throw y.create("token-update-no-token");return o.token}(e.firebaseDependencies,t),s=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await b(e.firebaseDependencies,s),n}catch(e){throw e}}(e,{token:s.token,createTime:Date.now(),subscriptionOptions:n}):s.token;try{await S(e.firebaseDependencies,s.token)}catch(e){console.warn(e)}return x(e.firebaseDependencies,n)}return x(e.firebaseDependencies,n)}async function v(e){const t=await w(e.firebaseDependencies);t&&(await S(e.firebaseDependencies,t.token),await async function(e){const t=_(e),n=(await k()).transaction(f,"readwrite");await n.objectStore(f).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return!n||n.unsubscribe()}async function x(e,t){const n=
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */await async function(e,t){const n=await C(e),s=A(t),r={method:"POST",headers:n,body:JSON.stringify(s)};let o;try{const t=await fetch(I(e.appConfig),r);o=await t.json()}catch(e){throw y.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw y.create("token-subscribe-failed",{errorInfo:e})}if(!o.token)throw y.create("token-subscribe-no-token");return o.token}(e,t),s={token:n,createTime:Date.now(),subscriptionOptions:t};return await b(e,s),s.token}async function N(e,t){const n=function(e,t){var n,s;const r={};e.from&&(r.project_number=e.from);e.fcmMessageId&&(r.message_id=e.fcmMessageId);r.instance_id=t,e.notification?r.message_type=l.DISPLAY_NOTIFICATION.toString():r.message_type=l.DATA_MESSAGE.toString();r.sdk_platform=3..toString(),r.package_name=self.origin.replace(/(^\w+:|^)\/\//,""),!e.collapse_key||(r.collapse_key=e.collapse_key);r.event=1..toString(),!(null===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label)||(r.analytics_label=null===(s=e.fcmOptions)||void 0===s?void 0:s.analytics_label);return r}(t,await e.firebaseDependencies.installations.getId());!function(e,t,n){const s={};s.event_time_ms=Math.floor(Date.now()).toString(),s.source_extension_json_proto3=JSON.stringify({messaging_client_event:t}),!n||(s.compliance_data=function(e){const t={privacy_context:{prequest:{origin_associated_product_id:e}}};return t}(n));e.logEvents.push(s)}(e,n,t.productId)}async function j(e,t){const n=function({data:e}){if(!e)return null;try{return e.json()}catch(e){return null}}(e);if(!n)return;t.deliveryMetricsExportedToBigQueryEnabled&&await N(t,n);const s=await D();if(function(e){return e.some(e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://"))}(s))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=d.PUSH_RECEIVED;for(const n of e)n.postMessage(t)}(s,n);if(n.notification&&await function(e){var t;const{actions:n}=e,{maxActions:s}=Notification;n&&s&&n.length>s&&console.warn(`This browser only supports ${s} actions. The remaining actions will not be displayed.`);return self.registration.showNotification(null!==(t=e.title)&&void 0!==t?t:"",e)}(function(e){const t=Object.assign({},e.notification);return t.data={[c]:e},t}(n)),t&&t.onBackgroundMessageHandler){const e=function(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const s=t.notification.body;s&&(e.notification.body=s);const r=t.notification.image;r&&(e.notification.image=r);const o=t.notification.icon;o&&(e.notification.icon=o)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var n,s,r,o,a;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const i=null!==(r=null===(s=t.fcmOptions)||void 0===s?void 0:s.link)&&void 0!==r?r:null===(o=t.notification)||void 0===o?void 0:o.click_action;i&&(e.fcmOptions.link=i);const c=null===(a=t.fcmOptions)||void 0===a?void 0:a.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(t,e),t}(n);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function P(e){var t,n;const s=null===(n=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===n?void 0:n[c];if(!s)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const r=function(e){var t,n,s;const r=null!==(n=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==n?n:null===(s=e.notification)||void 0===s?void 0:s.click_action;if(r)return r;return o=e.data,"object"==typeof o&&o&&"google.c.a.c_id"in o?self.location.origin:null;var o;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(s);if(!r)return;const o=new URL(r,self.location.href),a=new URL(self.location.origin);if(o.host!==a.host)return;let i=await async function(e){const t=await D();for(const n of t){const t=new URL(n.url,self.location.href);if(e.host===t.host)return n}return null}(o);var l;
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */return i?i=await i.focus():(i=await self.clients.openWindow(r),await(l=3e3,new Promise(e=>{setTimeout(e,l)}))),i?(s.messageType=d.NOTIFICATION_CLICKED,s.isFirebaseMessaging=!0,i.postMessage(s)):void 0}function D(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function R(e){return y.create("missing-app-config-values",{valueName:e})}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e,t){const n=[];for(let s=0;s<e.length;s++)n.push(e.charAt(s)),s<t.length&&n.push(t.charAt(s));n.join("")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class O{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const s=function(e){if(!e||!e.options)throw R("App Configuration Object");if(!e.name)throw R("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw R(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:s,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const M=e=>{const t=new O(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",e=>{e.waitUntil(j(e,t))}),self.addEventListener("pushsubscriptionchange",e=>{e.waitUntil(async function(e,t){var n,s;const{newSubscription:r}=e;if(!r)return void await v(t);const o=await w(t.firebaseDependencies);await v(t),t.vapidKey=null!==(s=null===(n=null==o?void 0:o.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==s?s:i,await T(t)}(e,t))}),self.addEventListener("notificationclick",e=>{e.waitUntil(P(e))}),t};
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
async function B(){return o.isIndexedDBAvailable()&&await o.validateIndexedDBOpenable()&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */a._registerComponent(new s.Component("messaging-sw",M,"PUBLIC")),n.experimentalSetDeliveryMetricsExportedToBigQueryEnabled=function(e,t){
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
return function(e,t){e.deliveryMetricsExportedToBigQueryEnabled=t}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e=o.getModularInstance(e),t)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getMessaging=function(e=a.getApp()){return B().then(e=>{if(!e)throw y.create("unsupported-browser")},e=>{throw y.create("indexed-db-unsupported")}),a._getProvider(o.getModularInstance(e),"messaging-sw").getImmediate()},n.isSupported=B,n.onBackgroundMessage=function(e,t){return function(e,t){if(self.document!==undefined)throw y.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=o.getModularInstance(e),t)}}}},{package:"@metamask/notification-services-controller>firebase>@firebase/messaging",file:"node_modules/@firebase/messaging/dist/index.sw.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@firebase/util/dist/index.esm2017.js",{_process:"/home/runner/work/metamask-extension/metamask-extension/node_modules/process/browser.js"},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.Sha1=n.RANDOM_FACTOR=n.MAX_VALUE_MILLIS=n.FirebaseError=n.ErrorFactory=n.Deferred=n.DecodeBase64StringError=n.CONSTANTS=void 0,n.areCookiesEnabled=function(){if("undefined"==typeof navigator||!navigator.cookieEnabled)return!1;return!0}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.assertionError=n.assert=void 0,n.async=function(e,t){return(...n)=>{Promise.resolve(!0).then(()=>{e(...n)}).catch(e=>{t&&t(e)})}},n.base64urlEncodeWithoutPadding=n.base64Encode=n.base64Decode=n.base64=void 0,n.calculateBackoffMillis=function(e,t=x,n=N){const s=t*Math.pow(n,e),r=Math.round(P*s*(Math.random()-.5)*2);return Math.min(j,s+r)}
/**
 * @license
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.createMockUserToken=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",s=e.iat||0,r=e.sub||e.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},e);return[l(JSON.stringify({alg:"none",type:"JWT"})),l(JSON.stringify(o)),""].join(".")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.createSubscribe=function(e,t){const n=new A(e,t);return n.subscribe.bind(n)},n.decode=void 0,n.deepCopy=function(e){return u(undefined,e)},n.deepEqual=function e(t,n){if(t===n)return!0;const s=Object.keys(t),r=Object.keys(n);for(const o of s){if(!r.includes(o))return!1;const s=t[o],a=n[o];if(C(s)&&C(a)){if(!e(s,a))return!1}else if(s!==a)return!1}for(const e of r)if(!s.includes(e))return!1;return!0},n.deepExtend=u,n.errorPrefix=v,n.extractQuerystring=function(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:undefined)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.getExperimentalSetting=n.getDefaults=n.getDefaultEmulatorHostnameAndPort=n.getDefaultEmulatorHost=n.getDefaultAppConfig=void 0,n.getGlobal=h,n.getModularInstance=
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e){return e&&e._delegate?e._delegate:e},n.getUA=k,n.isAdmin=void 0,n.isBrowser=function(){return"undefined"!=typeof window||b()},n.isBrowserExtension=function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:undefined;return"object"==typeof e&&e.id!==undefined},n.isCloudflareWorker=function(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent},n.isElectron=function(){return k().indexOf("Electron/")>=0},n.isEmpty=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},n.isIE=function(){const e=k();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0},n.isIndexedDBAvailable=function(){try{return"object"==typeof indexedDB}catch(e){return!1}},n.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(k())},n.isNode=w,n.isNodeSdk=function(){return!0===t.NODE_CLIENT||!0===t.NODE_ADMIN},n.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},n.isSafari=function(){return!w()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},n.isUWP=function(){return k().indexOf("MSAppHost/")>=0},n.isValidTimestamp=n.isValidFormat=void 0,n.isWebWorker=b,n.issuedAtTime=void 0,n.jsonEval=S,n.map=function(e,t,n){const s={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(s[r]=t.call(n,e[r],r,e));return s},n.ordinal=function(e){if(!Number.isFinite(e))return`${e}`;return e+function(e){e=Math.abs(e);const t=e%100;if(t>=10&&t<=20)return"th";const n=e%10;if(1===n)return"st";if(2===n)return"nd";if(3===n)return"rd";return"th"}(e)},n.promiseWithTimeout=
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function(e,t=2e3){const n=new g;return setTimeout(()=>n.reject("timeout!"),t),e.then(n.resolve,n.reject),n.promise}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.querystring=function(e){const t=[];for(const[n,s]of Object.entries(e))Array.isArray(s)?s.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(s));return t.length?"&"+t.join("&"):""},n.querystringDecode=function(e){const t={},n=e.replace(/^\?/,"").split("&");return n.forEach(e=>{if(e){const[n,s]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(s)}}),t},n.safeGet=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:undefined},n.stringToByteArray=n.stringLength=void 0,n.stringify=function(e){return JSON.stringify(e)}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.validateArgCount=void 0,n.validateCallback=function(e,t,n,s){if(s&&!n)return;if("function"!=typeof n)throw new Error(v(e,t)+"must be a valid function.")},n.validateContextObject=function(e,t,n,s){if(s&&!n)return;if("object"!=typeof n||null===n)throw new Error(v(e,t)+"must be a valid context object.")}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */,n.validateIndexedDBOpenable=function(){return new Promise((e,t)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(s),e(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var e;t((null===(e=r.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})},n.validateNamespace=function(e,t,n){if(n&&!t)return;if("string"!=typeof t)throw new Error(v(e,"namespace")+"must be a valid firebase namespace.")};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const t=n.CONSTANTS={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},s=function(e,t){if(!e)throw r(t)};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.assert=s;const r=function(e){return new Error("Firebase Database ("+t.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.assertionError=r;const o=function(e){const t=[];let n=0;for(let s=0;s<e.length;s++){let r=e.charCodeAt(s);r<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&s+1<e.length&&56320==(64512&e.charCodeAt(s+1))?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++s)),t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128)}return t},a=n.base64={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let t=0;t<e.length;t+=3){const r=e[t],o=t+1<e.length,a=o?e[t+1]:0,i=t+2<e.length,c=i?e[t+2]:0,l=r>>2,d=(3&r)<<4|a>>4;let u=(15&a)<<2|c>>6,m=63&c;i||(m=64,o||(u=64)),s.push(n[l],n[d],n[u],n[m])}return s.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(o(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,s=0;for(;n<e.length;){const r=e[n++];if(r<128)t[s++]=String.fromCharCode(r);else if(r>191&&r<224){const o=e[n++];t[s++]=String.fromCharCode((31&r)<<6|63&o)}else if(r>239&&r<365){const o=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[s++]=String.fromCharCode(55296+(o>>10)),t[s++]=String.fromCharCode(56320+(1023&o))}else{const o=e[n++],a=e[n++];t[s++]=String.fromCharCode((15&r)<<12|(63&o)<<6|63&a)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let t=0;t<e.length;){const r=n[e.charAt(t++)],o=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==r||null==o||null==a||null==c)throw new i;const l=r<<2|o>>4;if(s.push(l),64!==a){const e=o<<4&240|a>>2;if(s.push(e),64!==c){const e=a<<6&192|c;s.push(e)}}}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class i extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}n.DecodeBase64StringError=i;const c=function(e){const t=o(e);return a.encodeByteArray(t,!0)};n.base64Encode=c;const l=function(e){return c(e).replace(/\./g,"")};n.base64urlEncodeWithoutPadding=l;const d=function(e){try{return a.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function u(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:e===undefined&&(e={});break;case Array:e=[];break;default:return t}for(const n in t)t.hasOwnProperty(n)&&m(n)&&(e[n]=u(e[n],t[n]));return e}function m(e){return"__proto__"!==e}
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function h(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}
/**
 * @license
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */n.base64Decode=d;const p=()=>{try{return h().__FIREBASE_DEFAULTS__||(()=>{if(void 0===e||void 0===e.env)return})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&d(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}};n.getDefaults=p;const f=e=>{var t,n;return null===(n=null===(t=p())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]};n.getDefaultEmulatorHost=f;n.getDefaultEmulatorHostnameAndPort=e=>{const t=f(e);if(!t)return undefined;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const s=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),s]:[t.substring(0,n),s]};n.getDefaultAppConfig=()=>{var e;return null===(e=p())||void 0===e?void 0:e.config};
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.getExperimentalSetting=e=>{var t;return null===(t=p())||void 0===t?void 0:t[`_${e}`]};class g{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}
/**
 * @license
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function k(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function w(){var e;const t=null===(e=p())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function b(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}n.Deferred=g;class _ extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,_.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,E.prototype.create)}}n.FirebaseError=_;class E{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},s=`${this.service}/${e}`,r=this.errors[e],o=r?function(e,t){return e.replace(y,(e,n)=>{const s=t[n];return null!=s?String(s):`<${n}?>`})}(r,n):"Error",a=`${this.serviceName}: ${o} (${s}).`;return new _(s,a,n)}}n.ErrorFactory=E;const y=/\{\$([^}]+)}/g;
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function S(e){return JSON.parse(e)}const I=function(e){let t={},n={},s={},r="";try{const o=e.split(".");t=S(d(o[0])||""),n=S(d(o[1])||""),r=o[2],s=n.d||{},delete n.d}catch(e){}return{header:t,claims:n,data:s,signature:r}};n.decode=I;n.isValidTimestamp=function(e){const t=I(e).claims,n=Math.floor((new Date).getTime()/1e3);let s=0,r=0;return"object"==typeof t&&(t.hasOwnProperty("nbf")?s=t.nbf:t.hasOwnProperty("iat")&&(s=t.iat),r=t.hasOwnProperty("exp")?t.exp:s+86400),!!n&&!!s&&!!r&&n>=s&&n<=r};n.issuedAtTime=function(e){const t=I(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null};n.isValidFormat=function(e){const t=I(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")};function C(e){return null!==e&&"object"==typeof e}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.isAdmin=function(e){const t=I(e).claims;return"object"==typeof t&&!0===t.admin};n.Sha1=class{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);const n=this.W_;if("string"==typeof e)for(let s=0;s<16;s++)n[s]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let s=0;s<16;s++)n[s]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let e=16;e<80;e++){const t=n[e-3]^n[e-8]^n[e-14]^n[e-16];n[e]=4294967295&(t<<1|t>>>31)}let s,r,o=this.chain_[0],a=this.chain_[1],i=this.chain_[2],c=this.chain_[3],l=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(s=c^a&(i^c),r=1518500249):(s=a^i^c,r=1859775393):e<60?(s=a&i|c&(a|i),r=2400959708):(s=a^i^c,r=3395469782);const t=(o<<5|o>>>27)+s+l+r+n[e]&4294967295;l=c,c=i,i=4294967295&(a<<30|a>>>2),a=o,o=t}this.chain_[0]=this.chain_[0]+o&4294967295,this.chain_[1]=this.chain_[1]+a&4294967295,this.chain_[2]=this.chain_[2]+i&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295}update(e,t){if(null==e)return;t===undefined&&(t=e.length);const n=t-this.blockSize;let s=0;const r=this.buf_;let o=this.inbuf_;for(;s<t;){if(0===o)for(;s<=n;)this.compress_(e,s),s+=this.blockSize;if("string"==typeof e){for(;s<t;)if(r[o]=e.charCodeAt(s),++o,++s,o===this.blockSize){this.compress_(r),o=0;break}}else for(;s<t;)if(r[o]=e[s],++o,++s,o===this.blockSize){this.compress_(r),o=0;break}}this.inbuf_=o,this.total_+=t}digest(){const e=[];let t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let e=this.blockSize-1;e>=56;e--)this.buf_[e]=255&t,t/=256;this.compress_(this.buf_);let n=0;for(let t=0;t<5;t++)for(let s=24;s>=0;s-=8)e[n]=this.chain_[t]>>s&255,++n;return e}};class A{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let s;if(e===undefined&&t===undefined&&n===undefined)throw new Error("Missing Observer.");s=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},s.next===undefined&&(s.next=T),s.error===undefined&&(s.error=T),s.complete===undefined&&(s.complete=T);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch(e){}}),this.observers.push(s),r}unsubscribeOne(e){this.observers!==undefined&&this.observers[e]!==undefined&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&this.onNoObservers!==undefined&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==undefined&&this.observers[e]!==undefined)try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,e!==undefined&&(this.finalError=e),this.task.then(()=>{this.observers=undefined,this.onNoObservers=undefined}))}}function T(){}
/**
 * @license
 * Copyright 2017 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */function v(e,t){return`${e} failed: ${t} argument `}n.validateArgCount=function(e,t,n,s){let r;if(s<t?r="at least "+t:s>n&&(r=0===n?"none":"no more than "+n),r){throw new Error(e+" failed: Was called with "+s+(1===s?" argument.":" arguments.")+" Expects "+r+".")}};n.stringToByteArray=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);if(o>=55296&&o<=56319){const t=o-55296;r++,s(r<e.length,"Surrogate pair missing trail surrogate.");o=65536+(t<<10)+(e.charCodeAt(r)-56320)}o<128?t[n++]=o:o<2048?(t[n++]=o>>6|192,t[n++]=63&o|128):o<65536?(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=63&o|128):(t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=63&o|128)}return t};
/**
 * @license
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
n.stringLength=function(e){let t=0;for(let n=0;n<e.length;n++){const s=e.charCodeAt(n);s<128?t++:s<2048?t+=2:s>=55296&&s<=56319?(t+=4,n++):t+=3}return t};const x=1e3,N=2,j=n.MAX_VALUE_MILLIS=144e5,P=n.RANDOM_FACTOR=.5}).call(this)}).call(this,e("_process"))}}},{package:"@metamask/notification-services-controller>firebase>@firebase/util",file:"node_modules/@firebase/util/dist/index.esm2017.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-spec/json-pointer/lib/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});class s{static parse(e){if(""===e)return new s([]);if(!e.startsWith("/"))throw new r(e);const[,...t]=e.split("/");return new s(t.map(e=>e.replace(/~1/g,"/").replace(/~0/g,"~")))}constructor(e){this.tokens=e}toString(){if(0===this.tokens.length)return"";return`/${this.tokens.map(e=>e.replace(/~/g,"~0").replace(/\//g,"~1")).join("/")}`}shmeval(e){for(const t of this.tokens){if(!e.hasOwnProperty(t))throw new o(e,t);e=e[t]}return e}}n.default=s;class r extends Error{constructor(e){super(`Invalid JSON Pointer: ${e}`),this.ptr=e}}n.InvalidPtrError=r;class o extends Error{constructor(e,t){super(`Error evaluating JSON Pointer: no attribute ${t} on ${e}`),this.instance=e,this.token=t}}n.EvalError=o}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver>@json-schema-spec/json-pointer",file:"node_modules/@json-schema-spec/json-pointer/lib/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/dereferencer.js",{"@json-schema-tools/reference-resolver":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/index-web.js","@json-schema-tools/traverse":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/traverse/build/index.js","fast-safe-stringify":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-safe-stringify/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)},r=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,o){function a(e){try{c(s.next(e))}catch(e){o(e)}}function i(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,i)}c((s=s.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,s,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(n=1,s&&(r=2&i[0]?s.return:i[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,i[1])).done)return r;switch(s=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,s=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],s=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NonStringRefError=void 0;var i=a(e("@json-schema-tools/traverse")),c=a(e("@json-schema-tools/reference-resolver")),l=a(e("fast-safe-stringify")),d=function(e){this.name="NonStringRefError",this.message=["NonStringRefError","Found an improperly formatted $ref in schema. $ref must be a string","schema in question: ".concat((0,l.default)(e))].join("\n")};n.NonStringRefError=d;var u=function(e,t){if(e.$ref!==undefined&&Object.keys(e).length>1&&!0!==t&&!1!==t){var n=s(s({},t),e);return delete n.$ref,n}return t},m=function(){function e(e,t){var n;if(void 0===t&&(t={}),this.options=t,this.refCache={},n=!0===this.options.mutate||!0===e||!1===e?e:s({},e),this.options.recursive===undefined&&(this.options.recursive=!0),this.options.rootSchema===undefined&&(this.options.rootSchema=n),!0!==e&&!1!==e&&e.$id&&(this.options.rootSchema=n),this.options.refCache&&(this.refCache=this.options.refCache),this.options.protocolHandlerMap)for(var r=0,o=Object.keys(this.options.protocolHandlerMap);r<o.length;r++){var a=o[r];c.default.protocolHandlerMap[a]=this.options.protocolHandlerMap[a]}this.schema=n,this.refs=this.collectRefs()}return e.prototype.resolve=function(){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this._resolve()];case 1:return e.sent(),delete this.schema.definitions,delete this.schema.components,[2,this.schema]}})})},e.prototype._resolve=function(){return r(this,void 0,void 0,function(){var t,n,r,a,l,d,m,h,p,f,g,k=this;return o(this,function(o){switch(o.label){case 0:if(!0===this.schema||!1===this.schema)return[2,Promise.resolve(this.schema)];if(0===this.refs.length)return[2,Promise.resolve(this.schema)];t=this.refs.filter(function(e){return k.refCache[e]===undefined}),n=[],r=0,a=t,o.label=1;case 1:return r<a.length?(l=a[r],d=void 0,this.refCache[l]===undefined?[3,2]:(d=this.refCache[l],[3,5])):[3,11];case 2:if("#"!==l)return[3,3];if(this.options.rootSchema===undefined)throw new Error("options.rootSchema was not provided, but one of the schemas references '#'");return d=this.options.rootSchema,[3,5];case 3:return m=c.default.resolve(l,this.options.rootSchema),n.push(m),[4,m];case 4:d=o.sent(),o.label=5;case 5:return!0!==this.options.recursive||!0===d||!1===d||"#"===l?[3,9]:(h=s(s({},this.options),{refCache:this.refCache}),0===(p=new e(d,h)).refs.length?[3,7]:(f=p._resolve(),n.push(f),[4,f]));case 6:return g=o.sent(),this.refCache[l]=u(d,g),[3,8];case 7:this.refCache[l]=d,o.label=8;case 8:return[3,10];case 9:this.refCache[l]=d,o.label=10;case 10:return r++,[3,1];case 11:return this.schema.$ref!==undefined?this.schema=u(this.schema,this.refCache[this.schema.$ref]):(0,i.default)(this.schema,function(e){if(!0===e||!1===e)return e;if(e.$ref!==undefined){var t=k.refCache[e.$ref];return u(e,t)}return e},{mutable:!0}),[4,Promise.all(n)];case 12:return o.sent(),[2,this.schema]}})})},e.prototype.collectRefs=function(){var e=[];return(0,i.default)(this.schema,function(t){if(!0===t||!1===t)return t;if(t.$ref&&-1===e.indexOf(t.$ref)){if("string"!=typeof t.$ref)throw new d(t);e.push(t.$ref)}return t}),e},e}();n.default=m}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/index.js",{"./dereferencer":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/dereferencer/build/dereferencer.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NonStringRefError=void 0;var r=s(e("./dereferencer")),o=e("./dereferencer");Object.defineProperty(n,"NonStringRefError",{enumerable:!0,get:function(){return o.NonStringRefError}}),n.default=r.default}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer",file:"node_modules/@json-schema-tools/dereferencer/build/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/meta-schema/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.jsonSchema=void 0,n.jsonSchema={$schema:"https://meta.json-schema.tools/",$id:"https://meta.json-schema.tools/",title:"JSONSchema",default:{},oneOf:[{$ref:"#/definitions/JSONSchemaObject"},{$ref:"#/definitions/JSONSchemaBoolean"}],definitions:{JSONSchemaBoolean:{title:"JSONSchemaBoolean",description:"Always valid if true. Never valid if false. Is constant.",type:"boolean"},JSONSchemaObject:{title:"JSONSchemaObject",type:"object",properties:{$id:{title:"$id",type:"string",format:"uri-reference"},$schema:{title:"$schema",type:"string",format:"uri"},$ref:{title:"$ref",type:"string",format:"uri-reference"},$comment:{title:"$comment",type:"string"},title:{title:"title",type:"string"},description:{title:"description",type:"string"},default:!0,readOnly:{title:"readOnly",type:"boolean",default:!1},examples:{title:"examples",type:"array",items:!0},multipleOf:{title:"multipleOf",type:"number",exclusiveMinimum:0},maximum:{title:"maximum",type:"number"},exclusiveMaximum:{title:"exclusiveMaximum",type:"number"},minimum:{title:"minimum",type:"number"},exclusiveMinimum:{title:"exclusiveMinimum",type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{title:"pattern",type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{title:"items",anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{title:"uniqueItems",type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{title:"definitions",type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{title:"properties",type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{title:"patternProperties",type:"object",additionalProperties:{$ref:"#"},propertyNames:{title:"propertyNames",format:"regex"},default:{}},dependencies:{title:"dependencies",type:"object",additionalProperties:{title:"dependenciesSet",anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{title:"enum",type:"array",items:!0,minItems:1,uniqueItems:!0},type:{title:"type",anyOf:[{$ref:"#/definitions/simpleTypes"},{title:"arrayOfSimpleTypes",type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{title:"format",type:"string"},contentMediaType:{title:"contentMediaType",type:"string"},contentEncoding:{title:"contentEncoding",type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}}},schemaArray:{title:"schemaArray",type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{title:"nonNegativeInteger",type:"integer",minimum:0},nonNegativeIntegerDefault0:{title:"nonNegativeIntegerDefaultZero",type:"integer",minimum:0,default:0},simpleTypes:{title:"simpleTypes",type:"string",enum:["array","boolean","integer","null","number","object","string"]},stringArray:{title:"stringArray",type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}},n.default=n.jsonSchema}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/meta-schema",file:"node_modules/@json-schema-tools/meta-schema/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js",{"./errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/errors.js","isomorphic-fetch":"/home/runner/work/metamask-extension/metamask-extension/node_modules/isomorphic-fetch/fetch-npm-browserify.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,o){function a(e){try{c(s.next(e))}catch(e){o(e)}}function i(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,i)}c((s=s.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,s,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(n=1,s&&(r=2&i[0]?s.return:i[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,i[1])).done)return r;switch(s=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,s=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],s=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var a=e("./errors"),i=o(e("isomorphic-fetch")),c=function(e){return s(void 0,void 0,void 0,function(){var t,n;return r(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,(0,i.default)(e)];case 1:return t=s.sent(),[3,3];case 2:throw s.sent(),new a.InvalidRemoteURLError(e);case 3:return s.trys.push([3,5,,6]),[4,t.json()];case 4:return[2,s.sent()];case 5:throw n=s.sent(),new a.NonJsonRefError({$ref:e},n.message);case 6:return[2]}})})};n.default={https:c,http:c}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/errors.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.InvalidFileSystemPathError=n.InvalidRemoteURLError=n.NotResolvableError=n.NonJsonRefError=void 0;var s=function(e,t){this.name="NonJsonRefError",this.message=["NonJsonRefError","The resolved value at the reference: ".concat(e.$ref," was not JSON.parse 'able"),"The non-json content in question: ".concat(t)].join("\n")};n.NonJsonRefError=s;var r=function(e){this.name="NotResolvableError",this.message=["NotResolvableError","Could not resolve the reference: ".concat(e),"No protocol handler was found, and it was not found to be an internal reference"].join("\n")};n.NotResolvableError=r;var o=function(e){this.name="InvalidRemoteURLError",this.message=["InvalidRemoteURLError","The url was not resolvable: ".concat(e)].join("\n")};n.InvalidRemoteURLError=o;var a=function(e){this.name="InvalidFileSystemPathError",this.message=["InvalidFileSystemPathError","The path was not resolvable: ".concat(e)].join("\n")};n.InvalidFileSystemPathError=a}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/errors.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/index-web.js",{"./default-protocol-handler-map":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/default-protocol-handler-map.js","./reference-resolver":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)},r=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,o){function a(e){try{c(s.next(e))}catch(e){o(e)}}function i(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,i)}c((s=s.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,s,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(n=1,s&&(r=2&i[0]?s.return:i[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,i[1])).done)return r;switch(s=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,s=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],s=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var i=a(e("./default-protocol-handler-map")),c=a(e("./reference-resolver")),l=s(s({},i.default),{file:function(){return r(void 0,void 0,void 0,function(){return o(this,function(e){return[2,undefined]})})}});n.default=new c.default(l)}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/index-web.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js",{"./errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/errors.js","./resolve-pointer":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(r,o){function a(e){try{c(s.next(e))}catch(e){o(e)}}function i(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,i)}c((s=s.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,s,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(n=1,s&&(r=2&i[0]?s.return:i[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,i[1])).done)return r;switch(s=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,s=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],s=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var a=e("./errors"),i=o(e("./resolve-pointer")),c=function(){function e(e){this.protocolHandlerMap=e}return e.prototype.resolve=function(e){return s(this,arguments,void 0,function(e,t){var n,s,o,c,l,d,u,m,h,p;return void 0===t&&(t={}),r(this,function(r){switch(r.label){case 0:if("#"===e[0])return[2,Promise.resolve((0,i.default)(e,t))];(n=e.split("#")).length>1&&(s=n[n.length-1]),o=n[0],r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.protocolHandlerMap.file(o,t)];case 2:return c=r.sent(),[3,4];case 3:throw l=r.sent(),new a.NonJsonRefError({$ref:e},l.message);case 4:if(c!==undefined)return p=c,s&&(p=(0,i.default)(s,p)),[2,p];if(!1===e.includes("://"))throw new a.InvalidFileSystemPathError(e);d=0,u=Object.keys(this.protocolHandlerMap),r.label=5;case 5:return d<u.length?(m=u[d],o.startsWith(m)?[4,this.protocolHandlerMap[m](o,t)]:[3,7]):[3,8];case 6:if((h=r.sent())!==undefined)return p=h,s&&(p=(0,i.default)(s,p)),[2,p];r.label=7;case 7:return d++,[3,5];case 8:throw new a.NotResolvableError(e)}})})},e}();n.default=c}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/reference-resolver.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js",{"@json-schema-spec/json-pointer":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-spec/json-pointer/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.InvalidJsonPointerRefError=void 0;var r=s(e("@json-schema-spec/json-pointer")),o=function(e,t){this.name="InvalidJsonPointerRefError",this.message=["InvalidJsonPointerRefError","The provided RFC6901 JSON Pointer is invalid: ".concat(e),"","addition info: ",t].join("\n")};n.InvalidJsonPointerRefError=o,n.default=function(e,t){try{var n=e.replace("#","");return r.default.parse(n).shmeval(t)}catch(t){throw new o(e,t.message)}}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/reference-resolver",file:"node_modules/@json-schema-tools/reference-resolver/build/resolve-pointer.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@json-schema-tools/traverse/build/index.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},s.apply(this,arguments)},r=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var s,r=0,o=t.length;r<o;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))};Object.defineProperty(n,"__esModule",{value:!0}),n.defaultOptions=void 0,n.defaultOptions={skipFirstMutation:!1,mutable:!1,bfs:!1};var o=function(e){return e.map(function(e){return""===e?"$":".".concat(e)}).join("")},a=function(e,t){var n=t.find(function(t){return t===e});return n||!1},i=function(e,t){return void 0===t&&(t=1),e[e.length-t]};n.default=function e(t,c,l,d,u,m,h,p,f){void 0===l&&(l=n.defaultOptions),void 0===d&&(d=0),void 0===u&&(u=[]),void 0===m&&(m=[]),void 0===h&&(h=[]),void 0===p&&(p=[]),void 0===f&&(f=[]);var g=s(s({},n.defaultOptions),l);if(0===d&&(h=[""]),"boolean"==typeof t||t instanceof Boolean)return!0===g.skipFirstMutation&&0===d?t:c(t,!1,o(h),i(m));var k=t;!1===g.mutable&&(k=s({},t)),m.push(k),!0===g.bfs&&(!1!==g.skipFirstMutation&&0===d||(k=c(k,!1,o(h),i(m,2)))),u.push(t),p.push([t,k]);var w=function(t,n){var s=a(t,u);return s?(f.push(s),!0===g.skipFirstMutation&&s===u[0]?c(t,!0,o(n),i(m)):p.find(function(e){var t=e[0];return s===t})[1]):e(t,c,l,d+1,u,m,n,p,f)};if(t.anyOf)k.anyOf=t.anyOf.map(function(e,t){return w(e,r(r([],h,!0),["anyOf[".concat(t,"]")],!1))});else if(t.allOf)k.allOf=t.allOf.map(function(e,t){return w(e,r(r([],h,!0),["allOf[".concat(t,"]")],!1))});else if(t.oneOf)k.oneOf=t.oneOf.map(function(e,t){return w(e,r(r([],h,!0),["oneOf[".concat(t,"]")],!1))});else{if(t.items)if(t.items instanceof Array)k.items=t.items.map(function(e,t){return w(e,r(r([],h,!0),["items[".concat(t,"]")],!1))});else{var b=a(t.items,u);if(b)if(f.push(b),!0===g.skipFirstMutation&&b===u[0])k.items=c(t.items,!0,o(h),i(m));else{var _=p.find(function(e){var t=e[0];return b===t})[1];k.items=_}else k.items=e(t.items,c,l,d+1,u,m,r(r([],h,!0),["items"],!1),p,f)}if(t.additionalItems!==undefined&&(k.additionalItems=w(t.additionalItems,r(r([],h,!0),["additionalItems"],!1))),t.properties!==undefined){var E=t.properties,y={};Object.keys(t.properties).forEach(function(e){y[e]=w(E[e],r(r([],h,!0),["properties",e.toString()],!1))}),k.properties=y}if(t.patternProperties!==undefined){var S=t.patternProperties,I={};Object.keys(t.patternProperties).forEach(function(e){I[e]=w(S[e],r(r([],h,!0),["patternProperties",e.toString()],!1))}),k.patternProperties=I}t.additionalProperties!==undefined&&!0==!!t.additionalProperties&&(k.additionalProperties=w(t.additionalProperties,r(r([],h,!0),["additionalProperties"],!1)))}if(!0===g.skipFirstMutation&&0===d)return k;if(!0===g.bfs)return m.pop(),k;var C=-1!==f.indexOf(t);return m.pop(),c(k,C,o(h),i(m))}}}},{package:"@open-rpc/schema-utils-js>@json-schema-tools/dereferencer>@json-schema-tools/traverse",file:"node_modules/@json-schema-tools/traverse/build/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs",{"@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.AddressBookController=n.getDefaultAddressBookControllerState=n.controllerName=n.AddressType=void 0;const a=e("@metamask/base-controller"),i=e("@metamask/controller-utils");var c;!function(e){e.externallyOwnedAccounts="EXTERNALLY_OWNED_ACCOUNTS",e.contractAccounts="CONTRACT_ACCOUNTS",e.nonAccounts="NON_ACCOUNTS"}(c||(n.AddressType=c={})),n.controllerName="AddressBookController";const l={addressBook:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};n.getDefaultAddressBookControllerState=()=>({addressBook:{}});class d extends a.BaseController{constructor({messenger:e,state:t}){const a={...(0,n.getDefaultAddressBookControllerState)(),...t};super({messenger:e,metadata:l,name:n.controllerName,state:a}),s.add(this),o(this,s,"m",r).call(this)}list(){const{addressBook:e}=this.state;return Object.keys(e).reduce((t,n)=>{const s=n;return[...t,...Object.values(e[s])]},[])}clear(){this.update(e=>{e.addressBook={}})}delete(e,t){if(t=(0,i.toChecksumHexAddress)(t),!([e,t].every(e=>(0,i.isSafeDynamicKey)(e))&&(0,i.isValidHexAddress)(t)&&this.state.addressBook[e]&&this.state.addressBook[e][t]))return!1;const n={...this.state.addressBook[e][t]};return this.update(n=>{const s=n.addressBook[e];s?.[t]&&(delete s[t],0===Object.keys(s).length&&delete n.addressBook[e])}),"*"!==String(e)&&this.messenger.publish("AddressBookController:contactDeleted",n),!0}set(e,t,n=(0,i.toHex)(1),s="",r){if(e=(0,i.toChecksumHexAddress)(e),!(0,i.isValidHexAddress)(e))return!1;const o={address:e,chainId:n,isEns:!1,memo:s,name:t,addressType:r,lastUpdatedAt:Date.now()},a=(0,i.normalizeEnsName)(t);return a&&(o.name=a,o.isEns=!0),this.update(t=>{t.addressBook={...this.state.addressBook,[n]:{...this.state.addressBook[n],[e]:o}}}),"*"!==String(n)&&this.messenger.publish("AddressBookController:contactUpdated",o),!0}}n.AddressBookController=d,s=new WeakSet,r=function(){this.messenger.registerActionHandler(`${n.controllerName}:list`,this.list.bind(this)),this.messenger.registerActionHandler(`${n.controllerName}:set`,this.set.bind(this)),this.messenger.registerActionHandler(`${n.controllerName}:delete`,this.delete.bind(this))},n.default=d}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/address-book-controller/dist/index.cjs",{"./AddressBookController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/address-book-controller/dist/AddressBookController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AddressBookController=n.getDefaultAddressBookControllerState=void 0;var s=e("./AddressBookController.cjs");Object.defineProperty(n,"getDefaultAddressBookControllerState",{enumerable:!0,get:function(){return s.getDefaultAddressBookControllerState}}),Object.defineProperty(n,"AddressBookController",{enumerable:!0,get:function(){return s.AddressBookController}})}}},{package:"@metamask/address-book-controller",file:"node_modules/@metamask/address-book-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs",{"@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.AnnouncementController=void 0;const a=e("@metamask/base-controller"),i={announcements:{}},c={announcements:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}};class l extends a.BaseController{constructor({messenger:e,state:t,allAnnouncements:n}){const a={...i,...t};super({messenger:e,metadata:c,name:"AnnouncementController",state:a}),s.add(this),o(this,s,"m",r).call(this,n)}resetViewed(){this.update(({announcements:e})=>{for(const t of Object.values(e))t.isShown=!1})}updateViewed(e){this.update(({announcements:t})=>{for(const n of Object.keys(e).map(Number))t[n].isShown=e[n]})}}n.AnnouncementController=l,s=new WeakSet,r=function(e){this.update(t=>{Object.values(e).forEach(e=>{t.announcements[e.id]=t.announcements[e.id]??{...e,isShown:!1}})})}}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/index.cjs",{"./AnnouncementController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/announcement-controller/dist/AnnouncementController.cjs"},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;var s=e("./AnnouncementController.cjs");Object.defineProperty(n,"AnnouncementController",{enumerable:!0,get:function(){return s.AnnouncementController}})}}},{package:"@metamask/announcement-controller",file:"node_modules/@metamask/announcement-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs","./utils/bridge-status.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs","./utils/gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./utils/metrics.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs","./utils/transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/polling-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/polling-controller/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,l,d,u,m,h,p,f,g,k,w,b,_,E,y,S,I,C,A,T,v,x,N,j=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},P=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeStatusController=void 0;const D=e("@metamask/bridge-controller"),R=e("@metamask/controller-utils"),O=e("@metamask/polling-controller"),M=e("@metamask/transaction-controller"),B=e("@metamask/utils"),L=e("./constants.cjs"),F=e("./types.cjs"),U=e("./utils/bridge-status.cjs"),H=e("./utils/gas.cjs"),G=e("./utils/metrics.cjs"),q=e("./utils/transaction.cjs"),W={txHistory:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}};class $ extends((0,O.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:n,fetchFn:O,addTransactionFn:$,addTransactionBatchFn:V,updateTransactionFn:K,estimateGasFeeFn:Y,config:z,traceFn:Q}){super({name:L.BRIDGE_STATUS_CONTROLLER_NAME,metadata:W,messenger:e,state:{...L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,...t}}),s.add(this),r.set(this,{}),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,void 0),d.set(this,void 0),u.set(this,void 0),m.set(this,void 0),h.set(this,({id:e})=>{const t=this.state.txHistory[e]?e:Object.keys(this.state.txHistory).find(t=>this.state.txHistory[t].approvalTxId===e);t&&this.update(e=>{e.txHistory[t].status.status=D.StatusTypes.FAILED})}),this.resetState=()=>{this.update(e=>{e.txHistory=L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory})},this.wipeBridgeStatus=({address:e,ignoreNetwork:t})=>{if(t)this.update(e=>{e.txHistory=L.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE.txHistory});else{const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState"),n=this.messenger.call("NetworkController:getNetworkClientById",t).configuration.chainId;P(this,y,"f").call(this,e,n)}},this.restartPollingForFailedAttempts=e=>{const{txMetaId:t,txHash:n}=e;if(!t&&!n)throw new Error("Either txMetaId or txHash must be provided");let s;if(t?this.state.txHistory[t]&&(s=t):n&&(s=Object.keys(this.state.txHistory).find(e=>this.state.txHistory[e].status.srcChain.txHash===n)),!s)throw new Error("No bridge transaction history found for "+(t?`txMetaId: ${t}`:`txHash: ${n}`));const o=this.state.txHistory[s];this.update(e=>{s&&(e.txHistory[s].attempts=undefined)});if((0,D.isCrossChain)(o.quote.srcChainId,o.quote.destChainId)){P(this,r,"f")[s]||P(this,g,"f").call(this,s)}},this.getBridgeHistoryItemByTxMetaId=e=>this.state.txHistory[e],p.set(this,()=>{const{txHistory:e}=this.state;Object.values(e).filter(e=>e.status.status===D.StatusTypes.PENDING||e.status.status===D.StatusTypes.UNKNOWN).filter(e=>!P(this,r,"f")[e.txMetaId]).filter(e=>(0,D.isCrossChain)(e.quote.srcChainId,e.quote.destChainId)).forEach(e=>{const t=e.txMetaId;(0,U.shouldSkipFetchDueToFetchFailures)(e.attempts)||P(this,g,"f").call(this,t)})}),f.set(this,e=>{const{bridgeTxMeta:t,statusRequest:n,quoteResponse:s,startTime:r,slippagePercentage:o,initialDestAssetBalance:a,targetContractAddress:i,approvalTxId:c,isStxEnabled:l,accountAddress:d}=e,u={txMetaId:t.id,batchId:t.batchId,quote:s.quote,startTime:r,estimatedProcessingTimeInSeconds:s.estimatedProcessingTimeInSeconds,slippagePercentage:o,pricingData:{amountSent:s.sentAmount?.amount??"0",amountSentInUsd:s.sentAmount?.usd??undefined,quotedGasInUsd:s.gasFee?.effective?.usd??undefined,quotedReturnInUsd:s.toTokenAmount?.usd??undefined,quotedGasAmount:s.gasFee?.effective?.amount??undefined},initialDestAssetBalance:a,targetContractAddress:i,account:d,status:{status:D.StatusTypes.PENDING,srcChain:{chainId:n.srcChainId,txHash:n.srcTxHash}},hasApprovalTx:Boolean(s.approval),approvalTxId:c,isStxEnabled:l??!1,featureId:s.featureId};this.update(e=>{e.txHistory[t.id]=u})}),g.set(this,e=>{const t=P(this,r,"f")[e];t&&this.stopPollingByPollingToken(t);const n=this.state.txHistory[e];if(!n)return;const{quote:s}=n;(0,D.isCrossChain)(s.srcChainId,s.destChainId)&&(P(this,r,"f")[e]=this.startPolling({bridgeTxMetaId:e}))}),this.startPollingForBridgeTxStatus=e=>{const{bridgeTxMeta:t}=e;P(this,f,"f").call(this,e),P(this,g,"f").call(this,t.id)},this._executePoll=async e=>{await P(this,b,"f").call(this,e)},w.set(this,e=>{const{attempts:t}=this.state.txHistory[e],n=t?{counter:t.counter+1,lastAttemptTime:Date.now()}:{counter:1,lastAttemptTime:Date.now()},s=P(this,r,"f")[e];n.counter>=L.MAX_ATTEMPTS&&s&&(this.stopPollingByPollingToken(s),delete P(this,r,"f")[e]),this.update(t=>{t.txHistory[e].attempts=n})}),b.set(this,async({bridgeTxMetaId:e})=>{const{txHistory:t}=this.state;if(!(0,U.shouldSkipFetchDueToFetchFailures)(t[e]?.attempts))try{const n=t[e],s=P(this,_,"f").call(this,e);if(!s)return;P(this,E,"f").call(this,e,s);const c=(0,U.getStatusRequestWithSrcTxHash)(n.quote,s),{status:l,validationFailures:d}=await(0,U.fetchBridgeTxStatus)(c,P(this,o,"f"),P(this,a,"f"),P(this,i,"f").customBridgeApiBaseUrl);if(d.length>0)throw P(this,N,"f").call(this,D.UnifiedSwapBridgeEventName.StatusValidationFailed,e,{failures:d}),new Error(`Bridge status validation failed: ${d.join(", ")}`);const u={...n,status:l,completionTime:l.status===D.StatusTypes.COMPLETE||l.status===D.StatusTypes.FAILED?Date.now():undefined,attempts:undefined};this.update(t=>{t.txHistory[e]=u});const m=P(this,r,"f")[e];if((l.status===D.StatusTypes.COMPLETE||l.status===D.StatusTypes.FAILED)&&m){if(this.stopPollingByPollingToken(m),delete P(this,r,"f")[e],n.featureId)return;l.status===D.StatusTypes.COMPLETE&&(P(this,N,"f").call(this,D.UnifiedSwapBridgeEventName.Completed,e),this.messenger.publish("BridgeStatusController:destinationTransactionCompleted",n.quote.destAsset.assetId)),l.status===D.StatusTypes.FAILED&&P(this,N,"f").call(this,D.UnifiedSwapBridgeEventName.Failed,e)}}catch(t){console.warn("Failed to fetch bridge tx status",t),P(this,w,"f").call(this,e)}}),_.set(this,e=>{const{txHistory:t}=this.state,n=t[e].status.srcChain.txHash;if(n)return n;const s=this.messenger.call("TransactionController:getState").transactions.find(t=>t.id===e);return s?.hash}),E.set(this,(e,t)=>{const{txHistory:n}=this.state;n[e].status.srcChain.txHash||this.update(n=>{n.txHistory[e].status.srcChain.txHash=t})}),y.set(this,(e,t)=>{const n=Object.keys(this.state.txHistory).filter(n=>{const s=this.state.txHistory[n],r=(0,B.numberToHex)(s.quote.srcChainId);return s.account===e&&r===t});n.forEach(e=>{P(this,r,"f")[e]&&this.stopPollingByPollingToken(P(this,r,"f")[e])}),this.update(e=>{e.txHistory=n.reduce((e,t)=>(delete e[t],e),e.txHistory)})}),S.set(this,async(e,t,n)=>{if(!n.metadata?.snap?.id)throw new Error("Failed to submit cross-chain swap transaction: undefined snap id");const s=(0,q.getClientRequest)(e,t.quote.srcChainId,n),r=await this.messenger.call("SnapController:handleRequest",s),o={...t,trade:e};return(0,q.handleNonEvmTxResponse)(r,o,n)}),I.set(this,async e=>{const t=await e,n=this.messenger.call("TransactionController:getState").transactions.find(e=>e.hash===t);if(!n)throw new Error("Failed to submit cross-chain swap tx: txMeta for txHash was not found");return n}),C.set(this,async(e,t,n,s,r)=>{if(n){const o=async()=>{await P(this,T,"f").call(this,s);const o=await P(this,A,"f").call(this,{transactionType:e?M.TransactionType.bridgeApproval:M.TransactionType.swapApproval,trade:n,requireApproval:r});return await(0,q.handleApprovalDelay)(t),o};return await P(this,m,"f").call(this,{name:e?L.TraceName.BridgeTransactionApprovalCompleted:L.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,D.formatChainIdToCaip)(t),stxEnabled:!1}},o)}return undefined}),A.set(this,async({transactionType:e,trade:t,requireApproval:n=!1,txFee:s})=>{const r=(0,q.generateActionId)().toString();if(!this.messenger.call("AccountsController:getAccountByAddress",t.from))throw new Error("Failed to submit cross-chain swap transaction: unknown account in trade data");const o=(0,D.formatChainIdToHex)(t.chainId),a=this.messenger.call("NetworkController:findNetworkClientIdByChainId",o),i={actionId:r,networkClientId:a,requireApproval:n,type:e,origin:"metamask"},l={...t,chainId:o,gasLimit:t.gasLimit?.toString(),gas:t.gasLimit?.toString()},d={...l,...await P(this,v,"f").call(this,l,a,o,s)},{result:u}=await P(this,c,"f").call(this,d,i);return await P(this,I,"f").call(this,u)}),T.set(this,async e=>{e&&await P(this,A,"f").call(this,{transactionType:M.TransactionType.bridgeApproval,trade:e})}),v.set(this,async(e,t,n,s)=>{const r=(0,R.toHex)(e.gas??0);if(s)return{maxFeePerGas:(0,R.toHex)(s.maxFeePerGas??0),maxPriorityFeePerGas:(0,R.toHex)(s.maxPriorityFeePerGas??0),gas:r};const{gasFeeEstimates:o}=this.messenger.call("GasFeeController:getState"),{estimates:a}=await P(this,u,"f").call(this,{transactionParams:e,chainId:n,networkClientId:t}),{maxFeePerGas:i,maxPriorityFeePerGas:c}=(0,H.getTxGasEstimates)({networkGasFeeEstimates:o,txGasFeeEstimates:a});return{maxFeePerGas:i,maxPriorityFeePerGas:c,gas:r}}),x.set(this,async e=>{const t=await(0,q.getAddTransactionBatchParams)({messenger:this.messenger,estimateGasFeeFn:P(this,u,"f"),...e}),n={[M.TransactionType.bridgeApproval]:t.transactions.find(({type:e})=>e===M.TransactionType.bridgeApproval)?.params.data,[M.TransactionType.swapApproval]:t.transactions.find(({type:e})=>e===M.TransactionType.swapApproval)?.params.data,[M.TransactionType.bridge]:t.transactions.find(({type:e})=>e===M.TransactionType.bridge)?.params.data,[M.TransactionType.swap]:t.transactions.find(({type:e})=>e===M.TransactionType.swap)?.params.data},{batchId:s}=await P(this,l,"f").call(this,t),{approvalMeta:r,tradeMeta:o}=(0,q.findAndUpdateTransactionsInBatch)({messenger:this.messenger,updateTransactionFn:P(this,d,"f"),batchId:s,txDataByType:n});if(!o)throw new Error("Failed to update cross-chain swap transaction batch: tradeMeta not found");return{approvalMeta:r,tradeMeta:o}}),this.submitTx=async(e,t,n,r)=>{this.messenger.call("BridgeController:stopPollingForQuotes",D.AbortReason.TransactionSubmitted,t.featureId?undefined:r);const a=P(this,s,"m",k).call(this,e);if(!a)throw new Error("Failed to submit cross-chain swap transaction: undefined multichain account");const i=(0,D.isHardwareWallet)(a),c=(0,G.getPreConfirmationPropertiesFromQuote)(t,n,i);let l,d;!t.featureId&&P(this,N,"f").call(this,D.UnifiedSwapBridgeEventName.Submitted,undefined,c);const u=Date.now(),h=(0,D.isCrossChain)(t.quote.srcChainId,t.quote.destChainId);if((0,D.isNonEvmChainId)(t.quote.srcChainId)){if(t.approval&&(0,D.isTronTrade)(t.approval)){const e=await P(this,m,"f").call(this,{name:h?L.TraceName.BridgeTransactionApprovalCompleted:L.TraceName.SwapTransactionApprovalCompleted,data:{srcChainId:(0,D.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{return t.approval&&(0,D.isTronTrade)(t.approval)?await P(this,S,"f").call(this,t.approval,t,a):undefined}catch(e){throw!t.featureId&&P(this,N,"f").call(this,D.UnifiedSwapBridgeEventName.Failed,undefined,{error_message:e?.message,...c}),e}});d=e?.id,await(0,q.handleApprovalDelay)(t.quote.srcChainId)}l=await P(this,m,"f").call(this,{name:h?L.TraceName.BridgeTransactionCompleted:L.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,D.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:!1}},async()=>{try{if(!(0,D.isTronTrade)(t.trade)&&!(0,D.isBitcoinTrade)(t.trade)&&"string"!=typeof t.trade)throw new Error("Failed to submit cross-chain swap transaction: trade is not a non-EVM transaction");return await P(this,S,"f").call(this,t.trade,t,a)}catch(e){throw!t.featureId&&P(this,N,"f").call(this,D.UnifiedSwapBridgeEventName.Failed,l?.id,{error_message:e?.message,...c}),e}})}else{const e=P(this,o,"f")===F.BridgeClientId.MOBILE&&i;l=await P(this,m,"f").call(this,{name:h?L.TraceName.BridgeTransactionCompleted:L.TraceName.SwapTransactionCompleted,data:{srcChainId:(0,D.formatChainIdToCaip)(t.quote.srcChainId),stxEnabled:n}},async()=>{if(!(0,D.isEvmTxData)(t.trade))throw new Error("Failed to submit cross-chain swap transaction: trade is not an EVM transaction");if(n||t.quote.gasIncluded7702){const{tradeMeta:n,approvalMeta:s}=await P(this,x,"f").call(this,{isBridgeTx:h,resetApproval:t.resetApproval,approval:t.approval&&(0,D.isEvmTxData)(t.approval)?t.approval:undefined,trade:t.trade,quoteResponse:t,requireApproval:e});return d=s?.id,n}const s=await P(this,C,"f").call(this,h,t.quote.srcChainId,t.approval&&(0,D.isEvmTxData)(t.approval)?t.approval:undefined,t.resetApproval,e);return d=s?.id,await(0,q.handleMobileHardwareWalletDelay)(e),await P(this,A,"f").call(this,{transactionType:h?M.TransactionType.bridge:M.TransactionType.swap,trade:t.trade,requireApproval:e,txFee:t.quote.gasIncluded?t.quote.feeData.txFee:undefined})})}try{P(this,f,"f").call(this,{accountAddress:a.address,bridgeTxMeta:l,statusRequest:{...(0,q.getStatusRequestParams)(t),srcTxHash:l.hash},quoteResponse:t,slippagePercentage:0,isStxEnabled:n,startTime:u,approvalTxId:d}),(0,D.isNonEvmChainId)(t.quote.srcChainId)&&(P(this,g,"f").call(this,l.id),h||P(this,N,"f").call(this,D.UnifiedSwapBridgeEventName.Completed,l.id))}catch{}return l},N.set(this,(e,t,n)=>{const s={action_type:D.MetricsActionType.SWAPBRIDGE_V1,...n??{}};if(!t)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,s);const r=this.state.txHistory[t];if(!r)return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,n??{});const o=(0,G.getRequestParamFromHistory)(r);if(e===D.UnifiedSwapBridgeEventName.StatusValidationFailed){const{chain_id_source:t,chain_id_destination:n,token_address_source:a,token_address_destination:i}=o;return void this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,{...s,chain_id_source:t,chain_id_destination:n,token_address_source:a,token_address_destination:i,refresh_count:r.attempts?.counter??0})}if(r.featureId)return;const a=this.messenger.call("AccountsController:getAccountByAddress",r.account),{transactions:i}=this.messenger.call("TransactionController:getState"),c=i?.find(({id:e})=>e===t),l=i?.find(({id:e})=>e===r.approvalTxId),d={...s,...o,...(0,G.getRequestMetadataFromHistory)(r,a),...(0,G.getTradeDataFromHistory)(r),...(0,G.getTxStatusesFromHistory)(r),...(0,G.getFinalizedTxProperties)(r,c,l),...(0,G.getPriceImpactFromQuote)(r.quote)};this.messenger.call("BridgeController:trackUnifiedSwapBridgeEvent",e,d)}),j(this,o,n,"f"),j(this,a,O,"f"),j(this,c,$,"f"),j(this,l,V,"f"),j(this,d,K,"f"),j(this,u,Y,"f"),j(this,i,{customBridgeApiBaseUrl:z?.customBridgeApiBaseUrl??L.BRIDGE_PROD_API_BASE_URL},"f"),j(this,m,Q??((e,t)=>t?.()),"f"),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:startPollingForBridgeTxStatus`,this.startPollingForBridgeTxStatus.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:wipeBridgeStatus`,this.wipeBridgeStatus.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:submitTx`,this.submitTx.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:restartPollingForFailedAttempts`,this.restartPollingForFailedAttempts.bind(this)),this.messenger.registerActionHandler(`${L.BRIDGE_STATUS_CONTROLLER_NAME}:getBridgeHistoryItemByTxMetaId`,this.getBridgeHistoryItemByTxMetaId.bind(this)),this.setIntervalLength(L.REFRESH_INTERVAL_MS),this.messenger.subscribe("TransactionController:transactionFailed",({transactionMeta:e})=>{const{type:t,status:n,id:s}=e;t&&[M.TransactionType.bridge,M.TransactionType.swap,M.TransactionType.bridgeApproval,M.TransactionType.swapApproval].includes(t)&&[M.TransactionStatus.failed,M.TransactionStatus.dropped,M.TransactionStatus.rejected].includes(n)&&(P(this,h,"f").call(this,e),n!==M.TransactionStatus.rejected&&P(this,N,"f").call(this,D.UnifiedSwapBridgeEventName.Failed,s,(0,G.getEVMTxPropertiesFromTransactionMeta)(e)))}),this.messenger.subscribe("TransactionController:transactionConfirmed",e=>{const{type:t,id:n,chainId:s}=e;t===M.TransactionType.swap&&P(this,N,"f").call(this,D.UnifiedSwapBridgeEventName.Completed,n),t!==M.TransactionType.bridge||(0,D.isNonEvmChainId)(s)||P(this,g,"f").call(this,n)}),P(this,p,"f").call(this)}}n.BridgeStatusController=$,r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,m=new WeakMap,h=new WeakMap,p=new WeakMap,f=new WeakMap,g=new WeakMap,w=new WeakMap,b=new WeakMap,_=new WeakMap,E=new WeakMap,y=new WeakMap,S=new WeakMap,I=new WeakMap,C=new WeakMap,A=new WeakMap,T=new WeakMap,v=new WeakMap,x=new WeakMap,N=new WeakMap,s=new WeakSet,k=function(e){return this.messenger.call("AccountsController:getAccountByAddress",e)}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s;Object.defineProperty(n,"__esModule",{value:!0}),n.TraceName=n.APPROVAL_DELAY_MS=n.BRIDGE_PROD_API_BASE_URL=n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=n.BRIDGE_STATUS_CONTROLLER_NAME=n.MAX_ATTEMPTS=n.REFRESH_INTERVAL_MS=void 0,n.REFRESH_INTERVAL_MS=1e4,n.MAX_ATTEMPTS=7,n.BRIDGE_STATUS_CONTROLLER_NAME="BridgeStatusController",n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE={txHistory:{}},n.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",n.APPROVAL_DELAY_MS=5e3,function(e){e.BridgeTransactionApprovalCompleted="Bridge Transaction Approval Completed",e.BridgeTransactionCompleted="Bridge Transaction Completed",e.SwapTransactionApprovalCompleted="Swap Transaction Approval Completed",e.SwapTransactionCompleted="Swap Transaction Completed"}(s||(n.TraceName=s={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/index.cjs",{"./bridge-status-controller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/bridge-status-controller.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs","./utils/transaction.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getTxMetaFields=n.BridgeStatusController=n.BridgeStatusAction=n.BridgeId=n.MAX_ATTEMPTS=n.BRIDGE_STATUS_CONTROLLER_NAME=n.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE=n.REFRESH_INTERVAL_MS=void 0;var s=e("./constants.cjs");Object.defineProperty(n,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return s.REFRESH_INTERVAL_MS}}),Object.defineProperty(n,"DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE",{enumerable:!0,get:function(){return s.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE}}),Object.defineProperty(n,"BRIDGE_STATUS_CONTROLLER_NAME",{enumerable:!0,get:function(){return s.BRIDGE_STATUS_CONTROLLER_NAME}}),Object.defineProperty(n,"MAX_ATTEMPTS",{enumerable:!0,get:function(){return s.MAX_ATTEMPTS}});var r=e("./types.cjs");Object.defineProperty(n,"BridgeId",{enumerable:!0,get:function(){return r.BridgeId}}),Object.defineProperty(n,"BridgeStatusAction",{enumerable:!0,get:function(){return r.BridgeStatusAction}});var o=e("./bridge-status-controller.cjs");Object.defineProperty(n,"BridgeStatusController",{enumerable:!0,get:function(){return o.BridgeStatusController}});var a=e("./utils/transaction.cjs");Object.defineProperty(n,"getTxMetaFields",{enumerable:!0,get:function(){return a.getTxMetaFields}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeStatusAction=n.BridgeId=n.BridgeClientId=void 0,function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(s||(n.BridgeClientId=s={})),function(e){e.HOP="hop",e.CELER="celer",e.CELERCIRCLE="celercircle",e.CONNEXT="connext",e.POLYGON="polygon",e.AVALANCHE="avalanche",e.MULTICHAIN="multichain",e.AXELAR="axelar",e.ACROSS="across",e.STARGATE="stargate",e.RELAY="relay",e.MAYAN="mayan"}(r||(n.BridgeId=r={})),function(e){e.START_POLLING_FOR_BRIDGE_TX_STATUS="startPollingForBridgeTxStatus",e.WIPE_BRIDGE_STATUS="wipeBridgeStatus",e.GET_STATE="getState",e.RESET_STATE="resetState",e.SUBMIT_TX="submitTx",e.RESTART_POLLING_FOR_FAILED_ATTEMPTS="restartPollingForFailedAttempts",e.GET_BRIDGE_HISTORY_ITEM_BY_TX_META_ID="getBridgeHistoryItemByTxMetaId"}(o||(n.BridgeStatusAction=o={}))}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.shouldSkipFetchDueToFetchFailures=n.getStatusRequestWithSrcTxHash=n.fetchBridgeTxStatus=n.getStatusRequestDto=n.getBridgeStatusUrl=n.getClientIdHeader=void 0;const s=e("@metamask/superstruct"),r=e("./validators.cjs"),o=e("../constants.cjs");n.getClientIdHeader=e=>({"X-Client-Id":e});n.getBridgeStatusUrl=e=>`${e}/getTxStatus`;n.getStatusRequestDto=e=>{const{quote:t,...n}=e;return{...Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t.toString()])),...t?.requestId?{requestId:t.requestId}:{}}};n.fetchBridgeTxStatus=async(e,t,o,a)=>{const i=(0,n.getStatusRequestDto)(e),c=new URLSearchParams(i),l=`${(0,n.getBridgeStatusUrl)(a)}?${c.toString()}`,d=await o(l,{headers:(0,n.getClientIdHeader)(t)}),u=[];try{(0,r.validateBridgeStatusResponse)(d)}catch(t){t instanceof s.StructError&&t.failures().forEach(({branch:t,path:n})=>{const s=t?.[0]?.quote?.bridgeId||t?.[0]?.quote?.bridges?.[0]||d?.bridge||e.bridge||e.bridgeId||"unknown",r=n?.join(".")||"unknown";u.push([s,r].join("|"))})}return{status:d,validationFailures:u}};n.getStatusRequestWithSrcTxHash=(e,t)=>{const{bridgeId:n,bridges:s,srcChainId:r,destChainId:o,refuel:a}=e;return{bridgeId:n,srcTxHash:t,bridge:s[0],srcChainId:r,destChainId:o,quote:e,refuel:Boolean(a)}};n.shouldSkipFetchDueToFetchFailures=e=>{if(e){const t=o.REFRESH_INTERVAL_MS*Math.pow(2,e.counter-1);if(Date.now()-e.lastAttemptTime<t)return!0}return!1}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.calcActualGasUsed=n.calculateGasFees=n.getTxGasEstimates=void 0;const s=e("@metamask/controller-utils"),r=e("bignumber.js");n.getTxGasEstimates=({txGasFeeEstimates:e,networkGasFeeEstimates:t})=>{const{estimatedBaseFee:n="0"}=t;return((e,t)=>{const{maxFeePerGas:n,maxPriorityFeePerGas:s}=e?.high??{};return{baseAndPriorityFeePerGas:s?new r.BigNumber(t,10).times(10**9).plus(s,16):undefined,maxFeePerGas:n,maxPriorityFeePerGas:s}})(e,n)};n.calculateGasFees=async(e,t,r,{chainId:o,gasLimit:a,...i},c,l,d)=>{if(!e)return{};if(d)return{...d,gas:a?.toString()};const u={...i,gas:a?.toString(),data:i.data,to:i.to,value:i.value},{gasFeeEstimates:m}=t.call("GasFeeController:getState"),{estimates:h}=await r({transactionParams:u,chainId:l,networkClientId:c}),{maxFeePerGas:p,maxPriorityFeePerGas:f}=(0,n.getTxGasEstimates)({networkGasFeeEstimates:m,txGasFeeEstimates:h});return{maxFeePerGas:p,maxPriorityFeePerGas:f,gas:(0,s.toHex)(u.gas??0)}};const o=(e,t)=>e&&t?new r.BigNumber(e,16).times(new r.BigNumber(t,16)):null;n.calcActualGasUsed=({pricingData:e},t,n)=>{const s=e?.quotedGasInUsd&&e?.quotedGasAmount?new r.BigNumber(e?.quotedGasInUsd).div(e.quotedGasAmount):null,a=o(t?.gasUsed,t?.effectiveGasPrice)?.plus(o(n?.gasUsed,n?.effectiveGasPrice)??0),i=a?.div(new r.BigNumber(10).pow(18)).toString(10);return a&&i?{amount:a.toString(10),usd:s?.multipliedBy(i).toString(10)??null}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs",{"./gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./swap-received-amount.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getEVMTxPropertiesFromTransactionMeta=n.getRequestMetadataFromHistory=n.getTradeDataFromHistory=n.getPreConfirmationPropertiesFromQuote=n.getPriceImpactFromQuote=n.getTradeDataFromQuote=n.getRequestParamFromHistory=n.getFinalizedTxProperties=n.getTxStatusesFromHistory=void 0;const s=e("@metamask/bridge-controller"),r=e("@metamask/transaction-controller"),o=e("bignumber.js"),a=e("./gas.cjs"),i=e("./swap-received-amount.cjs");n.getTxStatusesFromHistory=({status:e,hasApprovalTx:t,approvalTxId:n,quote:r})=>{const o=e.srcChain.txHash?s.StatusTypes.COMPLETE:s.StatusTypes.PENDING,a=e.destChain?.txHash?e.status:s.StatusTypes.PENDING,i=(0,s.formatChainIdToHex)(r.srcChainId),c=(0,s.isEthUsdt)(i,r.srcAsset.address),l=e.srcChain.txHash?s.StatusTypes.COMPLETE:undefined,d=e.srcChain.txHash?s.StatusTypes.COMPLETE:s.StatusTypes.PENDING;return{allowance_reset_transaction:c?l:undefined,approval_transaction:t||n?d:undefined,source_transaction:o,destination_transaction:e.status===s.StatusTypes.FAILED?s.StatusTypes.FAILED:a}};n.getFinalizedTxProperties=(e,t,n)=>{const s=n?.submittedTime??t?.submittedTime??e.startTime,c=t?.type===r.TransactionType.swap?t?.time:e.completionTime,l=(0,a.calcActualGasUsed)(e,t?.txReceipt,n?.txReceipt),d=t?.type===r.TransactionType.swap?(0,i.getActualSwapReceivedAmount)(e,l,t):(0,i.getActualBridgeReceivedAmount)(e),u=e.pricingData?.quotedGasAmount&&l?.amount?new o.BigNumber(e.pricingData.quotedGasAmount).multipliedBy(new o.BigNumber(10).pow(18)).div(l.amount).toNumber():0,m=e.pricingData?.quotedReturnInUsd&&d?.usd?new o.BigNumber(e.pricingData.quotedReturnInUsd).div(d.usd).toNumber():0;return{actual_time_minutes:c&&s?(c-s)/6e4:0,usd_actual_return:Number(d?.usd??0),usd_actual_gas:l?.usd??0,quote_vs_execution_ratio:m,quoted_vs_used_gas_ratio:u}};n.getRequestParamFromHistory=e=>({chain_id_source:(0,s.formatChainIdToCaip)(e.quote.srcChainId),token_symbol_source:e.quote.srcAsset.symbol,token_address_source:e.quote.srcAsset.assetId,chain_id_destination:(0,s.formatChainIdToCaip)(e.quote.destChainId),token_symbol_destination:e.quote.destAsset.symbol,token_address_destination:e.quote.destAsset.assetId});n.getTradeDataFromQuote=e=>({usd_quoted_gas:Number(e.gasFee?.effective?.usd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,s.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.adjustedReturn?.usd??0)});n.getPriceImpactFromQuote=e=>({price_impact:Number(e.priceData?.priceImpact??"0")});n.getPreConfirmationPropertiesFromQuote=(e,t,r)=>{const{quote:o}=e;return{...(0,n.getPriceImpactFromQuote)(o),...(0,n.getTradeDataFromQuote)(e),chain_id_source:(0,s.formatChainIdToCaip)(o.srcChainId),token_symbol_source:o.srcAsset.symbol,chain_id_destination:(0,s.formatChainIdToCaip)(o.destChainId),token_symbol_destination:o.destAsset.symbol,is_hardware_wallet:r,swap_type:(0,s.getSwapType)(e.quote.srcChainId,e.quote.destChainId),usd_amount_source:Number(e.sentAmount?.usd??0),stx_enabled:t,action_type:s.MetricsActionType.SWAPBRIDGE_V1,custom_slippage:!1}};n.getTradeDataFromHistory=e=>({usd_quoted_gas:Number(e.pricingData?.quotedGasInUsd??0),gas_included:e.quote.gasIncluded??!1,gas_included_7702:e.quote.gasIncluded7702??!1,provider:(0,s.formatProviderLabel)(e.quote),quoted_time_minutes:Number(e.estimatedProcessingTimeInSeconds/60),usd_quoted_return:Number(e.pricingData?.quotedReturnInUsd??0)});n.getRequestMetadataFromHistory=(e,t)=>{const{quote:n,slippagePercentage:r,isStxEnabled:o}=e;return{slippage_limit:r,custom_slippage:(0,s.isCustomSlippage)(r),usd_amount_source:Number(e.pricingData?.amountSentInUsd??0),swap_type:(0,s.getSwapType)(n.srcChainId,n.destChainId),is_hardware_wallet:(0,s.isHardwareWallet)(t),stx_enabled:o??!1,security_warnings:[]}};n.getEVMTxPropertiesFromTransactionMeta=e=>({source_transaction:[r.TransactionStatus.failed,r.TransactionStatus.dropped,r.TransactionStatus.rejected].includes(e.status)?s.StatusTypes.FAILED:s.StatusTypes.COMPLETE,error_message:e.error?.message??"",chain_id_source:(0,s.formatChainIdToCaip)(e.chainId),chain_id_destination:(0,s.formatChainIdToCaip)(e.chainId),token_symbol_source:e.sourceTokenSymbol??"",token_symbol_destination:e.destinationTokenSymbol??"",usd_amount_source:100,stx_enabled:!1,token_address_source:(0,s.formatAddressToAssetId)(e.sourceTokenAddress??"",e.chainId)??"",token_address_destination:(0,s.formatAddressToAssetId)(e.destinationTokenAddress??"",e.chainId)??"",custom_slippage:!1,is_hardware_wallet:!1,swap_type:e.type&&[r.TransactionType.swap,r.TransactionType.swapApproval].includes(e.type)?s.MetricsSwapType.SINGLE:s.MetricsSwapType.CROSSCHAIN,security_warnings:[],price_impact:0,usd_quoted_gas:0,gas_included:!1,gas_included_7702:!1,quoted_time_minutes:0,usd_quoted_return:0,provider:"",actual_time_minutes:0,quote_vs_execution_ratio:0,quoted_vs_used_gas_ratio:0,usd_actual_return:0,usd_actual_gas:0,action_type:s.MetricsActionType.SWAPBRIDGE_V1})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/metrics.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs",{uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createClientTransactionRequest=void 0;const s=e("uuid");n.createClientTransactionRequest=(e,t,n,r,o)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,s.v4)(),jsonrpc:"2.0",method:"signAndSendTransaction",params:{transaction:t,scope:n,accountId:r,...o&&{options:o}}}})}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getActualBridgeReceivedAmount=n.getActualSwapReceivedAmount=void 0;const s=e("@metamask/bridge-controller"),r=e("bignumber.js");n.getActualSwapReceivedAmount=(e,t,n)=>{const{pricingData:o}=e,a=e.quote.destTokenAmount;if(!n?.txReceipt)return null;const i=(0,s.isNativeAddress)(e.quote.destAsset.address)?((e,t,n)=>{const{preTxBalance:s,postTxBalance:o}=n;return s&&o&&s!==o?t&&o&&s?new r.BigNumber(o,16).minus(s,16).minus(t.amount).div(10**e.quote.destAsset.decimals):null:new r.BigNumber(e.quote.destTokenAmount).div(new r.BigNumber(10).pow(e.quote.destAsset.decimals)).toString(10)})(e,t,n):((e,t)=>{const{txReceipt:n}=t;if(!n?.logs||"0x0"===n.status)return null;const{account:s,quote:o}=e,a=n.logs.find(e=>{const t=e.topics?.[0]?.startsWith("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"),n=e.address?.toLowerCase()===o.destAsset.address?.toLowerCase(),r=e.topics?.[2]&&(e.topics[2]===s||e.topics[2].match(s?.slice(2)));return t&&n&&r});return a?.data?new r.BigNumber(a.data,16).div(new r.BigNumber(10).pow(o.destAsset.decimals)):null})(e,n),c=o?.quotedReturnInUsd&&a?new r.BigNumber(o.quotedReturnInUsd).div(a).multipliedBy(10**e.quote.destAsset.decimals):null;return{amount:i,usd:i&&c?c.multipliedBy(i):null}};n.getActualBridgeReceivedAmount=e=>{const{quote:t,pricingData:n,status:s}=e,o=n?.quotedReturnInUsd?new r.BigNumber(n.quotedReturnInUsd).div(t.destTokenAmount):null,a=s.destChain?.amount;return a&&o?{amount:a,usd:o.multipliedBy(a).toString(10)}:null}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/swap-received-amount.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/constants.cjs","./gas.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/gas.cjs","./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/snaps.cjs","@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.findAndUpdateTransactionsInBatch=n.getAddTransactionBatchParams=n.toBatchTxParams=n.getClientRequest=n.handleMobileHardwareWalletDelay=n.handleApprovalDelay=n.handleNonEvmTxResponse=n.getTxMetaFields=n.getStatusRequestParams=n.generateActionId=void 0;const s=e("@metamask/bridge-controller"),r=e("@metamask/controller-utils"),o=e("@metamask/transaction-controller"),a=e("@metamask/utils"),i=e("uuid"),c=e("./gas.cjs"),l=e("./snaps.cjs"),d=e("../constants.cjs");n.generateActionId=()=>(Date.now()+Math.random()).toString();n.getStatusRequestParams=e=>({bridgeId:e.quote.bridgeId,bridge:e.quote.bridges[0],srcChainId:e.quote.srcChainId,destChainId:e.quote.destChainId,quote:e.quote,refuel:Boolean(e.quote.refuel)});n.getTxMetaFields=(e,t)=>{let n;try{n=(0,s.formatChainIdToHex)(e.quote.destChainId)}catch{n="0x1"}return{destinationChainId:n,sourceTokenAmount:e.quote.srcTokenAmount,sourceTokenSymbol:e.quote.srcAsset.symbol,sourceTokenDecimals:e.quote.srcAsset.decimals,sourceTokenAddress:e.quote.srcAsset.address,destinationTokenAmount:e.quote.destTokenAmount,destinationTokenSymbol:e.quote.destAsset.symbol,destinationTokenDecimals:e.quote.destAsset.decimals,destinationTokenAddress:e.quote.destAsset.address,approvalTxId:t,swapTokenValue:e.sentAmount.amount}};n.handleNonEvmTxResponse=(e,t,r)=>{const a=r.address,c=r.metadata.snap?.id;let l;"string"==typeof e?l=e:e&&"object"==typeof e&&("transactionId"in e&&e.transactionId?l=e.transactionId:"result"in e&&e.result&&"object"==typeof e.result?l=e.result.signature||e.result.txid||e.result.hash||e.result.txHash:"signature"in e&&e.signature&&"string"==typeof e.signature&&(l=e.signature));const d=(0,s.isCrossChain)(t.quote.srcChainId,t.quote.destChainId);let u;try{u=(0,s.formatChainIdToHex)(t.quote.srcChainId)}catch{u="0x1"}const m=(0,s.extractTradeData)(t.trade);return{...(0,n.getTxMetaFields)(t),time:Date.now(),id:l??(0,i.v4)(),chainId:u,networkClientId:c??u,txParams:{from:a,data:m},type:d?o.TransactionType.bridge:o.TransactionType.swap,status:o.TransactionStatus.submitted,hash:l,origin:c,isSolana:!0,isBridgeTx:d}};n.handleApprovalDelay=async e=>{if([s.ChainId.LINEA,s.ChainId.BASE].includes(e)){(0,a.createProjectLogger)("bridge")("Delaying submitting bridge tx to make Linea and Base confirmation more likely");const e=new Promise(e=>setTimeout(e,d.APPROVAL_DELAY_MS));await e}};n.handleMobileHardwareWalletDelay=async e=>{if(e){const e=new Promise(e=>setTimeout(e,1e3));await e}};n.getClientRequest=(e,t,n)=>{const r=(0,s.formatChainIdToCaip)(t),o=(0,s.extractTradeData)(e),a=(0,s.isTronTrade)(e)?{visible:e.visible,type:e.raw_data?.contract?.[0]?.type}:undefined;return(0,l.createClientTransactionRequest)(n.metadata.snap?.id,o,r,n.id,a)};n.toBatchTxParams=(e,{chainId:t,gasLimit:n,...s},{maxFeePerGas:o,maxPriorityFeePerGas:a,gas:i})=>{const c={...s,data:s.data,to:s.to,value:s.value};return e?{...c,gas:(0,r.toHex)(i??0),maxFeePerGas:(0,r.toHex)(o??0),maxPriorityFeePerGas:(0,r.toHex)(a??0)}:c};n.getAddTransactionBatchParams=async({messenger:e,isBridgeTx:t,approval:r,resetApproval:a,trade:i,quoteResponse:{quote:{feeData:{txFee:l},gasIncluded:d,gasIncluded7702:u,gasSponsored:m},sentAmount:h,toTokenAmount:p},requireApproval:f=!1,estimateGasFeeFn:g})=>{const k=d||u;if(!e.call("AccountsController:getAccountByAddress",i.from))throw new Error("Failed to submit cross-chain swap batch transaction: unknown account in trade data");const w=(0,s.formatChainIdToHex)(i.chainId),b=e.call("NetworkController:findNetworkClientIdByChainId",w),_=!0!==u,E=[];if(a){const s=await(0,c.calculateGasFees)(_,e,g,a,b,w,k?l:undefined);E.push({type:t?o.TransactionType.bridgeApproval:o.TransactionType.swapApproval,params:(0,n.toBatchTxParams)(_,a,s)})}if(r){const s=await(0,c.calculateGasFees)(_,e,g,r,b,w,k?l:undefined);E.push({type:t?o.TransactionType.bridgeApproval:o.TransactionType.swapApproval,params:(0,n.toBatchTxParams)(_,r,s)})}const y=await(0,c.calculateGasFees)(_,e,g,i,b,w,k?l:undefined);E.push({type:t?o.TransactionType.bridge:o.TransactionType.swap,params:(0,n.toBatchTxParams)(_,i,y),assetsFiatValues:{sending:h?.valueInCurrency?.toString(),receiving:p?.valueInCurrency?.toString()}});return{disable7702:_,isGasFeeIncluded:Boolean(u),isGasFeeSponsored:Boolean(m),networkClientId:b,requireApproval:f,origin:"metamask",from:i.from,transactions:E}};n.findAndUpdateTransactionsInBatch=({messenger:e,updateTransactionFn:t,batchId:n,txDataByType:s})=>{const r=e.call("TransactionController:getState").transactions,a={approvalMeta:undefined,tradeMeta:undefined};return Object.entries(s).forEach(([e,s])=>{const i=r.find(t=>{if(t.batchId!==n)return!1;if(Array.isArray(t.txParams.authorizationList)&&t.txParams.authorizationList.length>0||Boolean(t.delegationAddress)){if(e===o.TransactionType.swap&&t.type===o.TransactionType.batch)return!0;if(e===o.TransactionType.swapApproval&&t.txParams.data===s)return!0}return t.txParams.data===s});if(i){const n={...i,type:e};t(n,`Update tx type to ${e}`),a[[o.TransactionType.bridgeApproval,o.TransactionType.swapApproval].includes(e)?"approvalMeta":"tradeMeta"]=n}}),a}}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/transaction.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs",{"@metamask/bridge-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateBridgeStatusResponse=n.StatusResponseSchema=void 0;const s=e("@metamask/bridge-controller"),r=e("@metamask/superstruct"),o=(0,r.number)(),a=(0,r.type)({}),i=(0,r.type)({chainId:o,txHash:(0,r.optional)((0,r.string)()),amount:(0,r.optional)((0,r.string)()),token:(0,r.optional)((0,r.union)([a,s.BridgeAssetSchema]))}),c=(0,r.type)({chainId:o,txHash:(0,r.optional)((0,r.string)()),amount:(0,r.optional)((0,r.string)()),token:(0,r.optional)((0,r.union)([a,s.BridgeAssetSchema]))}),l=(0,r.type)({});n.StatusResponseSchema=(0,r.type)({status:(0,r.enums)(Object.values(s.StatusTypes)),srcChain:i,destChain:(0,r.optional)(c),bridge:(0,r.optional)((0,r.string)()),isExpectedToken:(0,r.optional)((0,r.boolean)()),isUnrecognizedRouterAddress:(0,r.optional)((0,r.boolean)()),refuel:(0,r.optional)(l)});n.validateBridgeStatusResponse=e=>((0,r.assert)(e,n.StatusResponseSchema),!0)}}},{package:"@metamask/bridge-status-controller",file:"node_modules/@metamask/bridge-status-controller/dist/utils/validators.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs",{"./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","./constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","./constants/traces.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs","./selectors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/assets.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs","./utils/balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/fetch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs","./utils/metrics/constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs","./utils/metrics/properties.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs","./utils/quote-fees.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs","@ethersproject/bignumber":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/bignumber/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js","@metamask/polling-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/polling-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,l,d,u,m,h,p,f,g,k,w,b,_,E,y,S,I,C,A,T,v=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},x=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeController=void 0;const N=e("@ethersproject/bignumber"),j=e("@ethersproject/contracts"),P=e("@ethersproject/providers"),D=e("@metamask/metamask-eth-abis"),R=e("@metamask/polling-controller"),O=e("./constants/bridge.cjs"),M=e("./constants/chains.cjs"),B=e("./constants/swaps.cjs"),L=e("./constants/traces.cjs"),F=e("./selectors.cjs"),U=e("./types.cjs"),H=e("./utils/assets.cjs"),G=e("./utils/balance.cjs"),q=e("./utils/bridge.cjs"),W=e("./utils/caip-formatters.cjs"),$=e("./utils/feature-flags.cjs"),V=e("./utils/fetch.cjs"),K=e("./utils/metrics/constants.cjs"),Y=e("./utils/metrics/properties.cjs"),z=e("./utils/quote.cjs"),Q=e("./utils/quote-fees.cjs"),J=e("./utils/snaps.cjs"),X={quoteRequest:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotes:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesInitialLoadTime:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesLastFetched:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesLoadingStatus:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quoteFetchError:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},quotesRefreshCount:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},assetExchangeRates:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0},minimumBalanceForRentExemptionInLamports:{includeInStateLogs:!0,persist:!1,includeInDebugSnapshot:!1,usedInUi:!0}};class Z extends((0,R.StaticIntervalPollingController)()){constructor({messenger:e,state:t,clientId:n,clientVersion:R,getLayer1GasFee:Z,fetchFn:ee,config:te,trackMetaMetricsFn:ne,traceFn:se}){super({name:O.BRIDGE_CONTROLLER_NAME,metadata:X,messenger:e,state:{...(0,q.getDefaultBridgeControllerState)(),...t}}),s.add(this),r.set(this,void 0),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,void 0),d.set(this,void 0),u.set(this,void 0),m.set(this,void 0),this._executePoll=async e=>{await x(this,w,"f").call(this,e)},this.updateBridgeQuoteRequestParams=async(e,t)=>{x(this,A,"f").call(this,e),this.resetState(K.AbortReason.QuoteRequestUpdated);const n={...O.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest,...e};if(this.update(e=>{e.quoteRequest=n}),await x(this,f,"f").call(this,n).catch(e=>console.warn("Failed to fetch asset exchange rates",e)),(0,z.isValidQuoteRequest)(n)){v(this,o,Date.now(),"f");const r=(0,q.isNonEvmChainId)(n.srcChainId),a=r?undefined:x(this,s,"m",y).call(this,(0,W.formatChainIdToHex)(n.srcChainId))?.configuration;let i,c=Boolean(e.resetApproval);r?i=e.insufficientBal:a?.rpcUrl?.includes("tenderly")?i=!0:(this.update(e=>{e.quotesLoadingStatus=U.RequestStatus.LOADING}),c=await x(this,k,"f").call(this,n),i=e.insufficientBal??await x(this,g,"f").call(this,n)),this.setChainIntervalLength(),this.startPolling({updatedQuoteRequest:{...n,insufficientBal:i,resetApproval:c},context:t})}},this.fetchQuotes=async(e,t=null,n=null)=>{const r=(0,$.getBridgeFeatureFlags)(this.messenger),o=n?r.quoteRequestOverrides?.[n]:undefined,d=await x(this,k,"f").call(this,e),{quotes:u,validationFailures:p}=await(0,V.fetchBridgeQuotes)(o?{...e,...o,resetApproval:d}:{...e,resetApproval:d},t,x(this,a,"f"),x(this,l,"f"),x(this,m,"f").customBridgeApiBaseUrl??O.BRIDGE_PROD_API_BASE_URL,n,x(this,i,"f"));x(this,h,"f").call(this,p);const f=await(0,Q.appendFeesToQuotes)(u,this.messenger,x(this,c,"f"),x(this,s,"m",E).call(this,e.walletAddress));return(0,z.sortQuotes)(f,n)},h.set(this,e=>{0!==e.length&&this.trackUnifiedSwapBridgeEvent(K.UnifiedSwapBridgeEventName.QuotesValidationFailed,{failures:e})}),p.set(this,()=>({...this.messenger.call("MultichainAssetsRatesController:getState"),...this.messenger.call("CurrencyRateController:getState"),...this.messenger.call("TokenRatesController:getState"),...this.state})),f.set(this,async({srcChainId:e,srcTokenAddress:t,destChainId:n,destTokenAddress:s})=>{const o=new Set([]),c=x(this,p,"f").call(this);t&&e&&!(0,F.selectIsAssetExchangeRateInState)(c,e,t)&&(0,H.getAssetIdsForToken)(t,e).forEach(e=>o.add(e)),s&&n&&!(0,F.selectIsAssetExchangeRateInState)(c,n,s)&&(0,H.getAssetIdsForToken)(s,n).forEach(e=>o.add(e));const d=this.messenger.call("CurrencyRateController:getState").currentCurrency;if(0===o.size)return;const u=await(0,V.fetchAssetPrices)({assetIds:o,currencies:new Set([d]),clientId:x(this,a,"f"),clientVersion:x(this,i,"f"),fetchFn:x(this,l,"f"),signal:x(this,r,"f")?.signal}),m=(0,H.toExchangeRates)(d,u);this.update(e=>{e.assetExchangeRates={...e.assetExchangeRates,...m}})}),g.set(this,async e=>{try{const t=(0,W.formatChainIdToHex)(e.srcChainId),n=x(this,s,"m",y).call(this,t)?.provider,r=(0,W.formatAddressToCaipReference)(e.srcTokenAddress);return!(n&&r&&e.srcTokenAmount&&t&&await(0,G.hasSufficientBalance)(n,e.walletAddress,r,e.srcTokenAmount,t))}catch(e){return console.warn("Failed to set insufficientBal",e),!0}}),k.set(this,async e=>{if((0,q.isNonEvmChainId)(e.srcChainId))return!1;try{const t=(0,W.formatAddressToCaipReference)(e.srcTokenAddress);if((0,q.isEthUsdt)(e.srcChainId,t)){const n=N.BigNumber.from(await x(this,T,"f").call(this,e.walletAddress,t,e.destChainId));return n.lt(e.srcTokenAmount)&&n.gt(0)}return!1}catch(e){return console.warn("Failed to set resetApproval",e),!0}}),this.stopPollingForQuotes=(e,t)=>{this.stopAllPolling(),this.state.quotesLoadingStatus===U.RequestStatus.LOADING&&t&&this.trackUnifiedSwapBridgeEvent(K.UnifiedSwapBridgeEventName.QuotesReceived,t),x(this,r,"f")?.abort(e)},this.resetState=(e=K.AbortReason.ResetState)=>{this.stopPollingForQuotes(e),this.update(e=>{e.quoteRequest=O.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest,e.quotesInitialLoadTime=O.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesInitialLoadTime,e.quotes=O.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes,e.quotesLastFetched=O.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesLastFetched,e.quotesLoadingStatus=O.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesLoadingStatus,e.quoteFetchError=O.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteFetchError,e.quotesRefreshCount=O.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesRefreshCount,e.assetExchangeRates=O.DEFAULT_BRIDGE_CONTROLLER_STATE.assetExchangeRates,e.minimumBalanceForRentExemptionInLamports=O.DEFAULT_BRIDGE_CONTROLLER_STATE.minimumBalanceForRentExemptionInLamports})},this.setChainIntervalLength=()=>{const{state:e}=this,{srcChainId:t}=e.quoteRequest,n=(0,$.getBridgeFeatureFlags)(this.messenger),s=t?n.chains[(0,W.formatChainIdToCaip)(t)]?.refreshRate:undefined,r=n.refreshRate;this.setIntervalLength(s??r)},w.set(this,async({updatedQuoteRequest:e,context:t})=>{x(this,r,"f")?.abort("New quote request"),v(this,r,new AbortController,"f"),this.trackUnifiedSwapBridgeEvent(K.UnifiedSwapBridgeEventName.QuotesRequested,t);const{sse:n,maxRefreshCount:a}=(0,$.getBridgeFeatureFlags)(this.messenger),c=n?.enabled&&(0,$.hasMinimumRequiredVersion)(x(this,i,"f"),n.minimumVersion);this.update(t=>{t.quoteRequest=e,t.quoteFetchError=O.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteFetchError,t.quotesLastFetched=Date.now(),t.quotesLoadingStatus=U.RequestStatus.LOADING});try{await x(this,u,"f").call(this,{name:(0,q.isCrossChain)(e.srcChainId,e.destChainId)?L.TraceName.BridgeQuotesFetched:L.TraceName.SwapQuotesFetched,data:{srcChainId:(0,W.formatChainIdToCaip)(e.srcChainId),destChainId:(0,W.formatChainIdToCaip)(e.destChainId)}},async()=>{const t=x(this,s,"m",E).call(this,e.walletAddress);if(x(this,_,"f").call(this,e.srcChainId,t?.metadata?.snap?.id),c)return void await x(this,b,"f").call(this,e,t);const n=await this.fetchQuotes(e,x(this,r,"f")?.signal);this.update(e=>{e.quotesRefreshCount===O.DEFAULT_BRIDGE_CONTROLLER_STATE.quotesRefreshCount&&x(this,o,"f")&&(e.quotesInitialLoadTime=Date.now()-x(this,o,"f")),e.quotes=n,e.quotesLoadingStatus=U.RequestStatus.FETCHED})})}catch(e){if(this.update(e=>{e.quotes=O.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes}),e.toString().includes("AbortError")||e.toString().includes("FetchRequestCanceledException")||[K.AbortReason.ResetState,K.AbortReason.NewQuoteRequest,K.AbortReason.QuoteRequestUpdated,K.AbortReason.TransactionSubmitted].includes(e))return;this.update(t=>{let n;try{n=e?.message??e.toString()}catch{}finally{t.quoteFetchError=n??"Unknown error"}t.quotesLoadingStatus=U.RequestStatus.ERROR}),this.trackUnifiedSwapBridgeEvent(K.UnifiedSwapBridgeEventName.QuotesError,t),console.log(`Failed to ${c?"stream":"fetch"} bridge quotes`,e)}this.update(e=>{e.quotesRefreshCount+=1}),(e.insufficientBal||!e.insufficientBal&&this.state.quotesRefreshCount>=a)&&this.stopAllPolling()}),b.set(this,async(e,t)=>{let n=0;const s=new Set;await(0,V.fetchBridgeQuoteStream)(x(this,l,"f"),e,x(this,r,"f")?.signal,x(this,a,"f"),x(this,m,"f").customBridgeApiBaseUrl??O.BRIDGE_PROD_API_BASE_URL,{onValidationFailure:x(this,h,"f"),onValidQuoteReceived:async e=>{const r=(async()=>{const s=await(0,Q.appendFeesToQuotes)([e],this.messenger,x(this,c,"f"),t);s.length>0&&(n+=1),this.update(e=>{1===n&&(e.quotes=O.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes,!e.quotesInitialLoadTime&&x(this,o,"f")&&(e.quotesInitialLoadTime=Date.now()-x(this,o,"f"))),e.quotes=[...e.quotes,...s]})})();s.add(r),r.catch(e=>{console.error("Error appending fees to quote",e)}).finally(()=>{s.delete(r)}),await r},onClose:async()=>{await Promise.allSettled(Array.from(s)),this.update(e=>{0===n&&(e.quotes=O.DEFAULT_BRIDGE_CONTROLLER_STATE.quotes),e.quotesLoadingStatus=U.RequestStatus.FETCHED})}},x(this,i,"f"))}),_.set(this,async(e,t)=>{if(!(0,q.isSolanaChainId)(e)||!t)return;const n=await(0,J.getMinimumBalanceForRentExemptionInLamports)(t,this.messenger);this.update(e=>{e.minimumBalanceForRentExemptionInLamports=n})}),S.set(this,()=>({slippage_limit:this.state.quoteRequest.slippage,swap_type:(0,Y.getSwapTypeFromQuote)(this.state.quoteRequest),custom_slippage:(0,Y.isCustomSlippage)(this.state.quoteRequest.slippage)})),I.set(this,()=>({quotes_count:this.state.quotes.length,quotes_list:this.state.quotes.map(({quote:e})=>(0,Y.formatProviderLabel)(e)),initial_load_time_all_quotes:this.state.quotesInitialLoadTime??0})),C.set(this,(e,t)=>{const n={...t,action_type:K.MetricsActionType.SWAPBRIDGE_V1};switch(e){case K.UnifiedSwapBridgeEventName.ButtonClicked:case K.UnifiedSwapBridgeEventName.PageViewed:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...n};case K.UnifiedSwapBridgeEventName.QuotesValidationFailed:return{...(0,Y.getRequestParams)(this.state.quoteRequest),refresh_count:this.state.quotesRefreshCount,...n};case K.UnifiedSwapBridgeEventName.QuotesReceived:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...x(this,S,"f").call(this),...x(this,I,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(x(this,s,"m",E).call(this)),refresh_count:this.state.quotesRefreshCount,...n};case K.UnifiedSwapBridgeEventName.QuotesRequested:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...x(this,S,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(x(this,s,"m",E).call(this)),has_sufficient_funds:!this.state.quoteRequest.insufficientBal,...n};case K.UnifiedSwapBridgeEventName.QuotesError:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...x(this,S,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(x(this,s,"m",E).call(this)),error_message:this.state.quoteFetchError,has_sufficient_funds:!this.state.quoteRequest.insufficientBal,...n};case K.UnifiedSwapBridgeEventName.AllQuotesOpened:case K.UnifiedSwapBridgeEventName.AllQuotesSorted:case K.UnifiedSwapBridgeEventName.QuoteSelected:return{...(0,Y.getRequestParams)(this.state.quoteRequest),...x(this,S,"f").call(this),...x(this,I,"f").call(this),is_hardware_wallet:(0,Y.isHardwareWallet)(x(this,s,"m",E).call(this)),...n};case K.UnifiedSwapBridgeEventName.Failed:return{...n,...(0,Y.getRequestParams)(this.state.quoteRequest),...x(this,S,"f").call(this),...x(this,I,"f").call(this),...t};case K.UnifiedSwapBridgeEventName.AssetDetailTooltipClicked:return n;case K.UnifiedSwapBridgeEventName.Submitted:case K.UnifiedSwapBridgeEventName.Completed:return t;case K.UnifiedSwapBridgeEventName.InputChanged:default:return n}}),A.set(this,e=>{Object.entries(e).forEach(([t,n])=>{const s=Y.toInputChangedPropertyKey[t],r=Y.toInputChangedPropertyValue[t]?.(e);s&&r!==undefined&&n!==this.state.quoteRequest[t]&&this.trackUnifiedSwapBridgeEvent(K.UnifiedSwapBridgeEventName.InputChanged,{input:s,input_value:r})})}),this.trackUnifiedSwapBridgeEvent=(e,t)=>{try{const n=x(this,C,"f").call(this,e,t);x(this,d,"f").call(this,e,n)}catch(t){console.error(`Error tracking cross-chain swaps MetaMetrics event ${e}`,t)}},T.set(this,async(e,t,n)=>{const r=x(this,s,"m",y).call(this,M.CHAIN_IDS.MAINNET),o=r?.provider;if(!o)throw new Error("No provider found");const a=new P.Web3Provider(o),i=new j.Contract(t,D.abiERC20,a),c=(0,q.isCrossChain)(M.CHAIN_IDS.MAINNET,n)?O.METABRIDGE_ETHEREUM_ADDRESS:B.SWAPS_CONTRACT_ADDRESSES[M.CHAIN_IDS.MAINNET];return(await i.allowance(e,c)).toString()}),this.setIntervalLength(O.REFRESH_INTERVAL_MS),v(this,r,new AbortController,"f"),v(this,c,Z,"f"),v(this,a,n,"f"),v(this,i,R,"f"),v(this,l,ee,"f"),v(this,d,ne,"f"),v(this,m,te??{},"f"),v(this,u,se??((e,t)=>t?.()),"f"),this.messenger.registerActionHandler(`${O.BRIDGE_CONTROLLER_NAME}:setChainIntervalLength`,this.setChainIntervalLength.bind(this)),this.messenger.registerActionHandler(`${O.BRIDGE_CONTROLLER_NAME}:updateBridgeQuoteRequestParams`,this.updateBridgeQuoteRequestParams.bind(this)),this.messenger.registerActionHandler(`${O.BRIDGE_CONTROLLER_NAME}:resetState`,this.resetState.bind(this)),this.messenger.registerActionHandler(`${O.BRIDGE_CONTROLLER_NAME}:trackUnifiedSwapBridgeEvent`,this.trackUnifiedSwapBridgeEvent.bind(this)),this.messenger.registerActionHandler(`${O.BRIDGE_CONTROLLER_NAME}:stopPollingForQuotes`,this.stopPollingForQuotes.bind(this)),this.messenger.registerActionHandler(`${O.BRIDGE_CONTROLLER_NAME}:fetchQuotes`,this.fetchQuotes.bind(this))}}n.BridgeController=Z,r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,m=new WeakMap,h=new WeakMap,p=new WeakMap,f=new WeakMap,g=new WeakMap,k=new WeakMap,w=new WeakMap,b=new WeakMap,_=new WeakMap,S=new WeakMap,I=new WeakMap,C=new WeakMap,A=new WeakMap,T=new WeakMap,s=new WeakSet,E=function(e){const t=e??this.state.quoteRequest.walletAddress;if(!t)throw new Error("Account address is required");return this.messenger.call("AccountsController:getAccountByAddress",t)},y=function(e){const t=this.messenger.call("NetworkController:findNetworkClientIdByChainId",e);if(!t)throw new Error(`No network client found for chainId: ${e}`);return this.messenger.call("NetworkController:getNetworkClientById",t)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.METABRIDGE_CHAIN_TO_ADDRESS_MAP=n.DEFAULT_BRIDGE_CONTROLLER_STATE=n.DEFAULT_FEATURE_FLAG_CONFIG=n.BRIDGE_CONTROLLER_NAME=n.DEFAULT_MAX_REFRESH_COUNT=n.REFRESH_INTERVAL_MS=n.BRIDGE_MM_FEE_RATE=n.BRIDGE_PREFERRED_GAS_ESTIMATE=n.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=n.BRIDGE_QUOTE_MAX_ETA_SECONDS=n.METABRIDGE_ETHEREUM_ADDRESS=n.ETH_USDT_ADDRESS=n.BridgeClientId=n.BRIDGE_PROD_API_BASE_URL=n.BRIDGE_DEV_API_BASE_URL=n.ALLOWED_BRIDGE_CHAIN_IDS=void 0;const s=e("@ethersproject/constants"),r=e("@metamask/keyring-api"),o=e("./chains.cjs");var a;n.ALLOWED_BRIDGE_CHAIN_IDS=[o.CHAIN_IDS.MAINNET,o.CHAIN_IDS.BSC,o.CHAIN_IDS.POLYGON,o.CHAIN_IDS.ZKSYNC_ERA,o.CHAIN_IDS.AVALANCHE,o.CHAIN_IDS.OPTIMISM,o.CHAIN_IDS.ARBITRUM,o.CHAIN_IDS.LINEA_MAINNET,o.CHAIN_IDS.BASE,o.CHAIN_IDS.SEI,o.CHAIN_IDS.MONAD,r.SolScope.Mainnet,r.BtcScope.Mainnet,r.TrxScope.Mainnet],n.BRIDGE_DEV_API_BASE_URL="https://bridge.dev-api.cx.metamask.io",n.BRIDGE_PROD_API_BASE_URL="https://bridge.api.cx.metamask.io",function(e){e.EXTENSION="extension",e.MOBILE="mobile"}(a||(n.BridgeClientId=a={})),n.ETH_USDT_ADDRESS="0xdac17f958d2ee523a2206206994597c13d831ec7",n.METABRIDGE_ETHEREUM_ADDRESS="0x0439e60F02a8900a951603950d8D4527f400C3f1",n.BRIDGE_QUOTE_MAX_ETA_SECONDS=3600,n.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=.5,n.BRIDGE_PREFERRED_GAS_ESTIMATE="medium",n.BRIDGE_MM_FEE_RATE=.875,n.REFRESH_INTERVAL_MS=3e4,n.DEFAULT_MAX_REFRESH_COUNT=5,n.BRIDGE_CONTROLLER_NAME="BridgeController",n.DEFAULT_FEATURE_FLAG_CONFIG={minimumVersion:"0.0.0",refreshRate:n.REFRESH_INTERVAL_MS,maxRefreshCount:n.DEFAULT_MAX_REFRESH_COUNT,support:!1,chains:{}},n.DEFAULT_BRIDGE_CONTROLLER_STATE={quoteRequest:{srcTokenAddress:s.AddressZero},quotesInitialLoadTime:null,quotes:[],quotesLastFetched:null,quotesLoadingStatus:null,quoteFetchError:null,quotesRefreshCount:0,assetExchangeRates:{},minimumBalanceForRentExemptionInLamports:"0"},n.METABRIDGE_CHAIN_TO_ADDRESS_MAP={[o.CHAIN_IDS.MAINNET]:n.METABRIDGE_ETHEREUM_ADDRESS}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.NETWORK_TO_NAME_MAP=n.MONAD_DISPLAY_NAME=n.SEI_DISPLAY_NAME=n.MODE_DISPLAY_NAME=n.MODE_SEPOLIA_DISPLAY_NAME=n.SONEIUM_DISPLAY_NAME=n.INK_DISPLAY_NAME=n.INK_SEPOLIA_DISPLAY_NAME=n.LISK_SEPOLIA_DISPLAY_NAME=n.LISK_DISPLAY_NAME=n.METACHAIN_ONE_DISPLAY_NAME=n.BERACHAIN_DISPLAY_NAME=n.OP_BNB_DISPLAY_NAME=n.SCROLL_SEPOLIA_DISPLAY_NAME=n.SCROLL_DISPLAY_NAME=n.MOONRIVER_DISPLAY_NAME=n.MOONBEAM_DISPLAY_NAME=n.POLYGON_ZKEVM_DISPLAY_NAME=n.CRONOS_DISPLAY_NAME=n.AURORA_DISPLAY_NAME=n.BASE_DISPLAY_NAME=n.ZK_SYNC_ERA_DISPLAY_NAME=n.GNOSIS_DISPLAY_NAME=n.CELO_DISPLAY_NAME=n.PALM_DISPLAY_NAME=n.HARMONY_DISPLAY_NAME=n.FANTOM_DISPLAY_NAME=n.OPTIMISM_DISPLAY_NAME=n.BNB_DISPLAY_NAME=n.ARBITRUM_DISPLAY_NAME=n.AVALANCHE_DISPLAY_NAME=n.POLYGON_DISPLAY_NAME=n.BSC_DISPLAY_NAME=n.LOCALHOST_DISPLAY_NAME=n.LINEA_MAINNET_DISPLAY_NAME=n.LINEA_SEPOLIA_DISPLAY_NAME=n.LINEA_GOERLI_DISPLAY_NAME=n.SEPOLIA_DISPLAY_NAME=n.GOERLI_DISPLAY_NAME=n.MAINNET_DISPLAY_NAME=n.NETWORK_TYPES=n.CHAIN_IDS=void 0,n.CHAIN_IDS={MAINNET:"0x1",GOERLI:"0x5",LOCALHOST:"0x539",BSC:"0x38",BSC_TESTNET:"0x61",OPTIMISM:"0xa",OPTIMISM_TESTNET:"0xaa37dc",OPTIMISM_GOERLI:"0x1a4",BASE:"0x2105",BASE_TESTNET:"0x14a33",OPBNB:"0xcc",OPBNB_TESTNET:"0x15eb",POLYGON:"0x89",POLYGON_TESTNET:"0x13881",AVALANCHE:"0xa86a",AVALANCHE_TESTNET:"0xa869",FANTOM:"0xfa",FANTOM_TESTNET:"0xfa2",CELO:"0xa4ec",ARBITRUM:"0xa4b1",HARMONY:"0x63564c40",PALM:"0x2a15c308d",SEPOLIA:"0xaa36a7",HOLESKY:"0x4268",LINEA_GOERLI:"0xe704",LINEA_SEPOLIA:"0xe705",AMOY:"0x13882",BASE_SEPOLIA:"0x14a34",BLAST_SEPOLIA:"0xa0c71fd",OPTIMISM_SEPOLIA:"0xaa37dc",PALM_TESTNET:"0x2a15c3083",CELO_TESTNET:"0xaef3",ZK_SYNC_ERA_TESTNET:"0x12c",MANTA_SEPOLIA:"0x138b",UNICHAIN_SEPOLIA:"0x515",LINEA_MAINNET:"0xe708",AURORA:"0x4e454152",MOONBEAM:"0x504",MOONBEAM_TESTNET:"0x507",MOONRIVER:"0x505",CRONOS:"0x19",GNOSIS:"0x64",ZKSYNC_ERA:"0x144",TEST_ETH:"0x539",ARBITRUM_GOERLI:"0x66eed",BLAST:"0x13e31",FILECOIN:"0x13a",POLYGON_ZKEVM:"0x44d",SCROLL:"0x82750",SCROLL_SEPOLIA:"0x8274f",WETHIO:"0x4e",CHZ:"0x15b38",NUMBERS:"0x290b",SEI:"0x531",APE_TESTNET:"0x8157",APE_MAINNET:"0x8173",BERACHAIN:"0x138d5",METACHAIN_ONE:"0x1b6e6",ARBITRUM_SEPOLIA:"0x66eee",NEAR:"0x18d",NEAR_TESTNET:"0x18e",B3:"0x208d",B3_TESTNET:"0x7c9",GRAVITY_ALPHA_MAINNET:"0x659",GRAVITY_ALPHA_TESTNET_SEPOLIA:"0x34c1",LISK:"0x46f",LISK_SEPOLIA:"0x106a",INK_SEPOLIA:"0xba5eD",INK:"0xdef1",MODE_SEPOLIA:"0x397",MODE:"0x868b",MONAD:"0x8f"},n.NETWORK_TYPES={GOERLI:"goerli",LOCALHOST:"localhost",MAINNET:"mainnet",SEPOLIA:"sepolia",LINEA_GOERLI:"linea-goerli",LINEA_SEPOLIA:"linea-sepolia",LINEA_MAINNET:"linea-mainnet"},n.MAINNET_DISPLAY_NAME="Ethereum Mainnet",n.GOERLI_DISPLAY_NAME="Goerli",n.SEPOLIA_DISPLAY_NAME="Sepolia",n.LINEA_GOERLI_DISPLAY_NAME="Linea Goerli",n.LINEA_SEPOLIA_DISPLAY_NAME="Linea Sepolia",n.LINEA_MAINNET_DISPLAY_NAME="Linea Mainnet",n.LOCALHOST_DISPLAY_NAME="Localhost 8545",n.BSC_DISPLAY_NAME="Binance Smart Chain",n.POLYGON_DISPLAY_NAME="Polygon",n.AVALANCHE_DISPLAY_NAME="Avalanche Network C-Chain",n.ARBITRUM_DISPLAY_NAME="Arbitrum One",n.BNB_DISPLAY_NAME="BNB Chain",n.OPTIMISM_DISPLAY_NAME="OP Mainnet",n.FANTOM_DISPLAY_NAME="Fantom Opera",n.HARMONY_DISPLAY_NAME="Harmony Mainnet Shard 0",n.PALM_DISPLAY_NAME="Palm",n.CELO_DISPLAY_NAME="Celo Mainnet",n.GNOSIS_DISPLAY_NAME="Gnosis",n.ZK_SYNC_ERA_DISPLAY_NAME="zkSync Era Mainnet",n.BASE_DISPLAY_NAME="Base Mainnet",n.AURORA_DISPLAY_NAME="Aurora Mainnet",n.CRONOS_DISPLAY_NAME="Cronos",n.POLYGON_ZKEVM_DISPLAY_NAME="Polygon zkEVM",n.MOONBEAM_DISPLAY_NAME="Moonbeam",n.MOONRIVER_DISPLAY_NAME="Moonriver",n.SCROLL_DISPLAY_NAME="Scroll",n.SCROLL_SEPOLIA_DISPLAY_NAME="Scroll Sepolia",n.OP_BNB_DISPLAY_NAME="opBNB",n.BERACHAIN_DISPLAY_NAME="Berachain Artio",n.METACHAIN_ONE_DISPLAY_NAME="Metachain One Mainnet",n.LISK_DISPLAY_NAME="Lisk",n.LISK_SEPOLIA_DISPLAY_NAME="Lisk Sepolia",n.INK_SEPOLIA_DISPLAY_NAME="Ink Sepolia",n.INK_DISPLAY_NAME="Ink Mainnet",n.SONEIUM_DISPLAY_NAME="Soneium Mainnet",n.MODE_SEPOLIA_DISPLAY_NAME="Mode Sepolia",n.MODE_DISPLAY_NAME="Mode Mainnet",n.SEI_DISPLAY_NAME="Sei Network",n.MONAD_DISPLAY_NAME="Monad",n.NETWORK_TO_NAME_MAP={[n.NETWORK_TYPES.GOERLI]:n.GOERLI_DISPLAY_NAME,[n.NETWORK_TYPES.MAINNET]:n.MAINNET_DISPLAY_NAME,[n.NETWORK_TYPES.LINEA_GOERLI]:n.LINEA_GOERLI_DISPLAY_NAME,[n.NETWORK_TYPES.LINEA_SEPOLIA]:n.LINEA_SEPOLIA_DISPLAY_NAME,[n.NETWORK_TYPES.LINEA_MAINNET]:n.LINEA_MAINNET_DISPLAY_NAME,[n.NETWORK_TYPES.LOCALHOST]:n.LOCALHOST_DISPLAY_NAME,[n.NETWORK_TYPES.SEPOLIA]:n.SEPOLIA_DISPLAY_NAME,[n.CHAIN_IDS.ARBITRUM]:n.ARBITRUM_DISPLAY_NAME,[n.CHAIN_IDS.AVALANCHE]:n.AVALANCHE_DISPLAY_NAME,[n.CHAIN_IDS.BSC]:n.BSC_DISPLAY_NAME,[n.CHAIN_IDS.BASE]:n.BASE_DISPLAY_NAME,[n.CHAIN_IDS.GOERLI]:n.GOERLI_DISPLAY_NAME,[n.CHAIN_IDS.MAINNET]:n.MAINNET_DISPLAY_NAME,[n.CHAIN_IDS.LINEA_GOERLI]:n.LINEA_GOERLI_DISPLAY_NAME,[n.CHAIN_IDS.LINEA_MAINNET]:n.LINEA_MAINNET_DISPLAY_NAME,[n.CHAIN_IDS.LINEA_SEPOLIA]:n.LINEA_SEPOLIA_DISPLAY_NAME,[n.CHAIN_IDS.LOCALHOST]:n.LOCALHOST_DISPLAY_NAME,[n.CHAIN_IDS.OPTIMISM]:n.OPTIMISM_DISPLAY_NAME,[n.CHAIN_IDS.POLYGON]:n.POLYGON_DISPLAY_NAME,[n.CHAIN_IDS.SCROLL]:n.SCROLL_DISPLAY_NAME,[n.CHAIN_IDS.SCROLL_SEPOLIA]:n.SCROLL_SEPOLIA_DISPLAY_NAME,[n.CHAIN_IDS.SEPOLIA]:n.SEPOLIA_DISPLAY_NAME,[n.CHAIN_IDS.OPBNB]:n.OP_BNB_DISPLAY_NAME,[n.CHAIN_IDS.ZKSYNC_ERA]:n.ZK_SYNC_ERA_DISPLAY_NAME,[n.CHAIN_IDS.BERACHAIN]:n.BERACHAIN_DISPLAY_NAME,[n.CHAIN_IDS.METACHAIN_ONE]:n.METACHAIN_ONE_DISPLAY_NAME,[n.CHAIN_IDS.LISK]:n.LISK_DISPLAY_NAME,[n.CHAIN_IDS.LISK_SEPOLIA]:n.LISK_SEPOLIA_DISPLAY_NAME,[n.CHAIN_IDS.SEI]:n.SEI_DISPLAY_NAME,[n.CHAIN_IDS.MONAD]:n.MONAD_DISPLAY_NAME}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ALLOWED_CONTRACT_ADDRESSES=n.SWAPS_WRAPPED_TOKENS_ADDRESSES=n.SWAPS_CONTRACT_ADDRESSES=n.SWAPS_API_V2_BASE_URL=void 0;const s=e("./chains.cjs");n.SWAPS_API_V2_BASE_URL="https://swap.api.cx.metamask.io";const r="0x881d40237659c251811cec9c364ef91dc08d300c";n.SWAPS_CONTRACT_ADDRESSES={[s.CHAIN_IDS.MAINNET]:r,[s.CHAIN_IDS.LOCALHOST]:r,[s.CHAIN_IDS.BSC]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[s.CHAIN_IDS.POLYGON]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[s.CHAIN_IDS.AVALANCHE]:"0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31",[s.CHAIN_IDS.ARBITRUM]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[s.CHAIN_IDS.OPTIMISM]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[s.CHAIN_IDS.ZKSYNC_ERA]:"0xf504c1fe13d14df615e66dcd0abf39e60c697f34",[s.CHAIN_IDS.LINEA_MAINNET]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[s.CHAIN_IDS.BASE]:"0x9dda6ef3d919c9bc8885d5560999a3640431e8e6",[s.CHAIN_IDS.SEI]:"0x962287c9d5B8a682389E61edAE90ec882325d08b"};const o="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";n.SWAPS_WRAPPED_TOKENS_ADDRESSES={[s.CHAIN_IDS.MAINNET]:o,[s.CHAIN_IDS.LOCALHOST]:o,[s.CHAIN_IDS.BSC]:"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",[s.CHAIN_IDS.POLYGON]:"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",[s.CHAIN_IDS.AVALANCHE]:"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",[s.CHAIN_IDS.ARBITRUM]:"0x82af49447d8a07e3bd95bd0d56f35241523fbab1",[s.CHAIN_IDS.OPTIMISM]:"0x4200000000000000000000000000000000000006",[s.CHAIN_IDS.ZKSYNC_ERA]:"0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",[s.CHAIN_IDS.LINEA_MAINNET]:"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",[s.CHAIN_IDS.BASE]:"0x4200000000000000000000000000000000000006",[s.CHAIN_IDS.SEI]:"0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7"},n.ALLOWED_CONTRACT_ADDRESSES={[s.CHAIN_IDS.MAINNET]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.MAINNET],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.MAINNET]],[s.CHAIN_IDS.LOCALHOST]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.LOCALHOST],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.LOCALHOST]],[s.CHAIN_IDS.BSC]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.BSC],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.BSC]],[s.CHAIN_IDS.POLYGON]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.POLYGON],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.POLYGON]],[s.CHAIN_IDS.AVALANCHE]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.AVALANCHE],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.AVALANCHE]],[s.CHAIN_IDS.ARBITRUM]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.ARBITRUM],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.ARBITRUM]],[s.CHAIN_IDS.OPTIMISM]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.OPTIMISM],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.OPTIMISM]],[s.CHAIN_IDS.ZKSYNC_ERA]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.ZKSYNC_ERA],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.ZKSYNC_ERA]],[s.CHAIN_IDS.LINEA_MAINNET]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.LINEA_MAINNET],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.LINEA_MAINNET]],[s.CHAIN_IDS.BASE]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.BASE],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.BASE]],[s.CHAIN_IDS.SEI]:[n.SWAPS_CONTRACT_ADDRESSES[s.CHAIN_IDS.SEI],n.SWAPS_WRAPPED_TOKENS_ADDRESSES[s.CHAIN_IDS.SEI]]}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs",{"./chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SYMBOL_TO_SLIP44_MAP=n.SWAPS_CHAINID_DEFAULT_TOKEN_MAP=n.DEFAULT_TOKEN_ADDRESS=void 0;const s=e("@metamask/keyring-api"),r=e("./chains.cjs");n.DEFAULT_TOKEN_ADDRESS="0x0000000000000000000000000000000000000000";const o="AVAX",a="BNB",i="ETH",c="POL",l="TESTETH",d="SOL",u="SEI",m="BTC",h="TRX",p="MON",f={symbol:i,name:"Ether",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},g={symbol:a,name:"Binance Coin",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},k={symbol:c,name:"Polygon",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},w={symbol:o,name:"Avalanche",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},b={symbol:l,name:"Test Ether",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},_={symbol:i,name:"Ether",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},E={symbol:i,name:"Ether",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},y={...f},S={...f},I={...f},C={...f},A={...f},T={symbol:d,name:"Solana",address:n.DEFAULT_TOKEN_ADDRESS,decimals:9,iconUrl:""},v={symbol:m,name:"Bitcoin",address:n.DEFAULT_TOKEN_ADDRESS,decimals:8,iconUrl:""},x={symbol:u,name:"Sei",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""},N={symbol:h,name:"Tron",address:n.DEFAULT_TOKEN_ADDRESS,decimals:6,iconUrl:""},j={symbol:p,name:"Mon",address:n.DEFAULT_TOKEN_ADDRESS,decimals:18,iconUrl:""};n.SWAPS_CHAINID_DEFAULT_TOKEN_MAP={[r.CHAIN_IDS.MAINNET]:f,[r.CHAIN_IDS.LOCALHOST]:b,[r.CHAIN_IDS.BSC]:g,[r.CHAIN_IDS.POLYGON]:k,[r.CHAIN_IDS.GOERLI]:_,[r.CHAIN_IDS.SEPOLIA]:E,[r.CHAIN_IDS.AVALANCHE]:w,[r.CHAIN_IDS.OPTIMISM]:S,[r.CHAIN_IDS.ARBITRUM]:y,[r.CHAIN_IDS.ZKSYNC_ERA]:I,[r.CHAIN_IDS.LINEA_MAINNET]:C,[r.CHAIN_IDS.BASE]:A,[r.CHAIN_IDS.SEI]:x,[r.CHAIN_IDS.MONAD]:j,[s.SolScope.Mainnet]:T,[s.SolScope.Devnet]:T,[s.BtcScope.Mainnet]:v,[s.TrxScope.Mainnet]:N},n.SYMBOL_TO_SLIP44_MAP={SOL:"slip44:501",BTC:"slip44:0",ETH:"slip44:60",POL:"slip44:966",BNB:"slip44:714",AVAX:"slip44:9000",TESTETH:"slip44:60",SEI:"slip44:19000118",TRX:"slip44:195",MON:"slip44:268435779"}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s;Object.defineProperty(n,"__esModule",{value:!0}),n.TraceName=void 0,function(e){e.BridgeQuotesFetched="Bridge Quotes Fetched",e.SwapQuotesFetched="Swap Quotes Fetched"}(s||(n.TraceName=s={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/traces.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs",{"./bridge-controller.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/bridge-controller.cjs","./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","./constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","./selectors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/balance.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/fetch.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs","./utils/metrics/constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs","./utils/metrics/properties.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/slippage.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs","./utils/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs","./utils/trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","./utils/validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isValidQuoteRequest=n.isCrossChain=n.getDefaultBridgeControllerState=n.getNativeAssetForChainId=n.isNonEvmChainId=n.isBitcoinChainId=n.isSolanaChainId=n.isNativeAddress=n.isEthUsdt=n.MetricsSwapType=n.MetricsActionType=n.ALLOWED_CONTRACT_ADDRESSES=n.SWAPS_WRAPPED_TOKENS_ADDRESSES=n.SWAPS_CONTRACT_ADDRESSES=n.SWAPS_API_V2_BASE_URL=n.SWAPS_CHAINID_DEFAULT_TOKEN_MAP=n.BRIDGE_PROD_API_BASE_URL=n.BRIDGE_DEV_API_BASE_URL=n.METABRIDGE_CHAIN_TO_ADDRESS_MAP=n.DEFAULT_BRIDGE_CONTROLLER_STATE=n.DEFAULT_MAX_REFRESH_COUNT=n.REFRESH_INTERVAL_MS=n.BRIDGE_MM_FEE_RATE=n.BRIDGE_PREFERRED_GAS_ESTIMATE=n.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE=n.BRIDGE_QUOTE_MAX_ETA_SECONDS=n.BRIDGE_CONTROLLER_NAME=n.BridgeClientId=n.ALLOWED_BRIDGE_CHAIN_IDS=n.FeatureId=n.BridgeAssetSchema=n.ActionTypes=n.FeeType=n.BridgeBackgroundAction=n.BridgeUserAction=n.RequestStatus=n.ChainId=n.SortOrder=n.AssetType=n.StatusTypes=n.AbortReason=n.getQuotesReceivedProperties=n.isCustomSlippage=n.isHardwareWallet=n.getSwapType=n.getRequestParams=n.formatProviderLabel=n.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY=n.UnifiedSwapBridgeEventName=n.BridgeController=void 0,n.fetchTokens=n.getSwapsContractAddress=n.isValidSwapsContractAddress=n.BRIDGE_DEFAULT_SLIPPAGE=n.getBridgeFeatureFlags=n.DEFAULT_FEATURE_FLAG_CONFIG=n.selectMinimumBalanceForRentExemptionInSOL=n.selectBridgeFeatureFlags=n.selectIsQuoteExpired=n.selectExchangeRateByChainIdAndAddress=n.selectDefaultSlippagePercentage=n.selectBridgeQuotes=n.isEvmTxData=n.isTronTrade=n.isBitcoinTrade=n.extractTradeData=n.formatAddressToAssetId=n.formatAddressToCaipReference=n.formatChainIdToHex=n.formatChainIdToCaip=n.getClientHeaders=n.fetchBridgeTokens=n.calcLatestSrcBalance=n.calcSlippagePercentage=n.formatEtaInMinutes=void 0;var s=e("./bridge-controller.cjs");Object.defineProperty(n,"BridgeController",{enumerable:!0,get:function(){return s.BridgeController}});var r=e("./utils/metrics/constants.cjs");Object.defineProperty(n,"UnifiedSwapBridgeEventName",{enumerable:!0,get:function(){return r.UnifiedSwapBridgeEventName}}),Object.defineProperty(n,"UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY",{enumerable:!0,get:function(){return r.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY}});var o=e("./utils/metrics/properties.cjs");Object.defineProperty(n,"formatProviderLabel",{enumerable:!0,get:function(){return o.formatProviderLabel}}),Object.defineProperty(n,"getRequestParams",{enumerable:!0,get:function(){return o.getRequestParams}}),Object.defineProperty(n,"getSwapType",{enumerable:!0,get:function(){return o.getSwapType}}),Object.defineProperty(n,"isHardwareWallet",{enumerable:!0,get:function(){return o.isHardwareWallet}}),Object.defineProperty(n,"isCustomSlippage",{enumerable:!0,get:function(){return o.isCustomSlippage}}),Object.defineProperty(n,"getQuotesReceivedProperties",{enumerable:!0,get:function(){return o.getQuotesReceivedProperties}});var a=e("./utils/metrics/constants.cjs");Object.defineProperty(n,"AbortReason",{enumerable:!0,get:function(){return a.AbortReason}});var i=e("./types.cjs");Object.defineProperty(n,"StatusTypes",{enumerable:!0,get:function(){return i.StatusTypes}});var c=e("./types.cjs");Object.defineProperty(n,"AssetType",{enumerable:!0,get:function(){return c.AssetType}}),Object.defineProperty(n,"SortOrder",{enumerable:!0,get:function(){return c.SortOrder}}),Object.defineProperty(n,"ChainId",{enumerable:!0,get:function(){return c.ChainId}}),Object.defineProperty(n,"RequestStatus",{enumerable:!0,get:function(){return c.RequestStatus}}),Object.defineProperty(n,"BridgeUserAction",{enumerable:!0,get:function(){return c.BridgeUserAction}}),Object.defineProperty(n,"BridgeBackgroundAction",{enumerable:!0,get:function(){return c.BridgeBackgroundAction}});var l=e("./utils/validators.cjs");Object.defineProperty(n,"FeeType",{enumerable:!0,get:function(){return l.FeeType}}),Object.defineProperty(n,"ActionTypes",{enumerable:!0,get:function(){return l.ActionTypes}}),Object.defineProperty(n,"BridgeAssetSchema",{enumerable:!0,get:function(){return l.BridgeAssetSchema}}),Object.defineProperty(n,"FeatureId",{enumerable:!0,get:function(){return l.FeatureId}});var d=e("./constants/bridge.cjs");Object.defineProperty(n,"ALLOWED_BRIDGE_CHAIN_IDS",{enumerable:!0,get:function(){return d.ALLOWED_BRIDGE_CHAIN_IDS}}),Object.defineProperty(n,"BridgeClientId",{enumerable:!0,get:function(){return d.BridgeClientId}}),Object.defineProperty(n,"BRIDGE_CONTROLLER_NAME",{enumerable:!0,get:function(){return d.BRIDGE_CONTROLLER_NAME}}),Object.defineProperty(n,"BRIDGE_QUOTE_MAX_ETA_SECONDS",{enumerable:!0,get:function(){return d.BRIDGE_QUOTE_MAX_ETA_SECONDS}}),Object.defineProperty(n,"BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE",{enumerable:!0,get:function(){return d.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE}}),Object.defineProperty(n,"BRIDGE_PREFERRED_GAS_ESTIMATE",{enumerable:!0,get:function(){return d.BRIDGE_PREFERRED_GAS_ESTIMATE}}),Object.defineProperty(n,"BRIDGE_MM_FEE_RATE",{enumerable:!0,get:function(){return d.BRIDGE_MM_FEE_RATE}}),Object.defineProperty(n,"REFRESH_INTERVAL_MS",{enumerable:!0,get:function(){return d.REFRESH_INTERVAL_MS}}),Object.defineProperty(n,"DEFAULT_MAX_REFRESH_COUNT",{enumerable:!0,get:function(){return d.DEFAULT_MAX_REFRESH_COUNT}}),Object.defineProperty(n,"DEFAULT_BRIDGE_CONTROLLER_STATE",{enumerable:!0,get:function(){return d.DEFAULT_BRIDGE_CONTROLLER_STATE}}),Object.defineProperty(n,"METABRIDGE_CHAIN_TO_ADDRESS_MAP",{enumerable:!0,get:function(){return d.METABRIDGE_CHAIN_TO_ADDRESS_MAP}}),Object.defineProperty(n,"BRIDGE_DEV_API_BASE_URL",{enumerable:!0,get:function(){return d.BRIDGE_DEV_API_BASE_URL}}),Object.defineProperty(n,"BRIDGE_PROD_API_BASE_URL",{enumerable:!0,get:function(){return d.BRIDGE_PROD_API_BASE_URL}});var u=e("./constants/tokens.cjs");Object.defineProperty(n,"SWAPS_CHAINID_DEFAULT_TOKEN_MAP",{enumerable:!0,get:function(){return u.SWAPS_CHAINID_DEFAULT_TOKEN_MAP}});var m=e("./constants/swaps.cjs");Object.defineProperty(n,"SWAPS_API_V2_BASE_URL",{enumerable:!0,get:function(){return m.SWAPS_API_V2_BASE_URL}}),Object.defineProperty(n,"SWAPS_CONTRACT_ADDRESSES",{enumerable:!0,get:function(){return m.SWAPS_CONTRACT_ADDRESSES}}),Object.defineProperty(n,"SWAPS_WRAPPED_TOKENS_ADDRESSES",{enumerable:!0,get:function(){return m.SWAPS_WRAPPED_TOKENS_ADDRESSES}}),Object.defineProperty(n,"ALLOWED_CONTRACT_ADDRESSES",{enumerable:!0,get:function(){return m.ALLOWED_CONTRACT_ADDRESSES}});var h=e("./utils/metrics/constants.cjs");Object.defineProperty(n,"MetricsActionType",{enumerable:!0,get:function(){return h.MetricsActionType}}),Object.defineProperty(n,"MetricsSwapType",{enumerable:!0,get:function(){return h.MetricsSwapType}});var p=e("./utils/bridge.cjs");Object.defineProperty(n,"isEthUsdt",{enumerable:!0,get:function(){return p.isEthUsdt}}),Object.defineProperty(n,"isNativeAddress",{enumerable:!0,get:function(){return p.isNativeAddress}}),Object.defineProperty(n,"isSolanaChainId",{enumerable:!0,get:function(){return p.isSolanaChainId}}),Object.defineProperty(n,"isBitcoinChainId",{enumerable:!0,get:function(){return p.isBitcoinChainId}}),Object.defineProperty(n,"isNonEvmChainId",{enumerable:!0,get:function(){return p.isNonEvmChainId}}),Object.defineProperty(n,"getNativeAssetForChainId",{enumerable:!0,get:function(){return p.getNativeAssetForChainId}}),Object.defineProperty(n,"getDefaultBridgeControllerState",{enumerable:!0,get:function(){return p.getDefaultBridgeControllerState}}),Object.defineProperty(n,"isCrossChain",{enumerable:!0,get:function(){return p.isCrossChain}});var f=e("./utils/quote.cjs");Object.defineProperty(n,"isValidQuoteRequest",{enumerable:!0,get:function(){return f.isValidQuoteRequest}}),Object.defineProperty(n,"formatEtaInMinutes",{enumerable:!0,get:function(){return f.formatEtaInMinutes}}),Object.defineProperty(n,"calcSlippagePercentage",{enumerable:!0,get:function(){return f.calcSlippagePercentage}});var g=e("./utils/balance.cjs");Object.defineProperty(n,"calcLatestSrcBalance",{enumerable:!0,get:function(){return g.calcLatestSrcBalance}});var k=e("./utils/fetch.cjs");Object.defineProperty(n,"fetchBridgeTokens",{enumerable:!0,get:function(){return k.fetchBridgeTokens}}),Object.defineProperty(n,"getClientHeaders",{enumerable:!0,get:function(){return k.getClientHeaders}});var w=e("./utils/caip-formatters.cjs");Object.defineProperty(n,"formatChainIdToCaip",{enumerable:!0,get:function(){return w.formatChainIdToCaip}}),Object.defineProperty(n,"formatChainIdToHex",{enumerable:!0,get:function(){return w.formatChainIdToHex}}),Object.defineProperty(n,"formatAddressToCaipReference",{enumerable:!0,get:function(){return w.formatAddressToCaipReference}}),Object.defineProperty(n,"formatAddressToAssetId",{enumerable:!0,get:function(){return w.formatAddressToAssetId}});var b=e("./utils/trade-utils.cjs");Object.defineProperty(n,"extractTradeData",{enumerable:!0,get:function(){return b.extractTradeData}}),Object.defineProperty(n,"isBitcoinTrade",{enumerable:!0,get:function(){return b.isBitcoinTrade}}),Object.defineProperty(n,"isTronTrade",{enumerable:!0,get:function(){return b.isTronTrade}}),Object.defineProperty(n,"isEvmTxData",{enumerable:!0,get:function(){return b.isEvmTxData}});var _=e("./selectors.cjs");Object.defineProperty(n,"selectBridgeQuotes",{enumerable:!0,get:function(){return _.selectBridgeQuotes}}),Object.defineProperty(n,"selectDefaultSlippagePercentage",{enumerable:!0,get:function(){return _.selectDefaultSlippagePercentage}}),Object.defineProperty(n,"selectExchangeRateByChainIdAndAddress",{enumerable:!0,get:function(){return _.selectExchangeRateByChainIdAndAddress}}),Object.defineProperty(n,"selectIsQuoteExpired",{enumerable:!0,get:function(){return _.selectIsQuoteExpired}}),Object.defineProperty(n,"selectBridgeFeatureFlags",{enumerable:!0,get:function(){return _.selectBridgeFeatureFlags}}),Object.defineProperty(n,"selectMinimumBalanceForRentExemptionInSOL",{enumerable:!0,get:function(){return _.selectMinimumBalanceForRentExemptionInSOL}});var E=e("./constants/bridge.cjs");Object.defineProperty(n,"DEFAULT_FEATURE_FLAG_CONFIG",{enumerable:!0,get:function(){return E.DEFAULT_FEATURE_FLAG_CONFIG}});var y=e("./utils/feature-flags.cjs");Object.defineProperty(n,"getBridgeFeatureFlags",{enumerable:!0,get:function(){return y.getBridgeFeatureFlags}});var S=e("./utils/slippage.cjs");Object.defineProperty(n,"BRIDGE_DEFAULT_SLIPPAGE",{enumerable:!0,get:function(){return S.BRIDGE_DEFAULT_SLIPPAGE}});var I=e("./utils/swaps.cjs");Object.defineProperty(n,"isValidSwapsContractAddress",{enumerable:!0,get:function(){return I.isValidSwapsContractAddress}}),Object.defineProperty(n,"getSwapsContractAddress",{enumerable:!0,get:function(){return I.getSwapsContractAddress}}),Object.defineProperty(n,"fetchTokens",{enumerable:!0,get:function(){return I.fetchTokens}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs",{"./constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./utils/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./utils/caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./utils/feature-flags.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs","./utils/quote.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs","./utils/slippage.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js",reselect:"/home/runner/work/metamask-extension/metamask-extension/node_modules/reselect/dist/cjs/reselect.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.selectDefaultSlippagePercentage=n.selectMinimumBalanceForRentExemptionInSOL=n.selectBridgeQuotes=n.selectIsQuoteExpired=n.selectIsAssetExchangeRateInState=n.selectExchangeRateByChainIdAndAddress=n.selectBridgeFeatureFlags=void 0;const s=e("@ethersproject/constants"),r=e("@metamask/utils"),o=e("bignumber.js"),a=e("lodash"),i=e("reselect"),c=e("./constants/bridge.cjs"),l=e("./types.cjs"),d=e("./utils/bridge.cjs"),u=e("./utils/caip-formatters.cjs"),m=e("./utils/feature-flags.cjs"),h=e("./utils/quote.cjs"),p=e("./utils/slippage.cjs"),f=i.createStructuredSelector.withTypes(),g=i.createSelector.withTypes(),k=i.createSelector.withTypes();n.selectBridgeFeatureFlags=k([e=>e.remoteFeatureFlags.bridgeConfig],e=>(0,m.processFeatureFlags)(e));const w=(e,t,n)=>{if(!t||!n)return{};const s=(0,u.formatAddressToAssetId)(n,t);if(!s)return{};const{assetExchangeRates:a,currencyRates:i,marketData:c,conversionRates:l}=e,m=a?.[s]??a?.[s.toLowerCase()];if(m?.exchangeRate)return m;if((0,d.isNonEvmChainId)(t)){const e=l?.[s];return e?{exchangeRate:e.rate,usdExchangeRate:undefined}:{}}if((0,d.isNativeAddress)(n)){const{symbol:e}=(0,d.getNativeAssetForChainId)(t),n=i?.[e];return n?{exchangeRate:n?.conversionRate?.toString(),usdExchangeRate:n?.usdConversionRate?.toString()}:{}}if(!(0,d.isNonEvmChainId)(t)){const e=c?.[(0,u.formatChainIdToHex)(t)],s=(0,r.isStrictHexString)(n)?e?.[n]:null,a=s?i[s?.currency]:undefined;if(s&&a)return{exchangeRate:new o.BigNumber(s.price).multipliedBy(a.conversionRate??0).toString(),usdExchangeRate:new o.BigNumber(s.price).multipliedBy(a.usdConversionRate??0).toString()}}return{}};n.selectExchangeRateByChainIdAndAddress=(e,t,n)=>w(e,t,n);n.selectIsAssetExchangeRateInState=(...e)=>Boolean(w(...e)?.exchangeRate)&&Boolean(w(...e)?.usdExchangeRate);const b=g([({quotes:e})=>e,f({estimatedBaseFeeInDecGwei:({gasFeeEstimates:e})=>e?.estimatedBaseFee,feePerGasInDecGwei:({gasFeeEstimates:e})=>e?.[c.BRIDGE_PREFERRED_GAS_ESTIMATE]?.suggestedMaxFeePerGas,maxFeePerGasInDecGwei:({gasFeeEstimates:e})=>e?.high?.suggestedMaxFeePerGas}),g([e=>e,({quoteRequest:{srcChainId:e}})=>e,({quoteRequest:{srcTokenAddress:e}})=>e],n.selectExchangeRateByChainIdAndAddress),g([e=>e,({quoteRequest:{destChainId:e}})=>e,({quoteRequest:{destTokenAddress:e}})=>e],n.selectExchangeRateByChainIdAndAddress),g([e=>e,({quoteRequest:{srcChainId:e}})=>e],(e,t)=>(0,n.selectExchangeRateByChainIdAndAddress)(e,t,s.AddressZero))],(e,t,n,s,r)=>e.map(e=>{const o=(0,h.calcSentAmount)(e.quote,n),a=(0,h.calcToAmount)(e.quote.destTokenAmount,e.quote.destAsset,s),i=(0,h.calcToAmount)(e.quote.minDestTokenAmount,e.quote.destAsset,s),c=(0,h.calcIncludedTxFees)(e.quote,n,s);let l,u,m,p;(0,d.isEvmQuoteResponse)(e)?(m=(0,h.calcRelayerFee)(e,r),p=(0,h.calcEstimatedAndMaxTotalGasFee)({bridgeQuote:e,...t,...r}),l=(0,h.calcTotalEstimatedNetworkFee)(p,m),u=(0,h.calcTotalMaxNetworkFee)(p,m)):(l=(0,h.calcNonEvmTotalNetworkFee)(e,r),p={effective:l,total:l,max:l},u=l);const f=(0,h.calcAdjustedReturn)(a,l,e.quote),g=(0,h.calcCost)(f,o);return{...e,sentAmount:o,toTokenAmount:a,minToTokenAmount:i,swapRate:(0,h.calcSwapRate)(o.amount,a.amount),totalNetworkFee:l,totalMaxNetworkFee:u,gasFee:p,adjustedReturn:f,cost:g,includedTxFees:c}})),_=g([b,(e,{sortOrder:t})=>t],(e,t)=>t===l.SortOrder.ETA_ASC?(0,a.orderBy)(e,e=>e.estimatedProcessingTimeInSeconds,"asc"):(0,a.orderBy)(e,({cost:e})=>e.valueInCurrency?Number(e.valueInCurrency):0,"asc")),E=g([_],e=>e.length>0?e[0]:null),y=g([E,(e,{selectedQuote:t})=>t],(e,t)=>t??e),S=g([n.selectBridgeFeatureFlags,e=>e.quoteRequest.insufficientBal,e=>e.quotesRefreshCount],(e,t,n)=>!t&&e.maxRefreshCount>n),I=g([n.selectBridgeFeatureFlags,e=>e.quoteRequest.srcChainId],(e,t)=>(t?e.chains[(0,u.formatChainIdToCaip)(t)]?.refreshRate:e.refreshRate)??e.refreshRate);n.selectIsQuoteExpired=g([S,({quotesLastFetched:e})=>e,I,(e,t,n)=>n],(e,t,n,s)=>Boolean(!e&&t&&s-t>n)),n.selectBridgeQuotes=f({sortedQuotes:_,recommendedQuote:E,activeQuote:y,quotesLastFetchedMs:e=>e.quotesLastFetched,isLoading:e=>e.quotesLoadingStatus===l.RequestStatus.LOADING,quoteFetchError:e=>e.quoteFetchError,quotesRefreshCount:e=>e.quotesRefreshCount,quotesInitialLoadTimeMs:e=>e.quotesInitialLoadTime,isQuoteGoingToRefresh:S});n.selectMinimumBalanceForRentExemptionInSOL=e=>new o.BigNumber(e.minimumBalanceForRentExemptionInLamports??0).div(10**9).toString(),n.selectDefaultSlippagePercentage=g([e=>(0,n.selectBridgeFeatureFlags)(e).chains,(e,t)=>t.srcTokenAddress,(e,t)=>t.destTokenAddress,(e,t)=>t.srcChainId?(0,u.formatChainIdToCaip)(t.srcChainId):undefined,(e,t)=>t.destChainId?(0,u.formatChainIdToCaip)(t.destChainId):undefined],(e,t,n,s,r)=>(0,p.getDefaultSlippagePercentage)({srcTokenAddress:t,destTokenAddress:n,srcChainId:s,destChainId:r},s?e[s]?.stablecoins:undefined,r?e[r]?.stablecoins:undefined))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/selectors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,l;Object.defineProperty(n,"__esModule",{value:!0}),n.BridgeBackgroundAction=n.BridgeUserAction=n.RequestStatus=n.ChainId=n.StatusTypes=n.SortOrder=n.AssetType=void 0,function(e){e.native="NATIVE",e.token="TOKEN",e.NFT="NFT",e.unknown="UNKNOWN"}(s||(n.AssetType=s={})),function(e){e.COST_ASC="cost_ascending",e.ETA_ASC="time_descending"}(r||(n.SortOrder=r={})),function(e){e.UNKNOWN="UNKNOWN",e.FAILED="FAILED",e.PENDING="PENDING",e.COMPLETE="COMPLETE"}(o||(n.StatusTypes=o={})),function(e){e[e.ETH=1]="ETH",e[e.OPTIMISM=10]="OPTIMISM",e[e.BSC=56]="BSC",e[e.POLYGON=137]="POLYGON",e[e.ZKSYNC=324]="ZKSYNC",e[e.BASE=8453]="BASE",e[e.ARBITRUM=42161]="ARBITRUM",e[e.AVALANCHE=43114]="AVALANCHE",e[e.LINEA=59144]="LINEA",e[e.SOLANA=0x416edef1601be]="SOLANA",e[e.BTC=20000000000001]="BTC",e[e.TRON=728126428]="TRON",e[e.SEI=1329]="SEI",e[e.MONAD=143]="MONAD"}(a||(n.ChainId=a={})),function(e){e[e.LOADING=0]="LOADING",e[e.FETCHED=1]="FETCHED",e[e.ERROR=2]="ERROR"}(i||(n.RequestStatus=i={})),function(e){e.SELECT_DEST_NETWORK="selectDestNetwork",e.UPDATE_QUOTE_PARAMS="updateBridgeQuoteRequestParams"}(c||(n.BridgeUserAction=c={})),function(e){e.SET_CHAIN_INTERVAL_LENGTH="setChainIntervalLength",e.RESET_STATE="resetState",e.TRACK_METAMETRICS_EVENT="trackUnifiedSwapBridgeEvent",e.STOP_POLLING_FOR_QUOTES="stopPollingForQuotes",e.FETCH_QUOTES="fetchQuotes"}(l||(n.BridgeBackgroundAction=l={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.toExchangeRates=n.getAssetIdsForToken=void 0;const s=e("./bridge.cjs"),r=e("./caip-formatters.cjs");n.getAssetIdsForToken=(e,t)=>{const n=[],o=(0,r.formatAddressToAssetId)(e,t);return o&&(n.push(o),(0,s.getNativeAssetForChainId)(t)?.assetId&&n.push((0,s.getNativeAssetForChainId)(t).assetId)),n};n.toExchangeRates=(e,t)=>Object.entries(t).reduce((t,[n,s])=>(s&&(t[n]={exchangeRate:s[e],usdExchangeRate:s.usd}),t),{})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/assets.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","@ethersproject/address":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/address/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.hasSufficientBalance=n.calcLatestSrcBalance=n.fetchTokenBalance=void 0;const s=e("@ethersproject/address"),r=e("@ethersproject/contracts"),o=e("@ethersproject/providers"),a=e("@metamask/metamask-eth-abis"),i=e("./bridge.cjs");n.fetchTokenBalance=async(e,t,n)=>{const s=new o.Web3Provider(n),i=new r.Contract(e,a.abiERC20,s),c="function"==typeof i?.balanceOf?i.balanceOf(t):Promise.resolve(undefined);return await c};n.calcLatestSrcBalance=async(e,t,r,a)=>{if(r&&a){if((0,i.isNativeAddress)(r)){const n=new o.Web3Provider(e);return await n.getBalance((0,s.getAddress)(t))}return await(0,n.fetchTokenBalance)(r,t,e)}return undefined};n.hasSufficientBalance=async(e,t,s,r,o)=>{const a=await(0,n.calcLatestSrcBalance)(e,t,s,o);return!!a&&a.gte(r)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/balance.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","../constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","../constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@ethersproject/contracts":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/contracts/lib/index.js","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/metamask-eth-abis":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/metamask-eth-abis/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isEvmQuoteResponse=n.isNonEvmChainId=n.isTronChainId=n.isBitcoinChainId=n.isSolanaChainId=n.isNativeAddress=n.isSwapsDefaultTokenSymbol=n.isSwapsDefaultTokenAddress=n.sumHexes=n.isEthUsdt=n.getEthUsdtResetData=n.getNativeAssetForChainId=n.getDefaultBridgeControllerState=n.isCrossChain=void 0;const s=e("@ethersproject/constants"),r=e("@ethersproject/contracts"),o=e("@metamask/keyring-api"),a=e("@metamask/metamask-eth-abis"),i=e("@metamask/utils"),c=e("./caip-formatters.cjs"),l=e("../constants/bridge.cjs"),d=e("../constants/chains.cjs"),u=e("../constants/swaps.cjs"),m=e("../constants/tokens.cjs"),h=e("../types.cjs");n.isCrossChain=(e,t)=>{try{return!!t&&(0,c.formatChainIdToCaip)(e)!==(0,c.formatChainIdToCaip)(t)}catch{return!1}};n.getDefaultBridgeControllerState=()=>l.DEFAULT_BRIDGE_CONTROLLER_STATE;const p=(e,t)=>`${(0,c.formatChainIdToCaip)(e)}/${m.SYMBOL_TO_SLIP44_MAP[t]}`;n.getNativeAssetForChainId=e=>{const t=(0,c.formatChainIdToCaip)(e),n=m.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[(0,c.formatChainIdToCaip)(e)]??m.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[(0,c.formatChainIdToHex)(e)];if(!n)throw new Error(`No XChain Swaps native asset found for chainId: ${e}`);return{...n,chainId:(0,c.formatChainIdToDec)(e),assetId:p(t,n.symbol)}};n.getEthUsdtResetData=e=>{const t=(0,n.isCrossChain)(d.CHAIN_IDS.MAINNET,e)?l.METABRIDGE_ETHEREUM_ADDRESS:u.SWAPS_CONTRACT_ADDRESSES[d.CHAIN_IDS.MAINNET];return new r.Contract(l.ETH_USDT_ADDRESS,a.abiERC20).interface.encodeFunctionData("approve",[t,"0"])};n.isEthUsdt=(e,t)=>(0,c.formatChainIdToDec)(e)===h.ChainId.ETH&&t.toLowerCase()===l.ETH_USDT_ADDRESS.toLowerCase();n.sumHexes=(...e)=>{if(0===e.length)return"0x0";return`0x${e.reduce((e,t)=>e+BigInt(t),BigInt(0)).toString(16)}`};n.isSwapsDefaultTokenAddress=(e,t)=>!(!e||!t)&&e===(0,n.getNativeAssetForChainId)(t)?.address;n.isSwapsDefaultTokenSymbol=(e,t)=>!(!e||!t)&&e===(0,n.getNativeAssetForChainId)(t)?.symbol;n.isNativeAddress=e=>e===s.AddressZero||""===e||!e||!(0,i.isStrictHexString)(e)&&Object.values(m.SYMBOL_TO_SLIP44_MAP).some(t=>e.includes(t)||t.endsWith(e));n.isSolanaChainId=e=>(0,i.isCaipChainId)(e)?e===o.SolScope.Mainnet.toString():e.toString()===h.ChainId.SOLANA.toString();n.isBitcoinChainId=e=>(0,i.isCaipChainId)(e)?e===o.BtcScope.Mainnet.toString():e.toString()===h.ChainId.BTC.toString();n.isTronChainId=e=>(0,i.isCaipChainId)(e)?e===o.TrxScope.Mainnet.toString():e.toString()===h.ChainId.TRON.toString();n.isNonEvmChainId=e=>(0,n.isSolanaChainId)(e)||(0,n.isBitcoinChainId)(e)||(0,n.isTronChainId)(e);n.isEvmQuoteResponse=e=>!(0,n.isNonEvmChainId)(e.quote.srcChainId)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","@ethersproject/address":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/address/lib/index.js","@ethersproject/constants":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/constants/lib/index.js","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/multichain-network-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.formatAddressToAssetId=n.formatAddressToCaipReference=n.formatChainIdToHex=n.formatChainIdToDec=n.formatChainIdToCaip=void 0;const s=e("@ethersproject/address"),r=e("@ethersproject/constants"),o=e("@metamask/controller-utils"),a=e("@metamask/keyring-api"),i=e("@metamask/multichain-network-controller"),c=e("@metamask/utils"),l=e("./bridge.cjs"),d=e("../types.cjs");n.formatChainIdToCaip=e=>(0,c.isCaipChainId)(e)?e:(0,c.isStrictHexString)(e)?(0,i.toEvmCaipChainId)(e):(0,l.isSolanaChainId)(e)?a.SolScope.Mainnet:(0,l.isBitcoinChainId)(e)?a.BtcScope.Mainnet:(0,l.isTronChainId)(e)?a.TrxScope.Mainnet:(0,i.toEvmCaipChainId)((0,c.numberToHex)(Number(e)));n.formatChainIdToDec=e=>(0,c.isStrictHexString)(e)?(0,o.convertHexToDecimal)(e):e===a.SolScope.Mainnet?d.ChainId.SOLANA:e===a.BtcScope.Mainnet?d.ChainId.BTC:e===a.TrxScope.Mainnet?d.ChainId.TRON:(0,c.isCaipChainId)(e)?Number(e.split(":").at(-1)):"string"==typeof e?parseInt(e,10):e;n.formatChainIdToHex=e=>{if((0,c.isStrictHexString)(e))return e;if("number"==typeof e||parseInt(e,10))return(0,c.numberToHex)(Number(e));if((0,c.isCaipChainId)(e)){const{reference:t}=(0,c.parseCaipChainId)(e);if((0,c.isCaipReference)(t)&&!isNaN(Number(t)))return(0,c.numberToHex)(Number(t))}throw new Error(`Invalid cross-chain swaps chainId: ${e}`)};n.formatAddressToCaipReference=e=>{if((0,c.isStrictHexString)(e))return(0,s.getAddress)(e);if((0,l.isNativeAddress)(e))return r.AddressZero;const t=e.split(":").at(-1);if(!t)throw new Error("Invalid address");return t};n.formatAddressToAssetId=(e,t)=>(0,c.isCaipAssetType)(e)?e:(0,l.isNativeAddress)(e)?(0,l.getNativeAssetForChainId)(t).assetId:t===a.SolScope.Mainnet?c.CaipAssetTypeStruct.create(`${t}/token:${e}`):(0,c.isStrictHexString)(e)?c.CaipAssetTypeStruct.create(`${(0,n.formatChainIdToCaip)(t)}/erc20:${e}`):undefined}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.hasMinimumRequiredVersion=n.getBridgeFeatureFlags=n.processFeatureFlags=n.formatFeatureFlags=void 0;const s=e("./caip-formatters.cjs"),r=e("./validators.cjs"),o=e("../constants/bridge.cjs");n.formatFeatureFlags=e=>{return{...e,chains:(t=e.chains,Object.entries(t).reduce((e,[t,n])=>({...e,[(0,s.formatChainIdToCaip)(t)]:n}),{}))};var t};n.processFeatureFlags=e=>(0,r.validateFeatureFlagsResponse)(e)?(0,n.formatFeatureFlags)(e):o.DEFAULT_FEATURE_FLAG_CONFIG,n.getBridgeFeatureFlags=function(e){const t=e.call("RemoteFeatureFlagController:getState"),s=t?.remoteFeatureFlags?.bridgeConfigV2,r=t?.remoteFeatureFlags?.bridgeConfig;return(0,n.processFeatureFlags)(s||r)};n.hasMinimumRequiredVersion=(e,t)=>{const[n,s,r]=e.split(".").map(Number),[o,a,i]=t.split(".").map(Number);return n>o||(n===o&&s>a||n===o&&s===a&&r>=i)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/feature-flags.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.fetchServerEvents=void 0;n.fetchServerEvents=async(e,{onMessage:t,onError:n,onClose:s,fetchFn:r,...o})=>{let a;try{const n=await r(e,o);if(!n.ok||!n.body)throw new Error(`${n.status}`);a=n.body.getReader();const i=new TextDecoder("utf-8");let c="";for(;;){const{done:e,value:n}=await a.read();if(e)break;c+=i.decode(n,{stream:!0});const s=c.split("\n\n");c=s.pop()||"";for(const e of s){const n=e.split("\n");let s;const r=[];for(const e of n)e.startsWith("event:")?s=e.slice(6).trim():e.startsWith("data:")&&r.push(e.slice(5).trim());if("error"===s)throw new Error(`Bridge-api error: ${r.join("\n")}`);if(r.length>0){const e=JSON.parse(r.join("\n"));await t(e,s)}}}await(s?.())}catch(e){n?.(e)}finally{try{await(a?.cancel())}catch(e){console.error("Error cleaning up stream reader",e)}}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./fetch-server-events.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch-server-events.cjs","./trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.fetchBridgeQuoteStream=n.fetchAssetPrices=n.fetchBridgeQuotes=n.fetchBridgeTokens=n.getClientHeaders=void 0;const s=e("@metamask/superstruct"),r=e("./bridge.cjs"),o=e("./caip-formatters.cjs"),a=e("./fetch-server-events.cjs"),i=e("./trade-utils.cjs"),c=e("./validators.cjs");n.getClientHeaders=(e,t)=>({"X-Client-Id":e,...t?{"Client-Version":t}:{}}),n.fetchBridgeTokens=async function(e,t,s,r,a){const i=`${r}/getTokens?chainId=${(0,o.formatChainIdToDec)(e)}`,l=await s(i,{headers:(0,n.getClientHeaders)(t,a)}),d={};return l.forEach(e=>{(0,c.validateSwapsTokenObject)(e)&&(d[e.address]=e)}),d};const l=e=>{const t=e.destWalletAddress??e.walletAddress,n={walletAddress:(0,o.formatAddressToCaipReference)(e.walletAddress),destWalletAddress:(0,o.formatAddressToCaipReference)(t),srcChainId:(0,o.formatChainIdToDec)(e.srcChainId),destChainId:(0,o.formatChainIdToDec)(e.destChainId),srcTokenAddress:(0,o.formatAddressToCaipReference)(e.srcTokenAddress),destTokenAddress:(0,o.formatAddressToCaipReference)(e.destTokenAddress),srcTokenAmount:e.srcTokenAmount,insufficientBal:Boolean(e.insufficientBal),resetApproval:Boolean(e.resetApproval),gasIncluded:Boolean(e.gasIncluded),gasIncluded7702:Boolean(e.gasIncluded7702)};e.slippage!==undefined&&(n.slippage=e.slippage),e.fee!==undefined&&(n.fee=e.fee),e.aggIds&&e.aggIds.length>0&&(n.aggIds=e.aggIds),e.bridgeIds&&e.bridgeIds.length>0&&(n.bridgeIds=e.bridgeIds);const s=new URLSearchParams;return Object.entries(n).forEach(([e,t])=>{s.append(e,t.toString())}),s};n.fetchBridgeQuotes=async function(e,t,o,a,d,u,m){const h=`${d}/getQuote?${l(e)}`,p=await a(h,{headers:(0,n.getClientHeaders)(o,m),signal:t}),f=new Set([]),g=p.filter(e=>{try{return(0,c.validateQuoteResponse)(e)}catch(t){return t instanceof s.StructError&&t.failures().forEach(({branch:t,path:n})=>{const s=t?.[0]?.quote?.bridgeId||t?.[0]?.quote?.bridges?.[0]||e?.quote?.bridgeId||e?.quote?.bridges?.[0]||"unknown",r=n?.join(".")||"unknown";f.add([s,r].join("|"))}),!1}}).map(t=>({...t,featureId:u??undefined,resetApproval:e.resetApproval&&t.approval&&(0,i.isEvmTxData)(t.approval)?{...t.approval,data:(0,r.getEthUsdtResetData)(e.destChainId)}:undefined})),k=Array.from(f);return f.size>0&&console.warn("Quote validation failed",k),{quotes:g,validationFailures:k}};n.fetchAssetPrices=async e=>{const{currencies:t,...s}=e,r=await Promise.allSettled(Array.from(t).map(async e=>await(async e=>{const{currency:t,assetIds:s,clientId:r,clientVersion:o,fetchFn:a,signal:i}=e,c=Array.from(s).filter(Boolean);if(0===c.length)return{};const l=`https://price.api.cx.metamask.io/v3/spot-prices?${new URLSearchParams({assetIds:c.filter(Boolean).join(","),vsCurrency:t})}`,d=await a(l,{headers:(0,n.getClientHeaders)(r,o),signal:i});return d&&"object"==typeof d?Object.entries(d).reduce((e,[n,s])=>s?(e[n]||(e[n]={}),s[t]&&(e[n][t]=s[t].toString()),e):e,{}):{}})({...s,currency:e}))).then(e=>e.reduce((e,t)=>("fulfilled"===t.status&&Object.entries(t.value).forEach(([t,n])=>{e[t]||(e[t]={}),Object.entries(n).forEach(([n,s])=>{e[t][n]=s})}),e),{}));return r},n.fetchBridgeQuoteStream=async function(e,t,o,d,u,m,h){const p=`${u}/getQuoteStream?${l(t)}`;await(0,a.fetchServerEvents)(p,{headers:{...(0,n.getClientHeaders)(d,h),"Content-Type":"text/event-stream"},signal:o,onMessage:async e=>{const n=new Set([]);try{if((0,c.validateQuoteResponse)(e))return await m.onValidQuoteReceived({...e,resetApproval:t.resetApproval&&e.approval&&(0,i.isEvmTxData)(e.approval)?{...e.approval,data:(0,r.getEthUsdtResetData)(t.destChainId)}:undefined})}catch(t){t instanceof s.StructError&&t.failures().forEach(({branch:t,path:s})=>{const r=t?.[0]?.quote?.bridgeId||t?.[0]?.quote?.bridges?.[0]||e?.quote?.bridgeId||e?.quote?.bridges?.[0]||"unknown",o=s?.join(".")||"unknown";n.add([r,o].join("|"))});const r=Array.from(n);if(n.size>0)return console.warn("Quote validation failed",r),m.onValidationFailure(r);throw t}return undefined},onError:e=>{throw e},onClose:async()=>{await m.onClose()},fetchFn:e})}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/fetch.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i;Object.defineProperty(n,"__esModule",{value:!0}),n.MetricsSwapType=n.MetricsActionType=n.MetaMetricsSwapsEventSource=n.AbortReason=n.UnifiedSwapBridgeEventName=n.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY=void 0,n.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY="Unified SwapBridge",function(e){e.ButtonClicked="Unified SwapBridge Button Clicked",e.PageViewed="Unified SwapBridge Page Viewed",e.InputChanged="Unified SwapBridge Input Changed",e.InputSourceDestinationSwitched="Unified SwapBridge Source Destination Switched",e.QuotesRequested="Unified SwapBridge Quotes Requested",e.QuotesReceived="Unified SwapBridge Quotes Received",e.QuotesError="Unified SwapBridge Quotes Error",e.Submitted="Unified SwapBridge Submitted",e.Completed="Unified SwapBridge Completed",e.Failed="Unified SwapBridge Failed",e.AllQuotesOpened="Unified SwapBridge All Quotes Opened",e.AllQuotesSorted="Unified SwapBridge All Quotes Sorted",e.QuoteSelected="Unified SwapBridge Quote Selected",e.AssetDetailTooltipClicked="Unified SwapBridge Asset Detail Tooltip Clicked",e.QuotesValidationFailed="Unified SwapBridge Quotes Failed Validation",e.StatusValidationFailed="Unified SwapBridge Status Failed Validation"}(s||(n.UnifiedSwapBridgeEventName=s={})),function(e){e.NewQuoteRequest="New Quote Request",e.QuoteRequestUpdated="Quote Request Updated",e.ResetState="Reset controller state",e.TransactionSubmitted="Transaction submitted"}(r||(n.AbortReason=r={})),function(e){e.MainView="Main View",e.TokenView="Token View"}(o||(n.MetaMetricsSwapsEventSource=o={})),function(e){e.CROSSCHAIN_V1="crosschain-v1",e.SWAPBRIDGE_V1="swapbridge-v1"}(a||(n.MetricsActionType=a={})),function(e){e.SINGLE="single_chain",e.CROSSCHAIN="crosschain"}(i||(n.MetricsSwapType=i={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs",{"../../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","../../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/types.cjs","../bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","../caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/constants.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getQuotesReceivedProperties=n.isCustomSlippage=n.isHardwareWallet=n.getRequestParams=n.formatProviderLabel=n.getSwapTypeFromQuote=n.getSwapType=n.toInputChangedPropertyValue=n.toInputChangedPropertyKey=void 0;const s=e("./constants.cjs"),r=e("../../constants/bridge.cjs"),o=e("../../types.cjs"),a=e("../bridge.cjs"),i=e("../caip-formatters.cjs");n.toInputChangedPropertyKey={srcTokenAddress:"token_source",destTokenAddress:"token_destination",srcChainId:"chain_source",destChainId:"chain_destination",slippage:"slippage"},n.toInputChangedPropertyValue={srcTokenAddress:({srcTokenAddress:e,srcChainId:t})=>t?(0,i.formatAddressToAssetId)(e??"",t):undefined,destTokenAddress:({destTokenAddress:e,destChainId:t})=>t?(0,i.formatAddressToAssetId)(e??"",t):undefined,srcChainId:({srcChainId:e})=>e?(0,i.formatChainIdToCaip)(e):undefined,destChainId:({destChainId:e})=>e?(0,i.formatChainIdToCaip)(e):undefined,slippage:({slippage:e})=>e?Number(e):e};n.getSwapType=(e,t)=>e&&!(0,a.isCrossChain)(e,t??e)?s.MetricsSwapType.SINGLE:s.MetricsSwapType.CROSSCHAIN;n.getSwapTypeFromQuote=e=>(0,n.getSwapType)(e.srcChainId,e.destChainId);n.formatProviderLabel=({bridgeId:e,bridges:t})=>`${e}_${t[0]}`;n.getRequestParams=({srcChainId:e,destChainId:t,srcTokenAddress:n,destTokenAddress:s})=>{const r=(0,i.formatChainIdToCaip)(e??o.ChainId.ETH);return{chain_id_source:r,chain_id_destination:t?(0,i.formatChainIdToCaip)(t):null,token_address_source:n?(0,i.formatAddressToAssetId)(n,r)??(0,a.getNativeAssetForChainId)(r)?.assetId??null:(0,a.getNativeAssetForChainId)(r)?.assetId??null,token_address_destination:s?(0,i.formatAddressToAssetId)(s,t??r)??null:null}};n.isHardwareWallet=e=>e?.metadata?.keyring.type?.includes("Hardware")??!1;n.isCustomSlippage=e=>e!==r.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest.slippage;n.getQuotesReceivedProperties=(e,t=[],s=!0,r)=>{const o=e?(0,n.formatProviderLabel)(e.quote):"_";return{can_submit:s,gas_included:Boolean(e?.quote?.gasIncluded),gas_included_7702:Boolean(e?.quote?.gasIncluded7702),quoted_time_minutes:e?.estimatedProcessingTimeInSeconds?e.estimatedProcessingTimeInSeconds/60:0,usd_quoted_gas:Number(e?.gasFee?.effective?.usd??0),usd_quoted_return:Number(e?.toTokenAmount?.usd??0),best_quote_provider:r?(0,n.formatProviderLabel)(r.quote):o,provider:o,warnings:t,price_impact:Number(e?.quote.priceData?.priceImpact??0)}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/metrics/properties.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs",{"../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs","./snaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs","./trade-utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.appendFeesToQuotes=void 0;const s=e("@metamask/utils"),r=e("./bridge.cjs"),o=e("./caip-formatters.cjs"),a=e("./snaps.cjs"),i=e("./trade-utils.cjs"),c=e("../constants/chains.cjs");n.appendFeesToQuotes=async(e,t,n,l)=>{const d=await(async(e,t)=>{if(e.some(({quote:e})=>{const t=(0,o.formatChainIdToCaip)(e.srcChainId);return![c.CHAIN_IDS.OPTIMISM,c.CHAIN_IDS.BASE].map(o.formatChainIdToCaip).includes(t)}))return undefined;const n=Promise.allSettled(e.map(async e=>{const{quote:n,trade:o,approval:a}=e,i=(0,s.numberToHex)(n.srcChainId),c=e=>({from:e.from,to:e.to,value:e.value,data:e.data,gasLimit:e.gasLimit?.toString()}),l=a?await t({transactionParams:c(a),chainId:i}):"0x0",d=await t({transactionParams:c(o),chainId:i});return l===undefined||d===undefined?undefined:{...e,l1GasFeesInHexWei:(0,r.sumHexes)(l,d)}}));return(await n).reduce((e,t)=>("fulfilled"===t.status&&t.value?e.push(t.value):"rejected"===t.status&&console.error("Error calculating L1 gas fees for quote",t.reason),e),[])})(e,n),u=await(async(e,t,n)=>{if(e.some(({quote:{srcChainId:e}})=>!(0,r.isNonEvmChainId)(e)))return undefined;const s=Promise.allSettled(e.map(async e=>{const{trade:s,quote:r}=e;if(!n?.metadata?.snap?.id||!s)return e;try{const c=(0,o.formatChainIdToCaip)(r.srcChainId),l=(0,i.extractTradeData)(s),d=(0,i.isTronTrade)(s)?{visible:s.visible,type:s.raw_data?.contract?.[0]?.type,feeLimit:s.raw_data?.fee_limit}:undefined,u=await t.call("SnapController:handleRequest",(0,a.computeFeeRequest)(n?.metadata?.snap?.id,l,n?.id,c,d)),m=u?.find(e=>"base"===e.type)||u?.find(e=>"priority"===e.type)||u?.[0],h=m?.asset?.amount||"0";return{...e,nonEvmFeesInNative:h}}catch(t){return console.error(`Failed to compute non-EVM fees for quote ${r.requestId}:`,t),{...e,nonEvmFeesInNative:undefined}}}));return(await s).reduce((e,t)=>("fulfilled"===t.status&&t.value&&e.push(t.value),e),[])})(e,t,l);return d??u??e}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote-fees.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs","./validators.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bignumber.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.sortQuotes=n.formatEtaInMinutes=n.calcSlippagePercentage=n.calcCost=n.calcSwapRate=n.calcAdjustedReturn=n.calcIncludedTxFees=n.calcTotalMaxNetworkFee=n.calcTotalEstimatedNetworkFee=n.calcEstimatedAndMaxTotalGasFee=n.calcRelayerFee=n.calcSentAmount=n.calcToAmount=n.calcNonEvmTotalNetworkFee=n.getQuoteIdentifier=n.isValidQuoteRequest=void 0;const s=e("@metamask/controller-utils"),r=e("bignumber.js"),o=e("./bridge.cjs"),a=e("./validators.cjs");n.isValidQuoteRequest=(e,t=!0)=>{const n=["srcTokenAddress","destTokenAddress","srcChainId","destChainId","walletAddress"];if(t&&n.push("srcTokenAmount"),e.destChainId&&e.srcChainId&&e.destChainId!==e.srcChainId&&((0,o.isNonEvmChainId)(e.destChainId)||(0,o.isNonEvmChainId)(e.srcChainId))&&(n.push("destWalletAddress"),!e.destWalletAddress))return!1;const s=[];return e.slippage!==undefined&&s.push("slippage"),n.every(t=>t in e&&"string"==typeof e[t]&&e[t]!==undefined&&""!==e[t]&&null!==e[t])&&s.every(t=>t in e&&"number"==typeof e[t]&&e[t]!==undefined&&!isNaN(Number(e[t]))&&null!==e[t])&&(!t||Boolean((e.srcTokenAmount??"").match(/^[1-9]\d*$/u)))};n.getQuoteIdentifier=e=>`${e.bridgeId}-${e.bridges[0]}-${e.steps.length}`;const i=(e,t)=>{const n=new r.BigNumber(10).pow(t??0);return new r.BigNumber(e).div(n)};n.calcNonEvmTotalNetworkFee=(e,{exchangeRate:t,usdExchangeRate:n})=>{const{nonEvmFeesInNative:s}=e,o=new r.BigNumber(s??"0");return{amount:o.toString(),valueInCurrency:t?o.times(t).toString():null,usd:n?o.times(n).toString():null}};n.calcToAmount=(e,t,{exchangeRate:n,usdExchangeRate:s})=>{const r=i(e,t.decimals);return{amount:r.toString(),valueInCurrency:n?r.times(n).toString():null,usd:s?r.times(s).toString():null}};n.calcSentAmount=({srcTokenAmount:e,srcAsset:t,feeData:n},{exchangeRate:s,usdExchangeRate:o})=>{const a=Object.values(n).filter(e=>e&&e.amount&&e.asset?.assetId===t.assetId).reduce((e,{amount:t})=>e.plus(t),new r.BigNumber(e)),c=i(a,t.decimals);return{amount:c.toString(),valueInCurrency:s?c.times(s).toString():null,usd:o?c.times(o).toString():null}};n.calcRelayerFee=(e,{exchangeRate:t,usdExchangeRate:a})=>{const{quote:c,trade:l}=e,d=new r.BigNumber((0,s.convertHexToDecimal)(l.value||"0x0"));let u=i(d,18);if((0,o.isNativeAddress)(c.srcAsset.address)){const e=(0,n.calcSentAmount)(c,{exchangeRate:t,usdExchangeRate:a}).amount;u=u.minus(e)}return{amount:u,valueInCurrency:t?u.times(t):null,usd:a?u.times(a):null}};const c=({approvalGasLimit:e,resetApprovalGasLimit:t,tradeGasLimit:n,l1GasFeesInHexWei:o,feePerGasInDecGwei:a,nativeToDisplayCurrencyExchangeRate:i,nativeToUsdExchangeRate:c})=>{const l=new r.BigNumber(n?.toString()??"0").plus(e?.toString()??"0").plus(t?.toString()??"0"),d=(0,s.weiHexToGweiDec)((0,s.toHex)(o??"0")),u=l.times(a).plus(d).times(new r.BigNumber(10).pow(-9)),m=i?u.times(i.toString()):null,h=c?u.times(c.toString()):null;return{amount:u.toString(),valueInCurrency:m?.toString()??null,usd:h?.toString()??null}};n.calcEstimatedAndMaxTotalGasFee=({bridgeQuote:{approval:e,trade:t,l1GasFeesInHexWei:n,resetApproval:s},estimatedBaseFeeInDecGwei:r,maxFeePerGasInDecGwei:o,feePerGasInDecGwei:a,exchangeRate:i,usdExchangeRate:l})=>{const{amount:d,valueInCurrency:u,usd:m}=c({approvalGasLimit:e?.effectiveGas??e?.gasLimit,resetApprovalGasLimit:s?.effectiveGas??s?.gasLimit,tradeGasLimit:t?.effectiveGas??t?.gasLimit,l1GasFeesInHexWei:n,feePerGasInDecGwei:a,nativeToDisplayCurrencyExchangeRate:i,nativeToUsdExchangeRate:l}),{amount:h,valueInCurrency:p,usd:f}=c({approvalGasLimit:e?.gasLimit,resetApprovalGasLimit:s?.gasLimit,tradeGasLimit:t?.gasLimit,l1GasFeesInHexWei:n,feePerGasInDecGwei:a,nativeToDisplayCurrencyExchangeRate:i,nativeToUsdExchangeRate:l}),{amount:g,valueInCurrency:k,usd:w}=c({approvalGasLimit:e?.gasLimit,resetApprovalGasLimit:s?.gasLimit,tradeGasLimit:t?.gasLimit,l1GasFeesInHexWei:n,feePerGasInDecGwei:o,nativeToDisplayCurrencyExchangeRate:i,nativeToUsdExchangeRate:l});return{effective:{amount:d,valueInCurrency:u,usd:m},total:{amount:h,valueInCurrency:p,usd:f},max:{amount:g,valueInCurrency:k,usd:w}}};n.calcTotalEstimatedNetworkFee=({total:e},t)=>({amount:new r.BigNumber(e?.amount??"0").plus(t.amount).toString(),valueInCurrency:e?.valueInCurrency?new r.BigNumber(e.valueInCurrency).plus(t.valueInCurrency||"0").toString():null,usd:e?.usd?new r.BigNumber(e.usd).plus(t.usd||"0").toString():null});n.calcTotalMaxNetworkFee=(e,t)=>({amount:new r.BigNumber(e.max.amount).plus(t.amount).toString(),valueInCurrency:e.max.valueInCurrency?new r.BigNumber(e.max.valueInCurrency).plus(t.valueInCurrency||"0").toString():null,usd:e.max.usd?new r.BigNumber(e.max.usd).plus(t.usd||"0").toString():null});n.calcIncludedTxFees=({gasIncluded:e,gasIncluded7702:t,srcAsset:n,feeData:{txFee:s}},r,o)=>{if(!s||!e&&!t)return null;const{exchangeRate:a,usdExchangeRate:c}=s.asset.assetId===n.assetId?r:o,l=i(s.amount,s.asset.decimals);return{amount:l.toString(),valueInCurrency:a?l.times(a).toString():null,usd:c?l.times(c).toString():null}};n.calcAdjustedReturn=(e,t,{feeData:{txFee:n},destAsset:{assetId:s}})=>n?.asset?.assetId===s?{valueInCurrency:e.valueInCurrency,usd:e.usd}:{valueInCurrency:e.valueInCurrency&&t.valueInCurrency?new r.BigNumber(e.valueInCurrency).minus(t.valueInCurrency).toString():null,usd:e.usd&&t.usd?new r.BigNumber(e.usd).minus(t.usd).toString():null};n.calcSwapRate=(e,t)=>new r.BigNumber(t).div(e).toString();n.calcCost=(e,t)=>({valueInCurrency:e.valueInCurrency&&t.valueInCurrency?new r.BigNumber(t.valueInCurrency).minus(e.valueInCurrency).toString():null,usd:e.usd&&t.usd?new r.BigNumber(t.usd).minus(e.usd).toString():null});n.calcSlippagePercentage=(e,t)=>{const s=(0,n.calcCost)(e,t);return s.valueInCurrency&&t.valueInCurrency?new r.BigNumber(s.valueInCurrency).div(t.valueInCurrency).times(100).abs().toString():s.usd&&t.usd?new r.BigNumber(s.usd).div(t.usd).times(100).abs().toString():null};n.formatEtaInMinutes=e=>e<60?"< 1":(e/60).toFixed();n.sortQuotes=(e,t)=>t===a.FeatureId.PERPS?e.sort((e,t)=>e.estimatedProcessingTimeInSeconds-t.estimatedProcessingTimeInSeconds):e}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/quote.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs",{"./bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/bridge.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getDefaultSlippagePercentage=n.BRIDGE_DEFAULT_SLIPPAGE=void 0;const s=e("./bridge.cjs");n.BRIDGE_DEFAULT_SLIPPAGE=.5;const r=undefined;n.getDefaultSlippagePercentage=({srcTokenAddress:e,destTokenAddress:t,srcChainId:o,destChainId:a},i,c)=>!o||(0,s.isCrossChain)(o,a)?n.BRIDGE_DEFAULT_SLIPPAGE:(0,s.isSolanaChainId)(o)?r:e&&t&&i?.map(e=>e.toLowerCase()).includes(e.toLowerCase())&&(c??i)?.map(e=>e.toLowerCase()).includes(t.toLowerCase())?.5:2}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/slippage.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs",{"../constants/bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/bridge.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.computeFeeRequest=n.getMinimumBalanceForRentExemptionInLamports=n.getMinimumBalanceForRentExemptionRequest=void 0;const s=e("@metamask/keyring-api"),r=e("uuid"),o=e("../constants/bridge.cjs");n.getMinimumBalanceForRentExemptionRequest=e=>({snapId:e,origin:"metamask",handler:"onProtocolRequest",request:{method:" ",jsonrpc:"2.0",params:{scope:s.SolScope.Mainnet,request:{id:(0,r.v4)(),jsonrpc:"2.0",method:"getMinimumBalanceForRentExemption",params:[0,{commitment:"confirmed"}]}}}});n.getMinimumBalanceForRentExemptionInLamports=async(e,t)=>String(await t.call("SnapController:handleRequest",(0,n.getMinimumBalanceForRentExemptionRequest)(e)).catch(e=>(console.error("Error setting minimum balance for rent exemption",e),o.DEFAULT_BRIDGE_CONTROLLER_STATE.minimumBalanceForRentExemptionInLamports)));n.computeFeeRequest=(e,t,n,s,o)=>({snapId:e,origin:"metamask",handler:"onClientRequest",request:{id:(0,r.v4)(),jsonrpc:"2.0",method:"computeFee",params:{transaction:t,accountId:n,scope:s,...o&&{options:o}}}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/snaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs",{"../constants/chains.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/chains.cjs","../constants/swaps.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/swaps.cjs","../constants/tokens.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/constants/tokens.cjs","./caip-formatters.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/caip-formatters.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.fetchTokens=n.DEV_BASE_URL=n.API_BASE_URL=n.getSwapsContractAddress=n.isValidSwapsContractAddress=void 0;const s=e("./caip-formatters.cjs"),r=e("../constants/chains.cjs"),o=e("../constants/swaps.cjs"),a=e("../constants/tokens.cjs");function i(e){return e?{"X-Client-Id":e}:undefined}n.isValidSwapsContractAddress=function(e,t){return!(!t||!o.ALLOWED_CONTRACT_ADDRESSES[e])&&o.ALLOWED_CONTRACT_ADDRESSES[e].some(e=>t.toLowerCase()===e.toLowerCase())},n.getSwapsContractAddress=function(e){return o.SWAPS_CONTRACT_ADDRESSES[e]},n.API_BASE_URL="https://swap.api.cx.metamask.io",n.DEV_BASE_URL="https://swap.dev-api.cx.metamask.io",n.fetchTokens=async function(e,t,o){const[c,l]=e===r.CHAIN_IDS.LOCALHOST?[r.CHAIN_IDS.MAINNET,n.DEV_BASE_URL]:[e,n.API_BASE_URL],d=`${l}/networks/${(0,s.formatChainIdToDec)(c)}/tokens`,u=(await t(d,{headers:i(o)})).filter(e=>e.address!==a.DEFAULT_TOKEN_ADDRESS),m=a.SWAPS_CHAINID_DEFAULT_TOKEN_MAP[e];return u.push(m),u}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/swaps.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs",{buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},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.extractTradeData=n.isTronTrade=n.isBitcoinTrade=n.isEvmTxData=void 0;n.isEvmTxData=e=>"object"==typeof e&&null!==e&&"data"in e&&"chainId"in e&&"to"in e;n.isBitcoinTrade=e=>"object"==typeof e&&null!==e&&"unsignedPsbtBase64"in e;n.isTronTrade=e=>"object"==typeof e&&null!==e&&"raw_data_hex"in e;n.extractTradeData=t=>(0,n.isBitcoinTrade)(t)?t.unsignedPsbtBase64:(0,n.isTronTrade)(t)?e.from(t.raw_data_hex,"hex").toString("base64"):"string"==typeof t?t:(0,n.isEvmTxData)(t)?t.data:""}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/trade-utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateQuoteResponse=n.QuoteResponseSchema=n.TronTradeDataSchema=n.BitcoinTradeDataSchema=n.TxDataSchema=n.QuoteSchema=n.StepSchema=n.ProtocolSchema=n.FeeDataSchema=n.validateSwapsTokenObject=n.validateFeatureFlagsResponse=n.PlatformConfigSchema=n.PriceImpactThresholdSchema=n.ChainConfigurationSchema=n.BridgeAssetSchema=n.truthyString=n.ActionTypes=n.FeatureId=n.FeeType=void 0;const s=e("@metamask/controller-utils"),r=e("@metamask/superstruct"),o=e("@metamask/utils");var a,i,c;!function(e){e.METABRIDGE="metabridge",e.REFUEL="refuel",e.TX_FEE="txFee"}(a||(n.FeeType=a={})),function(e){e.PERPS="perps"}(i||(n.FeatureId=i={})),function(e){e.BRIDGE="bridge",e.SWAP="swap",e.REFUEL="refuel"}(c||(n.ActionTypes=c={}));const l=(0,r.define)("HexAddress",e=>(0,s.isValidHexAddress)(e,{allowNonPrefixed:!1})),d=(0,r.define)("HexString",e=>(0,o.isStrictHexString)(e)),u=(0,r.define)("VersionString",e=>"string"==typeof e&&/^(\d+\.*){2}\d+$/u.test(e)&&3===e.split(".").length);n.truthyString=e=>Boolean(e?.length);const m=(0,r.pattern)((0,r.string)(),/^\d+$/u),h=(0,r.number)();n.BridgeAssetSchema=(0,r.type)({chainId:h,address:(0,r.string)(),assetId:o.CaipAssetTypeStruct,symbol:(0,r.string)(),name:(0,r.string)(),decimals:(0,r.number)(),icon:(0,r.optional)((0,r.nullable)((0,r.string)())),iconUrl:(0,r.optional)((0,r.nullable)((0,r.string)()))});const p=(0,r.type)({standard:(0,r.record)((0,r.string)(),(0,r.string)()),other:(0,r.record)((0,r.string)(),(0,r.string)())});n.ChainConfigurationSchema=(0,r.type)({isActiveSrc:(0,r.boolean)(),isActiveDest:(0,r.boolean)(),refreshRate:(0,r.optional)((0,r.number)()),topAssets:(0,r.optional)((0,r.array)((0,r.string)())),stablecoins:(0,r.optional)((0,r.array)((0,r.string)())),isUnifiedUIEnabled:(0,r.optional)((0,r.boolean)()),isSingleSwapBridgeButtonEnabled:(0,r.optional)((0,r.boolean)()),isGaslessSwapEnabled:(0,r.optional)((0,r.boolean)()),noFeeAssets:(0,r.optional)((0,r.array)((0,r.string)())),defaultPairs:(0,r.optional)(p)}),n.PriceImpactThresholdSchema=(0,r.type)({gasless:(0,r.number)(),normal:(0,r.number)()});const f=(0,r.type)({aggIds:(0,r.optional)((0,r.array)((0,r.string)())),bridgeIds:(0,r.optional)((0,r.array)((0,r.string)())),fee:(0,r.optional)((0,r.number)())}),g=(0,r.enums)(Object.values(i));n.PlatformConfigSchema=(0,r.type)({priceImpactThreshold:(0,r.optional)(n.PriceImpactThresholdSchema),quoteRequestOverrides:(0,r.optional)((0,r.record)(g,(0,r.optional)(f))),minimumVersion:(0,r.string)(),refreshRate:(0,r.number)(),maxRefreshCount:(0,r.number)(),support:(0,r.boolean)(),chains:(0,r.record)((0,r.string)(),n.ChainConfigurationSchema),bip44DefaultPairs:(0,r.optional)((0,r.record)((0,r.string)(),(0,r.optional)(p))),sse:(0,r.optional)((0,r.type)({enabled:(0,r.boolean)(),minimumVersion:u}))});n.validateFeatureFlagsResponse=e=>(0,r.is)(e,n.PlatformConfigSchema);n.validateSwapsTokenObject=e=>(0,r.is)(e,n.BridgeAssetSchema),n.FeeDataSchema=(0,r.type)({amount:m,asset:n.BridgeAssetSchema}),n.ProtocolSchema=(0,r.type)({name:(0,r.string)(),displayName:(0,r.optional)((0,r.string)()),icon:(0,r.optional)((0,r.string)())}),n.StepSchema=(0,r.type)({action:(0,r.enums)(Object.values(c)),srcChainId:h,destChainId:(0,r.optional)(h),srcAsset:n.BridgeAssetSchema,destAsset:n.BridgeAssetSchema,srcAmount:(0,r.string)(),destAmount:(0,r.string)(),protocol:n.ProtocolSchema});const k=n.StepSchema;n.QuoteSchema=(0,r.type)({requestId:(0,r.string)(),srcChainId:h,srcAsset:n.BridgeAssetSchema,srcTokenAmount:(0,r.string)(),destChainId:h,destAsset:n.BridgeAssetSchema,destTokenAmount:(0,r.string)(),minDestTokenAmount:(0,r.string)(),feeData:(0,r.type)({[a.METABRIDGE]:n.FeeDataSchema,[a.TX_FEE]:(0,r.optional)((0,r.intersection)([n.FeeDataSchema,(0,r.type)({maxFeePerGas:(0,r.string)(),maxPriorityFeePerGas:(0,r.string)()})]))}),gasIncluded:(0,r.optional)((0,r.boolean)()),gasIncluded7702:(0,r.optional)((0,r.boolean)()),bridgeId:(0,r.string)(),bridges:(0,r.array)((0,r.string)()),steps:(0,r.array)(n.StepSchema),refuel:(0,r.optional)(k),priceData:(0,r.optional)((0,r.type)({totalFromAmountUsd:(0,r.optional)((0,r.string)()),totalToAmountUsd:(0,r.optional)((0,r.string)()),priceImpact:(0,r.optional)((0,r.string)()),totalFeeAmountUsd:(0,r.optional)((0,r.string)())})),gasSponsored:(0,r.optional)((0,r.boolean)())}),n.TxDataSchema=(0,r.type)({chainId:(0,r.number)(),to:l,from:l,value:d,data:d,gasLimit:(0,r.nullable)((0,r.number)()),effectiveGas:(0,r.optional)((0,r.number)())}),n.BitcoinTradeDataSchema=(0,r.type)({unsignedPsbtBase64:(0,r.string)(),inputsToSign:(0,r.nullable)((0,r.array)((0,r.type)({})))}),n.TronTradeDataSchema=(0,r.type)({raw_data_hex:(0,r.string)(),visible:(0,r.optional)((0,r.boolean)()),raw_data:(0,r.optional)((0,r.nullable)((0,r.type)({contract:(0,r.optional)((0,r.array)((0,r.type)({type:(0,r.optional)((0,r.string)())})))})))}),n.QuoteResponseSchema=(0,r.type)({quote:n.QuoteSchema,estimatedProcessingTimeInSeconds:(0,r.number)(),approval:(0,r.optional)((0,r.union)([n.TxDataSchema,n.TronTradeDataSchema])),trade:(0,r.union)([n.TxDataSchema,n.BitcoinTradeDataSchema,n.TronTradeDataSchema,(0,r.string)()])});n.validateQuoteResponse=e=>((0,r.assert)(e,n.QuoteResponseSchema),!0)}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/bridge-controller/dist/utils/validators.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkController/MultichainNetworkController.cjs",{"../api/accounts-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/api/accounts-api.cjs","../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/constants.cjs","../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/utils.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,l,d,u,m=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},h=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.MultichainNetworkController=void 0;const p=e("@metamask/base-controller"),f=e("@metamask/keyring-api"),g=e("@metamask/utils"),k=e("../api/accounts-api.cjs"),w=e("../constants.cjs"),b=e("../types.cjs"),_=e("../utils.cjs");class E extends p.BaseController{constructor({messenger:e,state:t,networkService:n}){super({messenger:e,name:b.MULTICHAIN_NETWORK_CONTROLLER_NAME,metadata:w.MULTICHAIN_NETWORK_CONTROLLER_METADATA,state:{...(0,w.getDefaultMultichainNetworkControllerState)(),...t,multichainNetworkConfigurationsByChainId:w.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS}}),s.add(this),r.set(this,void 0),m(this,r,n,"f"),h(this,s,"m",d).call(this),h(this,s,"m",u).call(this)}async setActiveNetwork(e){if((0,g.isCaipChainId)(e)){if(!(0,_.checkIfSupportedCaipChainId)(e))throw new Error(`Unsupported Caip chain ID: ${String(e)}`);return h(this,s,"m",a).call(this,e)}return await h(this,s,"m",o).call(this,e)}async getNetworksWithTransactionActivityByAccounts(){const e=this.messenger.call("AccountsController:listMultichainAccounts").filter(e=>(0,f.isEvmAccountType)(e.type));if(!e||0===e.length)return this.state.networksWithTransactionActivity;const t=e.map(e=>(0,k.toAllowedCaipAccountIds)(e)).flat(),n=await h(this,r,"f").fetchNetworkActivity(t),s=(0,k.toActiveNetworksByAddress)(n);return this.update(e=>{e.networksWithTransactionActivity=s}),this.state.networksWithTransactionActivity}async removeNetwork(e){return(0,_.isEvmCaipChainId)(e)?await h(this,s,"m",i).call(this,e):h(this,s,"m",c).call(this,e)}}n.MultichainNetworkController=E,r=new WeakMap,s=new WeakSet,o=async function(e){const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState"),n=!this.state.isEvmSelected,s=e!==t;(n||s)&&(n&&this.update(e=>{e.isEvmSelected=!0}),s&&await this.messenger.call("NetworkController:setActiveNetwork",e),(n||s)&&this.messenger.publish("MultichainNetworkController:networkDidChange",e))},a=function(e){(e!==this.state.selectedMultichainNetworkChainId||this.state.isEvmSelected)&&(this.update(t=>{t.selectedMultichainNetworkChainId=e,t.isEvmSelected=!1}),this.messenger.publish("MultichainNetworkController:networkDidChange",e))},i=async function(e){const t=(0,_.convertEvmCaipToHexChainId)(e);if(this.messenger.call("NetworkController:getSelectedChainId")===t){if(this.state.isEvmSelected)throw new Error("Cannot remove the currently selected network");const e="0x1",t=this.messenger.call("NetworkController:findNetworkClientIdByChainId",e);await this.messenger.call("NetworkController:setActiveNetwork",t)}this.messenger.call("NetworkController:removeNetwork",t)},c=function(e){throw new Error("Removal of non-EVM networks is not supported")},l=function(e){const{type:t,scopes:n}=e;if((0,f.isEvmAccountType)(t)){if(this.state.isEvmSelected)return;return void this.update(e=>{e.isEvmSelected=!0})}if(n.includes(this.state.selectedMultichainNetworkChainId))return void this.update(e=>{e.isEvmSelected=!1});const s=(0,_.getChainIdForNonEvm)(n);this.update(e=>{e.selectedMultichainNetworkChainId=s,e.isEvmSelected=!1})},d=function(){this.messenger.subscribe("AccountsController:selectedAccountChange",e=>h(this,s,"m",l).call(this,e))},u=function(){this.messenger.registerActionHandler("MultichainNetworkController:setActiveNetwork",this.setActiveNetwork.bind(this)),this.messenger.registerActionHandler("MultichainNetworkController:getNetworksWithTransactionActivityByAccounts",this.getNetworksWithTransactionActivityByAccounts.bind(this))}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkController/MultichainNetworkController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkService/MultichainNetworkService.cjs",{"../api/accounts-api.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/api/accounts-api.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},c=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.MultichainNetworkService=void 0;const l=e("@metamask/superstruct"),d=e("lodash"),u=e("../api/accounts-api.cjs");n.MultichainNetworkService=class{constructor({fetch:e,batchSize:t}){s.add(this),r.set(this,void 0),o.set(this,void 0),i(this,r,e,"f"),i(this,o,t??20,"f")}async fetchNetworkActivity(e){if(0===e.length)return{activeNetworks:[]};if(e.length<=c(this,o,"f"))return c(this,s,"m",a).call(this,e);const t=(0,d.chunk)(e,c(this,o,"f"));return{activeNetworks:(await Promise.all(t.map(e=>c(this,s,"m",a).call(this,e)))).flatMap(e=>e.activeNetworks)}}},r=new WeakMap,o=new WeakMap,s=new WeakSet,a=async function(e){try{const t=(0,u.buildActiveNetworksUrl)(e),n=await c(this,r,"f").call(this,t.toString(),{method:"GET",headers:{[u.MULTICHAIN_ACCOUNTS_CLIENT_HEADER]:u.MULTICHAIN_ACCOUNTS_CLIENT_ID,Accept:"application/json"}});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const s=await n.json();return(0,l.assert)(s,u.ActiveNetworksResponseStruct),s}catch(e){if(e instanceof Error){if("AbortError"===e.name)throw new Error("Request timeout: Failed to fetch active networks");throw e}throw new Error(`Failed to fetch active networks: ${String(e)}`)}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkService/MultichainNetworkService.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/api/accounts-api.cjs",{"@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.buildActiveNetworksUrl=n.toActiveNetworksByAddress=n.toAllowedCaipAccountIds=n.MULTICHAIN_ALLOWED_ACTIVE_NETWORK_SCOPES=n.MULTICHAIN_ACCOUNTS_CLIENT_ID=n.MULTICHAIN_ACCOUNTS_CLIENT_HEADER=n.MULTICHAIN_ACCOUNTS_BASE_URL=n.ActiveNetworksResponseStruct=void 0;const s=e("@metamask/keyring-api"),r=e("@metamask/superstruct"),o=e("@metamask/utils");n.ActiveNetworksResponseStruct=(0,r.object)({activeNetworks:(0,r.array)(o.CaipAccountIdStruct)}),n.MULTICHAIN_ACCOUNTS_BASE_URL="https://accounts.api.cx.metamask.io",n.MULTICHAIN_ACCOUNTS_CLIENT_HEADER="x-metamask-clientproduct",n.MULTICHAIN_ACCOUNTS_CLIENT_ID="metamask-multichain-network-controller",n.MULTICHAIN_ALLOWED_ACTIVE_NETWORK_SCOPES=[String(s.BtcScope.Mainnet),String(s.BtcScope.Testnet),String(s.BtcScope.Testnet4),String(s.BtcScope.Signet),String(s.BtcScope.Regtest),String(s.SolScope.Mainnet),String(s.SolScope.Devnet),String(s.EthScope.Mainnet),String(s.EthScope.Testnet),String(s.EthScope.Eoa),String(s.TrxScope.Mainnet),String(s.TrxScope.Nile),String(s.TrxScope.Shasta)],n.toAllowedCaipAccountIds=function(e){const t=[];for(const s of e.scopes)n.MULTICHAIN_ALLOWED_ACTIVE_NETWORK_SCOPES.includes(s)&&t.push(`${s}:${e.address}`);return t},n.toActiveNetworksByAddress=function(e){const t={};return e.activeNetworks.forEach(e=>{const{address:n,chain:{namespace:s,reference:r}}=(0,o.parseCaipAccountId)(e);t[n]||(t[n]={namespace:s,activeChains:[]}),t[n].activeChains.push(r)}),t},n.buildActiveNetworksUrl=function(e){const t=new URL(`${n.MULTICHAIN_ACCOUNTS_BASE_URL}/v2/activeNetworks`);return t.searchParams.append("accountIds",e.join(",")),t}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/api/accounts-api.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/constants.cjs",{"@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/network-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MULTICHAIN_NETWORK_DECIMAL_PLACES=n.MULTICHAIN_NETWORK_TICKER=n.MULTICHAIN_NETWORK_CONTROLLER_METADATA=n.getDefaultMultichainNetworkControllerState=n.NETWORKS_METADATA=n.NON_EVM_TESTNET_IDS=n.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS=n.TRX_SHASTA_NATIVE_ASSET=n.TRX_NILE_NATIVE_ASSET=n.TRX_NATIVE_ASSET=n.SOL_DEVNET_NATIVE_ASSET=n.SOL_TESTNET_NATIVE_ASSET=n.SOL_NATIVE_ASSET=n.BTC_REGTEST_NATIVE_ASSET=n.BTC_SIGNET_NATIVE_ASSET=n.BTC_TESTNET4_NATIVE_ASSET=n.BTC_TESTNET_NATIVE_ASSET=n.BTC_NATIVE_ASSET=void 0;const s=e("@metamask/keyring-api"),r=e("@metamask/network-controller");n.BTC_NATIVE_ASSET=`${s.BtcScope.Mainnet}/slip44:0`,n.BTC_TESTNET_NATIVE_ASSET=`${s.BtcScope.Testnet}/slip44:0`,n.BTC_TESTNET4_NATIVE_ASSET=`${s.BtcScope.Testnet4}/slip44:0`,n.BTC_SIGNET_NATIVE_ASSET=`${s.BtcScope.Signet}/slip44:0`,n.BTC_REGTEST_NATIVE_ASSET=`${s.BtcScope.Regtest}/slip44:0`,n.SOL_NATIVE_ASSET=`${s.SolScope.Mainnet}/slip44:501`,n.SOL_TESTNET_NATIVE_ASSET=`${s.SolScope.Testnet}/slip44:501`,n.SOL_DEVNET_NATIVE_ASSET=`${s.SolScope.Devnet}/slip44:501`,n.TRX_NATIVE_ASSET=`${s.TrxScope.Mainnet}/slip44:195`,n.TRX_NILE_NATIVE_ASSET=`${s.TrxScope.Nile}/slip44:195`,n.TRX_SHASTA_NATIVE_ASSET=`${s.TrxScope.Shasta}/slip44:195`,n.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS={[s.BtcScope.Mainnet]:{chainId:s.BtcScope.Mainnet,name:"Bitcoin",nativeCurrency:n.BTC_NATIVE_ASSET,isEvm:!1},[s.BtcScope.Testnet]:{chainId:s.BtcScope.Testnet,name:"Bitcoin Testnet",nativeCurrency:n.BTC_TESTNET_NATIVE_ASSET,isEvm:!1},[s.BtcScope.Testnet4]:{chainId:s.BtcScope.Testnet4,name:"Bitcoin Testnet4",nativeCurrency:n.BTC_TESTNET4_NATIVE_ASSET,isEvm:!1},[s.BtcScope.Signet]:{chainId:s.BtcScope.Signet,name:"Bitcoin Mutinynet",nativeCurrency:n.BTC_SIGNET_NATIVE_ASSET,isEvm:!1},[s.BtcScope.Regtest]:{chainId:s.BtcScope.Regtest,name:"Bitcoin Regtest",nativeCurrency:n.BTC_REGTEST_NATIVE_ASSET,isEvm:!1},[s.SolScope.Mainnet]:{chainId:s.SolScope.Mainnet,name:"Solana",nativeCurrency:n.SOL_NATIVE_ASSET,isEvm:!1},[s.SolScope.Testnet]:{chainId:s.SolScope.Testnet,name:"Solana Testnet",nativeCurrency:n.SOL_TESTNET_NATIVE_ASSET,isEvm:!1},[s.SolScope.Devnet]:{chainId:s.SolScope.Devnet,name:"Solana Devnet",nativeCurrency:n.SOL_DEVNET_NATIVE_ASSET,isEvm:!1},[s.TrxScope.Mainnet]:{chainId:s.TrxScope.Mainnet,name:"Tron",nativeCurrency:n.TRX_NATIVE_ASSET,isEvm:!1},[s.TrxScope.Nile]:{chainId:s.TrxScope.Nile,name:"Tron Nile",nativeCurrency:n.TRX_NILE_NATIVE_ASSET,isEvm:!1},[s.TrxScope.Shasta]:{chainId:s.TrxScope.Shasta,name:"Tron Shasta",nativeCurrency:n.TRX_SHASTA_NATIVE_ASSET,isEvm:!1}},n.NON_EVM_TESTNET_IDS=[s.BtcScope.Testnet,s.BtcScope.Testnet4,s.BtcScope.Signet,s.BtcScope.Regtest,s.SolScope.Testnet,s.SolScope.Devnet,s.TrxScope.Nile,s.TrxScope.Shasta],n.NETWORKS_METADATA={[s.BtcScope.Mainnet]:{features:[],status:r.NetworkStatus.Available},[s.SolScope.Mainnet]:{features:[],status:r.NetworkStatus.Available},[s.TrxScope.Mainnet]:{features:[],status:r.NetworkStatus.Available}};n.getDefaultMultichainNetworkControllerState=()=>({multichainNetworkConfigurationsByChainId:n.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS,selectedMultichainNetworkChainId:s.SolScope.Mainnet,isEvmSelected:!0,networksWithTransactionActivity:{}}),n.MULTICHAIN_NETWORK_CONTROLLER_METADATA={multichainNetworkConfigurationsByChainId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0},selectedMultichainNetworkChainId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0},isEvmSelected:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0},networksWithTransactionActivity:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!0,usedInUi:!0}},n.MULTICHAIN_NETWORK_TICKER={[s.BtcScope.Mainnet]:"BTC",[s.BtcScope.Testnet]:"tBTC",[s.BtcScope.Testnet4]:"tBTC",[s.BtcScope.Signet]:"sBTC",[s.BtcScope.Regtest]:"rBTC",[s.SolScope.Mainnet]:"SOL",[s.SolScope.Testnet]:"tSOL",[s.SolScope.Devnet]:"dSOL",[s.TrxScope.Mainnet]:"TRX",[s.TrxScope.Nile]:"tTRX",[s.TrxScope.Shasta]:"sTRX"},n.MULTICHAIN_NETWORK_DECIMAL_PLACES={[s.BtcScope.Mainnet]:8,[s.BtcScope.Testnet]:8,[s.BtcScope.Testnet4]:8,[s.BtcScope.Signet]:8,[s.BtcScope.Regtest]:8,[s.SolScope.Mainnet]:5,[s.SolScope.Testnet]:5,[s.SolScope.Devnet]:5,[s.TrxScope.Mainnet]:6,[s.TrxScope.Nile]:6,[s.TrxScope.Shasta]:6}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/index.cjs",{"./MultichainNetworkController/MultichainNetworkController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkController/MultichainNetworkController.cjs","./MultichainNetworkService/MultichainNetworkService.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/MultichainNetworkService/MultichainNetworkService.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/constants.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.toEvmCaipChainId=n.toMultichainNetworkConfigurationsByChainId=n.toMultichainNetworkConfiguration=n.checkIfSupportedCaipChainId=n.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS=n.MULTICHAIN_NETWORK_DECIMAL_PLACES=n.MULTICHAIN_NETWORK_TICKER=n.NON_EVM_TESTNET_IDS=n.getDefaultMultichainNetworkControllerState=n.MultichainNetworkService=n.MultichainNetworkController=void 0;var s=e("./MultichainNetworkController/MultichainNetworkController.cjs");Object.defineProperty(n,"MultichainNetworkController",{enumerable:!0,get:function(){return s.MultichainNetworkController}});var r=e("./MultichainNetworkService/MultichainNetworkService.cjs");Object.defineProperty(n,"MultichainNetworkService",{enumerable:!0,get:function(){return r.MultichainNetworkService}});var o=e("./constants.cjs");Object.defineProperty(n,"getDefaultMultichainNetworkControllerState",{enumerable:!0,get:function(){return o.getDefaultMultichainNetworkControllerState}}),Object.defineProperty(n,"NON_EVM_TESTNET_IDS",{enumerable:!0,get:function(){return o.NON_EVM_TESTNET_IDS}}),Object.defineProperty(n,"MULTICHAIN_NETWORK_TICKER",{enumerable:!0,get:function(){return o.MULTICHAIN_NETWORK_TICKER}}),Object.defineProperty(n,"MULTICHAIN_NETWORK_DECIMAL_PLACES",{enumerable:!0,get:function(){return o.MULTICHAIN_NETWORK_DECIMAL_PLACES}}),Object.defineProperty(n,"AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS",{enumerable:!0,get:function(){return o.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS}});var a=e("./utils.cjs");Object.defineProperty(n,"checkIfSupportedCaipChainId",{enumerable:!0,get:function(){return a.checkIfSupportedCaipChainId}}),Object.defineProperty(n,"toMultichainNetworkConfiguration",{enumerable:!0,get:function(){return a.toMultichainNetworkConfiguration}}),Object.defineProperty(n,"toMultichainNetworkConfigurationsByChainId",{enumerable:!0,get:function(){return a.toMultichainNetworkConfigurationsByChainId}}),Object.defineProperty(n,"toEvmCaipChainId",{enumerable:!0,get:function(){return a.toEvmCaipChainId}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MULTICHAIN_NETWORK_CONTROLLER_NAME=void 0,n.MULTICHAIN_NETWORK_CONTROLLER_NAME="MultichainNetworkController"}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/constants.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isKnownCaipNamespace=n.toMultichainNetworkConfigurationsByChainId=n.toMultichainNetworkConfiguration=n.convertEvmCaipToHexChainId=n.toEvmCaipChainId=n.checkIfSupportedCaipChainId=n.getChainIdForNonEvm=n.isEvmCaipChainId=void 0;const s=e("@metamask/utils"),r=e("./constants.cjs");n.isEvmCaipChainId=function(e){const{namespace:t}=(0,s.parseCaipChainId)(e);return t===s.KnownCaipNamespace.Eip155},n.getChainIdForNonEvm=function(e){const t=e.find(e=>Object.keys(r.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS).includes(e));if(t)return t;throw new Error(`Unsupported scope: ${e.join(", ")}.`)},n.checkIfSupportedCaipChainId=function(e){return Object.keys(r.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS).includes(e)};n.toEvmCaipChainId=e=>(0,s.toCaipChainId)(s.KnownCaipNamespace.Eip155,(0,s.hexToNumber)(e).toString()),n.convertEvmCaipToHexChainId=function(e){const{namespace:t,reference:n}=(0,s.parseCaipChainId)(e);if(t===s.KnownCaipNamespace.Eip155)return(0,s.add0x)(parseInt(n,10).toString(16));throw new Error(`Unsupported CAIP chain ID namespace: ${t}. Only eip155 is supported.`)};n.toMultichainNetworkConfiguration=e=>{const{chainId:t,name:s,rpcEndpoints:r,defaultRpcEndpointIndex:o,nativeCurrency:a,blockExplorerUrls:i,defaultBlockExplorerUrlIndex:c=0}=e;return{chainId:(0,n.toEvmCaipChainId)(t),isEvm:!0,name:s||r[o].url,nativeCurrency:a,blockExplorerUrls:i,defaultBlockExplorerUrlIndex:c}};n.toMultichainNetworkConfigurationsByChainId=e=>Object.entries(e).reduce((e,[,t])=>({...e,[(0,n.toEvmCaipChainId)(t.chainId)]:(0,n.toMultichainNetworkConfiguration)(t)}),{}),n.isKnownCaipNamespace=function(e){return Object.values(s.KnownCaipNamespace).includes(e)}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/NetworkController.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/constants.cjs","./create-auto-managed-network-client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-auto-managed-network-client.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/logger.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/types.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/swappable-obj-proxy":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/swappable-obj-proxy/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","fast-deep-equal":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-deep-equal/index.js",immer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/immer/dist/index.js",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js",reselect:"/home/runner/work/metamask-extension/metamask-extension/node_modules/reselect/dist/cjs/reselect.cjs","uri-js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/uri-js/dist/es5/uri.all.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,l,d,u,m,h,p,f,g,k,w,b,_,E,y,S,I,C,A,T,v,x,N,j,P=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),D=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),R=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)&&P(t,e,n);return D(t,e),t},O=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},M=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},B=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.NetworkController=n.selectAvailableNetworkClientIds=n.getAvailableNetworkClientIds=n.selectNetworkConfigurations=n.getNetworkConfigurations=n.getDefaultNetworkControllerState=n.knownKeysOf=n.RpcEndpointType=void 0;const L=e("@metamask/base-controller"),F=e("@metamask/controller-utils"),U=B(e("@metamask/eth-query")),H=e("@metamask/rpc-errors"),G=e("@metamask/swappable-obj-proxy"),q=e("@metamask/utils"),W=B(e("fast-deep-equal")),$=e("immer"),V=e("lodash"),K=e("reselect"),Y=R(e("uri-js")),z=e("uuid"),Q=e("./constants.cjs"),J=e("./create-auto-managed-network-client.cjs"),X=e("./logger.cjs"),Z=e("./types.cjs"),ee=(0,X.createModuleLogger)(X.projectLogger,"NetworkController"),te=/^https:\/\/(?<networkName>[^.]+)\.infura\.io\/v\d+\/(?<apiKey>.+)$/u;var ne;function se(e){return Object.keys(e)}!function(e){e.Custom="custom",e.Infura="infura"}(ne||(n.RpcEndpointType=ne={})),n.knownKeysOf=se;const re="NetworkController";function oe(e=[]){const t=Object.values(F.InfuraNetworkType).reduce((e,t)=>{const n=F.ChainId[t];if(Q.DEPRECATED_NETWORKS.has(n))return e;const s=`https://${t}.infura.io/v3/{infuraProjectId}`,r={blockExplorerUrls:[],chainId:n,defaultRpcEndpointIndex:0,name:F.NetworkNickname[t],nativeCurrency:F.NetworksTicker[t],rpcEndpoints:[{failoverUrls:[],networkClientId:t,type:ne.Infura,url:s}]};return{...e,[n]:r}},{}),n={[F.ChainId["megaeth-testnet"]]:ae(F.CustomNetworkType["megaeth-testnet"]),[F.ChainId["megaeth-testnet-v2"]]:ae(F.CustomNetworkType["megaeth-testnet-v2"]),[F.ChainId["monad-testnet"]]:ae(F.CustomNetworkType["monad-testnet"])};return e.reduce((e,t)=>((0,q.hasProperty)(n,t)&&(e[t]=n[t]),e),t)}function ae(e){const{ticker:t,rpcPrefs:n}=F.BUILT_IN_NETWORKS[e],s=F.BUILT_IN_CUSTOM_NETWORKS_RPC[e];return{blockExplorerUrls:[n.blockExplorerUrl],chainId:F.ChainId[e],defaultRpcEndpointIndex:0,defaultBlockExplorerUrlIndex:0,name:F.NetworkNickname[e],nativeCurrency:t,rpcEndpoints:[{failoverUrls:[],networkClientId:e,type:ne.Custom,url:s}]}}function ie(e){const t=oe(e);return{selectedNetworkClientId:F.InfuraNetworkType.mainnet,networksMetadata:{},networkConfigurationsByChainId:t}}n.getDefaultNetworkControllerState=ie;function ce(e){return Object.values(e.networkConfigurationsByChainId)}function le(e){return e.flatMap(e=>e.rpcEndpoints.map(e=>e.networkClientId))}function de(e){const t=Y.parse(e);return t.error===undefined&&("http"===t.scheme||"https"===t.scheme)}function ue(e){const t=te.exec(e);if(t?.groups){if((0,F.isInfuraNetworkType)(t.groups.networkName))return t.groups.networkName;throw new Error(`Unknown Infura network '${t.groups.networkName}'`)}throw new Error("Could not derive Infura network from RPC endpoint URL")}function me(e){return new Map(Object.values(e).flatMap(e=>e.rpcEndpoints.map(t=>[t.networkClientId,e])))}n.getNetworkConfigurations=ce,n.selectNetworkConfigurations=(0,K.createSelector)(e=>e.networkConfigurationsByChainId,e=>Object.values(e)),n.getAvailableNetworkClientIds=le,n.selectAvailableNetworkClientIds=(0,K.createSelector)(n.selectNetworkConfigurations,le);class he extends L.BaseController{constructor(e){const{messenger:t,state:n,infuraProjectId:g,log:k,getRpcServiceOptions:w,getBlockTrackerOptions:b,additionalDefaultNetworks:_,isRpcFailoverEnabled:y=!1}=e,S={...ie(_),...n};!function(e){const t=Object.entries(e.networkConfigurationsByChainId),n=le(ce(e));if(0===t.length)throw new Error("NetworkController state is invalid: `networkConfigurationsByChainId` cannot be empty");for(const[e,n]of t){if(e!==n.chainId)throw new Error(`NetworkController state has invalid \`networkConfigurationsByChainId\`: Network configuration '${n.name}' is filed under '${e}' which does not match its \`chainId\` of '${n.chainId}'`);if(n.blockExplorerUrls.length>0?n.defaultBlockExplorerUrlIndex===undefined||n.blockExplorerUrls[n.defaultBlockExplorerUrlIndex]===undefined:n.defaultBlockExplorerUrlIndex!==undefined)throw new Error(`NetworkController state has invalid \`networkConfigurationsByChainId\`: Network configuration '${n.name}' has a \`defaultBlockExplorerUrlIndex\` that does not refer to an entry in \`blockExplorerUrls\``);if(n.rpcEndpoints[n.defaultRpcEndpointIndex]===undefined)throw new Error(`NetworkController state has invalid \`networkConfigurationsByChainId\`: Network configuration '${n.name}' has a \`defaultRpcEndpointIndex\` that does not refer to an entry in \`rpcEndpoints\``)}if([...new Set(n)].length<n.length)throw new Error("NetworkController state has invalid `networkConfigurationsByChainId`: Every RPC endpoint across all network configurations must have a unique `networkClientId`")}(S);const I=function(e,t){const n=ce(e).sort((e,t)=>e.chainId.localeCompare(t.chainId)),s=le(n),r=Object.keys(e.networksMetadata).filter(e=>!s.includes(e));return(0,$.produce)(e,o=>{if(!s.includes(e.selectedNetworkClientId)){const s=n[0],r=s.rpcEndpoints[s.defaultRpcEndpointIndex].networkClientId;t.captureException?.(new Error(`\`selectedNetworkClientId\` '${e.selectedNetworkClientId}' does not refer to an RPC endpoint within a network configuration; correcting to '${r}'`)),o.selectedNetworkClientId=r}if(r.length>0){for(const e of r)delete o.networksMetadata[e];t.captureException?.(new Error("`networksMetadata` had invalid network client IDs, which have been removed"))}})}(S,t);if(!g||"string"!=typeof g)throw new Error("Invalid Infura project ID");super({name:re,metadata:{selectedNetworkClientId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},networksMetadata:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},networkConfigurationsByChainId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}},messenger:t,state:I}),s.add(this),r.set(this,void 0),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,void 0),d.set(this,void 0),u.set(this,void 0),m.set(this,void 0),h.set(this,void 0),p.set(this,void 0),f.set(this,void 0),O(this,o,g,"f"),O(this,u,k,"f"),O(this,m,w,"f"),O(this,h,b,"f"),O(this,f,y,"f"),O(this,a,this.state.selectedNetworkClientId,"f"),O(this,p,me(this.state.networkConfigurationsByChainId),"f"),this.messenger.registerActionHandler(`${this.name}:getEthQuery`,()=>M(this,r,"f")),this.messenger.registerActionHandler(`${this.name}:getNetworkClientById`,this.getNetworkClientById.bind(this)),this.messenger.registerActionHandler(`${this.name}:getEIP1559Compatibility`,this.getEIP1559Compatibility.bind(this)),this.messenger.registerActionHandler(`${this.name}:setActiveNetwork`,this.setActiveNetwork.bind(this)),this.messenger.registerActionHandler(`${this.name}:setProviderType`,this.setProviderType.bind(this)),this.messenger.registerActionHandler(`${this.name}:findNetworkClientIdByChainId`,this.findNetworkClientIdByChainId.bind(this)),this.messenger.registerActionHandler(`${this.name}:getNetworkConfigurationByChainId`,this.getNetworkConfigurationByChainId.bind(this)),this.messenger.registerActionHandler(`${this.name}:getNetworkConfigurationByNetworkClientId`,this.getNetworkConfigurationByNetworkClientId.bind(this)),this.messenger.registerActionHandler(`${this.name}:getSelectedNetworkClient`,this.getSelectedNetworkClient.bind(this)),this.messenger.registerActionHandler(`${this.name}:getSelectedChainId`,this.getSelectedChainId.bind(this)),this.messenger.registerActionHandler(`${this.name}:addNetwork`,this.addNetwork.bind(this)),this.messenger.registerActionHandler(`${this.name}:removeNetwork`,this.removeNetwork.bind(this)),this.messenger.registerActionHandler(`${this.name}:updateNetwork`,this.updateNetwork.bind(this)),this.messenger.subscribe(`${this.name}:rpcEndpointChainUnavailable`,({networkClientId:e})=>{M(this,s,"m",E).call(this,e,{networkStatus:Q.NetworkStatus.Unavailable})}),this.messenger.subscribe(`${this.name}:rpcEndpointChainDegraded`,({networkClientId:e})=>{M(this,s,"m",E).call(this,e,{networkStatus:Q.NetworkStatus.Degraded})}),this.messenger.subscribe(`${this.name}:rpcEndpointChainAvailable`,({networkClientId:e})=>{M(this,s,"m",E).call(this,e,{networkStatus:Q.NetworkStatus.Available})})}enableRpcFailover(){M(this,s,"m",g).call(this,!0)}disableRpcFailover(){M(this,s,"m",g).call(this,!1)}getProviderAndBlockTracker(){return{provider:M(this,i,"f"),blockTracker:M(this,c,"f")}}getSelectedNetworkClient(){return M(this,i,"f")&&M(this,c,"f")?{provider:M(this,i,"f"),blockTracker:M(this,c,"f")}:undefined}getSelectedChainId(){const e=this.getNetworkConfigurationByNetworkClientId(this.state.selectedNetworkClientId);return e?.chainId}getNetworkClientRegistry(){const e=M(this,s,"m",x).call(this);return Object.assign({},e[Z.NetworkClientType.Infura],e[Z.NetworkClientType.Custom])}getNetworkClientById(e){if(!e)throw new Error("No network client ID was provided.");const t=M(this,s,"m",x).call(this);if((0,F.isInfuraNetworkType)(e)){const n=t[Z.NetworkClientType.Infura][e];if(!n)throw new Error(`No Infura network client was found with the ID "${e}".`);return n}const n=t[Z.NetworkClientType.Custom][e];if(!n)throw new Error(`No custom network client was found with the ID "${e}".`);return n}initializeProvider({lookupNetwork:e=!0}={}){return M(this,s,"m",j).call(this,this.state.selectedNetworkClientId),e?this.lookupNetwork():undefined}async lookupNetwork(e){e?await M(this,s,"m",b).call(this,e):await M(this,s,"m",_).call(this)}async lookupNetworkByClientId(e){await M(this,s,"m",b).call(this,e)}async setProviderType(e){if(e===F.NetworkType.rpc)throw new Error(`NetworkController - cannot call "setProviderType" with type "${F.NetworkType.rpc}". Use "setActiveNetwork"`);if(!(0,F.isInfuraNetworkType)(e))throw new Error(`Unknown Infura provider type "${String(e)}".`);await this.setActiveNetwork(e)}async setActiveNetwork(e,t={}){O(this,a,this.state.selectedNetworkClientId,"f"),await M(this,s,"m",k).call(this,e,t)}async getEIP1559Compatibility(e){if(e)return this.get1559CompatibilityWithNetworkClientId(e);if(!M(this,r,"f"))return!1;const{EIPS:t}=this.state.networksMetadata[this.state.selectedNetworkClientId];if(t[1559]!==undefined)return t[1559];const n=await M(this,s,"m",S).call(this,this.state.selectedNetworkClientId);return this.update(e=>{n!==undefined&&(e.networksMetadata[e.selectedNetworkClientId].EIPS[1559]=n)}),n}async get1559CompatibilityWithNetworkClientId(e){let t=this.state.networksMetadata[e];t?.EIPS[1559]===undefined&&(await this.lookupNetwork(e),t=this.state.networksMetadata[e]);const{EIPS:n}=t;return n[1559]}async resetConnection(){await M(this,s,"m",k).call(this,this.state.selectedNetworkClientId)}getNetworkConfigurationByChainId(e){return this.state.networkConfigurationsByChainId[e]}getNetworkConfigurationByNetworkClientId(e){return M(this,p,"f").get(e)}addNetwork(e){const{rpcEndpoints:t}=e,n=M(this,s,"m",x).call(this);M(this,s,"m",I).call(this,{mode:"add",networkFields:e,autoManagedNetworkClientRegistry:n});const r=t.map(e=>({type:"add",rpcEndpoint:e.type===ne.Custom?{...e,networkClientId:(0,z.v4)()}:e})),o=M(this,s,"m",C).call(this,{networkFields:e,networkClientOperations:r});return M(this,s,"m",A).call(this,{networkFields:e,networkClientOperations:r,autoManagedNetworkClientRegistry:n}),this.update(t=>{M(this,s,"m",v).call(this,{state:t,mode:"add",networkFields:e,networkConfigurationToPersist:o})}),this.messenger.publish(`${re}:networkAdded`,o),o}async updateNetwork(e,t,{replacementSelectedRpcEndpointIndex:n}={}){const r=this.state.networkConfigurationsByChainId[e];if(r===undefined)throw new Error(`Could not update network: Cannot find network configuration for chain '${e}'`);const o=e,{chainId:a,rpcEndpoints:i}=t,c=M(this,s,"m",x).call(this);M(this,s,"m",I).call(this,{mode:"update",networkFields:t,existingNetworkConfiguration:r,autoManagedNetworkClientRegistry:c});const l=[];for(const e of i){const t=r.rpcEndpoints.find(t=>t.type===e.type&&t.url===e.url&&(t.networkClientId===e.networkClientId||e.networkClientId===undefined)),n=r.rpcEndpoints.find(t=>t.type===ne.Infura&&e.type===ne.Infura||t.type===e.type&&t.networkClientId===e.networkClientId&&t.url===e.url),s=r.rpcEndpoints.find(t=>t.type===e.type&&(t.url===e.url||t.networkClientId===e.networkClientId));if(a!==o&&n!==undefined){const t=e.type===ne.Infura?e:{...e,networkClientId:(0,z.v4)()};l.push({type:"replace",oldRpcEndpoint:n,newRpcEndpoint:t})}else if(t!==undefined){let n;n=t.type===ne.Infura?t:Object.assign({},e,{networkClientId:t.networkClientId}),l.push({type:"noop",rpcEndpoint:n})}else if(s===undefined){const t={type:"add",rpcEndpoint:e.type===ne.Infura?e:{...e,networkClientId:(0,z.v4)()}};l.push(t)}else{let t;t=e.type===ne.Infura?e:{...e,networkClientId:(0,z.v4)()},l.push({type:"replace",oldRpcEndpoint:s,newRpcEndpoint:t})}}for(const e of r.rpcEndpoints)if(!l.some(t=>{const n="replace"===t.type?t.oldRpcEndpoint:t.rpcEndpoint;return n.type===e.type&&n.networkClientId===e.networkClientId&&n.url===e.url})){const t={type:"remove",rpcEndpoint:e};l.push(t)}const d=M(this,s,"m",C).call(this,{networkFields:t,networkClientOperations:l});if(n===undefined&&l.some(e=>"remove"===e.type&&e.rpcEndpoint.networkClientId===this.state.selectedNetworkClientId)&&!l.some(e=>"replace"===e.type&&e.oldRpcEndpoint.networkClientId===this.state.selectedNetworkClientId))throw new Error(`Could not update network: Cannot update RPC endpoints in such a way that the selected network '${this.state.selectedNetworkClientId}' would be removed without a replacement. Choose a different RPC endpoint as the selected network via the \`replacementSelectedRpcEndpointIndex\` option.`);M(this,s,"m",A).call(this,{networkFields:t,networkClientOperations:l,autoManagedNetworkClientRegistry:c});const u=l.map((e,t)=>[e,t]).find(([e,t])=>"replace"===e.type&&e.oldRpcEndpoint.networkClientId===this.state.selectedNetworkClientId),m=n??u?.[1];let h;if(m!==undefined&&(h=d.rpcEndpoints[m],h===undefined))throw new Error(`Could not update network: \`replacementSelectedRpcEndpointIndex\` ${m} does not refer to an entry in \`rpcEndpoints\``);return h&&h.networkClientId!==this.state.selectedNetworkClientId?await this.setActiveNetwork(h.networkClientId,{updateState:e=>{M(this,s,"m",v).call(this,{state:e,mode:"update",networkFields:t,networkConfigurationToPersist:d,existingNetworkConfiguration:r})}}):this.update(e=>{M(this,s,"m",v).call(this,{state:e,mode:"update",networkFields:t,networkConfigurationToPersist:d,existingNetworkConfiguration:r})}),M(this,s,"m",T).call(this,{networkClientOperations:l,autoManagedNetworkClientRegistry:c}),d}removeNetwork(e){const t=this.state.networkConfigurationsByChainId[e];if(t===undefined)throw new Error(`Cannot find network configuration for chain '${e}'`);if(t.rpcEndpoints.some(e=>e.networkClientId===this.state.selectedNetworkClientId))throw new Error("Cannot remove the currently selected network");const n=M(this,s,"m",x).call(this),r=t.rpcEndpoints.map(e=>({type:"remove",rpcEndpoint:e}));M(this,s,"m",T).call(this,{networkClientOperations:r,autoManagedNetworkClientRegistry:n}),this.update(e=>{M(this,s,"m",v).call(this,{state:e,mode:"remove",existingNetworkConfiguration:t});for(const n of t.rpcEndpoints)delete e.networksMetadata[n.networkClientId]}),this.messenger.publish("NetworkController:networkRemoved",t)}async rollbackToPreviousProvider(){await M(this,s,"m",k).call(this,M(this,a,"f"))}async destroy(){await(M(this,c,"f")?.destroy())}loadBackup({networkConfigurationsByChainId:e}){this.update(t=>{t.networkConfigurationsByChainId={...t.networkConfigurationsByChainId,...e}})}findNetworkClientIdByChainId(e){const t=this.state.networkConfigurationsByChainId[e];if(!t)throw new Error(`Invalid chain ID "${e}"`);const{networkClientId:n}=t.rpcEndpoints[t.defaultRpcEndpointIndex];return n}}n.NetworkController=he,r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,m=new WeakMap,h=new WeakMap,p=new WeakMap,f=new WeakMap,s=new WeakSet,g=function(e){if(M(this,f,"f")===e)return;const t=M(this,s,"m",x).call(this);for(const n of Object.values(t))for(const t of Object.keys(n)){const s=n[t];s.configuration.failoverRpcUrls&&s.configuration.failoverRpcUrls.length>0&&(e?s.enableRpcFailover():s.disableRpcFailover())}O(this,f,e,"f")},k=async function(e,t={}){this.messenger.publish("NetworkController:networkWillChange",this.state),M(this,s,"m",j).call(this,e,t),this.messenger.publish("NetworkController:networkDidChange",this.state),await this.lookupNetwork()},w=async function(e){const t=((0,F.isInfuraNetworkType)(e),this.getNetworkClientById(e)).configuration.type===Z.NetworkClientType.Infura;let n,r;try{r=await M(this,s,"m",S).call(this,e),n=Q.NetworkStatus.Available}catch(e){if(ee("NetworkController: lookupNetwork: ",e),function(e){return"object"==typeof e&&null!==e&&"code"in e}(e)){let s;if(t&&(0,q.hasProperty)(e,"message")&&"string"==typeof e.message)try{s=JSON.parse(e.message)}catch{M(this,u,"f")?.warn("NetworkController: lookupNetwork: json parse error: ",e)}(0,q.isPlainObject)(s)&&s.error===Q.INFURA_BLOCKED_KEY?n=Q.NetworkStatus.Blocked:e.code===H.errorCodes.rpc.internal?(n=Q.NetworkStatus.Unknown,M(this,u,"f")?.warn("NetworkController: lookupNetwork: rpc internal error: ",e)):(n=Q.NetworkStatus.Unavailable,M(this,u,"f")?.warn("NetworkController: lookupNetwork: ",e))}else ee("NetworkController - could not determine network status",e),n=Q.NetworkStatus.Unknown,M(this,u,"f")?.warn("NetworkController: lookupNetwork: ",e)}return{isInfura:t,networkStatus:n,isEIP1559Compatible:r}},b=async function(e){const{networkStatus:t,isEIP1559Compatible:n}=await M(this,s,"m",w).call(this,e);M(this,s,"m",E).call(this,e,{networkStatus:t,isEIP1559Compatible:n})},_=async function(){if(!M(this,r,"f"))return;let e=!1;const t=()=>{e=!0;try{this.messenger.unsubscribe("NetworkController:networkDidChange",t)}catch(e){if(!(e instanceof Error)||"Subscription not found for event: NetworkController:networkDidChange"!==e.message)throw e}};this.messenger.subscribe("NetworkController:networkDidChange",t);const{isInfura:n,networkStatus:o,isEIP1559Compatible:a}=await M(this,s,"m",w).call(this,this.state.selectedNetworkClientId);if(!e){try{this.messenger.unsubscribe("NetworkController:networkDidChange",t)}catch(e){if(!(e instanceof Error)||"Subscription not found for event: NetworkController:networkDidChange"!==e.message)throw e}M(this,s,"m",E).call(this,this.state.selectedNetworkClientId,{networkStatus:o,isEIP1559Compatible:a}),n?o===Q.NetworkStatus.Available?this.messenger.publish("NetworkController:infuraIsUnblocked"):o===Q.NetworkStatus.Blocked&&this.messenger.publish("NetworkController:infuraIsBlocked"):this.messenger.publish("NetworkController:infuraIsUnblocked")}},E=function(e,t){this.update(n=>{var s;(s=n.networksMetadata)[e]??(s[e]={status:Q.NetworkStatus.Unknown,EIPS:{}});const r=n.networksMetadata[e];r.status=t.networkStatus,"isEIP1559Compatible"in t&&(t.isEIP1559Compatible===undefined?delete r.EIPS[1559]:r.EIPS[1559]=t.isEIP1559Compatible)})},y=function(e=this.state.selectedNetworkClientId){const t=this.getNetworkClientById(e),n=new U.default(t.provider);return new Promise((e,t)=>{n.sendAsync({method:"eth_getBlockByNumber",params:["latest",!1]},(n,s)=>{n?t(n):e(s)})})},S=async function(e){const t=await M(this,s,"m",y).call(this,e);return t?t.baseFeePerGas!==undefined:undefined},I=function(e){const{mode:t,networkFields:n,autoManagedNetworkClientRegistry:s}=e,r="existingNetworkConfiguration"in e?e.existingNetworkConfiguration:null,o="update"===t?"Could not update network":"Could not add network";if(!(0,q.isStrictHexString)(n.chainId)||!(0,F.isSafeChainId)(n.chainId))throw new Error(`${o}: Invalid \`chainId\` '${n.chainId}' (must start with "0x" and not exceed the maximum)`);if(null===r||n.chainId!==r.chainId){const t=this.state.networkConfigurationsByChainId[n.chainId];if(t!==undefined)throw null===r?new Error(`Could not add network for chain ${e.networkFields.chainId} as another network for that chain already exists ('${t.name}')`):new Error(`Cannot move network from chain ${r.chainId} to ${n.chainId} as another network for that chain already exists ('${t.name}')`)}if(n.blockExplorerUrls.length>0?n.defaultBlockExplorerUrlIndex===undefined||n.blockExplorerUrls[n.defaultBlockExplorerUrlIndex]===undefined:n.defaultBlockExplorerUrlIndex!==undefined)throw new Error(`${o}: \`defaultBlockExplorerUrlIndex\` must refer to an entry in \`blockExplorerUrls\``);if(0===n.rpcEndpoints.length)throw new Error(`${o}: \`rpcEndpoints\` must be a non-empty array`);for(const e of n.rpcEndpoints){if(!de(e.url))throw new Error(`${o}: An entry in \`rpcEndpoints\` has invalid URL '${e.url}'`);const a="networkClientId"in e?e.networkClientId:undefined;if(e.type===ne.Custom&&a!==undefined&&(0,F.isInfuraNetworkType)(a))throw new Error(`${o}: Custom RPC endpoint '${e.url}' has invalid network client ID '${a}'`);if("update"===t&&a!==undefined&&e.type===ne.Custom&&!Object.values(s).some(e=>a in e))throw new Error(`${o}: RPC endpoint '${e.url}' refers to network client '${a}' that does not exist`);if(n.rpcEndpoints.some(t=>t!==e&&Y.equal(t.url,e.url)))throw new Error(`${o}: Each entry in rpcEndpoints must have a unique URL`);const i=Object.values(this.state.networkConfigurationsByChainId).filter(e=>!r||e.chainId!==r.chainId);for(const n of i){if(n.rpcEndpoints.find(t=>Y.equal(e.url,t.url)))throw"update"===t?new Error(`Could not update network to point to same RPC endpoint as existing network for chain ${n.chainId} ('${n.name}')`):new Error(`Could not add network that points to same RPC endpoint as existing network for chain ${n.chainId} ('${n.name}')`)}}if([...new Set(n.rpcEndpoints)].length<n.rpcEndpoints.length)throw new Error(`${o}: Each entry in rpcEndpoints must be unique`);const a=n.rpcEndpoints.map(e=>"networkClientId"in e?e.networkClientId:undefined).filter(e=>e!==undefined);if([...new Set(a)].length<a.length)throw new Error(`${o}: Each entry in rpcEndpoints must have a unique networkClientId`);const i=n.rpcEndpoints.filter(e=>e.type===ne.Infura);if(i.length>1)throw new Error(`${o}: There cannot be more than one Infura RPC endpoint`);const c=i[0];if(c){const e=ue(c.url),s=F.NetworkNickname[e],r=F.ChainId[e];if(n.chainId!==r)throw new Error("add"===t?`Could not add network with chain ID ${n.chainId} and Infura RPC endpoint for '${s}' which represents ${r}, as the two conflict`:`Could not update network with chain ID ${n.chainId} and Infura RPC endpoint for '${s}' which represents ${r}, as the two conflict`)}if(n.rpcEndpoints[n.defaultRpcEndpointIndex]===undefined)throw new Error(`${o}: \`defaultRpcEndpointIndex\` must refer to an entry in \`rpcEndpoints\``)},C=function({networkFields:e,networkClientOperations:t}){return{...e,rpcEndpoints:t.filter(e=>"add"===e.type||"noop"===e.type).map(e=>e.rpcEndpoint).concat(t.filter(e=>"replace"===e.type).map(e=>e.newRpcEndpoint))}},A=function({networkFields:e,networkClientOperations:t,autoManagedNetworkClientRegistry:n}){const s=t.filter(e=>"add"===e.type).map(e=>e.rpcEndpoint).concat(t.filter(e=>"replace"===e.type).map(e=>e.newRpcEndpoint));for(const t of s)t.type===ne.Infura?n[Z.NetworkClientType.Infura][t.networkClientId]=(0,J.createAutoManagedNetworkClient)({networkClientId:t.networkClientId,networkClientConfiguration:{type:Z.NetworkClientType.Infura,chainId:e.chainId,network:t.networkClientId,failoverRpcUrls:t.failoverUrls,infuraProjectId:M(this,o,"f"),ticker:e.nativeCurrency},getRpcServiceOptions:M(this,m,"f"),getBlockTrackerOptions:M(this,h,"f"),messenger:this.messenger,isRpcFailoverEnabled:M(this,f,"f"),logger:M(this,u,"f")}):n[Z.NetworkClientType.Custom][t.networkClientId]=(0,J.createAutoManagedNetworkClient)({networkClientId:t.networkClientId,networkClientConfiguration:{type:Z.NetworkClientType.Custom,chainId:e.chainId,failoverRpcUrls:t.failoverUrls,rpcUrl:t.url,ticker:e.nativeCurrency},getRpcServiceOptions:M(this,m,"f"),getBlockTrackerOptions:M(this,h,"f"),messenger:this.messenger,isRpcFailoverEnabled:M(this,f,"f"),logger:M(this,u,"f")})},T=function({networkClientOperations:e,autoManagedNetworkClientRegistry:t}){const n=e.filter(e=>"remove"===e.type).map(e=>e.rpcEndpoint).concat(e.filter(e=>"replace"===e.type).map(e=>e.oldRpcEndpoint));for(const e of n){const n=this.getNetworkClientById(e.networkClientId);n.destroy(),delete t[n.configuration.type][e.networkClientId]}},v=function(e){const{state:t,mode:n}=e;("remove"===n||"update"===n&&e.networkFields.chainId!==e.existingNetworkConfiguration.chainId)&&delete t.networkConfigurationsByChainId[e.existingNetworkConfiguration.chainId],"add"!==n&&"update"!==n||((0,W.default)(t.networkConfigurationsByChainId[e.networkFields.chainId],e.networkConfigurationToPersist)||(e.networkConfigurationToPersist.lastUpdatedAt=Date.now()),t.networkConfigurationsByChainId[e.networkFields.chainId]=e.networkConfigurationToPersist),O(this,p,me((0,V.cloneDeep)(t.networkConfigurationsByChainId)),"f")},x=function(){return O(this,l,M(this,l,"f")??M(this,s,"m",N).call(this),"f")},N=function(){return se(this.state.networkConfigurationsByChainId).flatMap(e=>{const t=this.state.networkConfigurationsByChainId[e];return t.rpcEndpoints.map(e=>{if(e.type===ne.Infura){const n=ue(e.url);return[e.networkClientId,(0,J.createAutoManagedNetworkClient)({networkClientId:e.networkClientId,networkClientConfiguration:{type:Z.NetworkClientType.Infura,network:n,failoverRpcUrls:e.failoverUrls,infuraProjectId:M(this,o,"f"),chainId:t.chainId,ticker:t.nativeCurrency},getRpcServiceOptions:M(this,m,"f"),getBlockTrackerOptions:M(this,h,"f"),messenger:this.messenger,isRpcFailoverEnabled:M(this,f,"f"),logger:M(this,u,"f")})]}return[e.networkClientId,(0,J.createAutoManagedNetworkClient)({networkClientId:e.networkClientId,networkClientConfiguration:{type:Z.NetworkClientType.Custom,chainId:t.chainId,failoverRpcUrls:e.failoverUrls,rpcUrl:e.url,ticker:t.nativeCurrency},getRpcServiceOptions:M(this,m,"f"),getBlockTrackerOptions:M(this,h,"f"),messenger:this.messenger,isRpcFailoverEnabled:M(this,f,"f"),logger:M(this,u,"f")})]})}).reduce((e,[t,n])=>({...e,[n.configuration.type]:{...e[n.configuration.type],[t]:n}}),{[Z.NetworkClientType.Custom]:{},[Z.NetworkClientType.Infura]:{}})},j=function(e,{updateState:t}={}){const n=M(this,s,"m",x).call(this);let o;if((0,F.isInfuraNetworkType)(e)){const t=n[Z.NetworkClientType.Infura][e];if(!t)throw new Error(`No Infura network client found with ID '${e}'`);o=t}else{const t=n[Z.NetworkClientType.Custom][e];if(!t)throw new Error(`No network client found with ID '${e}'`);o=t}O(this,d,o,"f"),this.update(n=>{var s;n.selectedNetworkClientId=e,(s=n.networksMetadata)[e]??(s[e]={status:Q.NetworkStatus.Unknown,EIPS:{}}),t?.(n)}),M(this,i,"f")?M(this,i,"f").setTarget(M(this,d,"f").provider):O(this,i,(0,G.createSwappableProxy)(M(this,d,"f").provider),"f"),M(this,c,"f")?M(this,c,"f").setTarget(M(this,d,"f").blockTracker):O(this,c,(0,G.createEventEmitterProxy)(M(this,d,"f").blockTracker,{eventFilter:"skipInternal"}),"f"),O(this,r,new U.default(M(this,i,"f")),"f")}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/NetworkController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s;Object.defineProperty(n,"__esModule",{value:!0}),n.DEPRECATED_NETWORKS=n.INFURA_BLOCKED_KEY=n.NetworkStatus=void 0,function(e){e.Unknown="unknown",e.Available="available",e.Degraded="degraded",e.Unavailable="unavailable",e.Blocked="blocked"}(s||(n.NetworkStatus=s={})),n.INFURA_BLOCKED_KEY="countryBlocked",n.DEPRECATED_NETWORKS=new Set(["0xe704","0x5"])}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-auto-managed-network-client.cjs",{"./create-network-client.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-network-client.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createAutoManagedNetworkClient=void 0;const s=e("./create-network-client.cjs"),r="__target__",o={__UNINITIALIZED__:!0};n.createAutoManagedNetworkClient=function({networkClientId:e,networkClientConfiguration:t,getRpcServiceOptions:n,getBlockTrackerOptions:a=()=>({}),messenger:i,isRpcFailoverEnabled:c,logger:l}){let d,u=c;const m=()=>{if(d??(d=(0,s.createNetworkClient)({id:e,configuration:t,getRpcServiceOptions:n,getBlockTrackerOptions:a,messenger:i,isRpcFailoverEnabled:u,logger:l})),d===undefined)throw new Error("It looks like `createNetworkClient` didn't return anything. Perhaps it's being mocked?");return d},h=new Proxy(o,{get(e,t,n){if(t===r)return d?.provider;const{provider:s}=m();if(t in s){const e=s[t];return"function"==typeof e?function(...t){return e.apply(this===n?s:this,t)}:e}return undefined},has(e,t){if(t===r)return!0;const{provider:n}=m();return t in n}}),p=new Proxy(o,{get(e,t,n){if(t===r)return d?.blockTracker;const{blockTracker:s}=m();if(t in s){const e=s[t];return"function"==typeof e?function(...t){return e.apply(this===n?s:this,t)}:e}return undefined},has(e,t){if(t===r)return!0;const{blockTracker:n}=m();return t in n}}),f=()=>{d?.destroy()};return{configuration:t,provider:h,blockTracker:p,destroy:f,enableRpcFailover:()=>{u=!0,f(),d=undefined},disableRpcFailover:()=>{u=!1,f(),d=undefined}}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-auto-managed-network-client.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-network-client.cjs",{"./rpc-service/rpc-service-chain.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service-chain.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/types.cjs","@metamask/connectivity-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/connectivity-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/eth-block-tracker":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-block-tracker/dist/index.cjs","@metamask/eth-json-rpc-infura":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-infura/dist/index.js","@metamask/eth-json-rpc-middleware":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-middleware/dist/index.cjs","@metamask/eth-json-rpc-provider":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-provider/dist/index.cjs","@metamask/json-rpc-engine":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/dist/index.cjs","@metamask/json-rpc-engine/v2":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/v2.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createNetworkClient=void 0;const s=e("@metamask/connectivity-controller"),r=e("@metamask/controller-utils"),o=e("@metamask/eth-block-tracker"),a=e("@metamask/eth-json-rpc-infura"),i=e("@metamask/eth-json-rpc-middleware"),c=e("@metamask/eth-json-rpc-provider"),l=e("@metamask/eth-json-rpc-provider"),d=e("@metamask/json-rpc-engine"),u=e("@metamask/json-rpc-engine/v2"),m=e("./rpc-service/rpc-service-chain.cjs"),h=e("./types.cjs"),p=1e3;function f({network:e}){return(0,u.createScaffoldMiddleware)({eth_chainId:r.ChainId[e]})}n.createNetworkClient=function({id:e,configuration:t,getRpcServiceOptions:n,getBlockTrackerOptions:r,messenger:w,isRpcFailoverEnabled:b,logger:_}){const E=t.type===h.NetworkClientType.Infura?`https://${t.network}.infura.io/v3/${t.infuraProjectId}`:t.rpcUrl,y=function({id:e,primaryEndpointUrl:t,configuration:n,getRpcServiceOptions:r,messenger:o,isRpcFailoverEnabled:a,logger:i}){const c=a?[t,...n.failoverRpcUrls??[]]:[t],l=()=>o.call("ConnectivityController:getState").connectivityStatus===s.CONNECTIVITY_STATUSES.Offline,d=c.map(e=>({...r(e),endpointUrl:e,logger:i,isOffline:l})),u=e=>"error"in e?e.error:"value"in e?e.value:undefined,h=new m.RpcServiceChain([d[0],...d.slice(1)]);return h.onBreak(t=>{const s=u(t);if(s===undefined)throw new Error("Could not make request to endpoint.");o.publish("NetworkController:rpcEndpointChainUnavailable",{chainId:n.chainId,networkClientId:e,error:s})}),h.onServiceBreak(({endpointUrl:t,primaryEndpointUrl:s,...r})=>{const a=u(r);if(a===undefined)throw new Error("Could not make request to endpoint.");o.publish("NetworkController:rpcEndpointUnavailable",{chainId:n.chainId,networkClientId:e,primaryEndpointUrl:s,endpointUrl:t,error:a})}),h.onDegraded(t=>{const s=u(t);o.publish("NetworkController:rpcEndpointChainDegraded",{chainId:n.chainId,networkClientId:e,error:s})}),h.onServiceDegraded(({endpointUrl:t,primaryEndpointUrl:s,...r})=>{const a=u(r);o.publish("NetworkController:rpcEndpointDegraded",{chainId:n.chainId,networkClientId:e,primaryEndpointUrl:s,endpointUrl:t,error:a})}),h.onAvailable(()=>{o.publish("NetworkController:rpcEndpointChainAvailable",{chainId:n.chainId,networkClientId:e})}),h.onServiceRetry(({attempt:t,endpointUrl:s,primaryEndpointUrl:r})=>{o.publish("NetworkController:rpcEndpointRetried",{chainId:n.chainId,networkClientId:e,primaryEndpointUrl:r,endpointUrl:s,attempt:t})}),h}({id:e,primaryEndpointUrl:E,configuration:t,getRpcServiceOptions:n,messenger:w,isRpcFailoverEnabled:b,logger:_});let S;S=t.type===h.NetworkClientType.Infura?(0,d.asV2Middleware)((0,a.createInfuraMiddleware)({rpcService:y,options:{source:"metamask"}})):(0,i.createFetchMiddleware)({rpcService:y});const I=(0,l.providerFromMiddlewareV2)(S),C=function({networkClientType:e,endpointUrl:t,getOptions:n,provider:s}){const r=e===h.NetworkClientType.Custom?{pollingInterval:p}:{};return new o.PollingBlockTracker({...r,...n(t),provider:s})}({networkClientType:t.type,endpointUrl:E,getOptions:r,provider:I}),A=t.type===h.NetworkClientType.Infura?function({blockTracker:e,network:t,rpcProvider:n,rpcApiMiddleware:s}){return u.JsonRpcEngineV2.create({middleware:[f({network:t}),(0,i.createBlockCacheMiddleware)({blockTracker:e}),(0,i.createInflightCacheMiddleware)(),(0,i.createBlockRefMiddleware)({blockTracker:e,provider:n}),(0,i.createRetryOnEmptyMiddleware)({blockTracker:e,provider:n}),(0,i.createBlockTrackerInspectorMiddleware)({blockTracker:e}),s]}).asMiddleware()}({blockTracker:C,network:t.network,rpcProvider:I,rpcApiMiddleware:S}):function({blockTracker:e,chainId:t,rpcApiMiddleware:n}){const s=[k()];return u.JsonRpcEngineV2.create({middleware:[...s,g(t),(0,i.createBlockRefRewriteMiddleware)({blockTracker:e}),(0,i.createBlockCacheMiddleware)({blockTracker:e}),(0,i.createInflightCacheMiddleware)(),(0,i.createBlockTrackerInspectorMiddleware)({blockTracker:e}),n]}).asMiddleware()}({blockTracker:C,chainId:t.chainId,rpcApiMiddleware:S});return{configuration:t,provider:new c.InternalProvider({engine:u.JsonRpcEngineV2.create({middleware:[A]})}),blockTracker:C,destroy:()=>{C.destroy()}}};const g=e=>({request:t,next:n})=>"eth_chainId"===t.method?e:n();function k(){return async({request:e,next:t})=>("eth_estimateGas"===e.method&&await new Promise(e=>setTimeout(e,2e3)),t())}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/create-network-client.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/index.cjs",{"./NetworkController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/NetworkController.cjs","./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/constants.cjs","./rpc-service/rpc-service.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),n.isConnectionError=n.NetworkClientType=n.RpcEndpointType=n.NetworkController=n.knownKeysOf=n.selectAvailableNetworkClientIds=n.getDefaultNetworkControllerState=void 0;var o=e("./NetworkController.cjs");Object.defineProperty(n,"getDefaultNetworkControllerState",{enumerable:!0,get:function(){return o.getDefaultNetworkControllerState}}),Object.defineProperty(n,"selectAvailableNetworkClientIds",{enumerable:!0,get:function(){return o.selectAvailableNetworkClientIds}}),Object.defineProperty(n,"knownKeysOf",{enumerable:!0,get:function(){return o.knownKeysOf}}),Object.defineProperty(n,"NetworkController",{enumerable:!0,get:function(){return o.NetworkController}}),Object.defineProperty(n,"RpcEndpointType",{enumerable:!0,get:function(){return o.RpcEndpointType}}),r(e("./constants.cjs"),n);var a=e("./types.cjs");Object.defineProperty(n,"NetworkClientType",{enumerable:!0,get:function(){return a.NetworkClientType}});var i=e("./rpc-service/rpc-service.cjs");Object.defineProperty(n,"isConnectionError",{enumerable:!0,get:function(){return i.isConnectionError}})}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/logger.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},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 s=e("@metamask/utils");Object.defineProperty(n,"createModuleLogger",{enumerable:!0,get:function(){return s.createModuleLogger}}),n.projectLogger=(0,s.createProjectLogger)("network-controller")}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service-chain.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/logger.cjs","./rpc-service.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,l=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},d=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.RpcServiceChain=void 0;const u=e("@metamask/controller-utils"),m=e("./rpc-service.cjs"),h=e("../logger.cjs"),p=(0,h.createModuleLogger)(h.projectLogger,"RpcServiceChain"),f="available",g="degraded",k="unknown",w="unavailable";n.RpcServiceChain=class{constructor(e){s.set(this,void 0),r.set(this,void 0),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l(this,i,e.map(e=>new m.RpcService(e)),"f"),l(this,a,d(this,i,"f")[0],"f"),l(this,c,k,"f"),l(this,r,new u.CockatielEventEmitter,"f"),l(this,o,new u.CockatielEventEmitter,"f");for(const e of d(this,i,"f"))e.onDegraded(e=>{if(d(this,c,"f")!==g){p('Updating status to "degraded"',e),l(this,c,g,"f");const{endpointUrl:t,...n}=e;d(this,o,"f").emit(n)}});l(this,s,new u.CockatielEventEmitter,"f");for(const e of d(this,i,"f"))e.onAvailable(e=>{if(d(this,c,"f")!==f){p('Updating status to "available"',e),l(this,c,f,"f");const{endpointUrl:t,...n}=e;d(this,s,"f").emit(n)}})}onServiceRetry(e){const t=d(this,i,"f").map(t=>t.onRetry(t=>{e({...t,primaryEndpointUrl:d(this,a,"f").endpointUrl.toString()})}));return{dispose(){t.forEach(e=>e.dispose())}}}onBreak(e){return d(this,r,"f").addListener(e)}onServiceBreak(e){const t=d(this,i,"f").map(t=>t.onBreak(t=>{e({...t,primaryEndpointUrl:d(this,a,"f").endpointUrl.toString()})}));return{dispose(){t.forEach(e=>e.dispose())}}}onDegraded(e){return d(this,o,"f").addListener(e)}onServiceDegraded(e){const t=d(this,i,"f").map(t=>t.onDegraded(t=>{e({...t,primaryEndpointUrl:d(this,a,"f").endpointUrl.toString()})}));return{dispose(){t.forEach(e=>e.dispose())}}}onAvailable(e){return d(this,s,"f").addListener(e)}async request(e,t={}){let n,s;for(const[o,a]of d(this,i,"f").entries()){p(`Trying service #${o+1}...`);const m=a.getCircuitState();try{s=await a.request(e,t),p("Service successfully received request."),n=o;break}catch(e){const{lastError:t}=a,n=a.getCircuitState()===u.CircuitState.Open;if(p("Service failed! error =",e,"lastError = ",t),n){if(o<d(this,i,"f").length-1){p("This service's circuit is open. Proceeding to next service...");continue}m!==u.CircuitState.Open&&d(this,c,"f")!==w&&t!==undefined&&(p('This service\'s circuit just opened and it is the last service. Updating status to "unavailable" and triggering onBreak.'),l(this,c,w,"f"),d(this,r,"f").emit({error:t}))}throw p((n?"":"This service's circuit is closed. ")+"Re-throwing error."),e}}if(s){if(n!==undefined)for(const[e,t]of[...d(this,i,"f").entries()].slice(n+1))p(`Resetting policy for service #${e+1}.`),t.resetPolicy();return s}throw new Error("Nothing to return")}},s=new WeakMap,r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,c=new WeakMap}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service-chain.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service.cjs",{"../logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/logger.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",cockatiel:"/home/runner/work/metamask-extension/metamask-extension/node_modules/cockatiel/dist/index.js",deepmerge:"/home/runner/work/metamask-extension/metamask-extension/node_modules/deepmerge/dist/cjs.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,l,d,u=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},m=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},h=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.RpcService=n.isConnectionError=n.CUSTOM_RPC_ERRORS=n.CONNECTION_ERRORS=n.DEFAULT_MAX_CONSECUTIVE_FAILURES=n.DEFAULT_MAX_RETRIES=void 0;const p=e("@metamask/controller-utils"),f=e("@metamask/rpc-errors"),g=e("@metamask/utils"),k=(e("cockatiel"),h(e("deepmerge"))),w=e("../logger.cjs"),b=(0,w.createModuleLogger)(w.projectLogger,"RpcService");function _(e){if("object"!=typeof e||null===e||!("message"in e))return!1;const{message:t}=e;return"string"==typeof t&&!function(e){return e.includes("Nock:")}(t)&&n.CONNECTION_ERRORS.some(({constructorName:n,pattern:s})=>e.constructor.name===n&&s.test(t))}function E(e){return e instanceof SyntaxError||/invalid json/iu.test((0,g.getErrorMessage)(e))}n.DEFAULT_MAX_RETRIES=4,n.DEFAULT_MAX_CONSECUTIVE_FAILURES=3*(1+n.DEFAULT_MAX_RETRIES),n.CONNECTION_ERRORS=[{constructorName:"TypeError",pattern:/network error/u},{constructorName:"TypeError",pattern:/Failed to fetch/u},{constructorName:"TypeError",pattern:/NetworkError when attempting to fetch resource\./u},{constructorName:"TypeError",pattern:/The Internet connection appears to be offline\./u},{constructorName:"TypeError",pattern:/Load failed/u},{constructorName:"TypeError",pattern:/Network request failed/u},{constructorName:"FetchError",pattern:/request to (.+) failed/u},{constructorName:"TypeError",pattern:/fetch failed/u},{constructorName:"TypeError",pattern:/terminated/u}],n.CUSTOM_RPC_ERRORS={unauthorized:-32006,httpClientError:-32080},n.isConnectionError=_;n.RpcService=class{constructor(e){s.add(this),r.set(this,void 0),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0);const{btoa:t,endpointUrl:l,fetch:d,logger:h,fetchOptions:f={},policyOptions:k={},isOffline:w}=e;u(this,r,d,"f");const b=(y=l)instanceof URL?y:new URL(y);var y;u(this,o,m(this,s,"m",c).call(this,b,f,t),"f"),this.endpointUrl=function(e){const t=new URL(e.toString());return t.username="",t.password="",t}(b),u(this,a,h,"f"),u(this,i,(0,p.createServicePolicy)({maxRetries:n.DEFAULT_MAX_RETRIES,maxConsecutiveFailures:n.DEFAULT_MAX_CONSECUTIVE_FAILURES,...k,retryFilterPolicy:(0,p.handleWhen)(e=>!w()&&(_(e)||E(e)||"httpStatus"in e&&(502===e.httpStatus||503===e.httpStatus||504===e.httpStatus)||(0,g.hasProperty)(e,"code")&&("ETIMEDOUT"===e.code||"ECONNRESET"===e.code)))}),"f")}resetPolicy(){m(this,i,"f").reset()}getCircuitState(){return m(this,i,"f").getCircuitState()}onRetry(e){return m(this,i,"f").onRetry(t=>{e({...t,endpointUrl:this.endpointUrl.toString()})})}onBreak(e){return m(this,i,"f").onBreak(t=>{"isolated"in t||e({...t,endpointUrl:this.endpointUrl.toString()})})}onDegraded(e){return m(this,i,"f").onDegraded(t=>{e({...t??{},endpointUrl:this.endpointUrl.toString()})})}onAvailable(e){return m(this,i,"f").onAvailable(()=>{e({endpointUrl:this.endpointUrl.toString()})})}async request(e,t={}){const n=m(this,s,"m",l).call(this,e,t);return await m(this,s,"m",d).call(this,n)}},r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,s=new WeakSet,c=function(e,t,n){if(e.username&&e.password){const s=n(`${e.username}:${e.password}`);return(0,k.default)(t,{headers:{Authorization:`Basic ${s}`}})}return t},l=function(e,t){const n=(0,k.default)({method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"}},(0,k.default)(m(this,o,"f"),t)),{id:s,jsonrpc:r,method:a,params:i}=e;return{...n,body:JSON.stringify({id:s,jsonrpc:r,method:a,params:i})}},d=async function(e){let t;try{b(`[${this.endpointUrl}] Circuit state`,m(this,i,"f").getCircuitState());const n=await m(this,i,"f").execute(async n=>{if(b("REQUEST INITIATED:",this.endpointUrl.toString(),"::",e,`(attempt ${n.attempt+1})`),t=await m(this,r,"f").call(this,this.endpointUrl,e),!t.ok)throw new p.HttpError(t.status);return b("REQUEST SUCCESSFUL:",this.endpointUrl.toString(),t.status),await t.json()});return this.lastError=undefined,n}catch(e){if(b("REQUEST ERROR:",this.endpointUrl.toString(),e),this.lastError=e instanceof Error?e:new Error((0,g.getErrorMessage)(e)),e instanceof p.HttpError){const t=e.httpStatus;if(401===t)throw new f.JsonRpcError(n.CUSTOM_RPC_ERRORS.unauthorized,"Unauthorized.",{httpStatus:t});if(429===t)throw f.rpcErrors.limitExceeded({message:"Request is being rate limited.",data:{httpStatus:t}});if(t>=500||402===t||404===t)throw f.rpcErrors.resourceUnavailable({message:"RPC endpoint not found or unavailable.",data:{httpStatus:t}});throw new f.JsonRpcError(n.CUSTOM_RPC_ERRORS.httpClientError,"RPC endpoint returned HTTP client error.",{httpStatus:t})}if(E(e))throw f.rpcErrors.parse({message:"RPC endpoint did not return JSON."});if(e instanceof p.BrokenCircuitError){m(this,a,"f")?.warn(e);const t=m(this,i,"f").getRemainingCircuitOpenDuration(),n=Intl.NumberFormat(undefined,{maximumFractionDigits:2}).format((t??m(this,i,"f").circuitBreakDuration)/g.Duration.Minute);throw f.rpcErrors.resourceUnavailable({message:`RPC endpoint returned too many errors, retrying in ${n} minutes. Consider using a different RPC endpoint.`})}throw e}}}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/rpc-service/rpc-service.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s;Object.defineProperty(n,"__esModule",{value:!0}),n.NetworkClientType=void 0,function(e){e.Custom="custom",e.Infura="infura"}(s||(n.NetworkClientType=s={}))}}},{package:"@metamask/bridge-status-controller>@metamask/bridge-controller>@metamask/multichain-network-controller>@metamask/network-controller",file:"node_modules/@metamask/bridge-status-controller/node_modules/@metamask/multichain-network-controller/node_modules/@metamask/network-controller/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){!function(e){var n,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,r=Math.ceil,o=Math.floor,a="[BigNumber Error] ",i=a+"Number primitive has more than 15 significant digits: ",c=1e14,l=14,d=9007199254740991,u=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,h=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function f(e){for(var t,n,s=1,r=e.length,o=e[0]+"";s<r;){for(t=e[s++]+"",n=l-t.length;n--;t="0"+t);o+=t}for(r=o.length;48===o.charCodeAt(--r););return o.slice(0,r+1||1)}function g(e,t){var n,s,r=e.c,o=t.c,a=e.s,i=t.s,c=e.e,l=t.e;if(!a||!i)return null;if(n=r&&!r[0],s=o&&!o[0],n||s)return n?s?0:-i:a;if(a!=i)return a;if(n=a<0,s=c==l,!r||!o)return s?0:!r^n?1:-1;if(!s)return c>l^n?1:-1;for(i=(c=r.length)<(l=o.length)?c:l,a=0;a<i;a++)if(r[a]!=o[a])return r[a]>o[a]^n?1:-1;return c==l?0:c>l^n?1:-1}function k(e,t,n,s){if(e<t||e>n||e!==o(e))throw Error(a+(s||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return p(e.e/l)==t&&e.c[t]%2!=0}function b(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _(e,t,n){var s,r;if(t<0){for(r=n+".";++t;r+=n);e=r+e}else if(++t>(s=e.length)){for(r=n,t-=s;--t;r+=n);e+=r}else t<s&&(e=e.slice(0,t)+"."+e.slice(t));return e}n=function e(t){var n,E,y,S,I,C,A,T,v,x,N=W.prototype={constructor:W,toString:null,valueOf:null},j=new W(1),P=20,D=4,R=-7,O=21,M=-1e7,B=1e7,L=!1,F=1,U=0,H={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},G="0123456789abcdefghijklmnopqrstuvwxyz",q=!0;function W(e,t){var n,r,a,c,u,m,h,p,f=this;if(!(f instanceof W))return new W(e,t);if(null==t){if(e&&!0===e._isBigNumber)return f.s=e.s,void(!e.c||e.e>B?f.c=f.e=null:e.e<M?f.c=[f.e=0]:(f.e=e.e,f.c=e.c.slice()));if((m="number"==typeof e)&&0*e==0){if(f.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,u=e;u>=10;u/=10,c++);return void(c>B?f.c=f.e=null:(f.e=c,f.c=[e]))}p=String(e)}else{if(!s.test(p=String(e)))return y(f,p,m);f.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(c=p.indexOf("."))>-1&&(p=p.replace(".","")),(u=p.search(/e/i))>0?(c<0&&(c=u),c+=+p.slice(u+1),p=p.substring(0,u)):c<0&&(c=p.length)}else{if(k(t,2,G.length,"Base"),10==t&&q)return Y(f=new W(e),P+f.e+1,D);if(p=String(e),m="number"==typeof e){if(0*e!=0)return y(f,p,m,t);if(f.s=1/e<0?(p=p.slice(1),-1):1,W.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(i+e)}else f.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(n=G.slice(0,t),c=u=0,h=p.length;u<h;u++)if(n.indexOf(r=p.charAt(u))<0){if("."==r){if(u>c){c=h;continue}}else if(!a&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){a=!0,u=-1,c=0;continue}return y(f,String(e),m,t)}m=!1,(c=(p=E(p,t,10,f.s)).indexOf("."))>-1?p=p.replace(".",""):c=p.length}for(u=0;48===p.charCodeAt(u);u++);for(h=p.length;48===p.charCodeAt(--h););if(p=p.slice(u,++h)){if(h-=u,m&&W.DEBUG&&h>15&&(e>d||e!==o(e)))throw Error(i+f.s*e);if((c=c-u-1)>B)f.c=f.e=null;else if(c<M)f.c=[f.e=0];else{if(f.e=c,f.c=[],u=(c+1)%l,c<0&&(u+=l),u<h){for(u&&f.c.push(+p.slice(0,u)),h-=l;u<h;)f.c.push(+p.slice(u,u+=l));u=l-(p=p.slice(u)).length}else u-=h;for(;u--;p+="0");f.c.push(+p)}}else f.c=[f.e=0]}function $(e,t,n,s){var r,o,a,i,c;if(null==n?n=D:k(n,0,8),!e.c)return e.toString();if(r=e.c[0],a=e.e,null==t)c=f(e.c),c=1==s||2==s&&(a<=R||a>=O)?b(c,a):_(c,a,"0");else if(o=(e=Y(new W(e),t,n)).e,i=(c=f(e.c)).length,1==s||2==s&&(t<=o||o<=R)){for(;i<t;c+="0",i++);c=b(c,o)}else if(t-=a,c=_(c,o,"0"),o+1>i){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-i)>0)for(o+1==i&&(c+=".");t--;c+="0");return e.s<0&&r?"-"+c:c}function V(e,t){for(var n,s,r=1,o=new W(e[0]);r<e.length;r++)(!(s=new W(e[r])).s||(n=g(o,s))===t||0===n&&o.s===t)&&(o=s);return o}function K(e,t,n){for(var s=1,r=t.length;!t[--r];t.pop());for(r=t[0];r>=10;r/=10,s++);return(n=s+n*l-1)>B?e.c=e.e=null:n<M?e.c=[e.e=0]:(e.e=n,e.c=t),e}function Y(e,t,n,s){var a,i,d,m,h,p,f,g=e.c,k=u;if(g){e:{for(a=1,m=g[0];m>=10;m/=10,a++);if((i=t-a)<0)i+=l,d=t,h=g[p=0],f=o(h/k[a-d-1]%10);else if((p=r((i+1)/l))>=g.length){if(!s)break e;for(;g.length<=p;g.push(0));h=f=0,a=1,d=(i%=l)-l+1}else{for(h=m=g[p],a=1;m>=10;m/=10,a++);f=(d=(i%=l)-l+a)<0?0:o(h/k[a-d-1]%10)}if(s=s||t<0||null!=g[p+1]||(d<0?h:h%k[a-d-1]),s=n<4?(f||s)&&(0==n||n==(e.s<0?3:2)):f>5||5==f&&(4==n||s||6==n&&(i>0?d>0?h/k[a-d]:0:g[p-1])%10&1||n==(e.s<0?8:7)),t<1||!g[0])return g.length=0,s?(t-=e.e+1,g[0]=k[(l-t%l)%l],e.e=-t||0):g[0]=e.e=0,e;if(0==i?(g.length=p,m=1,p--):(g.length=p+1,m=k[l-i],g[p]=d>0?o(h/k[a-d]%k[d])*m:0),s)for(;;){if(0==p){for(i=1,d=g[0];d>=10;d/=10,i++);for(d=g[0]+=m,m=1;d>=10;d/=10,m++);i!=m&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[p]+=m,g[p]!=c)break;g[p--]=0,m=1}for(i=g.length;0===g[--i];g.pop());}e.e>B?e.c=e.e=null:e.e<M&&(e.c=[e.e=0])}return e}function z(e){var t,n=e.e;return null===n?e.toString():(t=f(e.c),t=n<=R||n>=O?b(t,n):_(t,n,"0"),e.s<0?"-"+t:t)}return W.clone=e,W.ROUND_UP=0,W.ROUND_DOWN=1,W.ROUND_CEIL=2,W.ROUND_FLOOR=3,W.ROUND_HALF_UP=4,W.ROUND_HALF_DOWN=5,W.ROUND_HALF_EVEN=6,W.ROUND_HALF_CEIL=7,W.ROUND_HALF_FLOOR=8,W.EUCLID=9,W.config=W.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(a+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(k(n=e[t],0,h,t),P=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(k(n=e[t],0,8,t),D=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(k(n[0],-h,0,t),k(n[1],0,h,t),R=n[0],O=n[1]):(k(n,-h,h,t),R=-(O=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)k(n[0],-h,-1,t),k(n[1],1,h,t),M=n[0],B=n[1];else{if(k(n,-h,h,t),!n)throw Error(a+t+" cannot be zero: "+n);M=-(B=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(a+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!n,Error(a+"crypto unavailable");L=n}else L=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(k(n=e[t],0,9,t),F=n),e.hasOwnProperty(t="POW_PRECISION")&&(k(n=e[t],0,h,t),U=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(a+t+" not an object: "+n);H=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(a+t+" invalid: "+n);q="0123456789"==n.slice(0,10),G=n}}return{DECIMAL_PLACES:P,ROUNDING_MODE:D,EXPONENTIAL_AT:[R,O],RANGE:[M,B],CRYPTO:L,MODULO_MODE:F,POW_PRECISION:U,FORMAT:H,ALPHABET:G}},W.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!W.DEBUG)return!0;var t,n,s=e.c,r=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(s)){if((1===i||-1===i)&&r>=-h&&r<=h&&r===o(r)){if(0===s[0]){if(0===r&&1===s.length)return!0;break e}if((t=(r+1)%l)<1&&(t+=l),String(s[0]).length==t){for(t=0;t<s.length;t++)if((n=s[t])<0||n>=c||n!==o(n))break e;if(0!==n)return!0}}}else if(null===s&&null===r&&(null===i||1===i||-1===i))return!0;throw Error(a+"Invalid BigNumber: "+e)},W.maximum=W.max=function(){return V(arguments,-1)},W.minimum=W.min=function(){return V(arguments,1)},W.random=(S=9007199254740992,I=Math.random()*S&2097151?function(){return o(Math.random()*S)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,s,i,c,d=0,m=[],p=new W(j);if(null==e?e=P:k(e,0,h),i=r(e/l),L)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));d<i;)(c=131072*t[d]+(t[d+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[d]=n[0],t[d+1]=n[1]):(m.push(c%1e14),d+=2);d=i/2}else{if(!crypto.randomBytes)throw L=!1,Error(a+"crypto unavailable");for(t=crypto.randomBytes(i*=7);d<i;)(c=281474976710656*(31&t[d])+1099511627776*t[d+1]+4294967296*t[d+2]+16777216*t[d+3]+(t[d+4]<<16)+(t[d+5]<<8)+t[d+6])>=9e15?crypto.randomBytes(7).copy(t,d):(m.push(c%1e14),d+=7);d=i/7}if(!L)for(;d<i;)(c=I())<9e15&&(m[d++]=c%1e14);for(i=m[--d],e%=l,i&&e&&(c=u[l-e],m[d]=o(i/c)*c);0===m[d];m.pop(),d--);if(d<0)m=[s=0];else{for(s=-1;0===m[0];m.splice(0,1),s-=l);for(d=1,c=m[0];c>=10;c/=10,d++);d<l&&(s-=l-d)}return p.e=s,p.c=m,p}),W.sum=function(){for(var e=1,t=arguments,n=new W(t[0]);e<t.length;)n=n.plus(t[e++]);return n},E=function(){var e="0123456789";function t(e,t,n,s){for(var r,o,a=[0],i=0,c=e.length;i<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=s.indexOf(e.charAt(i++)),r=0;r<a.length;r++)a[r]>n-1&&(null==a[r+1]&&(a[r+1]=0),a[r+1]+=a[r]/n|0,a[r]%=n)}return a.reverse()}return function(s,r,o,a,i){var c,l,d,u,m,h,p,g,k=s.indexOf("."),w=P,b=D;for(k>=0&&(u=U,U=0,s=s.replace(".",""),h=(g=new W(r)).pow(s.length-k),U=u,g.c=t(_(f(h.c),h.e,"0"),10,o,e),g.e=g.c.length),d=u=(p=t(s,r,o,i?(c=G,e):(c=e,G))).length;0==p[--u];p.pop());if(!p[0])return c.charAt(0);if(k<0?--d:(h.c=p,h.e=d,h.s=a,p=(h=n(h,g,w,b,o)).c,m=h.r,d=h.e),k=p[l=d+w+1],u=o/2,m=m||l<0||null!=p[l+1],m=b<4?(null!=k||m)&&(0==b||b==(h.s<0?3:2)):k>u||k==u&&(4==b||m||6==b&&1&p[l-1]||b==(h.s<0?8:7)),l<1||!p[0])s=m?_(c.charAt(1),-w,c.charAt(0)):c.charAt(0);else{if(p.length=l,m)for(--o;++p[--l]>o;)p[l]=0,l||(++d,p=[1].concat(p));for(u=p.length;!p[--u];);for(k=0,s="";k<=u;s+=c.charAt(p[k++]));s=_(s,d,c.charAt(0))}return s}}(),n=function(){function e(e,t,n){var s,r,o,a,i=0,c=e.length,l=t%m,d=t/m|0;for(e=e.slice();c--;)i=((r=l*(o=e[c]%m)+(s=d*o+(a=e[c]/m|0)*l)%m*m+i)/n|0)+(s/m|0)+d*a,e[c]=r%n;return i&&(e=[i].concat(e)),e}function t(e,t,n,s){var r,o;if(n!=s)o=n>s?1:-1;else for(r=o=0;r<n;r++)if(e[r]!=t[r]){o=e[r]>t[r]?1:-1;break}return o}function n(e,t,n,s){for(var r=0;n--;)e[n]-=r,r=e[n]<t[n]?1:0,e[n]=r*s+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(s,r,a,i,d){var u,m,h,f,g,k,w,b,_,E,y,S,I,C,A,T,v,x=s.s==r.s?1:-1,N=s.c,j=r.c;if(!(N&&N[0]&&j&&j[0]))return new W(s.s&&r.s&&(N?!j||N[0]!=j[0]:j)?N&&0==N[0]||!j?0*x:x/0:NaN);for(_=(b=new W(x)).c=[],x=a+(m=s.e-r.e)+1,d||(d=c,m=p(s.e/l)-p(r.e/l),x=x/l|0),h=0;j[h]==(N[h]||0);h++);if(j[h]>(N[h]||0)&&m--,x<0)_.push(1),f=!0;else{for(C=N.length,T=j.length,h=0,x+=2,(g=o(d/(j[0]+1)))>1&&(j=e(j,g,d),N=e(N,g,d),T=j.length,C=N.length),I=T,y=(E=N.slice(0,T)).length;y<T;E[y++]=0);v=j.slice(),v=[0].concat(v),A=j[0],j[1]>=d/2&&A++;do{if(g=0,(u=t(j,E,T,y))<0){if(S=E[0],T!=y&&(S=S*d+(E[1]||0)),(g=o(S/A))>1)for(g>=d&&(g=d-1),w=(k=e(j,g,d)).length,y=E.length;1==t(k,E,w,y);)g--,n(k,T<w?v:j,w,d),w=k.length,u=1;else 0==g&&(u=g=1),w=(k=j.slice()).length;if(w<y&&(k=[0].concat(k)),n(E,k,y,d),y=E.length,-1==u)for(;t(j,E,T,y)<1;)g++,n(E,T<y?v:j,y,d),y=E.length}else 0===u&&(g++,E=[0]);_[h++]=g,E[0]?E[y++]=N[I]||0:(E=[N[I]],y=1)}while((I++<C||null!=E[0])&&x--);f=null!=E[0],_[0]||_.splice(0,1)}if(d==c){for(h=1,x=_[0];x>=10;x/=10,h++);Y(b,a+(b.e=h+m*l-1)+1,i,f)}else b.e=m,b.r=+f;return b}}(),C=/^(-?)0([xbo])(?=\w[\w.]*$)/i,A=/^([^.]+)\.$/,T=/^\.([^.]+)$/,v=/^-?(Infinity|NaN)$/,x=/^\s*\+(?=[\w.])|^\s+|\s+$/g,y=function(e,t,n,s){var r,o=n?t:t.replace(x,"");if(v.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(C,function(e,t,n){return r="x"==(n=n.toLowerCase())?16:"b"==n?2:8,s&&s!=r?e:t}),s&&(r=s,o=o.replace(A,"$1").replace(T,"0.$1")),t!=o))return new W(o,r);if(W.DEBUG)throw Error(a+"Not a"+(s?" base "+s:"")+" number: "+t);e.s=null}e.c=e.e=null},N.absoluteValue=N.abs=function(){var e=new W(this);return e.s<0&&(e.s=1),e},N.comparedTo=function(e,t){return g(this,new W(e,t))},N.decimalPlaces=N.dp=function(e,t){var n,s,r,o=this;if(null!=e)return k(e,0,h),null==t?t=D:k(t,0,8),Y(new W(o),e+o.e+1,t);if(!(n=o.c))return null;if(s=((r=n.length-1)-p(this.e/l))*l,r=n[r])for(;r%10==0;r/=10,s--);return s<0&&(s=0),s},N.dividedBy=N.div=function(e,t){return n(this,new W(e,t),P,D)},N.dividedToIntegerBy=N.idiv=function(e,t){return n(this,new W(e,t),0,1)},N.exponentiatedBy=N.pow=function(e,t){var n,s,i,c,d,u,m,h,p=this;if((e=new W(e)).c&&!e.isInteger())throw Error(a+"Exponent not an integer: "+z(e));if(null!=t&&(t=new W(t)),d=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new W(Math.pow(+z(p),d?e.s*(2-w(e)):+z(e))),t?h.mod(t):h;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new W(NaN);(s=!u&&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||d&&p.c[1]>=24e7:p.c[0]<8e13||d&&p.c[0]<=9999975e7)))return c=p.s<0&&w(e)?-0:0,p.e>-1&&(c=1/c),new W(u?1/c:c);U&&(c=r(U/l+2))}for(d?(n=new W(.5),u&&(e.s=1),m=w(e)):m=(i=Math.abs(+z(e)))%2,h=new W(j);;){if(m){if(!(h=h.times(p)).c)break;c?h.c.length>c&&(h.c.length=c):s&&(h=h.mod(t))}if(i){if(0===(i=o(i/2)))break;m=i%2}else if(Y(e=e.times(n),e.e+1,1),e.e>14)m=w(e);else{if(0===(i=+z(e)))break;m=i%2}p=p.times(p),c?p.c&&p.c.length>c&&(p.c.length=c):s&&(p=p.mod(t))}return s?h:(u&&(h=j.div(h)),t?h.mod(t):c?Y(h,U,D,undefined):h)},N.integerValue=function(e){var t=new W(this);return null==e?e=D:k(e,0,8),Y(t,t.e+1,e)},N.isEqualTo=N.eq=function(e,t){return 0===g(this,new W(e,t))},N.isFinite=function(){return!!this.c},N.isGreaterThan=N.gt=function(e,t){return g(this,new W(e,t))>0},N.isGreaterThanOrEqualTo=N.gte=function(e,t){return 1===(t=g(this,new W(e,t)))||0===t},N.isInteger=function(){return!!this.c&&p(this.e/l)>this.c.length-2},N.isLessThan=N.lt=function(e,t){return g(this,new W(e,t))<0},N.isLessThanOrEqualTo=N.lte=function(e,t){return-1===(t=g(this,new W(e,t)))||0===t},N.isNaN=function(){return!this.s},N.isNegative=function(){return this.s<0},N.isPositive=function(){return this.s>0},N.isZero=function(){return!!this.c&&0==this.c[0]},N.minus=function(e,t){var n,s,r,o,a=this,i=a.s;if(t=(e=new W(e,t)).s,!i||!t)return new W(NaN);if(i!=t)return e.s=-t,a.plus(e);var d=a.e/l,u=e.e/l,m=a.c,h=e.c;if(!d||!u){if(!m||!h)return m?(e.s=-t,e):new W(h?a:NaN);if(!m[0]||!h[0])return h[0]?(e.s=-t,e):new W(m[0]?a:3==D?-0:0)}if(d=p(d),u=p(u),m=m.slice(),i=d-u){for((o=i<0)?(i=-i,r=m):(u=d,r=h),r.reverse(),t=i;t--;r.push(0));r.reverse()}else for(s=(o=(i=m.length)<(t=h.length))?i:t,i=t=0;t<s;t++)if(m[t]!=h[t]){o=m[t]<h[t];break}if(o&&(r=m,m=h,h=r,e.s=-e.s),(t=(s=h.length)-(n=m.length))>0)for(;t--;m[n++]=0);for(t=c-1;s>i;){if(m[--s]<h[s]){for(n=s;n&&!m[--n];m[n]=t);--m[n],m[s]+=c}m[s]-=h[s]}for(;0==m[0];m.splice(0,1),--u);return m[0]?K(e,m,u):(e.s=3==D?-1:1,e.c=[e.e=0],e)},N.modulo=N.mod=function(e,t){var s,r,o=this;return e=new W(e,t),!o.c||!e.s||e.c&&!e.c[0]?new W(NaN):!e.c||o.c&&!o.c[0]?new W(o):(9==F?(r=e.s,e.s=1,s=n(o,e,0,3),e.s=r,s.s*=r):s=n(o,e,0,F),(e=o.minus(s.times(e))).c[0]||1!=F||(e.s=o.s),e)},N.multipliedBy=N.times=function(e,t){var n,s,r,o,a,i,d,u,h,f,g,k,w,b,_,E=this,y=E.c,S=(e=new W(e,t)).c;if(!(y&&S&&y[0]&&S[0]))return!E.s||!e.s||y&&!y[0]&&!S||S&&!S[0]&&!y?e.c=e.e=e.s=null:(e.s*=E.s,y&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(s=p(E.e/l)+p(e.e/l),e.s*=E.s,(d=y.length)<(f=S.length)&&(w=y,y=S,S=w,r=d,d=f,f=r),r=d+f,w=[];r--;w.push(0));for(b=c,_=m,r=f;--r>=0;){for(n=0,g=S[r]%_,k=S[r]/_|0,o=r+(a=d);o>r;)n=((u=g*(u=y[--a]%_)+(i=k*u+(h=y[a]/_|0)*g)%_*_+w[o]+n)/b|0)+(i/_|0)+k*h,w[o--]=u%b;w[o]=n}return n?++s:w.splice(0,1),K(e,w,s)},N.negated=function(){var e=new W(this);return e.s=-e.s||null,e},N.plus=function(e,t){var n,s=this,r=s.s;if(t=(e=new W(e,t)).s,!r||!t)return new W(NaN);if(r!=t)return e.s=-t,s.minus(e);var o=s.e/l,a=e.e/l,i=s.c,d=e.c;if(!o||!a){if(!i||!d)return new W(r/0);if(!i[0]||!d[0])return d[0]?e:new W(i[0]?s:0*r)}if(o=p(o),a=p(a),i=i.slice(),r=o-a){for(r>0?(a=o,n=d):(r=-r,n=i),n.reverse();r--;n.push(0));n.reverse()}for((r=i.length)-(t=d.length)<0&&(n=d,d=i,i=n,t=r),r=0;t;)r=(i[--t]=i[t]+d[t]+r)/c|0,i[t]=c===i[t]?0:i[t]%c;return r&&(i=[r].concat(i),++a),K(e,i,a)},N.precision=N.sd=function(e,t){var n,s,r,o=this;if(null!=e&&e!==!!e)return k(e,1,h),null==t?t=D:k(t,0,8),Y(new W(o),e,t);if(!(n=o.c))return null;if(s=(r=n.length-1)*l+1,r=n[r]){for(;r%10==0;r/=10,s--);for(r=n[0];r>=10;r/=10,s++);}return e&&o.e+1>s&&(s=o.e+1),s},N.shiftedBy=function(e){return k(e,-9007199254740991,d),this.times("1e"+e)},N.squareRoot=N.sqrt=function(){var e,t,s,r,o,a=this,i=a.c,c=a.s,l=a.e,d=P+4,u=new W("0.5");if(1!==c||!i||!i[0])return new W(!c||c<0&&(!i||i[0])?NaN:i?a:1/0);if(0==(c=Math.sqrt(+z(a)))||c==1/0?(((t=f(i)).length+l)%2==0&&(t+="0"),c=Math.sqrt(+t),l=p((l+1)/2)-(l<0||l%2),s=new W(t=c==1/0?"5e"+l:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+l)):s=new W(c+""),s.c[0])for((c=(l=s.e)+d)<3&&(c=0);;)if(o=s,s=u.times(o.plus(n(a,o,d,1))),f(o.c).slice(0,c)===(t=f(s.c)).slice(0,c)){if(s.e<l&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(r||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Y(s,s.e+P+2,1),e=!s.times(s).eq(a));break}if(!r&&(Y(o,o.e+P+2,0),o.times(o).eq(a))){s=o;break}d+=4,c+=4,r=1}return Y(s,s.e+P+1,D,e)},N.toExponential=function(e,t){return null!=e&&(k(e,0,h),e++),$(this,e,t,1)},N.toFixed=function(e,t){return null!=e&&(k(e,0,h),e=e+this.e+1),$(this,e,t)},N.toFormat=function(e,t,n){var s,r=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=H;else if("object"!=typeof n)throw Error(a+"Argument not an object: "+n);if(s=r.toFixed(e,t),r.c){var o,i=s.split("."),c=+n.groupSize,l=+n.secondaryGroupSize,d=n.groupSeparator||"",u=i[0],m=i[1],h=r.s<0,p=h?u.slice(1):u,f=p.length;if(l&&(o=c,c=l,l=o,f-=o),c>0&&f>0){for(o=f%c||c,u=p.substr(0,o);o<f;o+=c)u+=d+p.substr(o,c);l>0&&(u+=d+p.slice(o)),h&&(u="-"+u)}s=m?u+(n.decimalSeparator||"")+((l=+n.fractionGroupSize)?m.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):m):u}return(n.prefix||"")+s+(n.suffix||"")},N.toFraction=function(e){var t,s,r,o,i,c,d,m,h,p,g,k,w=this,b=w.c;if(null!=e&&(!(d=new W(e)).isInteger()&&(d.c||1!==d.s)||d.lt(j)))throw Error(a+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+z(d));if(!b)return new W(w);for(t=new W(j),h=s=new W(j),r=m=new W(j),k=f(b),i=t.e=k.length-w.e-1,t.c[0]=u[(c=i%l)<0?l+c:c],e=!e||d.comparedTo(t)>0?i>0?t:h:d,c=B,B=1/0,d=new W(k),m.c[0]=0;p=n(d,t,0,1),1!=(o=s.plus(p.times(r))).comparedTo(e);)s=r,r=o,h=m.plus(p.times(o=h)),m=o,t=d.minus(p.times(o=t)),d=o;return o=n(e.minus(s),r,0,1),m=m.plus(o.times(h)),s=s.plus(o.times(r)),m.s=h.s=w.s,g=n(h,r,i*=2,D).minus(w).abs().comparedTo(n(m,s,i,D).minus(w).abs())<1?[h,r]:[m,s],B=c,g},N.toNumber=function(){return+z(this)},N.toPrecision=function(e,t){return null!=e&&k(e,1,h),$(this,e,t,2)},N.toString=function(e){var t,n=this,s=n.s,r=n.e;return null===r?s?(t="Infinity",s<0&&(t="-"+t)):t="NaN":(null==e?t=r<=R||r>=O?b(f(n.c),r):_(f(n.c),r,"0"):10===e&&q?t=_(f((n=Y(new W(n),P+r+1,D)).c),n.e,"0"):(k(e,2,G.length,"Base"),t=E(_(f(n.c),r,"0"),10,e,s,!0)),s<0&&n.c[0]&&(t="-"+t)),t},N.valueOf=N.toJSON=function(){return z(this)},N._isBigNumber=!0,null!=t&&W.set(t),W}(),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/bridge-status-controller>bignumber.js",file:"node_modules/@metamask/bridge-status-controller/node_modules/bignumber.js/bignumber.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/browser-passworder/dist/index.js",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},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.isVaultUpdated=n.updateVaultWithDetail=n.updateVault=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 s=e("@metamask/utils"),r="jwk",o="AES-GCM",a="utf-8",i={algorithm:"PBKDF2",params:{iterations:1e4}},c={algorithm:"PBKDF2",params:{iterations:9e5}};async function l(e,t,n,s=g(),r=c){const o=n||await f(e,s,!1,r),a=await u(o,t);return a.salt=s,JSON.stringify(a)}async function d(e,t,n=g(),s=c){const r=await f(e,n,!0,s),o=await p(r);return{vault:await l(e,t,r,n),exportedKeyString:o}}async function u(e,n){const s=JSON.stringify(n),r=t.from(s,a),i=globalThis.crypto.getRandomValues(new Uint8Array(16)),c=b(e),l=await globalThis.crypto.subtle.encrypt({name:o,iv:i},c,r),d=new Uint8Array(l),u=t.from(i).toString("base64"),m={data:t.from(d).toString("base64"),iv:u};return k(e)&&(m.keyMetadata=e.derivationOptions),m}async function m(e,t,n){const s=JSON.parse(t),{salt:r,keyMetadata:o}=s,a=b(n||await f(e,r,!1,o));return await h(a,s)}async function h(e,n){const s=t.from(n.data,"base64"),r=t.from(n.iv,"base64"),i=b(e);let c;try{const e=await crypto.subtle.decrypt({name:o,iv:r},i,s),n=new Uint8Array(e),l=t.from(n).toString(a);c=JSON.parse(l)}catch(e){throw new Error("Incorrect password")}return c}async function p(e){return k(e)?JSON.stringify({key:await globalThis.crypto.subtle.exportKey(r,e.key),derivationOptions:e.derivationOptions}):JSON.stringify(await globalThis.crypto.subtle.exportKey(r,e))}async function f(e,n,s=!1,r=i){const c=t.from(e,a),l=t.from(n,"base64"),d=await globalThis.crypto.subtle.importKey("raw",c,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]),u=await globalThis.crypto.subtle.deriveKey({name:"PBKDF2",salt:l,iterations:r.params.iterations,hash:"SHA-256"},d,{name:o,length:256},s,["encrypt","decrypt"]);return r?{key:u,derivationOptions:r}:u}function g(e=32){const t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);return btoa(String.fromCharCode.apply(null,t))}function k(e){return(0,s.isPlainObject)(e)&&(0,s.hasProperty)(e,"key")&&(0,s.hasProperty)(e,"derivationOptions")&&e.key instanceof CryptoKey&&w(e.derivationOptions)}function w(e){return(0,s.isPlainObject)(e)&&(0,s.hasProperty)(e,"algorithm")&&(0,s.hasProperty)(e,"params")}function b(e){return k(e)?e.key:e}function _(e,t=c){const{keyMetadata:n}=JSON.parse(e);return w(n)&&n.algorithm===t.algorithm&&n.params.iterations===t.params.iterations}n.encrypt=l,n.encryptWithDetail=d,n.encryptWithKey=u,n.decrypt=m,n.decryptWithDetail=async function(e,t){const n=JSON.parse(t),{salt:s,keyMetadata:r}=n,o=await f(e,s,!0,r);return{exportedKeyString:await p(o),vault:await m(e,t,o),salt:s}},n.decryptWithKey=h,n.importKey=async function(e){const t=JSON.parse(e);return n=t,(0,s.isPlainObject)(n)&&(0,s.hasProperty)(n,"key")&&(0,s.hasProperty)(n,"derivationOptions")&&w(n.derivationOptions)?{key:await globalThis.crypto.subtle.importKey(r,t.key,o,!0,["encrypt","decrypt"]),derivationOptions:t.derivationOptions}:await globalThis.crypto.subtle.importKey(r,t,o,!0,["encrypt","decrypt"]);var n},n.exportKey=p,n.keyFromPassword=f,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 s=t.substr(e,2);n[e/2]=parseInt(s,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=g,n.updateVault=async function(e,t,n=c){return _(e,n)?e:l(t,await m(t,e),undefined,undefined,n)},n.updateVaultWithDetail=async function(e,t,n=c){return _(e.vault,n)?e:d(t,await m(t,e.vault),undefined,n)},n.isVaultUpdated=_}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/browser-passworder",file:"node_modules/@metamask/browser-passworder/dist/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/dist/AccountActivityService.cjs",{"./BackendWebSocketService.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/dist/BackendWebSocketService.cjs","./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/dist/logger.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,l,d,u,m,h,p,f,g=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},k=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.AccountActivityService=n.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS=n.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS=void 0;const w=e("./BackendWebSocketService.cjs"),b=e("./logger.cjs"),_="AccountActivityService",E=(0,b.createModuleLogger)(b.projectLogger,_),y=["subscribe","unsubscribe"];n.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS=["AccountsController:getSelectedAccount","BackendWebSocketService:connect","BackendWebSocketService:forceReconnection","BackendWebSocketService:subscribe","BackendWebSocketService:getConnectionInfo","BackendWebSocketService:channelHasSubscription","BackendWebSocketService:getSubscriptionsByChannel","BackendWebSocketService:findSubscriptionsByChannelPrefix","BackendWebSocketService:addChannelCallback","BackendWebSocketService:removeChannelCallback"],n.ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS=["AccountsController:selectedAccountChange","BackendWebSocketService:connectionStateChanged"];n.AccountActivityService=class{constructor(e){s.add(this),this.name=_,r.set(this,void 0),o.set(this,void 0),a.set(this,void 0),i.set(this,new Set),g(this,r,e.messenger,"f"),g(this,o,{subscriptionNamespace:e.subscriptionNamespace??"account-activity.v1"},"f"),g(this,a,e.traceFn??((e,t)=>t?.()),"f"),k(this,r,"f").registerMethodActionHandlers(this,y),k(this,r,"f").subscribe("AccountsController:selectedAccountChange",async e=>await k(this,s,"m",l).call(this,e)),k(this,r,"f").subscribe("BackendWebSocketService:connectionStateChanged",e=>k(this,s,"m",u).call(this,e)),k(this,r,"f").call("BackendWebSocketService:addChannelCallback",{channelName:`system-notifications.v1.${k(this,o,"f").subscriptionNamespace}`,callback:e=>k(this,s,"m",d).call(this,e)})}async subscribe(e){try{await k(this,r,"f").call("BackendWebSocketService:connect");const t=`${k(this,o,"f").subscriptionNamespace}.${e.address}`;if(k(this,r,"f").call("BackendWebSocketService:channelHasSubscription",t))return;await k(this,r,"f").call("BackendWebSocketService:subscribe",{channels:[t],channelType:k(this,o,"f").subscriptionNamespace,callback:e=>{k(this,s,"m",c).call(this,e.data)}})}catch(e){E("Subscription failed, forcing reconnection",{error:e}),await k(this,s,"m",f).call(this)}}async unsubscribe(e){const{address:t}=e;try{const e=`${k(this,o,"f").subscriptionNamespace}.${t}`,n=k(this,r,"f").call("BackendWebSocketService:getSubscriptionsByChannel",e);if(0===n.length)return;for(const e of n)await e.unsubscribe()}catch(e){E("Unsubscription failed, forcing reconnection",{error:e}),await k(this,s,"m",f).call(this)}}destroy(){k(this,r,"f").call("BackendWebSocketService:removeChannelCallback",`system-notifications.v1.${k(this,o,"f").subscriptionNamespace}`)}},r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,s=new WeakSet,c=function(e){const{address:t,tx:n,updates:s}=e,i=1e3*n.timestamp,c=Date.now()-i;E("Handling account activity update",{address:t,updateCount:s.length,elapsedMs:c}),k(this,a,"f").call(this,{name:`${_} Transaction Message`,data:{chain:n.chain,status:n.status,elapsed_ms:c},tags:{service:_,notification_type:k(this,o,"f").subscriptionNamespace}},()=>{k(this,r,"f").publish("AccountActivityService:transactionUpdated",n),k(this,r,"f").publish("AccountActivityService:balanceUpdated",{address:t,chain:n.chain,updates:s})})},l=async function(e){if(e?.address)try{const t=k(this,s,"m",p).call(this,e);await k(this,s,"m",h).call(this),await this.subscribe({address:t})}catch(e){E("Account change failed",{error:e})}},d=function(e){const t=e.data,{timestamp:n}=e;if(!t.chainIds||!Array.isArray(t.chainIds)||!t.status)throw new Error("Invalid system notification data: missing chainIds or status");if("up"===t.status)for(const e of t.chainIds)k(this,i,"f").add(e);else for(const e of t.chainIds)k(this,i,"f").delete(e);k(this,r,"f").publish("AccountActivityService:statusChanged",{chainIds:t.chainIds,status:t.status,timestamp:n}),E(`WebSocket status change - Published tracked chains as ${t.status}`,{count:t.chainIds.length,chains:t.chainIds,status:t.status})},u=async function(e){const{state:t}=e;if(t===w.WebSocketState.CONNECTED)await k(this,s,"m",m).call(this);else if(t===w.WebSocketState.DISCONNECTED){const e=Array.from(k(this,i,"f"));e.length>0&&(k(this,r,"f").publish("AccountActivityService:statusChanged",{chainIds:e,status:"down",timestamp:Date.now()}),E("WebSocket disconnection - Published tracked chains as down",{count:e.length,chains:e}),k(this,i,"f").clear())}},m=async function(){const e=k(this,r,"f").call("AccountsController:getSelectedAccount");if(!e||!e.address)return;const t=k(this,s,"m",p).call(this,e);await this.subscribe({address:t})},h=async function(){const e=k(this,r,"f").call("BackendWebSocketService:findSubscriptionsByChannelPrefix",k(this,o,"f").subscriptionNamespace);for(const t of e)await t.unsubscribe()},p=function(e){return e.scopes.some(e=>e.startsWith("eip155:"))?`eip155:0:${e.address}`:e.scopes.some(e=>e.startsWith("solana:"))?`solana:0:${e.address}`:e.address},f=async function(){E("Forcing WebSocket reconnection to clean up subscription state"),await k(this,r,"f").call("BackendWebSocketService:forceReconnection")}}}},{package:"@metamask/core-backend",file:"node_modules/@metamask/core-backend/dist/AccountActivityService.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/dist/BackendWebSocketService.cjs",{"./logger.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/dist/logger.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,l,d,u,m,h,p,f,g,k,w,b,_,E,y,S,I,C,A,T,v,x,N,j,P,D,R,O,M,B,L=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},F=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.BackendWebSocketService=n.WebSocketEventType=n.WebSocketState=n.getCloseReason=void 0;const U=e("@metamask/controller-utils"),H=e("@metamask/utils"),G=e("uuid"),q=e("./logger.cjs"),W="BackendWebSocketService",$=(0,q.createModuleLogger)(q.projectLogger,W),V="Internal: Manual disconnect",K=["connect","disconnect","forceReconnection","sendMessage","sendRequest","subscribe","getConnectionInfo","getSubscriptionsByChannel","channelHasSubscription","findSubscriptionsByChannelPrefix","addChannelCallback","removeChannelCallback","getChannelCallbacks"];function Y(e){switch(e){case 1e3:return"Normal Closure";case 1001:return"Going Away";case 1002:return"Protocol Error";case 1003:return"Unsupported Data";case 1004:return"Reserved";case 1005:return"No Status Received";case 1006:return"Abnormal Closure";case 1007:return"Invalid frame payload data";case 1008:return"Policy Violation";case 1009:return"Message Too Big";case 1010:return"Mandatory Extension";case 1011:return"Internal Server Error";case 1012:return"Service Restart";case 1013:return"Try Again Later";case 1014:return"Bad Gateway";case 1015:return"TLS Handshake";default:return e>=3e3&&e<=3999?"Library/Framework Error":e>=4e3&&e<=4999?"Application Error":"Unknown"}}var z,Q;n.getCloseReason=Y,function(e){e.CONNECTING="connecting",e.CONNECTED="connected",e.DISCONNECTING="disconnecting",e.DISCONNECTED="disconnected",e.ERROR="error"}(z||(n.WebSocketState=z={})),function(e){e.CONNECTED="connected",e.DISCONNECTED="disconnected",e.MESSAGE="message",e.ERROR="error",e.RECONNECTING="reconnecting",e.RECONNECTED="reconnected"}(Q||(n.WebSocketEventType=Q={}));n.BackendWebSocketService=class{constructor(e){s.add(this),this.name=W,r.set(this,void 0),o.set(this,void 0),a.set(this,void 0),i.set(this,void 0),c.set(this,void 0),l.set(this,z.DISCONNECTED),d.set(this,0),u.set(this,null),m.set(this,null),h.set(this,null),p.set(this,null),f.set(this,new Map),g.set(this,0),k.set(this,new Map),w.set(this,new Map),b.set(this,void 0),L(this,r,e.messenger,"f"),L(this,a,e.isEnabled,"f"),L(this,i,e.traceFn??((e,t)=>t?.()),"f"),L(this,o,{url:e.url,timeout:e.timeout??1e4,reconnectDelay:e.reconnectDelay??1e4,maxReconnectDelay:e.maxReconnectDelay??6e4,requestTimeout:e.requestTimeout??3e4},"f"),F(this,s,"m",D).call(this),F(this,s,"m",_).call(this),F(this,r,"f").registerMethodActionHandlers(this,K)}async connect(){if(F(this,a,"f")&&!F(this,a,"f").call(this))return F(this,s,"m",R).call(this),void L(this,d,0,"f");if(F(this,l,"f")!==z.CONNECTED)if(F(this,p,"f"))await F(this,p,"f");else if(!F(this,u,"f")){L(this,p,(async()=>{let e;try{const t=await F(this,r,"f").call("AuthenticationController:getBearerToken");if(!t)throw new Error("Authentication required: user not signed in");e=t}catch(e){throw $("Failed to check authentication requirements",{error:e}),e}await F(this,s,"m",y).call(this,e)})(),"f");try{await F(this,p,"f")}catch{F(this,s,"m",P).call(this)}finally{L(this,p,null,"f")}}}disconnect(){F(this,l,"f")!==z.DISCONNECTED&&F(this,c,"f")&&(F(this,c,"f").close(4999,V),$("WebSocket manually disconnected"))}async forceReconnection(){if(F(this,l,"f")===z.DISCONNECTED||!F(this,c,"f"))return $("WebSocket already disconnected, scheduling reconnect"),void F(this,s,"m",P).call(this);$("Forcing WebSocket reconnection to clean up subscription state"),F(this,c,"f").close(4998,"Internal: Force reconnect")}sendMessage(e){if(F(this,l,"f")!==z.CONNECTED||!F(this,c,"f"))throw new Error(`Cannot send message: WebSocket is ${F(this,l,"f")}`);try{F(this,c,"f").send(JSON.stringify(e))}catch(e){const t=(0,H.getErrorMessage)(e);throw F(this,s,"m",j).call(this,new Error(t)),new Error(t)}}async sendRequest(e){if(F(this,l,"f")!==z.CONNECTED)throw new Error(`Cannot send request: WebSocket is ${F(this,l,"f")}`);const t=e.data?.requestId??(0,G.v4)(),n={event:e.event,data:{...e.data,requestId:t}};return new Promise((e,s)=>{const r=setTimeout(()=>{F(this,f,"f").delete(t),$("Request timeout - triggering reconnection",{timeout:F(this,o,"f").requestTimeout}),F(this,l,"f")===z.CONNECTED&&F(this,c,"f")&&F(this,c,"f").close(3e3,"Request timeout - forcing reconnect"),s(new Error(`Request timeout after ${F(this,o,"f").requestTimeout}ms`))},F(this,o,"f").requestTimeout);F(this,f,"f").set(t,{resolve:e,reject:s,timeout:r});try{this.sendMessage(n)}catch(e){F(this,f,"f").delete(t),clearTimeout(r),s(e instanceof Error?e:new Error(String(e)))}})}getConnectionInfo(){return{state:F(this,l,"f"),url:F(this,o,"f").url,timeout:F(this,o,"f").timeout,reconnectDelay:F(this,o,"f").reconnectDelay,maxReconnectDelay:F(this,o,"f").maxReconnectDelay,requestTimeout:F(this,o,"f").requestTimeout,reconnectAttempts:F(this,d,"f"),connectedAt:F(this,g,"f")}}getSubscriptionsByChannel(e){const t=[];for(const[n,s]of F(this,k,"f"))s.channels.includes(e)&&t.push({subscriptionId:n,channels:s.channels,channelType:s.channelType,unsubscribe:s.unsubscribe});return t}channelHasSubscription(e){for(const t of F(this,k,"f").values())if(t.channels.includes(e))return!0;return!1}findSubscriptionsByChannelPrefix(e){const t=[];for(const[n,s]of F(this,k,"f")){s.channels.some(t=>t.startsWith(e))&&t.push({subscriptionId:n,channels:s.channels,channelType:s.channelType,unsubscribe:s.unsubscribe})}return t}addChannelCallback(e){const t={channelName:e.channelName,callback:e.callback};F(this,w,"f").has(e.channelName)||F(this,w,"f").set(e.channelName,t)}removeChannelCallback(e){return F(this,w,"f").delete(e)}getChannelCallbacks(){return Array.from(F(this,w,"f").values())}destroy(){F(this,s,"m",R).call(this),L(this,d,0,"f"),this.disconnect()}async subscribe(e){const{channels:t,channelType:n,callback:s,requestId:r}=e;if(F(this,l,"f")!==z.CONNECTED)throw new Error(`Cannot create subscription(s) ${t.join(", ")}: WebSocket is ${F(this,l,"f")}`);const o=await this.sendRequest({event:"subscribe",data:{channels:t,requestId:r}});if(!o?.subscriptionId)throw new Error("Invalid subscription response: missing subscription ID");const{subscriptionId:a}=o,i=async e=>{await this.sendRequest({event:"unsubscribe",data:{subscription:a,channels:t,requestId:e}}),F(this,k,"f").delete(a)},c={subscriptionId:a,channels:[...t],channelType:n,unsubscribe:i};return F(this,k,"f").set(a,{subscriptionId:a,channels:[...t],channelType:n,callback:s,unsubscribe:i}),c}},r=new WeakMap,o=new WeakMap,a=new WeakMap,i=new WeakMap,c=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,m=new WeakMap,h=new WeakMap,p=new WeakMap,f=new WeakMap,g=new WeakMap,k=new WeakMap,w=new WeakMap,b=new WeakMap,s=new WeakSet,_=function(){F(this,r,"f").subscribe("AuthenticationController:stateChange",e=>{e.isSignedIn?this.connect():this.disconnect()},e=>({isSignedIn:e.isSignedIn})),F(this,r,"f").subscribe("KeyringController:unlock",()=>{this.connect()}),F(this,r,"f").subscribe("KeyringController:lock",()=>{this.disconnect()})},E=function(e){const t=F(this,o,"f").url,n=new URL(t);return n.searchParams.set("token",e),n.toString()},y=async function(e){const t=F(this,s,"m",E).call(this,e);return F(this,s,"m",B).call(this,z.CONNECTING),F(this,i,"f").call(this,{name:`${W} Connection`,data:{reconnectAttempt:F(this,d,"f")},tags:{service:W}},()=>new Promise((e,n)=>{const r=new WebSocket(t);L(this,m,setTimeout(()=>{$("WebSocket connection timeout - forcing close",{timeout:F(this,o,"f").timeout}),r.close()},F(this,o,"f").timeout),"f"),r.onopen=()=>{F(this,m,"f")&&(clearTimeout(F(this,m,"f")),L(this,m,null,"f")),L(this,c,r,"f"),F(this,s,"m",B).call(this,z.CONNECTED),L(this,g,Date.now(),"f"),L(this,h,setTimeout(()=>{L(this,h,null,"f"),L(this,d,0,"f"),F(this,s,"m",D).call(this),$("Connection stable - reset reconnect attempts and backoff")},1e4),"f"),e()},r.onclose=t=>{if($("WebSocket onclose event triggered",{code:t.code,reason:t.reason||Y(t.code),wasClean:t.wasClean}),F(this,l,"f")===z.DISCONNECTED)return;const r=4999===t.code&&t.reason===V;F(this,l,"f")===z.CONNECTING&&(r?e():n(new Error(`WebSocket connection closed during connection: ${t.code} ${t.reason}`)));const o=F(this,g,"f")>0?Date.now()-F(this,g,"f"):0;F(this,s,"m",R).call(this),L(this,c,undefined,"f"),L(this,p,null,"f"),L(this,g,0,"f"),F(this,s,"m",O).call(this,new Error(`WebSocket connection closed: ${t.code} ${t.reason||Y(t.code)}`)),F(this,s,"m",M).call(this),F(this,s,"m",B).call(this,z.DISCONNECTED),r?L(this,d,0,"f"):F(this,s,"m",P).call(this),F(this,i,"f").call(this,{name:`${W} Disconnection`,data:{code:t.code,reason:t.reason||Y(t.code),wasClean:t.wasClean,reconnectAttempts:F(this,d,"f"),...o>0&&{connectionDuration_ms:o}},tags:{service:W}})},r.onmessage=e=>{try{const t=F(this,s,"m",N).call(this,e.data);F(this,s,"m",S).call(this,t)}catch{}}}))},S=function(e){if(F(this,s,"m",I).call(this,e))F(this,s,"m",T).call(this,e);else{if(F(this,s,"m",C).call(this,e)){const t=e;if(F(this,s,"m",x).call(this,t))return}if(F(this,s,"m",A).call(this,e)){const t=e;F(this,s,"m",v).call(this,t)}}},I=function(e){return"data"in e&&e.data&&"object"==typeof e.data&&"requestId"in e.data},C=function(e){return"subscriptionId"in e&&!F(this,s,"m",I).call(this,e)},A=function(e){return"channel"in e},T=function(e){const{requestId:t}=e.data,n=F(this,f,"f").get(t);n&&(F(this,f,"f").delete(t),clearTimeout(n.timeout),e.data.failed&&e.data.failed.length>0?n.reject(new Error(`Request failed: ${e.data.failed.join(", ")}`)):n.resolve(e.data))},v=function(e){0!==F(this,w,"f").size&&F(this,w,"f").get(e.channel)?.callback(e)},x=function(e){const{subscriptionId:t,timestamp:n,channel:s}=e;if(null!==t&&t!==undefined){const r=F(this,k,"f").get(t);if(!r)return!1;const o=Date.now()-n;return F(this,i,"f").call(this,{name:`${W} Notification`,data:{channel:s,latency_ms:o,subscriptionId:t},tags:{service:W,notification_type:r.channelType}},()=>{r.callback?.(e)}),!0}return!1},N=function(e){return JSON.parse(e)},j=function(e){},P=function(){if(F(this,u,"f"))return;L(this,d,F(this,d,"f")+1,"f");const e=F(this,b,"f").duration;L(this,b,F(this,b,"f").next({attempt:F(this,d,"f")}),"f"),$("Scheduling reconnect",{attempt:F(this,d,"f"),delay_ms:e}),L(this,u,setTimeout(()=>{if(L(this,u,null,"f"),F(this,a,"f")&&!F(this,a,"f").call(this))return L(this,d,0,"f"),void F(this,s,"m",D).call(this);this.connect()},e),"f")},D=function(){L(this,b,new U.ExponentialBackoff({initialDelay:F(this,o,"f").reconnectDelay,maxDelay:F(this,o,"f").maxReconnectDelay}).next(),"f")},R=function(){F(this,u,"f")&&(clearTimeout(F(this,u,"f")),L(this,u,null,"f")),F(this,m,"f")&&(clearTimeout(F(this,m,"f")),L(this,m,null,"f")),F(this,h,"f")&&(clearTimeout(F(this,h,"f")),L(this,h,null,"f"))},O=function(e){for(const[,t]of F(this,f,"f"))clearTimeout(t.timeout),t.reject(e);F(this,f,"f").clear()},M=function(){F(this,k,"f").clear()},B=function(e){const t=F(this,l,"f");L(this,l,e,"f"),t!==e&&F(this,r,"f").publish("BackendWebSocketService:connectionStateChanged",this.getConnectionInfo())}}}},{package:"@metamask/core-backend",file:"node_modules/@metamask/core-backend/dist/BackendWebSocketService.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/dist/index.cjs",{"./AccountActivityService.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/dist/AccountActivityService.cjs","./BackendWebSocketService.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/dist/BackendWebSocketService.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.AccountActivityService=n.BackendWebSocketService=void 0;var s=e("./BackendWebSocketService.cjs");Object.defineProperty(n,"BackendWebSocketService",{enumerable:!0,get:function(){return s.BackendWebSocketService}});var r=e("./AccountActivityService.cjs");Object.defineProperty(n,"AccountActivityService",{enumerable:!0,get:function(){return r.AccountActivityService}})}}},{package:"@metamask/core-backend",file:"node_modules/@metamask/core-backend/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/core-backend/dist/logger.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},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 s=e("@metamask/utils");Object.defineProperty(n,"createModuleLogger",{enumerable:!0,get:function(){return s.createModuleLogger}}),n.projectLogger=(0,s.createProjectLogger)("core-backend")}}},{package:"@metamask/core-backend",file:"node_modules/@metamask/core-backend/dist/logger.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/DelegationController.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/utils.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},a=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.DelegationController=n.controllerName=void 0;const i=e("@metamask/base-controller"),c=e("@metamask/keyring-controller"),l=e("@metamask/utils"),d=e("./constants.cjs"),u=e("./utils.cjs");n.controllerName="DelegationController";const m={delegations:{includeInStateLogs:!1,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}};class h extends i.BaseController{constructor({messenger:e,state:t,hashDelegation:a,getDelegationEnvironment:i}){super({messenger:e,metadata:m,name:n.controllerName,state:{delegations:{},...t}}),s.set(this,void 0),r.set(this,void 0),o(this,s,a,"f"),o(this,r,i,"f")}async signDelegation(e){const{delegation:t,chainId:n}=e,{DelegationManager:s}=a(this,r,"f").call(this,n),o=(0,u.createTypedMessageParams)({chainId:(0,l.hexToNumber)(n),from:t.delegator,delegation:{...t,signature:"0x"},verifyingContract:s});return await this.messenger.call("KeyringController:signTypedMessage",o,c.SignTypedDataVersion.V4)}store(e){const{entry:t}=e,n=a(this,s,"f").call(this,t.delegation);if(!(0,u.isHexEqual)(t.delegation.authority,d.ROOT_AUTHORITY)&&!this.state.delegations[t.delegation.authority])throw new Error("Invalid authority");this.update(e=>{e.delegations[n]=t})}list(e){const t=this.messenger.call("AccountsController:getSelectedAccount").address;let n=Object.values(this.state.delegations);e?.from&&(n=n.filter(t=>(0,u.isHexEqual)(t.delegation.delegator,e.from))),(!e?.from||e?.from&&!(0,u.isHexEqual)(e.from,t))&&(n=n.filter(e=>(0,u.isHexEqual)(e.delegation.delegate,t)));const s=e?.chainId;s&&(n=n.filter(e=>(0,u.isHexEqual)(e.chainId,s)));const r=e?.tags;return r&&r.length>0&&(n=n.filter(e=>r.every(t=>e.tags.includes(t)))),n}retrieve(e){return this.state.delegations[e]??null}chain(e){const t=[],n=this.retrieve(e);if(!n)return null;t.push(n);for(let e=n.delegation.authority;e!==d.ROOT_AUTHORITY;){const n=this.retrieve(e);if(!n)throw new Error("Invalid delegation chain");t.push(n),e=n.delegation.authority}return t}delete(e){if(!this.retrieve(e))return 0;const t=Object.entries(this.state.delegations),n=[e],s=[];for(;n.length>0;){const e=n.pop();t.filter(([t,n])=>n.delegation.authority===e).forEach(([e])=>{n.push(e)}),s.push(e)}return this.update(e=>{s.forEach(t=>{delete e.delegations[t]})}),s.length}}n.DelegationController=h,s=new WeakMap,r=new WeakMap}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/DelegationController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SIGNABLE_DELEGATION_TYPED_DATA=n.ROOT_AUTHORITY=void 0,n.ROOT_AUTHORITY="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";n.SIGNABLE_DELEGATION_TYPED_DATA={EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Caveat:[{name:"enforcer",type:"address"},{name:"terms",type:"bytes"}],Delegation:[{name:"delegate",type:"address"},{name:"delegator",type:"address"},{name:"authority",type:"bytes32"},{name:"caveats",type:"Caveat[]"},{name:"salt",type:"uint256"}]}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/index.cjs",{"./DelegationController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/DelegationController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.DelegationController=void 0;var s=e("./DelegationController.cjs");Object.defineProperty(n,"DelegationController",{enumerable:!0,get:function(){return s.DelegationController}})}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-controller/dist/constants.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createTypedMessageParams=n.toDelegationStruct=n.isHexEqual=void 0;const s=e("@metamask/utils"),r=e("./constants.cjs");n.isHexEqual=function(e,t){return e.toLowerCase()===t.toLowerCase()};n.toDelegationStruct=e=>{const t=e.caveats.map(e=>({enforcer:(0,s.getChecksumAddress)(e.enforcer),terms:e.terms,args:e.args})),n="0x"===e.salt?0n:BigInt(e.salt);return{delegate:(0,s.getChecksumAddress)(e.delegate),delegator:(0,s.getChecksumAddress)(e.delegator),authority:e.authority,caveats:t,salt:n,signature:e.signature}},n.createTypedMessageParams=function(e){const{chainId:t,from:s,delegation:o,verifyingContract:a}=e;return{data:{types:r.SIGNABLE_DELEGATION_TYPED_DATA,primaryType:"Delegation",domain:{chainId:t,name:"DelegationManager",version:"1",verifyingContract:a},message:(0,n.toDelegationStruct)(o)},from:s}}}}},{package:"@metamask/delegation-controller",file:"node_modules/@metamask/delegation-controller/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/delegation-deployments/dist/index.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var s={DelegationManager:"0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x69Aa2f9fe1572F1B640E1bbc512f5c3a734fc77c",MultiSigDeleGatorImpl:"0x56a9EdB16a0105eb5a4C54f4C062e2868844f3A7",HybridDeleGatorImpl:"0x48dBe696A4D990079e039489bA2053B36E8FFEC4",EIP7702StatelessDeleGatorImpl:"0x63c0c19a282a1B52b07dD5a65b58948A07DAE32B",AllowedCalldataEnforcer:"0xc2b0d624c1c4319760C96503BA27C347F3260f55",AllowedMethodsEnforcer:"0x2c21fD0Cb9DC8445CB3fb0DC5E7Bb0Aca01842B5",AllowedTargetsEnforcer:"0x7F20f61b1f09b08D970938F6fa563634d65c4EeB",BlockNumberEnforcer:"0x5d9818dF0AE3f66e9c3D0c5029DAF99d1823ca6c",DeployedEnforcer:"0x24ff2AA430D53a8CD6788018E902E098083dcCd2",ERC20BalanceChangeEnforcer:"0xcdF6aB796408598Cea671d79506d7D48E97a5437",ERC20TransferAmountEnforcer:"0xf100b0819427117EcF76Ed94B358B1A5b5C6D2Fc",ERC20PeriodTransferEnforcer:"0x474e3Ae7E169e940607cC624Da8A15Eb120139aB",ERC20StreamingEnforcer:"0x56c97aE02f233B29fa03502Ecc0457266d9be00e",ERC721BalanceChangeEnforcer:"0x8aFdf96eDBbe7e1eD3f5Cd89C7E084841e12A09e",ERC721TransferEnforcer:"0x3790e6B7233f779b09DA74C72b6e94813925b9aF",ERC1155BalanceChangeEnforcer:"0x63c322732695cAFbbD488Fc6937A0A7B66fC001A",ExactCalldataBatchEnforcer:"0x982FD5C86BBF425d7d1451f974192d4525113DfD",ExactCalldataEnforcer:"0x99F2e9bF15ce5eC84685604836F71aB835DBBdED",ExactExecutionBatchEnforcer:"0x1e141e455d08721Dd5BCDA1BaA6Ea5633Afd5017",ExactExecutionEnforcer:"0x146713078D39eCC1F5338309c28405ccf85Abfbb",IdEnforcer:"0xC8B5D93463c893401094cc70e66A206fb5987997",LimitedCallsEnforcer:"0x04658B29F6b82ed55274221a06Fc97D318E25416",NativeBalanceChangeEnforcer:"0xbD7B277507723490Cd50b12EaaFe87C616be6880",ArgsEqualityCheckEnforcer:"0x44B8C6ae3C304213c3e298495e12497Ed3E56E41",NativeTokenPaymentEnforcer:"0x4803a326ddED6dDBc60e659e5ed12d85c7582811",NativeTokenTransferAmountEnforcer:"0xF71af580b9c3078fbc2BBF16FbB8EEd82b330320",NativeTokenStreamingEnforcer:"0xD10b97905a320b13a0608f7E9cC506b56747df19",NativeTokenPeriodTransferEnforcer:"0x9BC0FAf4Aca5AE429F4c06aEEaC517520CB16BD9",NonceEnforcer:"0xDE4f2FAC4B3D87A1d9953Ca5FC09FCa7F366254f",OwnershipTransferEnforcer:"0x7EEf9734E7092032B5C56310Eb9BbD1f4A524681",RedeemerEnforcer:"0xE144b0b2618071B4E56f746313528a669c7E65c5",SpecificActionERC20TransferBatchEnforcer:"0x6649b61c873F6F9686A1E1ae9ee98aC380c7bA13",TimestampEnforcer:"0x1046bb45C8d673d4ea75321280DB34899413c069",ValueLteEnforcer:"0x92Bf12322527cAA612fd31a0e810472BBB106A8F",MultiTokenPeriodEnforcer:"0xFB2f1a9BD76d3701B730E5d69C3219D42D80eBb7"},r={DelegationManager:"0x56D56e07e3d6Ee5a24e30203A37a0a460f42D7A3",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x6ff518884f21168c30c58CB21184D6AdBC18Ad90",MultiSigDeleGatorImpl:"0xd1f421EDbA5e3FA9efe3874827114b20C5BEC40C",HybridDeleGatorImpl:"0x941f3a016F8726d5643Ce62452d0D78492D42b42",AllowedCalldataEnforcer:"0xff71d60f3208469cBCE0859717B5198042DCB3F3",AllowedMethodsEnforcer:"0xe32C2561792e8446Abe73B9f557B881C13906186",AllowedTargetsEnforcer:"0x06aaE4c67EEA95277c46Bf79b1583d4a01772D22",BlockNumberEnforcer:"0x8E470D2Ae278457b42d2405E0B8Cd4BE21Ed9045",DeployedEnforcer:"0xf9088f013dBD9ebb7Cebd66fEB48253c6Ac5a820",ERC20BalanceGteEnforcer:"0xB7B6f32ec6343261D814e55Ed8C5925d91Cab861",ERC20TransferAmountEnforcer:"0x9A069b18032B31429A363AeCFb1B6A0564b44471",IdEnforcer:"0x91015c3b9D9523966eD2399885e5Df7A567f916c",LimitedCallsEnforcer:"0xe694bFfffEA3E85923b1210b37e6a0175e910863",NonceEnforcer:"0xE83BCFD8bBE672A96747e831050a91cf44F4F87A",TimestampEnforcer:"0x550FdD13eEBC1f22ea2a2480024BacBF0Ad7e5CE",ValueLteEnforcer:"0xBE32a6DB7471F63BB168C088c57Db01AfAe87967",NativeTokenTransferAmountEnforcer:"0x5eD3833d7B957A8DB8A461c3AF2d668Ec25382E0",NativeBalanceGteEnforcer:"0x376a98860E210DdEda3689fb39565592c563cB0A",ArgsEqualityCheckEnforcer:"0x7378dE585998d3E18Ce147867C335C25B3dB8Ee5",NativeTokenPaymentEnforcer:"0x87Fe18EbF99e42fcE8A03a25F1d20E119407f8e7",RedeemerEnforcer:"0x926672b130D1EF60A9d6b11D2048d121b30f40C1"},o={DelegationManager:"0xbe4138886cb096bdc1b930f2f0ca7892aa234d78",EntryPoint:"0x0000000071727De22E5E9d8BAf0edAc6f37da032",SimpleFactory:"0x6ff518884f21168c30c58CB21184D6AdBC18Ad90",MultiSigDeleGatorImpl:"0x11f555af5844d85bfcf5d61d2a22866527eb585a",HybridDeleGatorImpl:"0xd6edd1256deccb2b06bdecef92dc16bcf26e531b",AllowedCalldataEnforcer:"0x48db3835a873d64a4af2c09f014052407c003bd7",AllowedMethodsEnforcer:"0xfd731951bf1c52afccee3e6f14ab656475b76dd4",AllowedTargetsEnforcer:"0xbc8673c0afa52d86d991c06881e55b2966920564",BlockNumberEnforcer:"0xc15faffa0d879b9263c15a46ce31eacfa2e0e8ae",DeployedEnforcer:"0x5accb9559b56a6c1e3f90e342c85c42d93720d43",ERC20BalanceGteEnforcer:"0xb5d6b1ec6d868a3bae5b7f48178eaa2686a7a087",ERC20TransferAmountEnforcer:"0x92ac423b9c111962179a6242e1adb58d02c103be",IdEnforcer:"0x34152d9f3f8f74338d50703e780389e829b4abac",LimitedCallsEnforcer:"0x4b3adad4a328bee8ba17b86074d92fe7372180cd",NonceEnforcer:"0x2f32ff3fc3086d7f63f16fe8d0065390d460b40d",TimestampEnforcer:"0x78e05f779490c24bf3bfa135b4112e7003b321cd",ValueLteEnforcer:"0xfc20ede0a1132e839fbda9d7ed3904ff3c89540f"},a={arbitrum:42161,arbitrumNova:42170,base:8453,berachain:80094,bsc:56,gnosis:100,ink:57073,linea:59144,mainnet:1,monad:143,optimism:10,polygon:137,sei:1329,sonic:146,unichain:130,bscTestnet:97,arbitrumSepolia:421614,baseSepolia:84532,berachainBepolia:80069,chiado:10200,citreaTestnet:5115,hoodiTestnet:560048,inkSepolia:763373,lineaSepolia:59141,megaEthTestnet:6342,monadTestnet:10143,optimismSepolia:11155420,polygonAmoy:80002,seiTestnet:1328,sepolia:11155111,sonicTestnet:14601,unichainSepolia:1301,lineaGoerli:59140},i={"1.0.0":{[a.optimism]:o,[a.polygon]:o,[a.base]:o,[a.arbitrum]:o,[a.linea]:o,[a.sepolia]:{...o,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"},[a.lineaSepolia]:{...o,HybridDeleGatorImpl:"0x5989F5D13DF8fc818EdA65e417AED90459fD67F7"}},"1.1.0":{[a.arbitrum]:r,[a.base]:r,[a.linea]:r,[a.optimism]:r,[a.polygon]:r,[a.sepolia]:r,[a.lineaSepolia]:r,[a.baseSepolia]:{...r,SimpleFactory:"0xE8eA1DE8D6AfE400B7C8C1A81B7C29B7876b4d02"}},"1.3.0":{[a.mainnet]:s,[a.polygon]:s,[a.bsc]:s,[a.optimism]:s,[a.arbitrum]:s,[a.ink]:s,[a.linea]:s,[a.base]:s,[a.gnosis]:s,[a.berachain]:s,[a.unichain]:s,[a.arbitrumNova]:s,[a.sei]:s,[a.sonic]:s,[a.monad]:s,[a.bscTestnet]:s,[a.citreaTestnet]:s,[a.megaEthTestnet]:s,[a.chiado]:s,[a.lineaSepolia]:s,[a.berachainBepolia]:s,[a.baseSepolia]:s,[a.arbitrumSepolia]:s,[a.sepolia]:s,[a.optimismSepolia]:s,[a.unichainSepolia]:s,[a.polygonAmoy]:s,[a.inkSepolia]:s,[a.monadTestnet]:s,[a.seiTestnet]:s,[a.sonicTestnet]:s,[a.hoodiTestnet]:s}};n.CHAIN_ID=a,n.DELEGATOR_CONTRACTS=i}}},{package:"@metamask/delegation-deployments",file:"node_modules/@metamask/delegation-deployments/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs",{"@metamask/keyring-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.GetCallsStatusCode=n.EIP7682ErrorCode=n.EIP5792ErrorCode=n.SupportedCapabilities=n.MessageType=n.KEYRING_TYPES_SUPPORTING_7702=n.VERSION=void 0;const s=e("@metamask/keyring-controller");var r,o,a,i,c;n.VERSION="2.0.0",n.KEYRING_TYPES_SUPPORTING_7702=[s.KeyringTypes.hd,s.KeyringTypes.simple],function(e){e.SendTransaction="eth_sendTransaction"}(r||(n.MessageType=r={})),function(e){e.AuxiliaryFunds="auxiliaryFunds"}(o||(n.SupportedCapabilities=o={})),function(e){e[e.UnsupportedNonOptionalCapability=5700]="UnsupportedNonOptionalCapability",e[e.UnsupportedChainId=5710]="UnsupportedChainId",e[e.UnknownBundleId=5730]="UnknownBundleId",e[e.RejectedUpgrade=5750]="RejectedUpgrade"}(a||(n.EIP5792ErrorCode=a={})),function(e){e[e.UnsupportedAsset=5771]="UnsupportedAsset",e[e.UnsupportedChain=5772]="UnsupportedChain",e[e.MalformedRequiredAssets=5773]="MalformedRequiredAssets"}(i||(n.EIP7682ErrorCode=i={})),function(e){e[e.PENDING=100]="PENDING",e[e.CONFIRMED=200]="CONFIRMED",e[e.FAILED_OFFCHAIN=400]="FAILED_OFFCHAIN",e[e.REVERTED=500]="REVERTED",e[e.REVERTED_PARTIAL=600]="REVERTED_PARTIAL"}(c||(n.GetCallsStatusCode=c={}))}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getCallsStatus=void 0;const s=e("@metamask/rpc-errors"),r=e("@metamask/transaction-controller"),o=e("../constants.cjs");n.getCallsStatus=function(e,t){const n=e.call("TransactionController:getState").transactions.filter(e=>e.batchId===t);if(!n?.length)throw new s.JsonRpcError(o.EIP5792ErrorCode.UnknownBundleId,"No matching bundle found");const a=n[0],{chainId:i,txReceipt:c}=a,l=function(e){const{hash:t,status:n}=e;if(n===r.TransactionStatus.confirmed)return o.GetCallsStatusCode.CONFIRMED;if(n===r.TransactionStatus.failed)return t?o.GetCallsStatusCode.REVERTED:o.GetCallsStatusCode.FAILED_OFFCHAIN;if(n===r.TransactionStatus.dropped)return o.GetCallsStatusCode.REVERTED;return o.GetCallsStatusCode.PENDING}(a),d=c,u=d?.logs??[],m=d&&[{blockHash:d.blockHash,blockNumber:d.blockNumber,gasUsed:d.gasUsed,logs:u.map(e=>({address:e.address,data:e.data,topics:e.topics})),status:d.status,transactionHash:d.transactionHash}];return{version:o.VERSION,id:t,chainId:i,atomic:!0,status:l,receipts:m}}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getCapabilities=void 0;const s=e("../constants.cjs"),r=e("../utils.cjs");n.getCapabilities=async function(e,t,n,o){const{getDismissSmartAccountSuggestionEnabled:a,getIsSmartTransaction:i,isAtomicBatchSupported:c,isRelaySupported:l,getSendBundleSupportedChains:d,isAuxiliaryFundsSupported:u}=e;let m=o?.map(e=>e.toLowerCase());if(!m?.length){const e=t.call("NetworkController:getState").networkConfigurationsByChainId;m=Object.keys(e)}const h=await c({address:n,chainIds:m}),p=await async function(e,t,n,s,r,o){const a=o.call("PreferencesController:getState").useTransactionSimulations,i=await Promise.all(t.map(({chainId:e})=>e).map(e=>s(e))),c=await r(e),l=t.map((e,t)=>({...e,relaySupportedForChain:i[t]}));return e.reduce((e,t)=>{const s=l.find(({chainId:e})=>e===t)??{},{isSupported:r=!1,relaySupportedForChain:o}=s,i=n(t),d=c[t]??!1;return a&&(i&&d||r&&o)&&(e[t]={alternateGasFees:{supported:!0}}),e},{})}(m,h,i,l,d,t);return m.reduce((e,o)=>{const i=h.find(({chainId:e})=>e===o)??{},{delegationAddress:c,isSupported:l,upgradeContractAddress:d}=i,m=a();let p=!1;try{const e=(0,r.getAccountKeyringType)(n,t);p=s.KEYRING_TYPES_SUPPORTING_7702.includes(e)}catch{}if(!l&&!(!m&&d&&!c&&p))return e;const f=l?"supported":"ready",g=o;return e[g]===undefined&&(e[g]={}),e[g].atomic={status:f},p&&u(o)&&(e[g].auxiliaryFunds={supported:!0}),e},p)}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs",{"../constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/transaction-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/transaction-controller/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",lodash:"/home/runner/work/metamask-extension/metamask-extension/node_modules/lodash/lodash.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.processSendCalls=void 0;const s=e("@metamask/rpc-errors"),r=e("@metamask/transaction-controller"),o=e("@metamask/utils"),a=e("lodash"),i=e("uuid"),c=e("../constants.cjs"),l=e("../utils.cjs");function d(e){const{version:t}=e;if(t!==c.VERSION)throw s.rpcErrors.invalidInput(`Version not supported: Got ${t}, expected ${c.VERSION}`)}function u(e,t){const{chainId:n}=e;if(n&&n.toLowerCase()!==t.toLowerCase())throw s.rpcErrors.invalidParams(`Chain ID must match the dApp selected network: Got ${n}, expected ${t}`)}function m(e,t,n){const{calls:r,capabilities:o,chainId:a}=e,i=[...Object.keys(o??{}).filter(e=>e!==c.SupportedCapabilities.AuxiliaryFunds.toString()&&!0!==o?.[e].optional),...r.flatMap(e=>Object.keys(e.capabilities??{}).filter(t=>t!==c.SupportedCapabilities.AuxiliaryFunds.toString()&&!0!==e.capabilities?.[t].optional))];if(i?.length)throw new s.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capabilities: ${i.join(", ")}`);o?.auxiliaryFunds&&function({auxiliaryFunds:e,chainId:t,keyringType:n,isAuxiliaryFundsSupported:r}){if(e.optional)return;const o=c.KEYRING_TYPES_SUPPORTING_7702.includes(n);if(!o)throw new s.JsonRpcError(c.EIP5792ErrorCode.UnsupportedNonOptionalCapability,`Unsupported non-optional capability: ${c.SupportedCapabilities.AuxiliaryFunds}`);if(!r(t))throw new s.JsonRpcError(c.EIP7682ErrorCode.UnsupportedChain,`The wallet no longer supports auxiliary funds on the requested chain: ${t}`);if(!e?.requiredAssets)return;for(const t of e.requiredAssets)if("erc20"!==t.standard)throw new s.JsonRpcError(c.EIP7682ErrorCode.UnsupportedAsset,`The requested asset ${t.address} is not available through the wallet’s auxiliary fund system: unsupported token standard ${t.standard}`)}({auxiliaryFunds:o.auxiliaryFunds,chainId:a,keyringType:t,isAuxiliaryFundsSupported:n})}function h(e){if(e.capabilities?.auxiliaryFunds?.requiredAssets){const{requiredAssets:t}=e.capabilities.auxiliaryFunds,n=(0,a.groupBy)(t,e=>`${e.address.toLowerCase()}-${e.standard}`),s=Object.values(n).map(e=>{if(1===e.length)return e[0];const t=e.reduce((e,t)=>e+BigInt(t.amount),0n);return{...e[0],amount:(0,o.add0x)(t.toString(16))}});e.capabilities.auxiliaryFunds.requiredAssets=s}}n.processSendCalls=async function(e,t,n,a){const{addTransactionBatch:p,addTransaction:f,getDismissSmartAccountSuggestionEnabled:g,isAtomicBatchSupported:k,validateSecurity:w,isAuxiliaryFundsSupported:b}=e,{calls:_,from:E}=n,{networkClientId:y,origin:S}=a,I=_.map(e=>({params:e})),{chainId:C}=t.call("NetworkController:getNetworkClientById",y).configuration,A=E??t.call("AccountsController:getSelectedAccount").address,T=(0,i.v4)(),v=w.bind(null,T),x=a.id?String(a.id):"";let N;return N=1===Object.keys(I).length?await async function({addTransaction:e,chainId:t,from:n,messenger:s,networkClientId:a,origin:p,requestId:f,securityAlertId:g,sendCalls:k,transactions:w,validateSecurity:b,isAuxiliaryFundsSupported:_}){const E=(0,l.getAccountKeyringType)(n,s);!function(e,t,n,s){d(e),m(e,n,s),u(e,t)}(k,t,E,_);const y={from:n,...w[0].params,type:r.TransactionEnvelopeType.feeMarket},S={method:c.MessageType.SendTransaction,params:[y],origin:p};b(S,t),h(k);const I=function(){const e=(0,i.v4)(),t=new Uint8Array((0,i.parse)(e));return(0,o.bytesToHex)(t)}();return await e(y,{requestId:f,networkClientId:a,origin:p,securityAlertResponse:{securityAlertId:g},batchId:I}),I}({addTransaction:f,chainId:C,from:A,messenger:t,networkClientId:y,origin:S,requestId:x,securityAlertId:T,sendCalls:n,transactions:I,validateSecurity:v,isAuxiliaryFundsSupported:b}):await async function({addTransactionBatch:e,isAtomicBatchSupported:t,chainId:n,from:r,getDismissSmartAccountSuggestionEnabled:o,networkClientId:a,messenger:i,origin:p,requestId:f,sendCalls:g,securityAlertId:k,transactions:w,validateSecurity:b,isAuxiliaryFundsSupported:_}){const E=await t({address:r,chainIds:[n]}),y=E?.[0],S=(0,l.getAccountKeyringType)(r,i),I=o();(function(e,t,n,r,o,a){d(e),function(e,t,n){if(u(e,t),!n)throw new s.JsonRpcError(c.EIP5792ErrorCode.UnsupportedChainId,`EIP-7702 not supported on chain: ${t}`)}(e,t,r),m(e,o,a),function(e,t,n){if(t?.delegationAddress)return;if(e)throw new s.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade disabled by the user");if(!c.KEYRING_TYPES_SUPPORTING_7702.includes(n))throw new s.JsonRpcError(c.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported on account")}(n,r,o)})(g,n,I,y,S,_),h(g);const C=await e({from:r,networkClientId:a,origin:p,requestId:f,securityAlertId:k,transactions:w,validateSecurity:b});return C.batchId}({addTransactionBatch:p,isAtomicBatchSupported:k,chainId:C,from:A,getDismissSmartAccountSuggestionEnabled:g,messenger:t,networkClientId:y,origin:S,requestId:x,sendCalls:n,securityAlertId:T,transactions:I,validateSecurity:v,isAuxiliaryFundsSupported:b}),{id:N}}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/index.cjs",{"./hooks/getCallsStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCallsStatus.cjs","./hooks/getCapabilities.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/getCapabilities.cjs","./hooks/processSendCalls.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/hooks/processSendCalls.cjs","./methods/wallet_getCallsStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs","./methods/wallet_getCapabilities.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs","./methods/wallet_sendCalls.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_sendCalls.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletGetCapabilities=n.walletGetCallsStatus=n.walletSendCalls=n.getCapabilities=n.getCallsStatus=n.processSendCalls=void 0;var s=e("./hooks/processSendCalls.cjs");Object.defineProperty(n,"processSendCalls",{enumerable:!0,get:function(){return s.processSendCalls}});var r=e("./hooks/getCallsStatus.cjs");Object.defineProperty(n,"getCallsStatus",{enumerable:!0,get:function(){return r.getCallsStatus}});var o=e("./hooks/getCapabilities.cjs");Object.defineProperty(n,"getCapabilities",{enumerable:!0,get:function(){return o.getCapabilities}});var a=e("./methods/wallet_sendCalls.cjs");Object.defineProperty(n,"walletSendCalls",{enumerable:!0,get:function(){return a.walletSendCalls}});var i=e("./methods/wallet_getCallsStatus.cjs");Object.defineProperty(n,"walletGetCallsStatus",{enumerable:!0,get:function(){return i.walletGetCallsStatus}});var c=e("./methods/wallet_getCapabilities.cjs");Object.defineProperty(n,"walletGetCapabilities",{enumerable:!0,get:function(){return c.walletGetCapabilities}})}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletGetCallsStatus=void 0;const s=e("@metamask/rpc-errors"),r=e("../types.cjs"),o=e("../utils.cjs");n.walletGetCallsStatus=async function(e,t,{getCallsStatus:n}){if(!n)throw s.rpcErrors.methodNotSupported();(0,o.validateParams)(e.params,r.GetCallsStatusStruct);const a=e.params[0];t.result=await n(a,e)}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCallsStatus.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletGetCapabilities=void 0;const s=e("@metamask/rpc-errors"),r=e("../types.cjs"),o=e("../utils.cjs");n.walletGetCapabilities=async function(e,t,{getAccounts:n,getCapabilities:a}){if(!a)throw s.rpcErrors.methodNotSupported();(0,o.validateParams)(e.params,r.GetCapabilitiesStruct);const i=e.params[0],c=e.params[1];await(0,o.validateAndNormalizeKeyholder)(i,e,{getAccounts:n});const l=await a(i,c,e);t.result=l}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_getCapabilities.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_sendCalls.cjs",{"../types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs","../utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletSendCalls=void 0;const s=e("@metamask/rpc-errors"),r=e("../types.cjs"),o=e("../utils.cjs");n.walletSendCalls=async function(e,t,{getAccounts:n,processSendCalls:a}){if(!a)throw s.rpcErrors.methodNotSupported();(0,o.validateParams)(e.params,r.SendCallsStruct);const i=e.params[0],c=i.from?await(0,o.validateAndNormalizeKeyholder)(i.from,e,{getAccounts:n}):undefined,l={...i,from:c};t.result=await a(l,e)}}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/methods/wallet_sendCalls.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/types.cjs",{"@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.SendCallsStruct=n.CapabilitiesStruct=n.GetCapabilitiesStruct=n.GetCallsStatusStruct=void 0;const s=e("@metamask/superstruct"),r=e("@metamask/utils");n.GetCallsStatusStruct=(0,s.tuple)([r.StrictHexStruct]),n.GetCapabilitiesStruct=(0,s.tuple)([r.HexChecksumAddressStruct,(0,s.optional)((0,s.array)(r.StrictHexStruct))]);const o=(0,s.type)({address:(0,s.nonempty)(r.HexChecksumAddressStruct),amount:(0,s.nonempty)(r.StrictHexStruct),standard:(0,s.nonempty)((0,s.string)())});n.CapabilitiesStruct=(0,s.record)((0,s.string)(),(0,s.type)({optional:(0,s.optional)((0,s.boolean)()),requiredAssets:(0,s.optional)((0,s.array)(o))})),n.SendCallsStruct=(0,s.tuple)([(0,s.object)({version:(0,s.nonempty)((0,s.string)()),id:(0,s.optional)(r.StrictHexStruct),from:(0,s.optional)(r.HexChecksumAddressStruct),chainId:r.StrictHexStruct,atomicRequired:(0,s.boolean)(),calls:(0,s.array)((0,s.object)({to:(0,s.optional)(r.HexChecksumAddressStruct),data:(0,s.optional)(r.StrictHexStruct),value:(0,s.optional)(r.StrictHexStruct),capabilities:(0,s.optional)(n.CapabilitiesStruct)})),capabilities:(0,s.optional)(n.CapabilitiesStruct)})])}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/utils.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-5792-middleware/dist/constants.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.resemblesAddress=n.validateParams=n.validateAndNormalizeKeyholder=n.getAccountKeyringType=void 0;const s=e("@metamask/rpc-errors"),r=e("@metamask/superstruct"),o=e("./constants.cjs");function a(e){return 42===e.length}n.getAccountKeyringType=function(e,t){const{accounts:n}=t.call("AccountsController:getState").internalAccounts,r=Object.values(n).find(t=>t.address.toLowerCase()===e.toLowerCase()),a=r?.metadata?.keyring?.type;if(!a)throw new s.JsonRpcError(o.EIP5792ErrorCode.RejectedUpgrade,"EIP-7702 upgrade not supported as account type is unknown");return a},n.validateAndNormalizeKeyholder=async function(e,t,{getAccounts:n}){if("string"==typeof e&&e.length>0&&a(e)){const r=(await n(t)).map(e=>e.toLowerCase()),o=e.toLowerCase();if(r.includes(o))return o;throw s.providerErrors.unauthorized()}throw s.rpcErrors.invalidParams({message:"Invalid parameters: must provide an Ethereum address."})},n.validateParams=function(e,t){const[n]=(0,r.validate)(e,t);if(n)throw s.rpcErrors.invalidParams(function(e,t){return`${t}\n\n${e.failures().map(e=>`${e.path.join(" > ")}${e.path.length?" - ":""}${e.message}`).join("\n")}`}(n,"Invalid params"))},n.resemblesAddress=a}}},{package:"@metamask/eip-5792-middleware",file:"node_modules/@metamask/eip-5792-middleware/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.DELEGATION_INDICATOR_PREFIX=n.METHOD_NAMES=void 0,n.METHOD_NAMES={UPGRADE_ACCOUNT:"wallet_upgradeAccount",GET_ACCOUNT_UPGRADE_STATUS:"wallet_getAccountUpgradeStatus"},n.DELEGATION_INDICATOR_PREFIX="0xef0100"}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/index.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","./wallet_getAccountUpgradeStatus.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs","./wallet_upgradeAccount.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.METHOD_NAMES=n.validateAndNormalizeAddress=n.validateParams=n.walletGetAccountUpgradeStatus=n.walletUpgradeAccount=void 0;var s=e("./wallet_upgradeAccount.cjs");Object.defineProperty(n,"walletUpgradeAccount",{enumerable:!0,get:function(){return s.walletUpgradeAccount}});var r=e("./wallet_getAccountUpgradeStatus.cjs");Object.defineProperty(n,"walletGetAccountUpgradeStatus",{enumerable:!0,get:function(){return r.walletGetAccountUpgradeStatus}});var o=e("./utils.cjs");Object.defineProperty(n,"validateParams",{enumerable:!0,get:function(){return o.validateParams}}),Object.defineProperty(n,"validateAndNormalizeAddress",{enumerable:!0,get:function(){return o.validateAndNormalizeAddress}});var a=e("./constants.cjs");Object.defineProperty(n,"METHOD_NAMES",{enumerable:!0,get:function(){return a.METHOD_NAMES}})}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs",{"@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.GetAccountUpgradeStatusParamsStruct=n.UpgradeAccountParamsStruct=void 0;const s=e("@metamask/superstruct"),r=e("@metamask/utils");n.UpgradeAccountParamsStruct=(0,s.object)({account:r.HexChecksumAddressStruct,chainId:(0,s.optional)(r.StrictHexStruct)}),n.GetAccountUpgradeStatusParamsStruct=(0,s.object)({account:r.HexChecksumAddressStruct,chainId:(0,s.optional)(r.StrictHexStruct)})}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs",{"@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/superstruct":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/superstruct/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validateParams=n.validateAndNormalizeAddress=void 0;const s=e("@metamask/rpc-errors"),r=e("@metamask/superstruct"),o=e("@metamask/utils");n.validateAndNormalizeAddress=async function(e,t,n){if("string"!=typeof e||0===e.length||!(0,o.isHexAddress)(e))throw s.rpcErrors.invalidParams({message:"Invalid parameters: must provide an EVM address."});if(!(await n(t)).map(e=>e.toLowerCase()).includes(e.toLowerCase()))throw s.providerErrors.unauthorized();return e},n.validateParams=function(e,t){const[n]=(0,r.validate)(e,t);if(n)throw s.rpcErrors.invalidParams(function(e,t){return`${t}\n\n${e.failures().map(e=>`${e.path.join(" > ")}${e.path.length?" - ":""}${e.message}`).join("\n")}`}(n,"Invalid parameters"))}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs",{"./constants.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/constants.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletGetAccountUpgradeStatus=void 0;const s=e("@metamask/rpc-errors"),r=e("@metamask/utils"),o=e("./constants.cjs"),a=e("./types.cjs"),i=e("./utils.cjs");n.walletGetAccountUpgradeStatus=async function(e,t,n){const{params:c,origin:l}=e;(0,i.validateParams)(c,a.GetAccountUpgradeStatusParamsStruct);const{account:d,chainId:u}=c,m=await(0,i.validateAndNormalizeAddress)(d,l,n.getPermittedAccountsForOrigin);let h;if(u!==undefined)h=u;else{const e=n.getCurrentChainIdForDomain(l);if(!e)throw s.rpcErrors.invalidParams({message:`Could not determine current chain ID for origin: ${l}`});h=e}const{isSupported:p}=await n.isEip7702Supported({address:m,chainId:h});if(p)try{const e=h,r=n.getSelectedNetworkClientIdForChain(e);if(!r)throw s.rpcErrors.invalidParams({message:`Network client ID not found for chain ID ${h}`});const{isUpgraded:a,upgradedAddress:i}=await(async(e,t,n)=>{const s=await n(e,t);if(!s||"0x"===s||s.length<=2)return{isUpgraded:!1,upgradedAddress:null};if(!s.startsWith(o.DELEGATION_INDICATOR_PREFIX))return{isUpgraded:!1,upgradedAddress:null};const r=o.DELEGATION_INDICATOR_PREFIX.length+40;return s.length!==r?{isUpgraded:!1,upgradedAddress:null}:{isUpgraded:!0,upgradedAddress:`0x${s.slice(8,48)}`}})(m,r,n.getCode);t.result={isSupported:p,account:m,isUpgraded:a,upgradedAddress:i,chainId:h}}catch(e){if(e instanceof s.JsonRpcError)throw e;throw s.rpcErrors.internal({message:`Failed to get account upgrade status: ${(0,r.getErrorMessage)(e)}`})}else t.result={isSupported:p,account:m,isUpgraded:!1,upgradedAddress:null,chainId:h}}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_getAccountUpgradeStatus.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs",{"./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/types.cjs","./utils.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/utils.cjs","@metamask/rpc-errors":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/rpc-errors/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.walletUpgradeAccount=void 0;const s=e("@metamask/rpc-errors"),r=e("./types.cjs"),o=e("./utils.cjs");n.walletUpgradeAccount=async function(e,t,n){const{params:a,origin:i}=e;(0,o.validateParams)(a,r.UpgradeAccountParamsStruct);const{account:c,chainId:l}=a,d=await(0,o.validateAndNormalizeAddress)(c,i,n.getPermittedAccountsForOrigin);let u;if(l!==undefined)u=l;else{const e=n.getCurrentChainIdForDomain(i);if(!e)throw s.rpcErrors.invalidParams({message:`No network configuration found for origin: ${i}`});u=e}try{const e=u,{isSupported:r,upgradeContractAddress:o}=await n.isEip7702Supported({address:d,chainId:e});if(!r)throw s.rpcErrors.invalidParams({message:`Account upgrade not supported on chain ID ${u}`});if(!o)throw s.rpcErrors.invalidParams({message:`No upgrade contract address available for chain ID ${u}`});const a=await n.upgradeAccount(d,o,u);t.result={transactionHash:a.transactionHash,upgradedAccount:d,delegatedTo:a.delegatedTo}}catch(e){if(e instanceof s.JsonRpcError)throw e;throw s.rpcErrors.internal({message:`Failed to upgrade account: ${e instanceof Error?e.message:String(e)}`})}}}}},{package:"@metamask/eip-7702-internal-rpc-middleware",file:"node_modules/@metamask/eip-7702-internal-rpc-middleware/dist/wallet_upgradeAccount.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/EnsController.cjs",{"@ethersproject/providers":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethersproject/providers/lib/index.js","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","punycode/punycode.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/punycode/punycode.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},l=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n};Object.defineProperty(n,"__esModule",{value:!0}),n.EnsController=n.DEFAULT_ENS_NETWORK_MAP=void 0;const d=e("@ethersproject/providers"),u=e("@metamask/base-controller"),m=e("@metamask/controller-utils"),h=e("@metamask/utils"),p=e("punycode/punycode.js"),f=(0,h.createProjectLogger)("ens-controller");n.DEFAULT_ENS_NETWORK_MAP={1:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",3:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",4:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",5:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",17e3:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",11155111:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"};const g={ensEntries:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},ensResolutionsByAddress:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0}},k={ensEntries:{},ensResolutionsByAddress:{}};class w extends u.BaseController{constructor({registriesByChainId:e=n.DEFAULT_ENS_NETWORK_MAP,messenger:t,state:i={},onNetworkDidChange:l}){super({name:"EnsController",metadata:g,messenger:t,state:{...k,ensEntries:Object.fromEntries(Object.entries(e).map(([e,t])=>[(0,m.toHex)(e),{".":{address:t,chainId:(0,m.toHex)(e),ensName:"."}}])),...i}}),s.add(this),r.set(this,null),c(this,s,"m",o).call(this,e),l&&l(({selectedNetworkClientId:t})=>{this.resetState(),c(this,s,"m",a).call(this,t,e)})}resetState(){this.update(e=>{e.ensResolutionsByAddress={}})}clear(){this.update(e=>{e.ensEntries={}})}delete(e,t){const n=(0,m.normalizeEnsName)(t);return!!((0,m.isSafeDynamicKey)(e)&&n&&this.state.ensEntries[e]&&this.state.ensEntries[e][n])&&(this.update(t=>{delete t.ensEntries[e][n],0===Object.keys(t.ensEntries[e]).length&&delete t.ensEntries[e]}),!0)}get(e,t){const n=(0,m.normalizeEnsName)(t);return n&&this.state.ensEntries[e]&&this.state.ensEntries[e][n]||null}set(e,t,n){if(!Number.isInteger(Number.parseInt(e,10))||!t||"string"!=typeof t||n&&!(0,m.isValidHexAddress)(n))throw new Error(`Invalid ENS entry: { chainId:${e}, ensName:${t}, address:${n}}`);const s=(0,m.normalizeEnsName)(t);if(!s)throw new Error(`Invalid ENS name: ${t}`);const r=n?(0,m.toChecksumHexAddress)(n):null,o=this.state.ensEntries[e];return(!o?.[s]||o[s].address!==r)&&(this.update(t=>{t.ensEntries={...this.state.ensEntries,[e]:{...this.state.ensEntries[e],[s]:{address:r,chainId:e,ensName:s}}}}),!0)}async reverseResolveAddress(e){if(!c(this,r,"f"))return undefined;const t=(0,m.toChecksumHexAddress)(e);if(this.state.ensResolutionsByAddress[t])return this.state.ensResolutionsByAddress[t];let n,s;try{n=await c(this,r,"f").lookupAddress(t)}catch(e){return f(e),undefined}if(!n)return undefined;try{s=await c(this,r,"f").resolveName(n)}catch(e){return f(e),undefined}return s?"0x0000000000000000000000000000000000000000"===s||"0x"===s||(0,m.toChecksumHexAddress)(s)!==t?undefined:(this.update(e=>{e.ensResolutionsByAddress[t]=(0,p.toASCII)(n)}),n):undefined}}n.EnsController=w,r=new WeakMap,s=new WeakSet,o=function(e){const{selectedNetworkClientId:t}=this.messenger.call("NetworkController:getState");c(this,s,"m",a).call(this,t,e)},a=function(e,t){const{configuration:{chainId:n},provider:o}=this.messenger.call("NetworkController:getNetworkClientById",e);t&&t[parseInt(n,16)]&&c(this,s,"m",i).call(this,n)?l(this,r,new d.Web3Provider(o,{chainId:(0,m.convertHexToDecimal)(n),name:m.CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP[n],ensAddress:t[parseInt(n,16)]}),"f"):l(this,r,null,"f")},i=function(e){return Boolean(this.state.ensEntries[e])},n.default=w}}},{package:"@metamask/ens-controller",file:"node_modules/@metamask/ens-controller/dist/EnsController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/index.cjs",{"./EnsController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/ens-controller/dist/EnsController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),r(e("./EnsController.cjs"),n)}}},{package:"@metamask/ens-controller",file:"node_modules/@metamask/ens-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/error-reporting-service/dist/error-reporting-service.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},a=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorReportingService=void 0;n.ErrorReportingService=class{constructor({messenger:e,captureException:t}){this.name="ErrorReportingService",this.state=null,s.set(this,void 0),r.set(this,void 0),o(this,r,e,"f"),o(this,s,t,"f"),a(this,r,"f").registerActionHandler("ErrorReportingService:captureException",a(this,s,"f").bind(this))}captureException(e){a(this,s,"f").call(this,e)}},s=new WeakMap,r=new WeakMap}}},{package:"@metamask/error-reporting-service",file:"node_modules/@metamask/error-reporting-service/dist/error-reporting-service.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/error-reporting-service/dist/index.cjs",{"./error-reporting-service.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/error-reporting-service/dist/error-reporting-service.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorReportingService=void 0;var s=e("./error-reporting-service.cjs");Object.defineProperty(n,"ErrorReportingService",{enumerable:!0,get:function(){return s.ErrorReportingService}})}}},{package:"@metamask/error-reporting-service",file:"node_modules/@metamask/error-reporting-service/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("./base-filter");t.exports=class extends s{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js",{"@metamask/safe-event-emitter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/safe-event-emitter/dist/cjs/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("@metamask/safe-event-emitter").default;t.exports=class extends s{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(e){this.updates=this.updates.concat(e),e.forEach(e=>this.emit("update",e))}addInitialResults(e){}getChangesAndClear(){const e=this.updates;return this.updates=[],e}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/base-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/block-filter.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js","./getBlocksForRange":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("./base-filter"),r=e("./getBlocksForRange"),{incrementHexInt:o}=e("./hexUtils");t.exports=class extends s{constructor({provider:e,params:t}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:t}){const n=t,s=o(e),a=(await r({provider:this.provider,fromBlock:s,toBlock:n})).map(e=>e.hash);this.addResults(a)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/block-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function s(e){return e===undefined||null===e?e:Number.parseInt(e,16)}function r(e){if(e===undefined||null===e)return e;return"0x"+e.toString(16)}t.exports=async function({provider:e,fromBlock:t,toBlock:n}){t||(t=n);const o=s(t),a=s(n),i=Array(a-o+1).fill().map((e,t)=>o+t).map(r);let c=await Promise.all(i.map(t=>async function(e,t,n){for(let s=0;s<3;s++)try{return e.request({id:1,jsonrpc:"2.0",method:t,params:n})}catch(e){console.error(`provider.request failed: ${e.stack||e.message||e}`)}return null}(e,"eth_getBlockByNumber",[t,!1])));return c=c.filter(e=>null!==e),c}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){function s(e){return e.sort((e,t)=>"latest"===e||"earliest"===t?1:"latest"===t||"earliest"===e?-1:r(e)-r(t))}function r(e){return e===undefined||null===e?e:Number.parseInt(e,16)}function o(e){if(e===undefined||null===e)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function a(){return Math.floor(16*Math.random()).toString(16)}t.exports={minBlockRef:function(...e){return s(e)[0]},maxBlockRef:function(...e){const t=s(e);return t[t.length-1]},sortBlockRefs:s,bnToHex:function(e){return"0x"+e.toString(16)},blockRefIsNumber:function(e){return e&&!["earliest","latest","pending"].includes(e)},hexToInt:r,incrementHexInt:function(e){if(e===undefined||null===e)return e;return o(r(e)+1)},intToHex:o,unsafeRandomBytes:function(e){let t="0x";for(let n=0;n<e;n++)t+=a(),t+=a();return t}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/index.js",{"./block-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/block-filter.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","./log-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/log-filter.js","./tx-filter.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/tx-filter.js","@metamask/json-rpc-engine":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/dist/index.cjs","async-mutex":"/home/runner/work/metamask-extension/metamask-extension/node_modules/async-mutex/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("async-mutex").Mutex,{createAsyncMiddleware:r,createScaffoldMiddleware:o}=e("@metamask/json-rpc-engine"),a=e("./log-filter.js"),i=e("./block-filter.js"),c=e("./tx-filter.js"),{intToHex:l,hexToInt:d}=e("./hexUtils");function u(e){return m(async(...t)=>{const n=await e(...t);return l(n.id)})}function m(e){return r(async(t,n)=>{const s=await e.apply(null,t.params);n.result=s})}function h(e,t){const n=[];for(let t in e)n.push(e[t]);return n}t.exports=function({blockTracker:e,provider:t}){let n=0,r={};const p=new s,f=function({mutex:e}){return t=>async(n,s,r,o)=>{(await e.acquire())(),t(n,s,r,o)}}({mutex:p}),g=o({eth_newFilter:f(u(w)),eth_newBlockFilter:f(u(b)),eth_newPendingTransactionFilter:f(u(_)),eth_uninstallFilter:f(m(S)),eth_getFilterChanges:f(m(E)),eth_getFilterLogs:f(m(y))}),k=async({oldBlock:e,newBlock:t})=>{if(0===r.length)return;const n=await p.acquire();try{await Promise.all(h(r).map(async n=>{try{await n.update({oldBlock:e,newBlock:t})}catch(e){console.error(e)}}))}catch(e){console.error(e)}n()};return g.newLogFilter=w,g.newBlockFilter=b,g.newPendingTransactionFilter=_,g.uninstallFilter=S,g.getFilterChanges=E,g.getFilterLogs=y,g.destroy=()=>{!async function(){const e=h(r).length;r={},C({prevFilterCount:e,newFilterCount:0})}()},g;async function w(e){const n=new a({provider:t,params:e});await I(n);return n}async function b(){const e=new i({provider:t});await I(e);return e}async function _(){const e=new c({provider:t});await I(e);return e}async function E(e){const t=d(e),n=r[t];if(!n)throw new Error(`No filter for index "${t}"`);return n.getChangesAndClear()}async function y(e){const t=d(e),n=r[t];if(!n)throw new Error(`No filter for index "${t}"`);let s=[];return"log"===n.type&&(s=n.getAllResults()),s}async function S(e){const t=d(e),n=r[t],s=Boolean(n);return s&&await async function(e){const t=h(r).length;delete r[e];const n=h(r).length;C({prevFilterCount:t,newFilterCount:n})}(t),s}async function I(t){const s=h(r).length,o=await e.getLatestBlock();await t.initialize({currentBlock:o}),n++,r[n]=t,t.id=n,t.idHex=l(n);return C({prevFilterCount:s,newFilterCount:h(r).length}),n}function C({prevFilterCount:t,newFilterCount:n}){0===t&&n>0?e.on("sync",k):t>0&&0===n&&e.removeListener("sync",k)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/index.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/log-filter.js",{"./base-filter-history":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter-history.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js",pify:"/home/runner/work/metamask-extension/metamask-extension/node_modules/pify/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("@metamask/eth-query"),r=e("pify"),o=e("./base-filter-history"),{bnToHex:a,hexToInt:i,incrementHexInt:c,minBlockRef:l,blockRefIsNumber:d}=e("./hexUtils");t.exports=class extends o{constructor({provider:e,params:t}){super(),this.type="log",this.ethQuery=new s(e),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:undefined,topics:[]},t),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map(e=>e.toLowerCase()))}async initialize({currentBlock:e}){let t=this.params.fromBlock;["latest","pending"].includes(t)&&(t=e),"earliest"===t&&(t="0x0"),this.params.fromBlock=t;const n=l(this.params.toBlock,e),s=Object.assign({},this.params,{toBlock:n}),r=await this._fetchLogs(s);this.addInitialResults(r)}async update({oldBlock:e,newBlock:t}){const n=t;let s;s=e?c(e):t;const r=Object.assign({},this.params,{fromBlock:s,toBlock:n}),o=(await this._fetchLogs(r)).filter(e=>this.matchLog(e));this.addResults(o)}async _fetchLogs(e){return await r(t=>this.ethQuery.getLogs(e,t))()}matchLog(e){if(i(this.params.fromBlock)>=i(e.blockNumber))return!1;if(d(this.params.toBlock)&&i(this.params.toBlock)<=i(e.blockNumber))return!1;const t=e.address&&e.address.toLowerCase();if(this.params.address&&t&&!this.params.address.includes(t))return!1;return this.params.topics.every((t,n)=>{let s=e.topics[n];if(!s)return!1;s=s.toLowerCase();let r=Array.isArray(t)?t:[t];if(r.includes(null))return!0;r=r.map(e=>e.toLowerCase());return r.includes(s)})}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/log-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/subscriptionManager.js",{"./getBlocksForRange.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js","./index.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/index.js","@metamask/json-rpc-engine":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/json-rpc-engine/dist/index.cjs","@metamask/safe-event-emitter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/safe-event-emitter/dist/cjs/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("@metamask/safe-event-emitter").default,{createAsyncMiddleware:r,createScaffoldMiddleware:o}=e("@metamask/json-rpc-engine"),a=e("./index.js"),{unsafeRandomBytes:i,incrementHexInt:c}=e("./hexUtils.js"),l=e("./getBlocksForRange.js");function d(e){return null===e||e===undefined?null:{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}t.exports=function({blockTracker:e,provider:t}){const n={},u=a({blockTracker:e,provider:t});let m=!1;const h=new s,p=o({eth_subscribe:r(async function(s,r){if(m)throw new Error("SubscriptionManager - attempting to use after destroying");const o=s.params[0],a=i(16);let h;switch(o){case"newHeads":h=p({subId:a});break;case"logs":const e=s.params[1];h=g({subId:a,filter:await u.newLogFilter(e)});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${o}"`)}return n[a]=h,void(r.result=a);function p({subId:n}){const s={type:o,destroy:async()=>{e.removeListener("sync",s.update)},update:async({oldBlock:e,newBlock:s})=>{const r=s,o=c(e);(await l({provider:t,fromBlock:o,toBlock:r})).map(d).filter(e=>null!==e).forEach(e=>{f(n,e)})}};return e.on("sync",s.update),s}function g({subId:e,filter:t}){t.on("update",t=>f(e,t));return{type:o,destroy:async()=>await u.uninstallFilter(t.idHex)}}}),eth_unsubscribe:r(async function(e,t){if(m)throw new Error("SubscriptionManager - attempting to use after destroying");const s=e.params[0],r=n[s];if(!r)return void(t.result=!1);delete n[s],await r.destroy(),t.result=!0})});return p.destroy=function(){h.removeAllListeners();for(const e in n)n[e].destroy(),delete n[e];m=!0},{events:h,middleware:p};function f(e,t){h.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:e,result:t}})}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/subscriptionManager.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/tx-filter.js",{"./base-filter":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/base-filter.js","./getBlocksForRange":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/getBlocksForRange.js","./hexUtils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-json-rpc-filters/hexUtils.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){const s=e("./base-filter"),r=e("./getBlocksForRange"),{incrementHexInt:o}=e("./hexUtils");t.exports=class extends s{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const t=e,n=o(e),s=await r({provider:this.provider,fromBlock:n,toBlock:t}),a=[];for(const e of s)a.push(...e.transactions);this.addResults(a)}}}}},{package:"@metamask/eth-json-rpc-filters",file:"node_modules/@metamask/eth-json-rpc-filters/tx-filter.js"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs",{"@metamask/hw-wallet-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.createLedgerError=function(e,t){const n=r(e);if(n){const e=t?`${n.message} (${t})`:n.message;return new s.HardwareWalletError(e,{code:n.code,severity:n.severity,category:n.category,userMessage:n.userMessage??e})}const o=t?`Unknown Ledger error: ${e} (${t})`:`Unknown Ledger error: ${e}`;return new s.HardwareWalletError(o,{code:s.ErrorCode.Unknown,severity:s.Severity.Err,category:s.Category.Unknown,userMessage:o})},n.isKnownLedgerError=function(e){return e in s.LEDGER_ERROR_MAPPINGS},n.getLedgerErrorMapping=r;const s=e("@metamask/hw-wallet-sdk");function r(e){return s.LEDGER_ERROR_MAPPINGS[e]}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/index.cjs",{"./errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs","./ledger-error-handler.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs","./ledger-hw-app.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs","./ledger-iframe-bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-iframe-bridge.cjs","./ledger-keyring-v2.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring-v2.cjs","./ledger-keyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring.cjs","./ledger-mobile-bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-mobile-bridge.cjs","./ledger-transport-middleware.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-transport-middleware.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),r(e("./ledger-keyring.cjs"),n),r(e("./ledger-keyring-v2.cjs"),n),r(e("./ledger-iframe-bridge.cjs"),n),r(e("./ledger-mobile-bridge.cjs"),n),r(e("./ledger-transport-middleware.cjs"),n),r(e("./ledger-hw-app.cjs"),n),r(e("./errors.cjs"),n),r(e("./ledger-error-handler.cjs"),n)}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs",{"./errors.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/errors.cjs","@ledgerhq/hw-transport":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ledgerhq/hw-transport/lib/Transport.js","@metamask/hw-wallet-sdk":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.handleLedgerTransportError=function(e,t){if(e instanceof s.TransportStatusError){const t=`0x${e.statusCode.toString(16)}`;if((0,o.isKnownLedgerError)(t)){const e=(0,o.createLedgerError)(t);throw i.has(t)&&(e.message=(n=e.message).startsWith(a)?n:`${a}${n}`),e}throw new r.HardwareWalletError(e.message,{code:r.ErrorCode.Unknown,severity:r.Severity.Err,category:r.Category.Unknown,userMessage:e.message,cause:e})}var n;if(e instanceof r.HardwareWalletError)throw e;if(e instanceof Error)throw new r.HardwareWalletError(e.message,{code:r.ErrorCode.Unknown,severity:r.Severity.Err,category:r.Category.Unknown,userMessage:e.message,cause:e});throw new r.HardwareWalletError(t,{code:r.ErrorCode.Unknown,severity:r.Severity.Err,category:r.Category.Unknown,userMessage:t})};const s=e("@ledgerhq/hw-transport"),r=e("@metamask/hw-wallet-sdk"),o=e("./errors.cjs"),a="Ledger: ",i=new Set(["0x6985","0x6a80","0x5515","0x650f"])}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs",{"@ledgerhq/hw-app-eth":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ledgerhq/hw-app-eth/lib/Eth.js",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.MetaMaskLedgerHwAppEth=void 0;const r=s(e("@ledgerhq/hw-app-eth")),o=e("buffer");class a extends r.default{constructor(){super(...arguments),this.mainAppName="BOLOS",this.ethAppName="Ethereum",this.transportEncoding="ascii"}async openEthApp(){await this.transport.send(224,216,0,0,o.Buffer.from(this.ethAppName,this.transportEncoding))}async closeApps(){await this.transport.send(176,167,0,0)}async getAppNameAndVersion(){const e=await this.transport.send(176,1,0,0);if(1!==e[0])throw new Error("Incorrect format return from getAppNameAndVersion.");let t=1;const n=e[t]??0;t+=1;const s=e.slice(t,t+=n).toString(this.transportEncoding),r=e[t]??0;t+=1;return{appName:s,version:e.slice(t,t+=r).toString(this.transportEncoding)}}}n.MetaMaskLedgerHwAppEth=a}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-iframe-bridge.cjs",{"@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,l,d,u,m=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},h=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n};Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerIframeBridge=n.IFrameMessageAction=void 0;const p=e("@metamask/utils");var f;!function(e){e.LedgerIsIframeReady="ledger-is-iframe-ready",e.LedgerConnectionChange="ledger-connection-change",e.LedgerUnlock="ledger-unlock",e.LedgerMakeApp="ledger-make-app",e.LedgerUpdateTransport="ledger-update-transport",e.LedgerSignTransaction="ledger-sign-transaction",e.LedgerSignPersonalMessage="ledger-sign-personal-message",e.LedgerSignTypedData="ledger-sign-typed-data",e.LedgerGetAppNameAndVersion="ledger-get-app-name-and-version",e.LedgerGetAppConfiguration="ledger-get-app-configuration"}(f||(n.IFrameMessageAction=f={}));n.LedgerIframeBridge=class{constructor(e={bridgeUrl:"https://metamask.github.io/eth-ledger-bridge-keyring"}){s.add(this),this.iframeLoaded=!1,r.set(this,void 0),this.isDeviceConnected=!1,this.currentMessageId=0,o.set(this,new Map),m(this,s,"m",u).call(this,e),h(this,r,{bridgeUrl:e?.bridgeUrl},"f")}async init(){await m(this,s,"m",i).call(this,m(this,r,"f").bridgeUrl),this.eventListener=m(this,s,"m",l).bind(this,m(this,r,"f").bridgeUrl),window.addEventListener("message",this.eventListener)}async destroy(){this.eventListener&&window.removeEventListener("message",this.eventListener)}async getOptions(){return m(this,r,"f")}async setOptions(e){m(this,s,"m",u).call(this,e),m(this,r,"f")?.bridgeUrl!==e.bridgeUrl&&(m(this,r,"f").bridgeUrl=e.bridgeUrl,await this.destroy(),await this.init())}async attemptMakeApp(){const e=await m(this,s,"m",d).call(this,{action:f.LedgerMakeApp},{timeout:8e3});if("success"in e&&e.success)return!0;throw"error"in e?e.error:new Error("Unknown error occurred")}async updateTransportMethod(e){if(!this.iframeLoaded)throw new Error("The iframe is not loaded yet");const t=await m(this,s,"m",d).call(this,{action:f.LedgerUpdateTransport,params:{transportType:e}},{timeout:8e3});if("success"in t&&t.success)return!0;throw new Error("Ledger transport could not be updated")}async getPublicKey(e){return m(this,s,"m",a).call(this,f.LedgerUnlock,e)}async deviceSignTransaction(e){return m(this,s,"m",a).call(this,f.LedgerSignTransaction,e)}async deviceSignMessage(e){return m(this,s,"m",a).call(this,f.LedgerSignPersonalMessage,e)}async deviceSignTypedData(e){return m(this,s,"m",a).call(this,f.LedgerSignTypedData,e)}async getAppNameAndVersion(){return m(this,s,"m",a).call(this,f.LedgerGetAppNameAndVersion,{})}async getAppConfiguration(){return m(this,s,"m",a).call(this,f.LedgerGetAppConfiguration,{})}},r=new WeakMap,o=new WeakMap,s=new WeakSet,a=async function(...[e,t]){const n=await m(this,s,"m",d).call(this,{action:e,params:t});if("payload"in n&&n.payload){if("success"in n&&n.success)return n.payload;if("error"in n.payload)throw n.payload.error}throw new Error("Unknown error occurred")},i=async function(e){return new Promise(t=>{this.iframe=document.createElement("iframe"),this.iframe.src=e,this.iframe.allow="hid 'src'",this.iframe.onload=async()=>{this.iframeLoaded=!0,t()},document.head.appendChild(this.iframe)})},c=function(e){const t=e.split("/");return t.splice(-1,1),t.join("/")},l=function(e,t){const{origin:n,data:r}=t;if(n===m(this,s,"m",c).call(this,e)&&r){const e=m(this,o,"f").get(r.messageId);e?(e.resolve(r),m(this,o,"f").delete(r.messageId)):r.action===f.LedgerConnectionChange&&(this.isDeviceConnected=r.payload.connected)}},d=async function(e,{timeout:t}={}){this.currentMessageId+=1;const n={...e,messageId:this.currentMessageId,target:"LEDGER-IFRAME"},s=(0,p.createDeferredPromise)();if(m(this,o,"f").set(this.currentMessageId,s),!this.iframeLoaded||!this.iframe?.contentWindow)throw new Error("The iframe is not loaded yet");return t&&setTimeout(()=>{m(this,o,"f").has(n.messageId)&&(m(this,o,"f").delete(n.messageId),s.reject(new Error("Ledger iframe message timeout")))},t),this.iframe.contentWindow.postMessage(n,"*"),s.promise},u=function(e){if("string"!=typeof e.bridgeUrl||0===e.bridgeUrl.length)throw new Error("bridgeURL is not a valid URL")}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-iframe-bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring-v2.cjs",{"@metamask/keyring-api":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/keyring-api/dist/index.cjs","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerKeyringV2=void 0;const l=e("@metamask/keyring-api"),d=e("@metamask/utils"),u=[l.EthMethod.SignTransaction,l.EthMethod.PersonalSign,l.EthMethod.SignTypedDataV4],m={scopes:[l.EthScope.Eoa],bip44:{deriveIndex:!0,derivePath:!0}},h=/^m\/44'\/60'\/(\d+)'\/0\/0$/u,p=/^(m\/44'\/60'(?:\/\d+'?)*)\/(\d+)$/u;class f extends l.EthKeyringWrapper{constructor(e){super({type:l.KeyringType.Ledger,inner:e.legacyKeyring,capabilities:m}),s.add(this),this.entropySource=e.entropySource}async getAccounts(){const e=await this.inner.getAccounts();return 0===e.length?[]:e.map(e=>{const t=this.registry.getAccountId(e);if(t){const e=this.registry.get(t);if(e)return e}const n=c(this,s,"m",a).call(this,e);return c(this,s,"m",i).call(this,e,n)})}async createAccounts(e){return this.withLock(async()=>{if("bip44:derive-path"!==e.type&&"bip44:derive-index"!==e.type)throw new Error(`Unsupported account creation type for LedgerKeyring: ${String(e.type)}`);if(e.entropySource!==this.entropySource)throw new Error(`Entropy source mismatch: expected '${this.entropySource}', got '${e.entropySource}'`);const t=await this.getAccounts();let n,r,a;if("bip44:derive-path"===e.type){const t=c(this,s,"m",o).call(this,e.derivationPath);n=t.index,r=t.basePath,a=e.derivationPath}else n=e.groupIndex,r="m/44'/60'/0'/0",a=`${r}/${n}`;const l=t.find(e=>e.options.entropy.groupIndex===n&&e.options.entropy.derivationPath===a);if(l)return[l];this.inner.setHdPath(r),this.inner.setAccountToUnlock(n);const[d]=await this.inner.addAccounts(1);if(!d)throw new Error("Failed to create new account");return[c(this,s,"m",i).call(this,d,n)]})}async deleteAccount(e){await this.withLock(async()=>{const{address:t}=await this.getAccount(e),n=this.toHexAddress(t);this.inner.removeAccount(n),this.registry.delete(e)})}}n.LedgerKeyringV2=f,s=new WeakSet,r=function(e){return(0,d.getChecksumAddress)((0,d.add0x)(e))},o=function(e){const t=e.match(h);if(t?.[1])return{basePath:"m/44'/60'/0'/0/0",index:parseInt(t[1],10)};const n=e.match(p);if(n)return{basePath:n[1],index:parseInt(n[2],10)};throw new Error(`Invalid derivation path format: ${e}. Expected Ledger Live (m/44'/60'/{index}'/0/0) or index-at-end (m/44'/60'/.../{index}) format.`)},a=function(e){const t=c(this,s,"m",r).call(this,e),n=this.inner.accountDetails[t];if(!n)throw new Error(`Address ${t} not found in account details`);const{hdPath:o}=n;if(!o)throw new Error(`No HD path found for address ${t}`);if(n.bip44){const e=o.match(h);if(e?.[1])return parseInt(e[1],10)}else{const e=o.match(p);if(e?.[2])return parseInt(e[2],10)}throw new Error(`Could not extract index from HD path: ${o}`)},i=function(e,t){const n=this.registry.register(e),o=c(this,s,"m",r).call(this,e),a=this.inner.accountDetails[o];if(!a?.hdPath)throw new Error(`No HD path found for address ${o}. Cannot create account.`);const i={id:n,type:l.EthAccountType.Eoa,address:e,scopes:[...this.capabilities.scopes],methods:[...u],options:{entropy:{type:l.KeyringAccountEntropyTypeOption.Mnemonic,id:this.entropySource,groupIndex:t,derivationPath:a.hdPath}}};return this.registry.set(i),i}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring-v2.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring.cjs",{"./ledger-error-handler.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-error-handler.cjs","@ethereumjs/rlp":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/rlp/dist/cjs/index.js","@ethereumjs/tx":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/tx/dist/cjs/index.js","@ethereumjs/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/util/dist/cjs/index.js","@metamask/eth-sig-util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-sig-util/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js",hdkey:"/home/runner/work/metamask-extension/metamask-extension/node_modules/hdkey/lib/hdkey.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c,l,d,u,m,h,p,f,g,k,w=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},b=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerKeyring=void 0;const _=e("@ethereumjs/rlp"),E=e("@ethereumjs/tx"),y=e("@ethereumjs/util"),S=e("@metamask/eth-sig-util"),I=e("@metamask/utils"),C=e("buffer"),A=b(e("hdkey")),T=e("./ledger-error-handler.cjs"),v="m",x=`${v}/44'/60'/0'`,N="Ledger Hardware";var j;!function(e){e.Ropsten="https://api-ropsten.etherscan.io",e.Kovan="https://api-kovan.etherscan.io",e.Rinkeby="https://api-rinkeby.etherscan.io",e.Mainnet="https://api.etherscan.io"}(j||(j={}));class P{constructor({bridge:e}){if(s.add(this),this.deviceId="",this.type=N,this.page=0,this.perPage=5,this.unlockedAccount=0,this.accounts=[],this.accountDetails={},this.hdk=new A.default,this.hdPath=x,this.paths={},this.network=j.Mainnet,this.implementFullBIP44=!1,!e)throw new Error("Bridge is a required dependency for the keyring");this.bridge=e}async init(){return this.bridge.init()}async destroy(){return this.bridge.destroy()}async serialize(){return{hdPath:this.hdPath,accounts:this.accounts.slice(),deviceId:this.deviceId,accountDetails:this.accountDetails,implementFullBIP44:!1}}async deserialize(e){this.hdPath=e.hdPath??x,this.accounts=e.accounts??[],this.deviceId=e.deviceId??"",this.accountDetails=e.accountDetails??{},e.accountDetails||w(this,s,"m",r).call(this,e),this.implementFullBIP44=e.implementFullBIP44??!1;const t=new Set(Object.keys(this.accountDetails));return this.accounts=this.accounts.filter(e=>t.has(w(this,s,"m",g).call(this,e))),Promise.resolve()}setDeviceId(e){this.deviceId=e}getDeviceId(){return this.deviceId}isUnlocked(){return Boolean(this.hdk.publicKey)}isConnected(){return this.bridge.isDeviceConnected}setAccountToUnlock(e){this.unlockedAccount=e}setHdPath(e){this.hdPath!==e&&(this.hdk=new A.default),this.hdPath=e}async unlock(e,t=!0){if(this.isUnlocked()&&!e)return w(this,s,"m",g).call(this,(0,I.bytesToHex)((0,y.publicToAddress)(this.hdk.publicKey,!0)));const n=e?w(this,s,"m",h).call(this,e):this.hdPath;let r;try{r=await this.bridge.getPublicKey({hdPath:n})}catch(e){(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while unlocking account")}return t&&r.chainCode&&(this.hdk.publicKey=C.Buffer.from(r.publicKey,"hex"),this.hdk.chainCode=C.Buffer.from(r.chainCode,"hex")),(0,I.add0x)(r.address)}async addAccounts(e){return new Promise((t,n)=>{this.unlock().then(async n=>{const r=this.unlockedAccount,o=r+e,a=[];for(let e=r;e<o;e++){const t=w(this,s,"m",u).call(this,e);let n;n=w(this,s,"m",m).call(this)?await this.unlock(t):w(this,s,"m",l).call(this,v,e),this.accountDetails[w(this,s,"m",g).call(this,n)]={bip44:w(this,s,"m",m).call(this),hdPath:t},this.accounts.includes(n)||(this.accounts=[...this.accounts,n],a.push(n)),this.page=0}t(a)}).catch(n)})}getName(){return N}async getFirstPage(){return this.page=0,w(this,s,"m",a).call(this,1)}async getNextPage(){return w(this,s,"m",a).call(this,1)}async getPreviousPage(){return w(this,s,"m",a).call(this,-1)}async getAccounts(){return Promise.resolve(this.accounts.slice())}removeAccount(e){const t=this.accounts.filter(t=>t.toLowerCase()!==e.toLowerCase());if(t.length===this.accounts.length)throw new Error(`Address ${e} not found in this keyring`);this.accounts=t,delete this.accountDetails[w(this,s,"m",g).call(this,e)]}async attemptMakeApp(){return this.bridge.attemptMakeApp()}async updateTransportMethod(e){return this.bridge.updateTransportMethod(e)}async getAppNameAndVersion(){try{return await this.bridge.getAppNameAndVersion()}catch(e){return(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while getting app name and version")}}async getAppConfiguration(){try{return await this.bridge.getAppConfiguration()}catch(e){return(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while getting app configuration")}}async signTransaction(e,t){let n;if(function(e){return"getChainId"in e&&"function"==typeof e.getChainId}(t))return t.v=t.getChainId(),t.r="0x00",t.s="0x00",n=t.serialize().toString("hex"),w(this,s,"m",o).call(this,e,n,e=>(t.v=C.Buffer.from(e.v,"hex"),t.r=C.Buffer.from(e.r,"hex"),t.s=C.Buffer.from(e.s,"hex"),t));const r=t.getMessageToSign();return n=Array.isArray(r)?C.Buffer.from(_.RLP.encode(r)).toString("hex"):(0,I.bytesToHex)(r),w(this,s,"m",o).call(this,e,n,e=>{const n=t.toJSON();return n.type=t.type,n.v=(0,I.add0x)(e.v),n.r=(0,I.add0x)(e.r),n.s=(0,I.add0x)(e.s),E.TransactionFactory.fromTxData(n,{common:t.common,freeze:Object.isFrozen(t)})})}async signMessage(e,t){return this.signPersonalMessage(e,t)}async signPersonalMessage(e,t){const n=await this.unlockAccountByAddress(e);if(!n)throw new Error("Ledger: Unknown error while signing message");let r;try{r=await this.bridge.deviceSignMessage({hdPath:n,message:(0,I.remove0x)(t)})}catch(e){(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while signing message")}const o=w(this,s,"m",k).call(this,parseInt(String(r.v),10)),a=`0x${r.r}${r.s}${o}`,i=(0,S.recoverPersonalSignature)({data:t,signature:a});if(w(this,s,"m",g).call(this,i)!==w(this,s,"m",g).call(this,e))throw new Error("Ledger: The signature doesnt match the right address");return a}async unlockAccountByAddress(e){const t=w(this,s,"m",g).call(this,e),n=this.accountDetails[t];if(!n)throw new Error(`Ledger: Account for address '${t}' not found`);const{hdPath:r}=n;if((await this.unlock(r,!1)).toLowerCase()!==e.toLowerCase())throw new Error(`Ledger: Account ${e} does not belong to the connected device`);return r}async signTypedData(e,t,n){const{version:r}=n??{};if(!("V4"===r))throw new Error("Ledger: Only version 4 of typed data signing is supported");const{domain:o,types:a,primaryType:i,message:c}=S.TypedDataUtils.sanitizeData(t),l=await this.unlockAccountByAddress(e);if(!l)throw new Error("Ledger: Unknown error while signing message");let d;try{d=await this.bridge.deviceSignTypedData({hdPath:l,message:{domain:{name:o.name,chainId:o.chainId,version:o.version,verifyingContract:o.verifyingContract,salt:o.salt instanceof ArrayBuffer?C.Buffer.from(o.salt).toString("hex"):o.salt},types:a,primaryType:i.toString(),message:c}})}catch(e){(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while signing message")}const u=w(this,s,"m",k).call(this,parseInt(String(d.v),10)),m=`0x${d.r}${d.s}${u}`,h=(0,S.recoverTypedSignature)({data:t,signature:m,version:S.SignTypedDataVersion.V4});if(w(this,s,"m",g).call(this,h)!==w(this,s,"m",g).call(this,e))throw new Error("Ledger: The signature doesnt match the right address");return m}forgetDevice(){this.deviceId="",this.accounts=[],this.page=0,this.unlockedAccount=0,this.paths={},this.accountDetails={},this.hdk=new A.default}}n.LedgerKeyring=P,s=new WeakSet,r=function(e){if(w(this,s,"m",m).call(this)&&e.accountIndexes)for(const[t,n]of Object.entries(e.accountIndexes))this.accountDetails[t]={bip44:!0,hdPath:w(this,s,"m",u).call(this,n)};const t=new Set(Object.keys(this.accountDetails));w(this,s,"m",m).call(this)||this.accounts.forEach(e=>{const n=w(this,s,"m",g).call(this,e);t.has(n)||(this.accountDetails[n]={bip44:!1,hdPath:w(this,s,"m",d).call(this,e)})})},o=async function(e,t,n){const s=await this.unlockAccountByAddress(e);if(!s)throw new Error("Ledger: hdPath is empty while signing transaction");let r;try{r=await this.bridge.deviceSignTransaction({tx:(0,I.remove0x)(t),hdPath:s})}catch(e){(0,T.handleLedgerTransportError)(e,"Ledger: Unknown error while signing transaction")}const o=n(r);if(o.verifySignature())return o;throw new Error("Ledger: The transaction signature is not valid")},a=async function(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=w(this,s,"m",m).call(this)?await w(this,s,"m",i).call(this,t,n):w(this,s,"m",c).call(this,t,n),r},i=async function(e,t){const n=[];for(let r=e;r<t;r++){const e=w(this,s,"m",u).call(this,r),t=await this.unlock(e),o=!this.implementFullBIP44||await w(this,s,"m",p).call(this,t);if(n.push({address:t,balance:null,index:r}),!o)break}return n},c=function(e,t){const n=[];for(let r=e;r<t;r++){const e=w(this,s,"m",l).call(this,v,r);n.push({address:e,balance:null,index:r}),this.paths[w(this,s,"m",g).call(this,e)]=r}return n},l=function(e,t){const n=this.hdk.derive(`${e}/${t}`),r=(0,I.bytesToHex)((0,y.publicToAddress)(n.publicKey,!0));return w(this,s,"m",g).call(this,r)},d=function(e){const t=w(this,s,"m",g).call(this,e);let n=this.paths[t];if(void 0===n)for(let e=0;e<1e3;e++)if(t===w(this,s,"m",l).call(this,v,e)){n=e;break}if(void 0===n)throw new Error("Unknown address");return w(this,s,"m",u).call(this,n)},u=function(e){return w(this,s,"m",m).call(this)?`m/44'/60'/${e}'/0/0`:`${this.hdPath}/${e}`},m=function(){return"m/44'/60'/0'/0/0"===this.hdPath},h=function(e){return e.toString().replace("m/","")},p=async function(e){const t=w(this,s,"m",f).call(this),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},f=function(){return this.network},g=function(e){return(0,I.getChecksumAddress)((0,I.add0x)(e))},k=function(e){return 0===e||1===e?(e+27).toString(16):e.toString(16)},P.type=N}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-keyring.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-mobile-bridge.cjs",{"./ledger-hw-app.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a,i,c=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},l=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerMobileBridge=void 0;e("./ledger-hw-app.cjs");n.LedgerMobileBridge=class{constructor(e,t={}){s.add(this),r.set(this,void 0),o.set(this,void 0),this.isDeviceConnected=!1,c(this,o,t,"f"),c(this,r,e,"f")}async init(){return Promise.resolve()}async destroy(){try{await l(this,s,"m",a).call(this).dispose()}catch(e){console.error(e)}this.isDeviceConnected=!1}async deviceSignMessage({hdPath:e,message:t}){return l(this,s,"m",i).call(this).signPersonalMessage(e,t)}async deviceSignTypedData({hdPath:e,message:t}){return l(this,s,"m",i).call(this).signEIP712Message(e,t)}async deviceSignTransaction({tx:e,hdPath:t}){return l(this,s,"m",i).call(this).clearSignTransaction(t,e,{externalPlugins:!0,erc20:!0,nft:!0})}async getPublicKey({hdPath:e}){return await l(this,s,"m",i).call(this).getAddress(e,!1,!0)}async getOptions(){return l(this,o,"f")}async setOptions(e){c(this,o,e,"f")}async updateTransportMethod(e){if(!e.deviceModel)throw new Error("Property `deviceModel` is not defined in `transport`.");if(!e.deviceModel.id)throw new Error("Property `deviceModel.id` is not defined in `transport`.");return l(this,s,"m",a).call(this).setTransport(e),this.isDeviceConnected=!0,Promise.resolve(!0)}async attemptMakeApp(){throw new Error("Method not supported.")}async openEthApp(){await l(this,s,"m",i).call(this).openEthApp()}async closeApps(){await l(this,s,"m",i).call(this).closeApps()}async getAppNameAndVersion(){return l(this,s,"m",i).call(this).getAppNameAndVersion()}async getAppConfiguration(){return l(this,s,"m",i).call(this).getAppConfiguration()}},r=new WeakMap,o=new WeakMap,s=new WeakSet,a=function(){if(l(this,r,"f"))return l(this,r,"f");throw new Error("Instance `transportMiddleware` is not initialized.")},i=function(){return l(this,s,"m",a).call(this).getEthApp()}}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-mobile-bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-transport-middleware.cjs",{"./ledger-hw-app.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-hw-app.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},o=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.LedgerTransportMiddleware=void 0;const a=e("./ledger-hw-app.cjs");n.LedgerTransportMiddleware=class{constructor(){this.mainAppName="BOLOS",this.ethAppName="Ethereum",this.transportEncoding="ascii",s.set(this,void 0)}async dispose(){const e=this.getTransport();await e.close()}setTransport(e){r(this,s,e,"f")}getTransport(){if(!o(this,s,"f"))throw new Error("Instance `transport` is not initialized.");return o(this,s,"f")}getEthApp(){return new a.MetaMaskLedgerHwAppEth(this.getTransport())}},s=new WeakMap}}},{package:"@metamask/eth-ledger-bridge-keyring",file:"node_modules/@metamask/eth-ledger-bridge-keyring/dist/ledger-transport-middleware.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error-mappings.cjs",{"./hardware-errors-enums.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MOBILE_ERROR_MAPPINGS=n.BLE_ERROR_MAPPINGS=n.LEDGER_ERROR_MAPPINGS=void 0;const s=e("./hardware-errors-enums.cjs");n.LEDGER_ERROR_MAPPINGS={"0x9000":{code:s.ErrorCode.Success,message:"Operation successful",severity:s.Severity.Info,category:s.Category.Success},"0x6300":{code:s.ErrorCode.AuthenticationFailed,message:"Authentication failed",severity:s.Severity.Err,category:s.Category.Authentication,userMessage:"Authentication failed. Please verify your credentials."},"0x63c0":{code:s.ErrorCode.AuthenticationPinAttemptsRemaining,message:"PIN attempts remaining",severity:s.Severity.Warning,category:s.Category.Authentication,userMessage:"Incorrect PIN. Please try again."},"0x6982":{code:s.ErrorCode.AuthenticationSecurityCondition,message:"Security conditions not satisfied",severity:s.Severity.Err,category:s.Category.Authentication,userMessage:"Device is locked or access rights are insufficient. Please unlock your device."},"0x6985":{code:s.ErrorCode.UserRejected,message:"User rejected action on device",severity:s.Severity.Warning,category:s.Category.UserAction,userMessage:"Transaction was rejected. Please approve on your device to continue."},"0x9804":{code:s.ErrorCode.AuthenticationSecurityCondition,message:"App update required",severity:s.Severity.Err,category:s.Category.Authentication,userMessage:"Please update your Ledger app to continue."},"0x9808":{code:s.ErrorCode.AuthenticationFailed,message:"Contradiction in secret code status",severity:s.Severity.Err,category:s.Category.Authentication},"0x9840":{code:s.ErrorCode.AuthenticationDeviceBlocked,message:"Code blocked",severity:s.Severity.Critical,category:s.Category.Authentication,userMessage:"Your device is blocked due to too many failed attempts. Please follow device recovery procedures."},"0x650f":{code:s.ErrorCode.ConnectionClosed,message:"App closed or connection issue",severity:s.Severity.Err,category:s.Category.Connection,userMessage:"Connection lost or app closed. Please open the corresponding app on your Ledger device."},"0x5515":{code:s.ErrorCode.AuthenticationDeviceLocked,message:"Device is locked",severity:s.Severity.Err,category:s.Category.Authentication,userMessage:"Please unlock your Ledger device to continue."},"0x5501":{code:s.ErrorCode.UserRejected,message:"User refused on device",severity:s.Severity.Warning,category:s.Category.UserAction,userMessage:"Operation was rejected. Please approve on your device to continue."},"0x6a80":{code:s.ErrorCode.DeviceStateBlindSignNotSupported,message:"Blind signing not supported",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Blind signing is not supported on this device."},"0x6d00":{code:s.ErrorCode.DeviceStateOnlyV4Supported,message:"Ledger Only V4 supported",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Only V4 is supported on this device."},"0x6e00":{code:s.ErrorCode.DeviceStateEthAppClosed,message:"Ethereum app closed",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Ethereum app is closed. Please open it to continue."},"0x6501":{code:s.ErrorCode.DeviceStateEthAppOutOfDate,message:"Ethereum app out of date",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Ethereum app is out of date. Please update it to continue."},"0x6f00":{code:s.ErrorCode.DeviceUnresponsive,message:"Device unresponsive",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Your device is not responding. Please disconnect and reconnect your device."},"0x6b0c":{code:s.ErrorCode.AuthenticationDeviceLocked,message:"Device locked",severity:s.Severity.Err,category:s.Category.Authentication,userMessage:"Please unlock your Ledger device to continue."},"0x6a15":{code:s.ErrorCode.DeviceStateEthAppClosed,message:"Ethereum app closed",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Ethereum app is closed. Please open it to continue."},"0x6511":{code:s.ErrorCode.DeviceStateEthAppClosed,message:"Ethereum app closed",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"Ethereum app is closed. Please open it to continue."}},n.BLE_ERROR_MAPPINGS={BLUETOOTH_PERMISSION_DENIED:{code:s.ErrorCode.PermissionBluetoothDenied,message:"Bluetooth permission denied",severity:s.Severity.Err,category:s.Category.Configuration,userMessage:"Bluetooth permission is required to connect to your hardware wallet. Please enable it in your device settings."},LOCATION_PERMISSION_DENIED:{code:s.ErrorCode.PermissionLocationDenied,message:"Location permission denied",severity:s.Severity.Err,category:s.Category.Configuration,userMessage:"Location permission is required for Bluetooth scanning on Android. Please enable it in your device settings."},NEARBY_DEVICES_PERMISSION_DENIED:{code:s.ErrorCode.PermissionNearbyDevicesDenied,message:"Nearby devices permission denied",severity:s.Severity.Err,category:s.Category.Configuration,userMessage:"Nearby devices permission is required to scan for your hardware wallet. Please enable it in your device settings."},BLUETOOTH_DISABLED:{code:s.ErrorCode.BluetoothDisabled,message:"Bluetooth is turned off",severity:s.Severity.Warning,category:s.Category.Connection,userMessage:"Bluetooth is turned off. Please enable Bluetooth to connect to your hardware wallet."},BLUETOOTH_SCAN_FAILED:{code:s.ErrorCode.BluetoothScanFailed,message:"Bluetooth scanning failed",severity:s.Severity.Err,category:s.Category.Connection,userMessage:"Unable to scan for Bluetooth devices. Please try again."},BLUETOOTH_CONNECTION_FAILED:{code:s.ErrorCode.BluetoothConnectionFailed,message:"Bluetooth connection failed",severity:s.Severity.Err,category:s.Category.Connection,userMessage:"Failed to connect via Bluetooth. Please make sure your device is nearby and try again."}},n.MOBILE_ERROR_MAPPINGS={NOT_SUPPORTED:{code:s.ErrorCode.MobileNotSupported,message:"Operation not supported on mobile",severity:s.Severity.Err,category:s.Category.DeviceState,userMessage:"This operation is not supported on mobile devices."}}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error-mappings.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error.cjs",{"./hardware-errors-enums.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.HardwareWalletError=void 0;const a=e("./hardware-errors-enums.cjs");class i extends Error{constructor(e,t){super(e),s.add(this),this.name="HardwareWalletError",this.id=`err_${Date.now().toString(36)}_${Math.random().toString(36).substring(2,9)}`,this.code=t.code,this.severity=t.severity,this.category=t.category,this.userMessage=t.userMessage,this.timestamp=new Date,this.metadata=t.metadata,this.cause=t.cause}isCritical(){return this.severity===a.Severity.Critical}isWarning(){return this.severity===a.Severity.Warning}withMetadata(e){const t={code:this.code,severity:this.severity,category:this.category,userMessage:this.userMessage,metadata:{...this.metadata??{},...e}};return this.cause!==undefined&&(t.cause=this.cause),new i(this.message,t)}toJSON(){const e={id:this.id,name:this.name,message:this.message,code:this.code,severity:this.severity,category:this.category,userMessage:this.userMessage,timestamp:this.timestamp.toISOString(),metadata:this.metadata};return this.cause!==undefined&&(e.cause={name:this.cause.name,message:this.cause.message}),e}toString(){return`${o(this,s,"m",r).call(this)}: ${this.message}`}toDetailedString(){const e=[this.toString(),`User Message: ${this.userMessage}`,`Severity: ${this.severity}`,`Category: ${this.category}`,`Timestamp: ${this.timestamp.toISOString()}`];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`Metadata: ${JSON.stringify(this.metadata,null,2)}`),this.cause!==undefined&&e.push(`Caused by: ${this.cause.message}`),e.join("\n")}static isHardwareWalletError(e){return e instanceof i}}n.HardwareWalletError=i,s=new WeakSet,r=function(){const e=(t=this.code,a.ErrorCode[t]??a.ErrorCode[a.ErrorCode.Unknown]);var t;return`${this.name} [${e}:${this.code}]`}}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.Category=n.Severity=n.ErrorCode=void 0,function(e){e[e.Success=0]="Success",e[e.AuthenticationFailed=1e3]="AuthenticationFailed",e[e.AuthenticationIncorrectPin=1001]="AuthenticationIncorrectPin",e[e.AuthenticationPinAttemptsRemaining=1002]="AuthenticationPinAttemptsRemaining",e[e.AuthenticationPinCancelled=1003]="AuthenticationPinCancelled",e[e.AuthenticationDeviceLocked=1100]="AuthenticationDeviceLocked",e[e.AuthenticationDeviceBlocked=1101]="AuthenticationDeviceBlocked",e[e.AuthenticationSecurityCondition=1200]="AuthenticationSecurityCondition",e[e.AuthenticationWipeCodeMismatch=1300]="AuthenticationWipeCodeMismatch",e[e.UserRejected=2e3]="UserRejected",e[e.UserCancelled=2001]="UserCancelled",e[e.UserConfirmationRequired=2002]="UserConfirmationRequired",e[e.UserInputRequired=2003]="UserInputRequired",e[e.DeviceNotReady=3e3]="DeviceNotReady",e[e.DeviceInvalidSession=3001]="DeviceInvalidSession",e[e.DeviceDisconnected=3003]="DeviceDisconnected",e[e.DeviceUsedElsewhere=3004]="DeviceUsedElsewhere",e[e.DeviceCallInProgress=3005]="DeviceCallInProgress",e[e.DeviceUnresponsive=3006]="DeviceUnresponsive",e[e.DeviceNotFound=3010]="DeviceNotFound",e[e.DeviceMultipleConnected=3011]="DeviceMultipleConnected",e[e.DeviceMissingCapability=3020]="DeviceMissingCapability",e[e.DeviceBtcOnlyFirmware=3021]="DeviceBtcOnlyFirmware",e[e.DeviceIncompatibleMode=3030]="DeviceIncompatibleMode",e[e.ConnectionTransportMissing=4e3]="ConnectionTransportMissing",e[e.ConnectionClosed=4001]="ConnectionClosed",e[e.ConnectionTimeout=4002]="ConnectionTimeout",e[e.ConnectionBlocked=4003]="ConnectionBlocked",e[e.ProtocolUnexpectedMessage=5e3]="ProtocolUnexpectedMessage",e[e.ProtocolCommandError=5001]="ProtocolCommandError",e[e.ProtocolMessageError=5002]="ProtocolMessageError",e[e.DeviceStateBlindSignNotSupported=6001]="DeviceStateBlindSignNotSupported",e[e.DeviceStateOnlyV4Supported=6002]="DeviceStateOnlyV4Supported",e[e.DeviceStateEthAppClosed=6003]="DeviceStateEthAppClosed",e[e.DeviceStateEthAppOutOfDate=6004]="DeviceStateEthAppOutOfDate",e[e.PermissionBluetoothDenied=7e3]="PermissionBluetoothDenied",e[e.PermissionLocationDenied=7001]="PermissionLocationDenied",e[e.PermissionNearbyDevicesDenied=7002]="PermissionNearbyDevicesDenied",e[e.BluetoothDisabled=7100]="BluetoothDisabled",e[e.BluetoothScanFailed=7101]="BluetoothScanFailed",e[e.BluetoothConnectionFailed=7102]="BluetoothConnectionFailed",e[e.MobileNotSupported=7300]="MobileNotSupported",e[e.TxInsufficientFunds=1e4]="TxInsufficientFunds",e[e.Unknown=99999]="Unknown"}(s||(n.ErrorCode=s={})),function(e){e.Info="Info",e.Err="Error",e.Warning="Warning",e.Critical="Critical"}(r||(n.Severity=r={})),function(e){e.Success="Success",e.Authentication="Authentication",e.Protocol="Protocol",e.Connection="Connection",e.UserAction="UserAction",e.DeviceState="DeviceState",e.Unknown="Unknown",e.Configuration="Configuration"}(o||(n.Category=o={}))}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs",{"./hardware-error-mappings.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error-mappings.cjs","./hardware-error.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-error.cjs","./hardware-errors-enums.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/hardware-errors-enums.cjs","./types.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/types.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),r(e("./hardware-errors-enums.cjs"),n),r(e("./hardware-error-mappings.cjs"),n),r(e("./hardware-error.cjs"),n),r(e("./types.cjs"),n)}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/types.cjs",{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.DeviceEvent=n.ConnectionStatus=n.HardwareWalletType=void 0,function(e){e.Ledger="ledger",e.Trezor="trezor",e.OneKey="onekey",e.Lattice="lattice",e.Qr="qr",e.Unknown="unknown"}(s||(n.HardwareWalletType=s={})),function(e){e.Disconnected="disconnected",e.Scanning="scanning",e.Connecting="connecting",e.Connected="connected",e.Ready="ready",e.AwaitingApp="awaiting_app",e.AwaitingConfirmation="awaiting_confirmation",e.ErrorState="error"}(r||(n.ConnectionStatus=r={})),function(e){e.Connected="connected",e.Disconnected="disconnected",e.ConnectionFailed="connection_failed",e.DeviceLocked="device_locked",e.AppOpened="app_opened",e.AppNotOpen="app_not_open",e.AppChanged="app_changed",e.ConfirmationRequired="confirmation_required",e.ConfirmationReceived="confirmation_received",e.ConfirmationRejected="confirmation_rejected",e.OperationTimeout="operation_timeout",e.PermissionChanged="permission_changed"}(o||(n.DeviceEvent=o={}))}}},{package:"@metamask/eth-ledger-bridge-keyring>@metamask/hw-wallet-sdk",file:"node_modules/@metamask/eth-ledger-bridge-keyring/node_modules/@metamask/hw-wallet-sdk/dist/types.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/index.cjs",{"./onekey-keyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/onekey-keyring.cjs","./trezor-connect-bridge.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/trezor-connect-bridge.cjs","./trezor-keyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/trezor-keyring.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),r(e("./trezor-keyring.cjs"),n),r(e("./onekey-keyring.cjs"),n),r(e("./trezor-connect-bridge.cjs"),n)}}},{package:"@metamask/eth-trezor-keyring",file:"node_modules/@metamask/eth-trezor-keyring/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/onekey-keyring.cjs",{"./trezor-keyring.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/trezor-keyring.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.OneKeyKeyring=void 0;const s=e("./trezor-keyring.cjs"),r="OneKey Hardware";class o extends s.TrezorKeyring{constructor(){super(...arguments),this.type=r}}n.OneKeyKeyring=o,o.type=r}}},{package:"@metamask/eth-trezor-keyring",file:"node_modules/@metamask/eth-trezor-keyring/dist/onekey-keyring.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/trezor-connect-bridge.cjs",{"@trezor/connect-web":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@trezor/connect-web/lib/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),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)&&s(t,e,n);return r(t,e),t};Object.defineProperty(n,"__esModule",{value:!0}),n.TrezorConnectBridge=void 0;const a=o(e("@trezor/connect-web"));n.TrezorConnectBridge=class{constructor(){this.trezorConnectInitiated=!1}async init(e){a.default.on(a.DEVICE_EVENT,e=>{var t;e.type===a.DEVICE.CONNECT&&(this.model=null===(t=e.payload.features)||void 0===t?void 0:t.model)}),this.trezorConnectInitiated||(await a.default.init(e),this.trezorConnectInitiated=!0)}async dispose(){return a.default.dispose(),Promise.resolve()}getPublicKey(e){return a.default.getPublicKey(e)}ethereumSignTransaction(e){return a.default.ethereumSignTransaction(e)}ethereumSignMessage(e){return a.default.ethereumSignMessage(e)}ethereumSignTypedData(e){return a.default.ethereumSignTypedData(e)}}}}},{package:"@metamask/eth-trezor-keyring",file:"node_modules/@metamask/eth-trezor-keyring/dist/trezor-connect-bridge.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-trezor-keyring/dist/trezor-keyring.cjs",{"@ethereumjs/tx":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/tx/dist/cjs/index.js","@ethereumjs/util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@ethereumjs/util/dist/cjs/index.js","@metamask/eth-sig-util":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-sig-util/dist/index.js","@metamask/utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/utils/dist/index.cjs","@trezor/connect-plugin-ethereum":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@trezor/connect-plugin-ethereum/lib/index.js",buffer:"/home/runner/work/metamask-extension/metamask-extension/node_modules/browserify/node_modules/buffer/index.js",hdkey:"/home/runner/work/metamask-extension/metamask-extension/node_modules/hdkey/lib/hdkey.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){var s,r,o,a,i,c,l=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},d=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.TrezorKeyring=n.TREZOR_CONNECT_MANIFEST=void 0;const u=e("@ethereumjs/tx"),m=e("@ethereumjs/util"),h=e("@metamask/eth-sig-util"),p=e("@metamask/utils"),f=e("@trezor/connect-plugin-ethereum"),g=d(e("hdkey")),k="m/44'/60'/0'/0",w="m/44'/1'/0'/0",b="m/44'/60'/0'",_={[k]:!0,[b]:!0,[w]:!0},E="Trezor Hardware",y=1e3;async function S(e){return new Promise(t=>setTimeout(t,e))}function I(e){return"function"==typeof e.getChainId}n.TREZOR_CONNECT_MANIFEST={appName:"MetaMask",email:"support@metamask.io",appUrl:"https://metamask.io"};class C{constructor({bridge:e}){if(s.add(this),this.type=E,this.accounts=[],this.hdk=new g.default,this.hdPath=k,this.page=0,this.perPage=5,this.unlockedAccount=0,this.paths={},!e)throw new Error("Bridge is a required dependency for the keyring");this.bridge=e}getModel(){return this.bridge.model}async init(){return this.bridge.init({manifest:n.TREZOR_CONNECT_MANIFEST,lazyLoad:!0})}async destroy(){return this.bridge.dispose()}async serialize(){return Promise.resolve({hdPath:this.hdPath,accounts:this.accounts.slice(),page:this.page,paths:this.paths,perPage:this.perPage,unlockedAccount:this.unlockedAccount})}async deserialize(e){var t,n,s,r;return this.hdPath=null!==(t=e.hdPath)&&void 0!==t?t:k,this.accounts=null!==(n=e.accounts)&&void 0!==n?n:[],this.page=null!==(s=e.page)&&void 0!==s?s:0,this.perPage=null!==(r=e.perPage)&&void 0!==r?r:5,Promise.resolve()}isUnlocked(){var e;return Boolean(null===(e=this.hdk)||void 0===e?void 0:e.publicKey)}async unlock(){return this.isUnlocked()?Promise.resolve("already unlocked"):new Promise((e,n)=>{this.bridge.getPublicKey({path:this.hdPath,coin:"ETH"}).then(s=>{var r;s.success?(this.hdk.publicKey=t.from(s.payload.publicKey,"hex"),this.hdk.chainCode=t.from(s.payload.chainCode,"hex"),e("just unlocked")):n(new Error((null===(r=s.payload)||void 0===r?void 0:r.error)||"Unknown error"))}).catch(e=>{n(new Error((null==e?void 0:e.toString())||"Unknown error"))})})}setAccountToUnlock(e){this.unlockedAccount=parseInt(String(e),10)}async addAccounts(e){return new Promise((t,n)=>{this.unlock().then(n=>{const r=this.unlockedAccount,o=r+e,a=[];for(let e=r;e<o;e++){const t=l(this,s,"m",i).call(this,"m",e);this.accounts.includes(t)||(this.accounts=[...this.accounts,t],a.push(t)),this.page=0}t(a)}).catch(e=>{n(e)})})}async getFirstPage(){return this.page=0,l(this,s,"m",r).call(this,1)}async getNextPage(){return l(this,s,"m",r).call(this,1)}async getPreviousPage(){return l(this,s,"m",r).call(this,-1)}async 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())}async signTransaction(e,n){return I(n)?l(this,s,"m",o).call(this,e,n.getChainId(),n,e=>(n.v=t.from(e.v,"hex"),n.r=t.from(e.r,"hex"),n.s=t.from(e.s,"hex"),n)):l(this,s,"m",o).call(this,e,Number(n.common.chainId()),n,e=>{const t=n.toJSON();return t.type=n.type,t.v=(0,p.add0x)(e.v),t.r=(0,p.add0x)(e.r),t.s=(0,p.add0x)(e.s),u.TransactionFactory.fromTxData(t,{common:n.common,freeze:Object.isFrozen(n)})})}async signMessage(e,t){return this.signPersonalMessage(e,t)}async signPersonalMessage(e,t){return new Promise((n,r)=>{this.unlock().then(o=>{setTimeout(()=>{this.bridge.ethereumSignMessage({path:l(this,s,"m",c).call(this,e),message:(0,p.remove0x)(t),hex:!0}).then(t=>{var s;if(t.success){t.payload.address!==(0,p.getChecksumAddress)(e)&&r(new Error("signature doesnt match the right address"));const s=`0x${t.payload.signature}`;n(s)}else r(new Error((null===(s=t.payload)||void 0===s?void 0:s.error)||"Unknown error"))}).catch(e=>{r(new Error((null==e?void 0:e.toString())||"Unknown error"))})},"just unlocked"===o?y:0)}).catch(e=>{r(new Error((null==e?void 0:e.toString())||"Unknown error"))})})}async signTypedData(e,t,n){var r,o;const{version:a}=null!=n?n:{version:h.SignTypedDataVersion.V4},i=(0,f.transformTypedData)(t,a===h.SignTypedDataVersion.V4),{types:d,message:u={},domain:m={},primaryType:g,domain_separator_hash:k,message_hash:w}=i,b=await this.unlock();await S("just unlocked"===b?y:0);const _=await this.bridge.ethereumSignTypedData({path:l(this,s,"m",c).call(this,e),data:{types:Object.assign(Object.assign({},d),{EIP712Domain:null!==(r=d.EIP712Domain)&&void 0!==r?r:[]}),message:u,domain:m,primaryType:g},metamask_v4_compat:!0,domain_separator_hash:k,message_hash:null!=w?w:""});if(_.success){if((0,p.getChecksumAddress)(e)!==_.payload.address)throw new Error("signature doesnt match the right address");return _.payload.signature}throw new Error((null===(o=_.payload)||void 0===o?void 0:o.error)||"Unknown error")}forgetDevice(){this.accounts=[],this.hdk=new g.default,this.page=0,this.unlockedAccount=0,this.paths={}}setHdPath(e){if(!_[e])throw new Error(`The setHdPath method does not support setting HD Path to ${e}`);this.hdPath!==e&&(this.hdk=new g.default,this.accounts=[],this.page=0,this.perPage=5,this.unlockedAccount=0,this.paths={}),this.hdPath=e}}n.TrezorKeyring=C,s=new WeakSet,r=async function(e){return this.page+=e,this.page<=0&&(this.page=1),new Promise((e,t)=>{this.unlock().then(t=>{const n=(this.page-1)*this.perPage,r=n+this.perPage,o=[];for(let e=n;e<r;e++){const t=l(this,s,"m",i).call(this,"m",e);o.push({address:t,balance:null,index:e}),this.paths[(0,p.getChecksumAddress)(t)]=e}e(o)}).catch(e=>{t(e)})})},o=async function(e,n,r,o){var i,d,u,m;let h;h=I(r)?{to:l(this,s,"m",a).call(this,r.to),value:l(this,s,"m",a).call(this,r.value),data:l(this,s,"m",a).call(this,r.data),chainId:n,nonce:l(this,s,"m",a).call(this,r.nonce),gasLimit:l(this,s,"m",a).call(this,r.gasLimit),gasPrice:l(this,s,"m",a).call(this,r.gasPrice)}:Object.assign(Object.assign({},r.toJSON()),{chainId:n,to:l(this,s,"m",a).call(this,t.from(null!==(d=null===(i=r.to)||void 0===i?void 0:i.bytes)&&void 0!==d?d:[]))});try{const t=await this.unlock();await S("just unlocked"===t?y:0);const n=await this.bridge.ethereumSignTransaction({path:l(this,s,"m",c).call(this,e),transaction:h});if(n.success){const t=o(n.payload),s=(0,p.getChecksumAddress)((0,p.add0x)(t.getSenderAddress().toString("hex")));if(s!==(0,p.getChecksumAddress)(e))throw new Error("signature doesn't match the right address");return t}throw new Error((null===(u=n.payload)||void 0===u?void 0:u.error)||"Unknown error")}catch(e){throw new Error(null!==(m=null==e?void 0:e.toString())&&void 0!==m?m:"Unknown error")}},a=function(e){return(0,p.bytesToHex)(e)},i=function(e,t){const n=this.hdk.derive(`${e}/${t}`),s=(0,p.bytesToHex)((0,m.publicToAddress)(n.publicKey,!0));return(0,m.toChecksumAddress)(s)},c=function(e){const t=(0,p.getChecksumAddress)(e);let n=this.paths[t];if(void 0===n)for(let e=0;e<1e3;e++)if(t===l(this,s,"m",i).call(this,"m",e)){n=e;break}if(void 0===n)throw new Error("Unknown address");return`${this.hdPath}/${n}`},C.type=E}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/eth-trezor-keyring",file:"node_modules/@metamask/eth-trezor-keyring/dist/trezor-keyring.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/GasFeeController.cjs",{"./determineGasFeeCalculations.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/determineGasFeeCalculations.cjs","./gas-util.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/gas-util.cjs","@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","@metamask/eth-query":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/eth-query/index.js","@metamask/polling-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/index.cjs",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,o,a=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,n):r?r.value=n:t.set(e,n),n},i=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},c=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 l=e("@metamask/controller-utils"),d=c(e("@metamask/eth-query")),u=e("@metamask/polling-controller"),m=e("uuid"),h=c(e("./determineGasFeeCalculations.cjs")),p=e("./gas-util.cjs");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={gasFeeEstimatesByChainId:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},gasFeeEstimates:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},estimatedGasFeeTimeBounds:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},gasEstimateType:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!0},nonRPCGasFeeApisDisabled:{includeInStateLogs:!0,persist:!0,includeInDebugSnapshot:!1,usedInUi:!1}},g={gasFeeEstimatesByChainId:{},gasFeeEstimates:{},estimatedGasFeeTimeBounds:{},gasEstimateType:n.GAS_ESTIMATE_TYPES.NONE,nonRPCGasFeeApisDisabled:!1};class k extends((0,u.StaticIntervalPollingController)()){constructor({interval:e=15e3,messenger:t,state:c,getCurrentNetworkEIP1559Compatibility:l,getCurrentAccountEIP1559Compatibility:u,getChainId:m,getCurrentNetworkLegacyGasAPICompatibility:h,getProvider:p,onNetworkDidChange:k,legacyAPIEndpoint:w=n.LEGACY_GAS_PRICES_API_URL,EIP1559APIEndpoint:b,clientId:_}){if(super({name:"GasFeeController",metadata:f,messenger:t,state:{...g,...c}}),s.add(this),r.set(this,void 0),this.intervalDelay=e,this.setIntervalLength(e),this.pollTokens=new Set,this.getCurrentNetworkEIP1559Compatibility=l,this.getCurrentNetworkLegacyGasAPICompatibility=h,this.getCurrentAccountEIP1559Compatibility=u,a(this,r,p,"f"),this.EIP1559APIEndpoint=b,this.legacyAPIEndpoint=w,this.clientId=_,this.ethQuery=new d.default(i(this,r,"f").call(this)),k&&m)this.currentChainId=m(),k(async e=>{await i(this,s,"m",o).call(this,e)});else{const{selectedNetworkClientId:e}=this.messenger.call("NetworkController:getState");this.currentChainId=this.messenger.call("NetworkController:getNetworkClientById",e).configuration.chainId,this.messenger.subscribe("NetworkController:networkDidChange",async e=>{await i(this,s,"m",o).call(this,e)})}}async resetPolling(){if(0!==this.pollTokens.size){const e=Array.from(this.pollTokens);this.stopPolling(),await this.getGasFeeEstimatesAndStartPolling(e[0]),e.slice(1).forEach(e=>{this.pollTokens.add(e)})}}async fetchGasFeeEstimates(e){return await this._fetchGasFeeEstimateData(e)}async getGasFeeEstimatesAndStartPolling(e){const t=e||(0,m.v1)();return this.pollTokens.add(t),1===this.pollTokens.size&&(await this._fetchGasFeeEstimateData(),this._poll()),t}async _fetchGasFeeEstimateData(e={}){const{shouldUpdateState:t=!0,networkClientId:n}=e;let s,r,o,a;if(n!==undefined){const e=this.messenger.call("NetworkController:getNetworkClientById",n);o="0x38"===e.configuration.chainId,a=(0,l.convertHexToDecimal)(e.configuration.chainId);try{r=await this.messenger.call("NetworkController:getEIP1559Compatibility",n)||!1}catch{r=!1}s=new d.default(e.provider)}s??(s=this.ethQuery),o??(o=this.getCurrentNetworkLegacyGasAPICompatibility()),a??(a=(0,l.convertHexToDecimal)(this.currentChainId));try{r??(r=await this.getEIP1559Compatibility())}catch(e){console.error(e),r??(r=!1)}const i=await(0,h.default)({isEIP1559Compatible:r,isLegacyGasAPICompatible:o,fetchGasEstimates:p.fetchGasEstimates,fetchGasEstimatesUrl:this.EIP1559APIEndpoint.replace("<chain_id>",`${a}`),fetchLegacyGasPriceEstimates:p.fetchLegacyGasPriceEstimates,fetchLegacyGasPriceEstimatesUrl:this.legacyAPIEndpoint.replace("<chain_id>",`${a}`),fetchEthGasPriceEstimate:p.fetchEthGasPriceEstimate,calculateTimeEstimate:p.calculateTimeEstimate,clientId:this.clientId,ethQuery:s,nonRPCGasFeeApisDisabled:this.state.nonRPCGasFeeApisDisabled});if(t){const e=(0,l.toHex)(a);this.update(t=>{this.currentChainId===e&&(t.gasFeeEstimates=i.gasFeeEstimates,t.estimatedGasFeeTimeBounds=i.estimatedGasFeeTimeBounds,t.gasEstimateType=i.gasEstimateType),t.gasFeeEstimatesByChainId??(t.gasFeeEstimatesByChainId={}),t.gasFeeEstimatesByChainId[e]={gasFeeEstimates:i.gasFeeEstimates,estimatedGasFeeTimeBounds:i.estimatedGasFeeTimeBounds,gasEstimateType:i.gasEstimateType}})}return 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(async()=>{await(0,l.safelyExecute)(()=>this._fetchGasFeeEstimateData())},this.intervalDelay)}async _executePoll({networkClientId:e}){await this._fetchGasFeeEstimateData({networkClientId:e})}resetState(){this.update(()=>g)}async getEIP1559Compatibility(){const e=await this.getCurrentNetworkEIP1559Compatibility(),t=this.getCurrentAccountEIP1559Compatibility?.()??!0;return e&&t}getTimeEstimate(e,t){return this.state.gasFeeEstimates&&this.state.gasEstimateType===n.GAS_ESTIMATE_TYPES.FEE_MARKET?(0,p.calculateTimeEstimate)(e,t,this.state.gasFeeEstimates):{}}enableNonRPCGasFeeApis(){this.update(e=>{e.nonRPCGasFeeApisDisabled=!1})}disableNonRPCGasFeeApis(){this.update(e=>{e.nonRPCGasFeeApisDisabled=!0})}}n.GasFeeController=k,r=new WeakMap,s=new WeakSet,o=async function({selectedNetworkClientId:e}){const t=this.messenger.call("NetworkController:getNetworkClientById",e).configuration.chainId;t!==this.currentChainId&&(this.ethQuery=new d.default(i(this,r,"f").call(this)),await this.resetPolling(),this.currentChainId=t)},n.default=k}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/GasFeeController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/determineGasFeeCalculations.cjs",{"./GasFeeController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/GasFeeController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});const s=e("./GasFeeController.cjs");n.default=async function(e){try{return await async function(e){const{isEIP1559Compatible:t,isLegacyGasAPICompatible:n,nonRPCGasFeeApisDisabled:r}=e;try{if(t&&!r)return await async function(e){const{fetchGasEstimates:t,fetchGasEstimatesUrl:n,clientId:r,calculateTimeEstimate:o}=e,a=await t(n,r),{suggestedMaxPriorityFeePerGas:i,suggestedMaxFeePerGas:c}=a.medium,l=o(i,c,a);return{gasFeeEstimates:a,estimatedGasFeeTimeBounds:l,gasEstimateType:s.GAS_ESTIMATE_TYPES.FEE_MARKET}}(e);if(n&&!r)return await async function(e){const{fetchLegacyGasPriceEstimates:t,fetchLegacyGasPriceEstimatesUrl:n,clientId:r}=e;return{gasFeeEstimates:await t(n,r),estimatedGasFeeTimeBounds:{},gasEstimateType:s.GAS_ESTIMATE_TYPES.LEGACY}}(e);throw new Error("Main gas fee/price estimation failed. Use fallback")}catch{return await async function(e){const{ethQuery:t,fetchEthGasPriceEstimate:n}=e;return{gasFeeEstimates:await n(t),estimatedGasFeeTimeBounds:{},gasEstimateType:s.GAS_ESTIMATE_TYPES.ETH_GASPRICE}}(e)}}(e)}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.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/gas-util.cjs",{"@metamask/controller-utils":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/controller-utils/dist/index.cjs","bn.js":"/home/runner/work/metamask-extension/metamask-extension/node_modules/bn.js/lib/bn.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.calculateTimeEstimate=n.fetchEthGasPriceEstimate=n.fetchLegacyGasPriceEstimates=n.fetchGasEstimates=n.normalizeGWEIDecimalNumbers=void 0;const r=e("@metamask/controller-utils"),o=s(e("bn.js")),a=e=>({"X-Client-Id":e});function i(e){const t=(0,r.gweiDecToWEIBN)(e).toString(16);return(0,r.weiHexToGweiDec)(t)}n.normalizeGWEIDecimalNumbers=i,n.fetchGasEstimates=async function(e,t){const n=await(0,r.handleFetch)(e,t?{headers:a(t)}:undefined);return{low:{...n.low,suggestedMaxPriorityFeePerGas:i(n.low.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:i(n.low.suggestedMaxFeePerGas)},medium:{...n.medium,suggestedMaxPriorityFeePerGas:i(n.medium.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:i(n.medium.suggestedMaxFeePerGas)},high:{...n.high,suggestedMaxPriorityFeePerGas:i(n.high.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:i(n.high.suggestedMaxFeePerGas)},estimatedBaseFee:i(n.estimatedBaseFee),historicalBaseFeeRange:n.historicalBaseFeeRange,baseFeeTrend:n.baseFeeTrend,latestPriorityFeeRange:n.latestPriorityFeeRange,historicalPriorityFeeRange:n.historicalPriorityFeeRange,priorityFeeTrend:n.priorityFeeTrend,networkCongestion:n.networkCongestion}},n.fetchLegacyGasPriceEstimates=async function(e,t){const n=await(0,r.handleFetch)(e,{referrer:e,referrerPolicy:"no-referrer-when-downgrade",method:"GET",mode:"cors",headers:{"Content-Type":"application/json",...t&&a(t)}});return{low:n.SafeGasPrice,medium:n.ProposeGasPrice,high:n.FastGasPrice}},n.fetchEthGasPriceEstimate=async function(e){const t=await(0,r.query)(e,"gasPrice");return{gasPrice:(0,r.weiHexToGweiDec)(t).toString()}},n.calculateTimeEstimate=function(e,t,n){const{low:s,medium:a,high:i,estimatedBaseFee:c}=n,l=(0,r.gweiDecToWEIBN)(e),d=(0,r.gweiDecToWEIBN)(t),u=(0,r.gweiDecToWEIBN)(c),m=o.default.min(l,d.sub(u)),h=(0,r.gweiDecToWEIBN)(s.suggestedMaxPriorityFeePerGas),p=(0,r.gweiDecToWEIBN)(a.suggestedMaxPriorityFeePerGas),f=(0,r.gweiDecToWEIBN)(i.suggestedMaxPriorityFeePerGas);let g,k;return m.lt(h)?(g=null,k="unknown"):m.gte(h)&&m.lt(p)?(g=s.minWaitTimeEstimate,k=s.maxWaitTimeEstimate):m.gte(p)&&m.lt(f)?(g=a.minWaitTimeEstimate,k=a.maxWaitTimeEstimate):m.eq(f)?(g=i.minWaitTimeEstimate,k=i.maxWaitTimeEstimate):(g=0,k=i.maxWaitTimeEstimate),{lowerTimeBound:g,upperTimeBound:k}}}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/gas-util.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/index.cjs",{"./GasFeeController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/dist/GasFeeController.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){s===undefined&&(s=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,r)}:function(e,t,n,s){s===undefined&&(s=n),e[s]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),r(e("./GasFeeController.cjs"),n)}}},{package:"@metamask/gas-fee-controller",file:"node_modules/@metamask/gas-fee-controller/dist/index.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/AbstractPollingController.cjs",{"fast-json-stable-stringify":"/home/runner/work/metamask-extension/metamask-extension/node_modules/fast-json-stable-stringify/index.js",uuid:"/home/runner/work/metamask-extension/metamask-extension/node_modules/uuid/dist/index.js"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.AbstractPollingControllerBaseMixin=n.getKey=void 0;const o=r(e("fast-json-stable-stringify")),a=e("uuid");n.getKey=e=>(0,o.default)(e),n.AbstractPollingControllerBaseMixin=function(e){var t,r;return t=new WeakMap,r=new WeakMap,class extends e{constructor(){super(...arguments),t.set(this,new Map),r.set(this,new Map)}startPolling(e){const r=(0,a.v4)(),o=(0,n.getKey)(e),i=s(this,t,"f").get(o)??new Set;return i.add(r),s(this,t,"f").set(o,i),1===i.size&&this._startPolling(e),r}stopAllPolling(){s(this,t,"f").forEach((e,t)=>{e.forEach(e=>{this.stopPollingByPollingToken(e)})})}stopPollingByPollingToken(e){if(!e)throw new Error("pollingToken required");let n=null;for(const[r,o]of s(this,t,"f"))if(o.delete(e)){0===o.size&&(n=r);break}if(n){this._stopPollingByPollingTokenSetId(n),s(this,t,"f").delete(n);const e=s(this,r,"f").get(n);if(e){for(const t of e)t(JSON.parse(n));e.clear()}}}onPollingComplete(e,t){const o=(0,n.getKey)(e),a=s(this,r,"f").get(o)??new Set;a.add(t),s(this,r,"f").set(o,a)}}}}}},{package:"@metamask/gas-fee-controller>@metamask/polling-controller",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/AbstractPollingController.cjs"}],["/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/BlockTrackerPollingController.cjs",{"./AbstractPollingController.cjs":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/AbstractPollingController.cjs","@metamask/base-controller":"/home/runner/work/metamask-extension/metamask-extension/node_modules/@metamask/base-controller/dist/index.cjs"},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s=this&&this.__classPrivateFieldGet||function(e,t,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(e):s?s.value:t.get(e)};Object.defineProperty(n,"__esModule",{value:!0}),n.BlockTrackerPollingController=n.BlockTrackerPollingControllerOnly=void 0;const r=e("@metamask/base-controller"),o=e("./AbstractPollingController.cjs");function a(e){var t;class n extends((0,o.AbstractPollingControllerBaseMixin)(e)){constructor(){super(...arguments),t.set(this,{})}_startPolling(e){const n=(0,o.getKey)(e);if(s(this,t,"f")[n])return;const r=this._getNetworkClientById(e.networkClientId);if(!r)throw new Error(`Unable to retrieve blockTracker for networkClientId ${e.networkClientId}`);{const o=this._executePoll.bind(this,e);r.blockTracker.addListener("latest",o),s(this,t,"f")[n]=o}}_stopPollingByPollingTokenSetId(e){const{networkClientId:n}=JSON.parse(e),r=this._getNetworkClientById(n);if(r&&s(this,t,"f")[e]){const n=s(this,t,"f")[e];n&&(r.blockTracker.removeListener("latest",n),delete s(this,t,"f")[e])}}}return t=new WeakMap,n}class i{}n.BlockTrackerPollingControllerOnly=()=>a(i);n.BlockTrackerPollingController=()=>a(r.BaseController)}}},{package:"@metamask/gas-fee-controller>@metamask/polling-controller",file:"node_modules/@metamask/gas-fee-controller/node_modules/@metamask/polling-controller/dist/BlockTrackerPollingController.cjs"}]],[],{});